~fluidity-core/fluidity/shallow-water-dev

« back to all changes in this revision

Viewing changes to tests/darcy_p0p1_test_cty_cv_pressBCinlet_advect_tracer_p1cv_steptwochannel/darcy_p0p1_test_cty_cv_pressBCinlet_2d.flml

  • Committer: colin.cotter at ac
  • Date: 2012-02-16 17:35:27 UTC
  • mfrom: (3565.1.365 fluidity)
  • Revision ID: colin.cotter@imperial.ac.uk-20120216173527-wpnlu4v9v1kmf4xz
MergeĀ fromĀ trunk.

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_p0p1_test_cty_cv_pressBCinlet_2d</string_value>
 
5
    <comment>a simple short test case for darcy flow using the element type p0p1_test_cty_cv for velocity-pressure
 
6
 
 
7
the darcy velocity is solved for then the tracer is advected using a CV scheme on a continuous mesh.
 
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
where darcy_vel = porosity*interstitial_velocity
 
16
 
 
17
sigma is a function of viscosity and permeability
 
18
 
 
19
python diagnostics are used to form the sigma term that is assoicated with a p0 dg mesh (ie. element wise) and the interstitial velocity
 
20
 
 
21
this case has a 1 region 1 material with pressure boundary condition inflow. 
 
22
 
 
23
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.
 
24
 
 
25
the absorption term is included in the pressure correction (being a necessity as it is the only term in the matrix equation) 
 
26
 
 
27
the geometry is 2d (although this is a 1d problem)
 
28
 
 
29
NOTE: Because the velocity and pressure are time independent the simulation is broken into two.
 
30
      First the velocity and pressure are solved and checkpointed. 
 
31
      Second the tracer is advected using a prescribed velocity from the previous checkpointed run.</comment>
 
32
  </simulation_name>
 
33
  <problem_type>
 
34
    <string_value lines="1">fluids</string_value>
 
35
  </problem_type>
 
36
  <geometry>
 
37
    <dimension>
 
38
      <integer_value rank="0">2</integer_value>
 
39
    </dimension>
 
40
    <mesh name="CoordinateMesh">
 
41
      <from_file file_name="steptwochannel">
 
42
        <format name="gmsh"/>
 
43
        <stat>
 
44
          <include_in_stat/>
 
45
        </stat>
 
46
      </from_file>
 
47
    </mesh>
 
48
    <mesh name="VelocityMesh">
 
49
      <from_mesh>
 
50
        <mesh name="CoordinateMesh"/>
 
51
        <mesh_shape>
 
52
          <polynomial_degree>
 
53
            <integer_value rank="0">0</integer_value>
 
54
          </polynomial_degree>
 
55
        </mesh_shape>
 
56
        <mesh_continuity>
 
57
          <string_value>discontinuous</string_value>
 
58
        </mesh_continuity>
 
59
        <stat>
 
60
          <exclude_from_stat/>
 
61
        </stat>
 
62
      </from_mesh>
 
63
    </mesh>
 
64
    <mesh name="PressureMesh">
 
65
      <from_mesh>
 
66
        <mesh name="CoordinateMesh"/>
 
67
        <stat>
 
68
          <exclude_from_stat/>
 
69
        </stat>
 
70
      </from_mesh>
 
71
    </mesh>
 
72
    <mesh name="DGP0">
 
73
      <from_mesh>
 
74
        <mesh name="CoordinateMesh"/>
 
75
        <mesh_shape>
 
76
          <polynomial_degree>
 
77
            <integer_value rank="0">0</integer_value>
 
78
          </polynomial_degree>
 
79
        </mesh_shape>
 
80
        <mesh_continuity>
 
81
          <string_value>discontinuous</string_value>
 
82
        </mesh_continuity>
 
83
        <stat>
 
84
          <exclude_from_stat/>
 
85
        </stat>
 
86
      </from_mesh>
 
87
    </mesh>
 
88
    <quadrature>
 
89
      <degree>
 
90
        <integer_value rank="0">3</integer_value>
 
91
      </degree>
 
92
    </quadrature>
 
93
  </geometry>
 
94
  <io>
 
95
    <dump_format>
 
96
      <string_value>vtk</string_value>
 
97
    </dump_format>
 
98
    <dump_period_in_timesteps>
 
99
      <constant>
 
100
        <integer_value rank="0">0</integer_value>
 
101
      </constant>
 
102
    </dump_period_in_timesteps>
 
103
    <output_mesh name="VelocityMesh"/>
 
104
    <checkpointing>
 
105
      <checkpoint_period_in_dumps>
 
106
        <integer_value rank="0">1000</integer_value>
 
107
      </checkpoint_period_in_dumps>
 
108
      <checkpoint_at_end/>
 
109
    </checkpointing>
 
110
    <stat/>
 
111
  </io>
 
112
  <timestepping>
 
113
    <current_time>
 
114
      <real_value rank="0">0.0</real_value>
 
115
    </current_time>
 
116
    <timestep>
 
117
      <real_value rank="0">0.1</real_value>
 
118
    </timestep>
 
119
    <finish_time>
 
120
      <real_value rank="0">9.0</real_value>
 
121
    </finish_time>
 
122
    <final_timestep>
 
123
      <integer_value rank="0">1</integer_value>
 
124
    </final_timestep>
 
125
  </timestepping>
 
126
  <material_phase name="fluid">
 
127
    <scalar_field name="Pressure" rank="0">
 
128
      <prognostic>
 
129
        <mesh name="PressureMesh"/>
 
130
        <spatial_discretisation>
 
131
          <continuous_galerkin>
 
132
            <test_continuity_with_cv_dual/>
 
133
          </continuous_galerkin>
 
134
        </spatial_discretisation>
 
135
        <scheme>
 
136
          <poisson_pressure_solution>
 
137
            <string_value lines="1">never</string_value>
 
138
          </poisson_pressure_solution>
 
139
          <use_projection_method/>
 
140
          <update_discretised_equation/>
 
141
        </scheme>
 
142
        <solver>
 
143
          <iterative_method name="gmres">
 
144
            <restart>
 
145
              <integer_value rank="0">30</integer_value>
 
146
            </restart>
 
147
          </iterative_method>
 
148
          <preconditioner name="sor"/>
 
149
          <relative_error>
 
150
            <real_value rank="0">1.0e-10</real_value>
 
151
          </relative_error>
 
152
          <max_iterations>
 
153
            <integer_value rank="0">1000</integer_value>
 
154
          </max_iterations>
 
155
          <never_ignore_solver_failures/>
 
156
          <diagnostics>
 
157
            <monitors/>
 
158
          </diagnostics>
 
159
        </solver>
 
160
        <boundary_conditions name="right_outflow">
 
161
          <surface_ids>
 
162
            <integer_value shape="1" rank="1">8</integer_value>
 
163
          </surface_ids>
 
164
          <type name="dirichlet">
 
165
            <constant>
 
166
              <real_value rank="0">0.0</real_value>
 
167
            </constant>
 
168
          </type>
 
169
        </boundary_conditions>
 
170
        <boundary_conditions name="left_inflow">
 
171
          <surface_ids>
 
172
            <integer_value shape="2" rank="1">10 100</integer_value>
 
173
          </surface_ids>
 
174
          <type name="dirichlet">
 
175
            <constant>
 
176
              <real_value rank="0">1.5e+09</real_value>
 
177
            </constant>
 
178
          </type>
 
179
        </boundary_conditions>
 
180
        <output/>
 
181
        <stat/>
 
182
        <convergence>
 
183
          <include_in_convergence/>
 
184
        </convergence>
 
185
        <detectors>
 
186
          <exclude_from_detectors/>
 
187
        </detectors>
 
188
        <steady_state>
 
189
          <include_in_steady_state/>
 
190
        </steady_state>
 
191
        <no_interpolation/>
 
192
      </prognostic>
 
193
    </scalar_field>
 
194
    <vector_field name="Velocity" rank="1">
 
195
      <prognostic>
 
196
        <mesh name="VelocityMesh"/>
 
197
        <equation name="Boussinesq"/>
 
198
        <spatial_discretisation>
 
199
          <discontinuous_galerkin>
 
200
            <mass_terms>
 
201
              <exclude_mass_terms/>
 
202
            </mass_terms>
 
203
            <viscosity_scheme>
 
204
              <compact_discontinuous_galerkin/>
 
205
            </viscosity_scheme>
 
206
            <advection_scheme>
 
207
              <none/>
 
208
              <integrate_advection_by_parts>
 
209
                <twice/>
 
210
              </integrate_advection_by_parts>
 
211
            </advection_scheme>
 
212
          </discontinuous_galerkin>
 
213
          <conservative_advection>
 
214
            <real_value rank="0">0.0</real_value>
 
215
          </conservative_advection>
 
216
        </spatial_discretisation>
 
217
        <temporal_discretisation>
 
218
          <theta>
 
219
            <real_value rank="0">1.0</real_value>
 
220
          </theta>
 
221
          <relaxation>
 
222
            <real_value rank="0">1.0</real_value>
 
223
          </relaxation>
 
224
        </temporal_discretisation>
 
225
        <solver>
 
226
          <iterative_method name="gmres">
 
227
            <restart>
 
228
              <integer_value rank="0">30</integer_value>
 
229
            </restart>
 
230
          </iterative_method>
 
231
          <preconditioner name="sor"/>
 
232
          <relative_error>
 
233
            <real_value rank="0">1.0e-10</real_value>
 
234
          </relative_error>
 
235
          <max_iterations>
 
236
            <integer_value rank="0">1000</integer_value>
 
237
          </max_iterations>
 
238
          <never_ignore_solver_failures/>
 
239
          <diagnostics>
 
240
            <monitors/>
 
241
          </diagnostics>
 
242
        </solver>
 
243
        <initial_condition name="WholeMesh">
 
244
          <constant>
 
245
            <real_value shape="2" dim1="dim" rank="1">0.0 0.0</real_value>
 
246
          </constant>
 
247
        </initial_condition>
 
248
        <boundary_conditions name="no_outflow_top_bottom">
 
249
          <surface_ids>
 
250
            <integer_value shape="2" rank="1">7 9</integer_value>
 
251
          </surface_ids>
 
252
          <type name="dirichlet">
 
253
            <apply_weakly/>
 
254
            <align_bc_with_cartesian>
 
255
              <y_component>
 
256
                <constant>
 
257
                  <real_value rank="0">0.0</real_value>
 
258
                </constant>
 
259
              </y_component>
 
260
            </align_bc_with_cartesian>
 
261
          </type>
 
262
        </boundary_conditions>
 
263
        <vector_field name="Absorption" rank="1">
 
264
          <diagnostic>
 
265
            <mesh name="DGP0"/>
 
266
            <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
 
267
              <string_value lines="20" type="python"># get the prescribed fields 
 
268
perm = states["fluid"].scalar_fields["Permeability"]
 
269
visc = states["fluid"].scalar_fields["Viscosity"]
 
270
 
 
271
# loop the DMmesh_p0 nodes (which are element centred)
 
272
for n in range(field.node_count):
 
273
   perm_n = perm.node_val(n)
 
274
   visc_n = visc.node_val(n)
 
275
      
 
276
   # calc the absorption term
 
277
   sigma_n = visc_n/perm_n
 
278
   
 
279
   # set the absorption term
 
280
   field.set(n,sigma_n)</string_value>
 
281
              <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
 
282
 
 
283
also assume that the velocity is dg</comment>
 
284
            </algorithm>
 
285
            <output/>
 
286
            <stat>
 
287
              <include_in_stat/>
 
288
            </stat>
 
289
            <convergence>
 
290
              <include_in_convergence/>
 
291
            </convergence>
 
292
            <detectors>
 
293
              <include_in_detectors/>
 
294
            </detectors>
 
295
            <steady_state>
 
296
              <include_in_steady_state/>
 
297
            </steady_state>
 
298
          </diagnostic>
 
299
          <include_pressure_correction/>
 
300
        </vector_field>
 
301
        <output/>
 
302
        <stat>
 
303
          <include_in_stat/>
 
304
          <previous_time_step>
 
305
            <exclude_from_stat/>
 
306
          </previous_time_step>
 
307
          <nonlinear_field>
 
308
            <exclude_from_stat/>
 
309
          </nonlinear_field>
 
310
        </stat>
 
311
        <convergence>
 
312
          <include_in_convergence/>
 
313
        </convergence>
 
314
        <detectors>
 
315
          <include_in_detectors/>
 
316
        </detectors>
 
317
        <steady_state>
 
318
          <include_in_steady_state/>
 
319
        </steady_state>
 
320
        <consistent_interpolation/>
 
321
      </prognostic>
 
322
    </vector_field>
 
323
    <scalar_field name="Viscosity" rank="0">
 
324
      <prescribed>
 
325
        <mesh name="DGP0"/>
 
326
        <value name="WholeMesh">
 
327
          <constant>
 
328
            <real_value rank="0">1.0e-04</real_value>
 
329
          </constant>
 
330
        </value>
 
331
        <output/>
 
332
        <stat/>
 
333
        <detectors>
 
334
          <exclude_from_detectors/>
 
335
        </detectors>
 
336
      </prescribed>
 
337
    </scalar_field>
 
338
    <scalar_field name="ControlVolumeDivergence" rank="0">
 
339
      <diagnostic field_name="Velocity">
 
340
        <algorithm name="Internal" material_phase_support="multiple"/>
 
341
        <mesh name="PressureMesh"/>
 
342
        <output/>
 
343
        <stat/>
 
344
        <convergence>
 
345
          <include_in_convergence/>
 
346
        </convergence>
 
347
        <detectors>
 
348
          <include_in_detectors/>
 
349
        </detectors>
 
350
        <steady_state>
 
351
          <include_in_steady_state/>
 
352
        </steady_state>
 
353
      </diagnostic>
 
354
    </scalar_field>
 
355
    <vector_field name="InterstitialVelocity" rank="1">
 
356
      <diagnostic>
 
357
        <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
 
358
          <string_value lines="20" type="python">phi = states["fluid"].scalar_fields["Porosity"]
 
359
darcy_vel = states["fluid"].vector_fields["Velocity"]
 
360
 
 
361
for ele in range(field.element_count):
 
362
   phi_ele = phi.node_val(ele)
 
363
   
 
364
   factor_ele = 1.0/max(phi_ele,1.0e-08)
 
365
   
 
366
   vel_ele = []
 
367
   for i in range(len(darcy_vel.ele_val(ele))):
 
368
     vel_ele.append(factor_ele*darcy_vel.ele_val(ele)[i])
 
369
   
 
370
   field.set(darcy_vel.ele_nodes(ele),vel_ele)</string_value>
 
371
        </algorithm>
 
372
        <mesh name="VelocityMesh"/>
 
373
        <output/>
 
374
        <stat>
 
375
          <include_in_stat/>
 
376
        </stat>
 
377
        <convergence>
 
378
          <include_in_convergence/>
 
379
        </convergence>
 
380
        <detectors>
 
381
          <include_in_detectors/>
 
382
        </detectors>
 
383
        <steady_state>
 
384
          <include_in_steady_state/>
 
385
        </steady_state>
 
386
      </diagnostic>
 
387
    </vector_field>
 
388
  </material_phase>
 
389
  <porous_media>
 
390
    <scalar_field name="Porosity">
 
391
      <prescribed>
 
392
        <mesh name="DGP0"/>
 
393
        <value name="left_bottom">
 
394
          <region_ids>
 
395
            <integer_value shape="1" rank="1">11</integer_value>
 
396
          </region_ids>
 
397
          <constant>
 
398
            <real_value rank="0">0.1</real_value>
 
399
          </constant>
 
400
        </value>
 
401
        <value name="right_bottom">
 
402
          <region_ids>
 
403
            <integer_value shape="1" rank="1">12</integer_value>
 
404
          </region_ids>
 
405
          <constant>
 
406
            <real_value rank="0">0.4</real_value>
 
407
          </constant>
 
408
        </value>
 
409
        <value name="left_top">
 
410
          <region_ids>
 
411
            <integer_value shape="1" rank="1">13</integer_value>
 
412
          </region_ids>
 
413
          <constant>
 
414
            <real_value rank="0">0.2</real_value>
 
415
          </constant>
 
416
        </value>
 
417
        <value name="right_top">
 
418
          <region_ids>
 
419
            <integer_value shape="1" rank="1">14</integer_value>
 
420
          </region_ids>
 
421
          <constant>
 
422
            <real_value rank="0">0.2</real_value>
 
423
          </constant>
 
424
        </value>
 
425
        <output/>
 
426
        <stat/>
 
427
        <detectors>
 
428
          <exclude_from_detectors/>
 
429
        </detectors>
 
430
      </prescribed>
 
431
    </scalar_field>
 
432
    <scalar_field name="Permeability">
 
433
      <prescribed>
 
434
        <mesh name="DGP0"/>
 
435
        <value name="WholeMesh">
 
436
          <constant>
 
437
            <real_value rank="0">1.0e-10</real_value>
 
438
          </constant>
 
439
        </value>
 
440
        <output/>
 
441
        <stat/>
 
442
        <detectors>
 
443
          <exclude_from_detectors/>
 
444
        </detectors>
 
445
      </prescribed>
 
446
    </scalar_field>
 
447
  </porous_media>
 
448
</fluidity_options>