1
<?xml version='1.0' encoding='utf-8'?>
4
<string_value lines="1">darcy_p1dgp2_velBCinlet_2d</string_value>
5
<comment>a simple short test case for darcy flow using the element type p1dgp2 for velocity-pressure
7
the darcy velocity is solved for and the interstitial velocity is a diagnostic from this (assuming a dg solution)
9
it compares the pressure gradient against the analytic, as well as checking that the interstitial velocity is correct
11
the darcy flow equation is
13
sigma*darcy_vel = - grad P
15
sigma is a function of viscosity and permeability which are two input fields that are named in the flml - not on fluidity special names (ie. this doesnt use the porous media object options)
17
python diagnostics are used to form the sigma term that is assoicated with a p0 dg mesh (ie. element wise) and the interstitial velocity
19
this case has a 1 region 1 material with velocity boundary condition inflow.
21
to get a darcy equation the time, stress and advection terms are not included in a bousinessq formulation (to avoid needing to specify a density). Ideally it would be better to actually have a darcy momentum option to simplify the input.
23
the absorption term is included in the pressure correction (being a necessity as it is the only term in the matrix equation)
25
the geometry is 2d (although this is a 1d problem) and one time step is done (as nothing depends on time)</comment>
28
<string_value lines="1">fluids</string_value>
32
<integer_value rank="0">2</integer_value>
34
<mesh name="CoordinateMesh">
35
<from_file file_name="square">
42
<mesh name="VelocityMesh">
44
<mesh name="CoordinateMesh"/>
46
<string_value>discontinuous</string_value>
53
<mesh name="PressureMesh">
55
<mesh name="CoordinateMesh"/>
58
<integer_value rank="0">2</integer_value>
68
<mesh name="CoordinateMesh"/>
71
<integer_value rank="0">0</integer_value>
75
<string_value>discontinuous</string_value>
84
<integer_value rank="0">5</integer_value>
90
<string_value>vtk</string_value>
92
<dump_period_in_timesteps>
94
<integer_value rank="0">0</integer_value>
96
</dump_period_in_timesteps>
97
<output_mesh name="VelocityMesh"/>
102
<real_value rank="0">0.0</real_value>
105
<real_value rank="0">1.0</real_value>
108
<real_value rank="0">1.0</real_value>
111
<material_phase name="fluid">
112
<scalar_field name="Pressure" rank="0">
114
<mesh name="PressureMesh"/>
115
<spatial_discretisation>
116
<continuous_galerkin/>
117
</spatial_discretisation>
119
<poisson_pressure_solution>
120
<string_value lines="1">never</string_value>
121
</poisson_pressure_solution>
122
<use_projection_method/>
125
<iterative_method name="cg"/>
126
<preconditioner name="sor"/>
128
<real_value rank="0">1.0e-10</real_value>
131
<integer_value rank="0">1000</integer_value>
133
<never_ignore_solver_failures/>
138
<boundary_conditions name="right_outflow">
140
<integer_value shape="1" rank="1">8</integer_value>
142
<type name="dirichlet">
144
<real_value rank="0">0.0</real_value>
147
</boundary_conditions>
151
<include_in_convergence/>
154
<exclude_from_detectors/>
157
<include_in_steady_state/>
162
<vector_field name="Velocity" rank="1">
164
<mesh name="VelocityMesh"/>
165
<equation name="Boussinesq"/>
166
<spatial_discretisation>
167
<discontinuous_galerkin>
169
<exclude_mass_terms/>
172
<compact_discontinuous_galerkin/>
176
<integrate_advection_by_parts>
178
</integrate_advection_by_parts>
180
</discontinuous_galerkin>
181
<conservative_advection>
182
<real_value rank="0">0.0</real_value>
183
</conservative_advection>
184
</spatial_discretisation>
185
<temporal_discretisation>
187
<real_value rank="0">1.0</real_value>
190
<real_value rank="0">1.0</real_value>
192
</temporal_discretisation>
194
<iterative_method name="gmres">
196
<integer_value rank="0">30</integer_value>
199
<preconditioner name="sor"/>
201
<real_value rank="0">1.0e-10</real_value>
204
<integer_value rank="0">1000</integer_value>
206
<never_ignore_solver_failures/>
211
<initial_condition name="WholeMesh">
213
<real_value shape="2" dim1="dim" rank="1">0.0 0.0</real_value>
216
<boundary_conditions name="left_inflow">
218
<integer_value shape="1" rank="1">10</integer_value>
220
<type name="dirichlet">
222
<align_bc_with_cartesian>
225
<real_value rank="0">5.0</real_value>
228
</align_bc_with_cartesian>
230
</boundary_conditions>
231
<boundary_conditions name="no_outflow_top_bottom">
233
<integer_value shape="2" rank="1">7 9</integer_value>
235
<type name="dirichlet">
237
<align_bc_with_cartesian>
240
<real_value rank="0">0.0</real_value>
243
</align_bc_with_cartesian>
245
</boundary_conditions>
246
<vector_field name="Absorption" rank="1">
249
<algorithm name="vector_python_diagnostic" material_phase_support="multiple">
250
<string_value type="python" lines="20"># get the prescribed fields
251
perm = states["fluid"].scalar_fields["Permeability"]
252
visc = states["fluid"].scalar_fields["Viscosity"]
254
# loop the DMmesh_p0 nodes (which are element centred)
255
for n in range(field.node_count):
256
perm_n = perm.node_val(n)
257
visc_n = visc.node_val(n)
259
# calc the absorption term
260
sigma_n = visc_n/perm_n
262
# set the absorption term
263
field.set(n,sigma_n)</string_value>
264
<comment>this assumes that the porosity, absorption, permeability, and viscosity are defined on a p0 dg mesh (ie. element wise) such that the number of nodes is also the number of elements
266
also assume that the velocity is dg</comment>
273
<include_in_convergence/>
276
<include_in_detectors/>
279
<include_in_steady_state/>
282
<include_pressure_correction/>
289
</previous_time_step>
295
<include_in_convergence/>
298
<include_in_detectors/>
301
<include_in_steady_state/>
303
<consistent_interpolation/>
306
<scalar_field name="Porosity" rank="0">
309
<value name="WholeMesh">
311
<real_value rank="0">0.5</real_value>
317
<exclude_from_detectors/>
321
<scalar_field name="Permeability" rank="0">
324
<value name="WholeMesh">
326
<real_value rank="0">1.0e-10</real_value>
332
<exclude_from_detectors/>
336
<scalar_field name="Viscosity" rank="0">
339
<value name="WholeMesh">
341
<real_value rank="0">1.0e-04</real_value>
347
<exclude_from_detectors/>
351
<vector_field name="interstitial_velocity" rank="1">
353
<algorithm name="vector_python_diagnostic" material_phase_support="multiple">
354
<string_value type="python" lines="20">phi = states["fluid"].scalar_fields["Porosity"]
355
darcy_vel = states["fluid"].vector_fields["Velocity"]
357
for ele in range(field.element_count):
358
phi_ele = phi.node_val(ele)
360
factor_ele = 1.0/max(phi_ele,1.0e-08)
363
for i in range(len(darcy_vel.ele_val(ele))):
364
vel_ele.append(factor_ele*darcy_vel.ele_val(ele)[i])
366
field.set(darcy_vel.ele_nodes(ele),vel_ele)</string_value>
367
<comment>this assumes that the porosity, absorption, permeability, and viscosity are defined on a p0 dg mesh (ie. element wise) such that the number of nodes is also the number of elements
369
also assume that the velocity is dg</comment>
371
<mesh name="VelocityMesh"/>
377
<include_in_convergence/>
380
<include_in_detectors/>
383
<include_in_steady_state/>