1
<?xml version='1.0' encoding='utf-8'?>
4
<string_value lines="1">mms_adjoint_A</string_value>
8
<integer_value rank="0">1</integer_value>
10
<mesh name="CoordinateMesh">
11
<from_file file_name="mms_A">
12
<format name="triangle"/>
18
<mesh name="VelocityMesh">
20
<mesh name="CoordinateMesh"/>
28
<integer_value rank="0">4</integer_value>
33
<dump_format>vtk</dump_format>
34
<dump_period_in_timesteps>
36
<integer_value rank="0">1</integer_value>
38
</dump_period_in_timesteps>
39
<output_mesh name="VelocityMesh"/>
43
<real_value rank="0">0</real_value>
46
<real_value rank="0">0.1</real_value>
49
<real_value rank="0">1</real_value>
51
<nonlinear_iterations>
52
<integer_value rank="0">2</integer_value>
53
</nonlinear_iterations>
55
<material_phase name="Fluid">
56
<scalar_field name="Velocity" rank="0">
58
<mesh name="VelocityMesh"/>
59
<temporal_discretisation>
61
<real_value rank="0">0.5</real_value>
64
<real_value rank="0">0.5</real_value>
66
</temporal_discretisation>
68
<iterative_method name="preonly"/>
69
<preconditioner name="lu"/>
71
<real_value rank="0">1e-16</real_value>
74
<real_value rank="0">1e-12</real_value>
77
<integer_value rank="0">10000</integer_value>
79
<never_ignore_solver_failures/>
84
<remove_advection_term/>
85
<initial_condition name="WholeMesh">
87
<string_value lines="20" type="python">def val(X, t):
88
from math import sin, cos
90
return sin(x) + cos(x)</string_value>
93
<boundary_conditions name="bc">
95
<integer_value shape="2" rank="1">1 2</integer_value>
97
<type name="dirichlet">
99
<string_value lines="20" type="python">def val(X, t):
100
from math import sin, cos
102
return sin(x) + cos(x)</string_value>
105
</boundary_conditions>
107
<real_value rank="0">1</real_value>
113
<scalar_field name="Source" rank="0">
115
<value name="WholeMesh">
117
<string_value lines="20" type="python">def val(X, t):
118
from math import sin, cos
121
return y</string_value>
128
<scalar_field name="AnalyticalSolution" rank="0">
130
<mesh name="VelocityMesh"/>
131
<value name="WholeMesh">
133
<string_value lines="20" type="python">def val(X, t):
134
from math import sin, cos
136
return sin(x) + cos(x)</string_value>
144
<scalar_field name="Error" rank="0">
146
<mesh name="VelocityMesh"/>
147
<algorithm name="scalar_python_diagnostic" material_phase_support="single">
148
<string_value lines="20" type="python">soln = state.scalar_fields["Velocity"]
149
exact = state.scalar_fields["AnalyticalSolution"]
151
for i in range(field.node_count):
152
field.set(i, abs(soln.node_val(i) - exact.node_val(i)))</string_value>
160
<scalar_field name="funct_derivative" rank="0">
162
<mesh name="VelocityMesh"/>
163
<algorithm name="scalar_python_diagnostic" material_phase_support="single">
164
<string_value lines="20" type="python">field.val[:] = 0.0
166
coord = state.vector_fields['Coordinate']
167
adj_u = state.scalar_fields['AdjointVelocity']
168
#print "Adjoint velocity(t=1.0): ", adj_u.val
169
for ele in range(coord.element_count):
170
t = Transform(ele, coord)
171
shape = adj_u.ele_shape(ele)
172
mass = t.shape_shape(shape, shape)
173
field.addto(adj_u.ele_nodes(ele), numpy.dot(mass, adj_u.ele_val(ele)))
175
#print "Funct_derivative (diagnostic): ", field.val</string_value>
186
<max_memory_checkpoints>
187
<integer_value rank="0">5</integer_value>
188
</max_memory_checkpoints>
189
<max_disk_checkpoints>
190
<integer_value rank="0">0</integer_value>
191
</max_disk_checkpoints>
193
<functional name="time_integral_ad">
195
<algorithm name="functional_value">
196
<string_value lines="20" type="python">import numpy
200
if time > 1.0-eps:
201
coord = states[n]["Fluid"].vector_fields["Coordinate"]
202
u = states[n]["Fluid"].scalar_fields["Velocity"]
204
#print "u(t=0): ", states[0]["Fluid"].scalar_fields["Velocity"].val
205
#print "u(t=1): ", states[1]["Fluid"].scalar_fields["Velocity"].val
207
for ele in range(coord.element_count):
208
t = Transform(ele, coord)
209
shape = u.ele_shape(ele)
210
mass = t.shape_shape(shape, shape)
211
J = J + 0.5 * numpy.dot(u.ele_val(ele), numpy.dot(mass, u.ele_val(ele)))
212
# print "Got functional value: ", J
214
#if hasattr(J, "nominal_value"):
215
# print "u.val: ", u.val
216
# print "delJ/delu: ", [J.derivatives[x] for x in u.val]
217
# print "J.nominal_value: ", J.nominal_value</string_value>
223
<functional_dependencies>
224
<algorithm name="functional_dependencies">
225
<string_value lines="20" type="python">def dependencies(times, timestep):
226
if times[0] <= 1.0 <= times[1]:
227
return {"Fluid::Coordinate": [timestep],
228
"Fluid::Velocity": [timestep]}
230
return {}</string_value>
232
</functional_dependencies>
235
<control name="Source">
236
<type field_name="Fluid::VelocitySource" name="source_term"/>
241
<check_action_transposes/>