1
<?xml version='1.0' encoding='utf-8'?>
4
<string_value lines="1">mms_adjoint_E</string_value>
8
<integer_value rank="0">1</integer_value>
10
<mesh name="CoordinateMesh">
11
<from_file file_name="mms_E">
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">1</real_value>
49
<real_value rank="0">1</real_value>
51
<nonlinear_iterations>
52
<integer_value rank="0">4</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
<initial_condition name="WholeMesh">
86
<string_value lines="20" type="python">def val(X, t):
87
from math import sin, cos
89
return sin(x) + cos(x)</string_value>
92
<boundary_conditions name="bc">
94
<integer_value shape="2" rank="1">1 2</integer_value>
96
<type name="dirichlet">
98
<string_value lines="20" type="python">def val(X, t):
99
from math import sin, cos
101
return sin(x) + cos(x)</string_value>
104
</boundary_conditions>
106
<real_value rank="0">1</real_value>
112
<scalar_field name="Source" rank="0">
114
<value name="WholeMesh">
116
<string_value lines="20" type="python">def val(X, t):
117
from math import sin, cos
120
return y</string_value>
127
<scalar_field name="AnalyticalSolution" rank="0">
129
<mesh name="VelocityMesh"/>
130
<value name="WholeMesh">
132
<string_value lines="20" type="python">def val(X, t):
133
from math import sin, cos
135
return sin(x) + cos(x)</string_value>
143
<scalar_field name="Error" rank="0">
145
<mesh name="VelocityMesh"/>
146
<algorithm name="scalar_python_diagnostic" material_phase_support="single">
147
<string_value lines="20" type="python">soln = state.scalar_fields["Velocity"]
148
exact = state.scalar_fields["AnalyticalSolution"]
150
for i in range(field.node_count):
151
field.set(i, abs(soln.node_val(i) - exact.node_val(i)))</string_value>
161
<functional name="time_integral_ad">
163
<algorithm name="functional_value">
164
<string_value lines="20" type="python">import numpy
169
coord = states[1]["Fluid"].vector_fields["Coordinate"]
170
u = states[1]["Fluid"].scalar_fields["Velocity"]
172
# print "u(t=0): ", states[0]["Fluid"].scalar_fields["Velocity"].val
173
# print "u(t=1): ", states[1]["Fluid"].scalar_fields["Velocity"].val
175
for ele in range(coord.element_count):
176
t = Transform(ele, coord)
177
shape = u.ele_shape(ele)
178
mass = t.shape_shape(shape, shape)
179
J = J + 0.5 * numpy.dot(u.ele_val(ele), numpy.dot(mass, u.ele_val(ele)))
180
# print "Got functional value: ", J
182
#if hasattr(J, "nominal_value"):
183
# print "u.val: ", u.val
184
# print "delJ/delu: ", [J.derivatives[x] for x in u.val]
185
# print "J.nominal_value: ", J.nominal_value</string_value>
191
<functional_dependencies>
192
<algorithm name="functional_dependencies">
193
<string_value lines="20" type="python">def dependencies(times, timestep):
194
if times[0] < 1.0 <= times[1]:
195
return {"Fluid::Coordinate": [1],
196
"Fluid::Velocity": [1]}
198
return {}</string_value>
200
</functional_dependencies>
203
<control name="InitialCondition">
204
<type field_name="Fluid::Velocity" name="initial_condition"/>