1
<?xml version='1.0' encoding='utf8'?>
2
<shallow_water_options>
4
<string_value lines="1">wave_D</string_value>
8
<integer_value rank="0">3</integer_value>
10
<mesh name="CoordinateMesh">
11
<from_file file_name="src/mesh_D">
12
<format name="triangle"/>
14
<integer_value rank="0">1</integer_value>
21
<mesh name="VelocityMesh">
23
<mesh name="PeriodicMesh"/>
25
<string_value>discontinuous</string_value>
32
<mesh name="PressureMesh">
34
<mesh name="PeriodicMesh"/>
37
<integer_value rank="0">2</integer_value>
45
<mesh name="PeriodicMesh">
47
<mesh name="CoordinateMesh"/>
48
<periodic_boundary_conditions name="periodicity">
49
<physical_boundary_ids>
50
<integer_value shape="1" rank="1">1</integer_value>
51
</physical_boundary_ids>
52
<aliased_boundary_ids>
53
<integer_value shape="1" rank="1">2</integer_value>
54
</aliased_boundary_ids>
56
<string_value lines="20" type="python">def val(X,t):
58
result[0]=result[0]-1.0
59
return result</string_value>
61
</periodic_boundary_conditions>
69
<integer_value rank="0">4</integer_value>
75
<string_value>vtk</string_value>
77
<dump_period_in_timesteps>
79
<integer_value rank="0">1</integer_value>
81
</dump_period_in_timesteps>
82
<output_mesh name="CoordinateMesh"/>
86
<real_value rank="0">0</real_value>
89
<real_value rank="0">0.03125</real_value>
91
<nonlinear_iterations>
92
<integer_value rank="0">1</integer_value>
93
</nonlinear_iterations>
95
<real_value rank="0">1.0</real_value>
101
<real_value rank="0">0.1</real_value>
103
<vector_field name="GravityDirection" rank="1">
105
<mesh name="CoordinateMesh"/>
106
<value name="WholeMesh">
108
<real_value shape="3" dim1="dim" rank="1">0.0 0.0 -1.0</real_value>
116
<exclude_from_detectors/>
124
</physical_parameters>
125
<material_phase name="Fluid">
126
<vector_field name="Velocity" rank="1">
128
<mesh name="VelocityMesh"/>
129
<equation name="ShallowWater"/>
130
<spatial_discretisation>
131
<discontinuous_galerkin>
135
</discontinuous_galerkin>
136
<conservative_advection>
137
<real_value rank="0">0</real_value>
138
</conservative_advection>
139
</spatial_discretisation>
141
<iterative_method name="preonly"/>
142
<preconditioner name="lu"/>
144
<real_value rank="0">1.0e-7</real_value>
147
<integer_value rank="0">500</integer_value>
149
<never_ignore_solver_failures/>
154
<initial_condition name="WholeMesh">
156
<string_value lines="20" type="python">def val(X, t):
158
return constants.u_exact(X[0], 0.0)</string_value>
161
<vector_field name="Source" rank="1">
163
<value name="WholeMesh">
165
<string_value lines="20" type="python">def val(X, t):
167
return constants.u_src(X[0], t)</string_value>
175
<exclude_from_detectors/>
187
</previous_time_step>
193
<include_in_convergence/>
196
<include_in_detectors/>
199
<include_in_steady_state/>
201
<consistent_interpolation/>
204
<scalar_field name="LayerThickness" rank="0">
206
<mesh name="PressureMesh"/>
207
<spatial_discretisation>
208
<continuous_galerkin>
210
<exclude_advection_terms/>
212
</continuous_galerkin>
213
<conservative_advection>
214
<real_value rank="0">0</real_value>
215
</conservative_advection>
216
</spatial_discretisation>
217
<temporal_discretisation>
219
<real_value rank="0">0.5</real_value>
222
<real_value rank="0">1</real_value>
224
</temporal_discretisation>
226
<iterative_method name="preonly"/>
227
<preconditioner name="lu"/>
229
<real_value rank="0">1.0e-7</real_value>
232
<integer_value rank="0">500</integer_value>
234
<never_ignore_solver_failures/>
235
<cache_solver_context/>
240
<initial_condition name="WholeMesh">
242
<string_value lines="20" type="python">def val(X, t):
244
return constants.eta_exact(X[0], 0.0)</string_value>
247
<mean_layer_thickness>
248
<real_value rank="0">0.5</real_value>
249
</mean_layer_thickness>
250
<scalar_field name="Source">
252
<value name="WholeMesh">
254
<string_value lines="20" type="python">def val(X, t):
256
return constants.eta_src(X[0], t)</string_value>
262
<exclude_from_detectors/>
271
<consistent_interpolation/>
274
<scalar_field name="AnalyticalLayerThickness" rank="0">
276
<mesh name="PressureMesh"/>
277
<value name="WholeMesh">
279
<string_value lines="20" type="python">def val(X,t):
282
return constants.eta_exact(x, t)</string_value>
288
<exclude_from_detectors/>
295
<scalar_field name="LayerThicknessError" rank="0">
297
<algorithm source_field_2_type="scalar" name="scalar_difference" source_field_1_name="LayerThickness" source_field_2_name="AnalyticalLayerThickness" material_phase_support="single" source_field_1_type="scalar">
298
<absolute_difference/>
300
<mesh name="PressureMesh"/>
304
<include_in_convergence/>
307
<include_in_detectors/>
310
<include_in_steady_state/>
317
<scalar_field name="LayerThicknessSourceDerivative" rank="0">
319
<algorithm name="scalar_python_diagnostic" material_phase_support="single">
320
<string_value lines="20" type="python">import constants
321
import numpy, numpy.linalg
323
coord = state.vector_fields["Coordinate"]
324
eta_mesh = state.meshes["PressureMesh"]
325
u_mesh = state.meshes["VelocityMesh"]
326
timeprime = time + constants.theta*dt
329
for ele in range(coord.ele_count):
330
t = Transform(ele, coord)
331
shape = field.ele_shape(ele)
332
eta_mass = t.shape_shape(shape, shape)
333
u_shape = u_mesh.shape
334
u_mass = t.shape_shape(u_shape, u_shape)
337
source = numpy.dot(eta_mass, [constants.eta_exact(x[0], 0.0) for x in coord.remap_ele(ele, field.mesh)])
339
# First, the eta source term contribution
340
source = numpy.dot(eta_mass, [constants.eta_src(x[0], timeprime)*abs(dt) for x in coord.remap_ele(ele, field.mesh)])
342
# Now, the u source term contribution
343
#Linv_Musrc = numpy.dot(numpy.linalg.inv(u_mass), # + coriolis matrix in here!!!!
344
# numpy.dot(u_mass, [constants.u_src(x, timeprime) for x in coord.remap_ele(ele, u_mesh)]))
345
Linv_Musrc = numpy.array([constants.u_src(x[0], timeprime) for x in coord.remap_ele(ele, u_mesh)])
347
u_dshape = t.grad(u_mesh.shape)
348
cT = t.shape_dshape(shape, u_dshape)
349
#print "Initial eta_src: ", source
350
for dim in range(cT.shape[2]):
351
source += numpy.dot(cT[:,:,dim], Linv_Musrc[:,dim]) * (dt**2 * constants.d0 * constants.theta)
352
#print "Final eta_src: ", source
353
field.addto(field.ele_nodes(ele), source)</string_value>
355
<mesh name="PressureMesh"/>
359
<include_in_convergence/>
362
<include_in_detectors/>
365
<include_in_steady_state/>
372
<scalar_field name="dJdh" rank="0">
374
<algorithm name="scalar_python_diagnostic" material_phase_support="single">
375
<string_value lines="20" type="python">import fluidity.state_types
378
coord = state.vector_fields["Coordinate"]
379
local_adj_delta_u = state.vector_fields["AdjointLocalVelocityDelta"]
380
du_src = state.vector_fields["VelocitySourceDerivative"]
381
adj_u = state.vector_fields["AdjointVelocity"]
383
tmpval = numpy.zeros(du_src.val.shape)
384
adj_delta_u = fluidity.state_types.VectorField("GlobalAdjointVelocityDelta", tmpval, 0, "/none", "None")
385
adj_delta_u.mesh = du_src.mesh
386
for node in range(adj_delta_u.node_count):
387
adj_delta_u.set(node, [-1 * local_adj_delta_u.node_val(node)[0], 0, 0])
389
adj_delta_eta = state.scalar_fields["AdjointLayerThicknessDelta"]
390
deta_src = state.scalar_fields["LayerThicknessSourceDerivative"]
391
adj_eta = state.scalar_fields["AdjointLayerThickness"]
395
J = numpy.dot(adj_eta.val, deta_src.val) + sum([numpy.dot(adj_u.val[:,dim], du_src.val[:,dim]) for dim in range(3)])
397
J = numpy.dot(adj_delta_eta.val, deta_src.val) + sum([numpy.dot(adj_delta_u.val[:,dim], du_src.val[:,dim]) for dim in range(3)])
399
field.val[:] = J</string_value>
401
<string_value lines="1">LayerThicknessSourceDerivative,VelocitySourceDerivative</string_value>
404
<mesh name="VelocityMesh"/>
408
<include_in_convergence/>
411
<include_in_detectors/>
414
<include_in_steady_state/>
421
<vector_field name="AnalyticalVelocity" rank="1">
423
<mesh name="VelocityMesh"/>
424
<value name="WholeMesh">
426
<string_value lines="20" type="python">def val(X,t):
429
return constants.u_exact(x, t)</string_value>
437
<exclude_from_detectors/>
444
<vector_field name="VelocityError" rank="1">
446
<algorithm source_field_2_type="vector" name="vector_difference" source_field_1_name="Velocity" source_field_2_name="AnalyticalVelocity" material_phase_support="single" source_field_1_type="vector">
447
<absolute_difference/>
449
<mesh name="VelocityMesh"/>
455
<include_in_convergence/>
458
<include_in_detectors/>
461
<include_in_steady_state/>
468
<vector_field name="VelocitySourceDerivative" rank="1">
470
<algorithm name="vector_python_diagnostic" material_phase_support="single">
471
<string_value lines="20" type="python">import constants
472
import numpy, numpy.linalg
474
coord = state.vector_fields["Coordinate"]
475
u_mesh = state.meshes["VelocityMesh"]
476
timeprime = time + constants.theta*dt
479
for ele in range(coord.ele_count):
480
t = Transform(ele, coord)
481
u_shape = u_mesh.shape
482
u_mass = t.shape_shape(u_shape, u_shape)
485
source = numpy.dot(u_mass, [constants.u_exact(x[0], 0.0) for x in coord.remap_ele(ele, field.mesh)])
487
# Add the u source term contribution
488
source = numpy.dot(u_mass, [constants.u_src(x[0], timeprime)*abs(dt) for x in coord.remap_ele(ele, field.mesh)])
489
#print "Final u_src: ", source
490
field.addto(field.ele_nodes(ele), source)</string_value>
492
<mesh name="VelocityMesh"/>
498
<include_in_convergence/>
501
<include_in_detectors/>
504
<include_in_steady_state/>
513
<functional name="integral_eta_t1">
515
<algorithm name="functional_value">
516
<string_value lines="20" type="python">J = 0.0
517
T = 1.0 # the time at which to evaluate
518
if time < T <= time+dt:
520
eta_prev = states[n-1]["Fluid"].scalar_fields["LayerThickness"]
521
eta = states[n]["Fluid"].scalar_fields["LayerThickness"]
523
# We want to temporally interpolate to evaluate eta at t=1.0
524
alpha = (time + dt - T) / dt
525
assert 0 <= alpha < 1
526
tmp_eta = alpha * eta_prev.val + (1-alpha) * eta.val
528
# Now we want to integrate that over space
529
coord = states[0]["Fluid"].vector_fields["Coordinate"]
530
assert eta.element_count == eta_prev.element_count == coord.element_count
531
for ele in range(coord.element_count):
532
t = Transform(ele, coord)
533
shape = eta_prev.ele_shape(ele)
534
mass = t.shape_shape(shape, shape)
535
nodes = eta_prev.ele_nodes(ele)
536
J = J + numpy.dot(tmp_eta[nodes], numpy.dot(mass, tmp_eta[nodes]))</string_value>
542
<functional_dependencies>
543
<algorithm name="functional_dependencies">
544
<string_value lines="20" type="python">def dependencies(times, timestep):
545
if times[0] < 1.0 <= times[1]:
546
return {"Fluid::Coordinate": [0],
547
"Fluid::LayerThickness": [timestep-1, timestep]}
549
return {}</string_value>
551
</functional_dependencies>
557
</shallow_water_options>
b'\\ No newline at end of file'