1 | // C struct for domain and quantities |
---|
2 | // |
---|
3 | // Stephen Roberts 2012 |
---|
4 | // John Weng 2013 |
---|
5 | |
---|
6 | #define SW_DOMAIN |
---|
7 | |
---|
8 | struct boundary { |
---|
9 | long length;// number_of_elements |
---|
10 | long * ids; // element id list |
---|
11 | int type; // boundary type |
---|
12 | }; |
---|
13 | |
---|
14 | |
---|
15 | // structures |
---|
16 | struct domain { |
---|
17 | // Changing these don't change the data in python object |
---|
18 | long number_of_elements; |
---|
19 | long number_of_boundary_elements;// Nb |
---|
20 | long boundary_number; // # boundary |
---|
21 | double epsilon; |
---|
22 | double H0; |
---|
23 | double h0; |
---|
24 | double limiting_threshold; |
---|
25 | double g; |
---|
26 | long optimise_dry_cells; |
---|
27 | double evolve_max_timestep; |
---|
28 | double evolve_min_timestep; |
---|
29 | long extrapolate_velocity_second_order; |
---|
30 | double minimum_allowed_height; |
---|
31 | double time; |
---|
32 | double starttime; |
---|
33 | double finaltime; |
---|
34 | double yieldtime; |
---|
35 | double timestep; |
---|
36 | |
---|
37 | int smallsteps; |
---|
38 | int max_smallsteps; |
---|
39 | int number_of_steps; |
---|
40 | int number_of_first_order_steps; |
---|
41 | int _order_; |
---|
42 | int default_order; |
---|
43 | int use_sloped_mannings; |
---|
44 | int use_centroid_velocities; |
---|
45 | int use_edge_limiter; |
---|
46 | |
---|
47 | int flow_algorithm; |
---|
48 | int compute_fluxes_method; |
---|
49 | int timestepping_method; |
---|
50 | |
---|
51 | long* boundary_cells; |
---|
52 | long* boundary_edges; |
---|
53 | struct boundary* boundary_map; // # boundary (up, down, left, right ...) |
---|
54 | |
---|
55 | |
---|
56 | double CFL; |
---|
57 | double flux_timestep; |
---|
58 | double recorded_max_timestep; |
---|
59 | double recorded_min_timestep; |
---|
60 | double maximum_allowed_speed; |
---|
61 | double optimised_gradient_limiter; |
---|
62 | double alpha_balance; |
---|
63 | double tight_slope_limiters; |
---|
64 | |
---|
65 | double beta_w; |
---|
66 | double beta_w_dry; |
---|
67 | double beta_uh; |
---|
68 | double beta_uh_dry; |
---|
69 | double beta_vh; |
---|
70 | double beta_vh_dry; |
---|
71 | |
---|
72 | double stage_beta; |
---|
73 | double xmom_beta; |
---|
74 | double ymom_beta; |
---|
75 | |
---|
76 | |
---|
77 | // long or int ??? |
---|
78 | long* neighbours; |
---|
79 | long* neighbour_edges; |
---|
80 | long* surrogate_neighbours; |
---|
81 | double* normals; |
---|
82 | double* edgelengths; |
---|
83 | double* radii; |
---|
84 | double* areas; |
---|
85 | |
---|
86 | |
---|
87 | |
---|
88 | long* tri_full_flag; |
---|
89 | long* already_computed_flux; |
---|
90 | double* max_speed; |
---|
91 | double* timestep_array; |
---|
92 | |
---|
93 | double* vertex_coordinates; |
---|
94 | double* edge_coordinates; |
---|
95 | double* centroid_coordinates; |
---|
96 | |
---|
97 | long* number_of_boundaries; |
---|
98 | |
---|
99 | // Edge Values |
---|
100 | double* stage_edge_values; |
---|
101 | double* xmom_edge_values; |
---|
102 | double* ymom_edge_values; |
---|
103 | double* bed_edge_values; |
---|
104 | double* height_edge_values; |
---|
105 | double* xvelocity_edge_values; |
---|
106 | double* yvelocity_edge_values; |
---|
107 | |
---|
108 | |
---|
109 | // Centroid values |
---|
110 | double* stage_centroid_values; |
---|
111 | double* xmom_centroid_values; |
---|
112 | double* ymom_centroid_values; |
---|
113 | double* bed_centroid_values; |
---|
114 | double* friction_centroid_values; |
---|
115 | double* height_centroid_values; |
---|
116 | double* xvelocity_centroid_values; |
---|
117 | double* yvelocity_centroid_values; |
---|
118 | // Store values |
---|
119 | double* stage_centroid_store; |
---|
120 | double* xmom_centroid_store; |
---|
121 | double* ymom_centroid_store; |
---|
122 | // Backup values |
---|
123 | double* stage_centroid_backup; |
---|
124 | double* xmom_centroid_backup; |
---|
125 | double* ymom_centroid_backup; |
---|
126 | |
---|
127 | |
---|
128 | // Vertex values |
---|
129 | double* stage_vertex_values; |
---|
130 | double* xmom_vertex_values; |
---|
131 | double* ymom_vertex_values; |
---|
132 | double* bed_vertex_values; |
---|
133 | double* height_vertex_values; |
---|
134 | double* xvelocity_vertex_values; |
---|
135 | double* yvelocity_vertex_values; |
---|
136 | |
---|
137 | |
---|
138 | // Explicit update values |
---|
139 | double* stage_explicit_update; |
---|
140 | double* xmom_explicit_update; |
---|
141 | double* ymom_explicit_update; |
---|
142 | |
---|
143 | |
---|
144 | // Semi_implicit update values |
---|
145 | double* stage_semi_implicit_update; |
---|
146 | double* xmom_semi_implicit_update; |
---|
147 | double* ymom_semi_implicit_update; |
---|
148 | |
---|
149 | |
---|
150 | // Gradient values |
---|
151 | double* stage_x_gradient; |
---|
152 | double* xmom_x_gradient; |
---|
153 | double* ymom_x_gradient; |
---|
154 | double* height_x_gradient; |
---|
155 | double* xvelocity_x_gradient; |
---|
156 | double* yvelocity_x_gradient; |
---|
157 | |
---|
158 | double* stage_y_gradient; |
---|
159 | double* xmom_y_gradient; |
---|
160 | double* ymom_y_gradient; |
---|
161 | double* height_y_gradient; |
---|
162 | double* xvelocity_y_gradient; |
---|
163 | double* yvelocity_y_gradient; |
---|
164 | |
---|
165 | |
---|
166 | // Some others |
---|
167 | double* min_bed_edge_values; |
---|
168 | double* max_bed_edge_values; |
---|
169 | int* count_wet_neighbours; |
---|
170 | |
---|
171 | // Boundary values |
---|
172 | double* stage_boundary_values; |
---|
173 | double* xmom_boundary_values; |
---|
174 | double* ymom_boundary_values; |
---|
175 | double* bed_boundary_values; |
---|
176 | double* height_boundary_values; |
---|
177 | double* xvelocity_boundary_values; |
---|
178 | double* yvelocity_boundary_values; |
---|
179 | |
---|
180 | }; |
---|
181 | |
---|
182 | |
---|
183 | struct edge { |
---|
184 | int cell_id; |
---|
185 | int edge_id; |
---|
186 | |
---|
187 | // mid point values |
---|
188 | double w; |
---|
189 | double h; |
---|
190 | double z; |
---|
191 | double uh; |
---|
192 | double vh; |
---|
193 | double u; |
---|
194 | double v; |
---|
195 | |
---|
196 | // vertex values |
---|
197 | double w1; |
---|
198 | double h1; |
---|
199 | double z1; |
---|
200 | double uh1; |
---|
201 | double vh1; |
---|
202 | double u1; |
---|
203 | double v1; |
---|
204 | |
---|
205 | double w2; |
---|
206 | double h2; |
---|
207 | double z2; |
---|
208 | double uh2; |
---|
209 | double vh2; |
---|
210 | double u2; |
---|
211 | double v2; |
---|
212 | |
---|
213 | }; |
---|
214 | |
---|
215 | |
---|