~reducedmodelling/fluidity/ROM_Non-intrusive-ann

« back to all changes in this revision

Viewing changes to tests/darcy_p1dgp2_velBCinlet/darcy_p1dgp2_velBCinlet_2d.flml

  • Committer: Brendan Tollit
  • Date: 2011-11-20 13:22:14 UTC
  • mto: This revision was merged to the branch mainline in revision 3860.
  • Revision ID: brendan.tollit05@imperial.ac.uk-20111120132214-no8ljc9argzddwon
Remove the two darcy test cases that were there in 1d and 
replace them with versions that do 1,2 and 3d.

Change the sign of the ct_rhs add to in Divergence_CV.F90 
for incompressible flow.

Adjust the darcy test that was there to test this so that 
it runs and the 1,2 and 3d version use weak velocity BC.

Add a similar test that uses two phase but one with a large 
absorption such as to be the solid porous media. This tests
the multiphase ct_rhs add to sign change.

The mms_ns case still has issues.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version='1.0' encoding='utf-8'?>
 
2
<fluidity_options>
 
3
  <simulation_name>
 
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
 
6
 
 
7
the darcy velocity is solved for and the interstitial velocity is a diagnostic from this (assuming a dg solution)
 
8
 
 
9
it compares the pressure gradient against the analytic, as well as checking that the interstitial velocity is correct 
 
10
 
 
11
the darcy flow equation is
 
12
 
 
13
sigma*darcy_vel = - grad P
 
14
 
 
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)
 
16
 
 
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
 
18
 
 
19
this case has a 1 region 1 material with velocity boundary condition inflow. 
 
20
 
 
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.
 
22
 
 
23
the absorption term is included in the pressure correction (being a necessity as it is the only term in the matrix equation) 
 
24
 
 
25
the geometry is 2d (although this is a 1d problem) and one time step is done (as nothing depends on time)</comment>
 
26
  </simulation_name>
 
27
  <problem_type>
 
28
    <string_value lines="1">fluids</string_value>
 
29
  </problem_type>
 
30
  <geometry>
 
31
    <dimension>
 
32
      <integer_value rank="0">2</integer_value>
 
33
    </dimension>
 
34
    <mesh name="CoordinateMesh">
 
35
      <from_file file_name="square">
 
36
        <format name="gmsh"/>
 
37
        <stat>
 
38
          <include_in_stat/>
 
39
        </stat>
 
40
      </from_file>
 
41
    </mesh>
 
42
    <mesh name="VelocityMesh">
 
43
      <from_mesh>
 
44
        <mesh name="CoordinateMesh"/>
 
45
        <mesh_continuity>
 
46
          <string_value>discontinuous</string_value>
 
47
        </mesh_continuity>
 
48
        <stat>
 
49
          <exclude_from_stat/>
 
50
        </stat>
 
51
      </from_mesh>
 
52
    </mesh>
 
53
    <mesh name="PressureMesh">
 
54
      <from_mesh>
 
55
        <mesh name="CoordinateMesh"/>
 
56
        <mesh_shape>
 
57
          <polynomial_degree>
 
58
            <integer_value rank="0">2</integer_value>
 
59
          </polynomial_degree>
 
60
        </mesh_shape>
 
61
        <stat>
 
62
          <exclude_from_stat/>
 
63
        </stat>
 
64
      </from_mesh>
 
65
    </mesh>
 
66
    <mesh name="DGP0">
 
67
      <from_mesh>
 
68
        <mesh name="CoordinateMesh"/>
 
69
        <mesh_shape>
 
70
          <polynomial_degree>
 
71
            <integer_value rank="0">0</integer_value>
 
72
          </polynomial_degree>
 
73
        </mesh_shape>
 
74
        <mesh_continuity>
 
75
          <string_value>discontinuous</string_value>
 
76
        </mesh_continuity>
 
77
        <stat>
 
78
          <exclude_from_stat/>
 
79
        </stat>
 
80
      </from_mesh>
 
81
    </mesh>
 
82
    <quadrature>
 
83
      <degree>
 
84
        <integer_value rank="0">5</integer_value>
 
85
      </degree>
 
86
    </quadrature>
 
87
  </geometry>
 
88
  <io>
 
89
    <dump_format>
 
90
      <string_value>vtk</string_value>
 
91
    </dump_format>
 
92
    <dump_period_in_timesteps>
 
93
      <constant>
 
94
        <integer_value rank="0">0</integer_value>
 
95
      </constant>
 
96
    </dump_period_in_timesteps>
 
97
    <output_mesh name="VelocityMesh"/>
 
98
    <stat/>
 
99
  </io>
 
100
  <timestepping>
 
101
    <current_time>
 
102
      <real_value rank="0">0.0</real_value>
 
103
    </current_time>
 
104
    <timestep>
 
105
      <real_value rank="0">1.0</real_value>
 
106
    </timestep>
 
107
    <finish_time>
 
108
      <real_value rank="0">1.0</real_value>
 
109
    </finish_time>
 
110
  </timestepping>
 
111
  <material_phase name="fluid">
 
112
    <scalar_field name="Pressure" rank="0">
 
113
      <prognostic>
 
114
        <mesh name="PressureMesh"/>
 
115
        <spatial_discretisation>
 
116
          <continuous_galerkin/>
 
117
        </spatial_discretisation>
 
118
        <scheme>
 
119
          <poisson_pressure_solution>
 
120
            <string_value lines="1">never</string_value>
 
121
          </poisson_pressure_solution>
 
122
          <use_projection_method/>
 
123
        </scheme>
 
124
        <solver>
 
125
          <iterative_method name="cg"/>
 
126
          <preconditioner name="sor"/>
 
127
          <relative_error>
 
128
            <real_value rank="0">1.0e-10</real_value>
 
129
          </relative_error>
 
130
          <max_iterations>
 
131
            <integer_value rank="0">1000</integer_value>
 
132
          </max_iterations>
 
133
          <never_ignore_solver_failures/>
 
134
          <diagnostics>
 
135
            <monitors/>
 
136
          </diagnostics>
 
137
        </solver>
 
138
        <boundary_conditions name="right_outflow">
 
139
          <surface_ids>
 
140
            <integer_value shape="1" rank="1">8</integer_value>
 
141
          </surface_ids>
 
142
          <type name="dirichlet">
 
143
            <constant>
 
144
              <real_value rank="0">0.0</real_value>
 
145
            </constant>
 
146
          </type>
 
147
        </boundary_conditions>
 
148
        <output/>
 
149
        <stat/>
 
150
        <convergence>
 
151
          <include_in_convergence/>
 
152
        </convergence>
 
153
        <detectors>
 
154
          <exclude_from_detectors/>
 
155
        </detectors>
 
156
        <steady_state>
 
157
          <include_in_steady_state/>
 
158
        </steady_state>
 
159
        <no_interpolation/>
 
160
      </prognostic>
 
161
    </scalar_field>
 
162
    <vector_field name="Velocity" rank="1">
 
163
      <prognostic>
 
164
        <mesh name="VelocityMesh"/>
 
165
        <equation name="Boussinesq"/>
 
166
        <spatial_discretisation>
 
167
          <discontinuous_galerkin>
 
168
            <mass_terms>
 
169
              <exclude_mass_terms/>
 
170
            </mass_terms>
 
171
            <viscosity_scheme>
 
172
              <compact_discontinuous_galerkin/>
 
173
            </viscosity_scheme>
 
174
            <advection_scheme>
 
175
              <none/>
 
176
              <integrate_advection_by_parts>
 
177
                <twice/>
 
178
              </integrate_advection_by_parts>
 
179
            </advection_scheme>
 
180
          </discontinuous_galerkin>
 
181
          <conservative_advection>
 
182
            <real_value rank="0">0.0</real_value>
 
183
          </conservative_advection>
 
184
        </spatial_discretisation>
 
185
        <temporal_discretisation>
 
186
          <theta>
 
187
            <real_value rank="0">1.0</real_value>
 
188
          </theta>
 
189
          <relaxation>
 
190
            <real_value rank="0">1.0</real_value>
 
191
          </relaxation>
 
192
        </temporal_discretisation>
 
193
        <solver>
 
194
          <iterative_method name="gmres">
 
195
            <restart>
 
196
              <integer_value rank="0">30</integer_value>
 
197
            </restart>
 
198
          </iterative_method>
 
199
          <preconditioner name="sor"/>
 
200
          <relative_error>
 
201
            <real_value rank="0">1.0e-10</real_value>
 
202
          </relative_error>
 
203
          <max_iterations>
 
204
            <integer_value rank="0">1000</integer_value>
 
205
          </max_iterations>
 
206
          <never_ignore_solver_failures/>
 
207
          <diagnostics>
 
208
            <monitors/>
 
209
          </diagnostics>
 
210
        </solver>
 
211
        <initial_condition name="WholeMesh">
 
212
          <constant>
 
213
            <real_value shape="2" dim1="dim" rank="1">0.0 0.0</real_value>
 
214
          </constant>
 
215
        </initial_condition>
 
216
        <boundary_conditions name="left_inflow">
 
217
          <surface_ids>
 
218
            <integer_value shape="1" rank="1">10</integer_value>
 
219
          </surface_ids>
 
220
          <type name="dirichlet">
 
221
            <apply_weakly/>
 
222
            <align_bc_with_cartesian>
 
223
              <x_component>
 
224
                <constant>
 
225
                  <real_value rank="0">5.0</real_value>
 
226
                </constant>
 
227
              </x_component>
 
228
            </align_bc_with_cartesian>
 
229
          </type>
 
230
        </boundary_conditions>
 
231
        <boundary_conditions name="no_outflow_top_bottom">
 
232
          <surface_ids>
 
233
            <integer_value shape="2" rank="1">7 9</integer_value>
 
234
          </surface_ids>
 
235
          <type name="dirichlet">
 
236
            <apply_weakly/>
 
237
            <align_bc_with_cartesian>
 
238
              <y_component>
 
239
                <constant>
 
240
                  <real_value rank="0">0.0</real_value>
 
241
                </constant>
 
242
              </y_component>
 
243
            </align_bc_with_cartesian>
 
244
          </type>
 
245
        </boundary_conditions>
 
246
        <vector_field name="Absorption" rank="1">
 
247
          <diagnostic>
 
248
            <mesh name="DGP0"/>
 
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"]
 
253
 
 
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)
 
258
   
 
259
   # calc the absorption term
 
260
   sigma_n = visc_n/perm_n
 
261
   
 
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
 
265
 
 
266
also assume that the velocity is dg</comment>
 
267
            </algorithm>
 
268
            <output/>
 
269
            <stat>
 
270
              <include_in_stat/>
 
271
            </stat>
 
272
            <convergence>
 
273
              <include_in_convergence/>
 
274
            </convergence>
 
275
            <detectors>
 
276
              <include_in_detectors/>
 
277
            </detectors>
 
278
            <steady_state>
 
279
              <include_in_steady_state/>
 
280
            </steady_state>
 
281
          </diagnostic>
 
282
          <include_pressure_correction/>
 
283
        </vector_field>
 
284
        <output/>
 
285
        <stat>
 
286
          <include_in_stat/>
 
287
          <previous_time_step>
 
288
            <exclude_from_stat/>
 
289
          </previous_time_step>
 
290
          <nonlinear_field>
 
291
            <exclude_from_stat/>
 
292
          </nonlinear_field>
 
293
        </stat>
 
294
        <convergence>
 
295
          <include_in_convergence/>
 
296
        </convergence>
 
297
        <detectors>
 
298
          <include_in_detectors/>
 
299
        </detectors>
 
300
        <steady_state>
 
301
          <include_in_steady_state/>
 
302
        </steady_state>
 
303
        <consistent_interpolation/>
 
304
      </prognostic>
 
305
    </vector_field>
 
306
    <scalar_field name="Porosity" rank="0">
 
307
      <prescribed>
 
308
        <mesh name="DGP0"/>
 
309
        <value name="WholeMesh">
 
310
          <constant>
 
311
            <real_value rank="0">0.5</real_value>
 
312
          </constant>
 
313
        </value>
 
314
        <output/>
 
315
        <stat/>
 
316
        <detectors>
 
317
          <exclude_from_detectors/>
 
318
        </detectors>
 
319
      </prescribed>
 
320
    </scalar_field>
 
321
    <scalar_field name="Permeability" rank="0">
 
322
      <prescribed>
 
323
        <mesh name="DGP0"/>
 
324
        <value name="WholeMesh">
 
325
          <constant>
 
326
            <real_value rank="0">1.0e-10</real_value>
 
327
          </constant>
 
328
        </value>
 
329
        <output/>
 
330
        <stat/>
 
331
        <detectors>
 
332
          <exclude_from_detectors/>
 
333
        </detectors>
 
334
      </prescribed>
 
335
    </scalar_field>
 
336
    <scalar_field name="Viscosity" rank="0">
 
337
      <prescribed>
 
338
        <mesh name="DGP0"/>
 
339
        <value name="WholeMesh">
 
340
          <constant>
 
341
            <real_value rank="0">1.0e-04</real_value>
 
342
          </constant>
 
343
        </value>
 
344
        <output/>
 
345
        <stat/>
 
346
        <detectors>
 
347
          <exclude_from_detectors/>
 
348
        </detectors>
 
349
      </prescribed>
 
350
    </scalar_field>
 
351
    <vector_field name="interstitial_velocity" rank="1">
 
352
      <diagnostic>
 
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"]
 
356
 
 
357
for ele in range(field.element_count):
 
358
   phi_ele = phi.node_val(ele)
 
359
   
 
360
   factor_ele = 1.0/max(phi_ele,1.0e-08)
 
361
   
 
362
   vel_ele = []
 
363
   for i in range(len(darcy_vel.ele_val(ele))):
 
364
     vel_ele.append(factor_ele*darcy_vel.ele_val(ele)[i])
 
365
   
 
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
 
368
 
 
369
also assume that the velocity is dg</comment>
 
370
        </algorithm>
 
371
        <mesh name="VelocityMesh"/>
 
372
        <output/>
 
373
        <stat>
 
374
          <include_in_stat/>
 
375
        </stat>
 
376
        <convergence>
 
377
          <include_in_convergence/>
 
378
        </convergence>
 
379
        <detectors>
 
380
          <include_in_detectors/>
 
381
        </detectors>
 
382
        <steady_state>
 
383
          <include_in_steady_state/>
 
384
        </steady_state>
 
385
      </diagnostic>
 
386
    </vector_field>
 
387
  </material_phase>
 
388
</fluidity_options>