Merge lp:~btollit/fluidity/pressure_CV_weak_pressure_BC into lp:fluidity

Proposed by Brendan Tollit
Status: Merged
Approved by: Cian Wilson
Approved revision: 3873
Merged at revision: 3882
Proposed branch: lp:~btollit/fluidity/pressure_CV_weak_pressure_BC
Merge into: lp:fluidity
Diff against target: 7063 lines (+6824/-2)
40 files modified
assemble/Makefile.dependencies (+17/-1)
assemble/Makefile.in (+1/-1)
assemble/Momentum_Equation.F90 (+6/-0)
assemble/Pressure_Dirichlet_BCS_CV.F90 (+280/-0)
tests/darcy_p0p1_test_cty_cv_pressBCinlet/Makefile (+32/-0)
tests/darcy_p0p1_test_cty_cv_pressBCinlet/cube.geo (+39/-0)
tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet.xml (+118/-0)
tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet_1d.flml (+411/-0)
tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet_2d.flml (+427/-0)
tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet_3d.flml (+442/-0)
tests/darcy_p0p1_test_cty_cv_pressBCinlet/square.geo (+22/-0)
tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/Makefile (+23/-0)
tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain.xml (+46/-0)
tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain_2d.flml (+372/-0)
tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/square_rotated.geo (+38/-0)
tests/darcy_p0p1_test_cty_cv_velBCinlet/Makefile (+32/-0)
tests/darcy_p0p1_test_cty_cv_velBCinlet/cube.geo (+39/-0)
tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet.xml (+94/-0)
tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet_1d.flml (+391/-0)
tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet_2d.flml (+407/-0)
tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet_3d.flml (+404/-0)
tests/darcy_p0p1_test_cty_cv_velBCinlet/square.geo (+22/-0)
tests/darcy_p0p1cv_pressBCinlet/Makefile (+32/-0)
tests/darcy_p0p1cv_pressBCinlet/cube.geo (+39/-0)
tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet.xml (+94/-0)
tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet_1d.flml (+384/-0)
tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet_2d.flml (+392/-0)
tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet_3d.flml (+398/-0)
tests/darcy_p0p1cv_pressBCinlet/square.geo (+22/-0)
tests/darcy_p0p1cv_pressBCinlet_1solidphase/Makefile (+32/-0)
tests/darcy_p0p1cv_pressBCinlet_1solidphase/cube.geo (+39/-0)
tests/darcy_p0p1cv_pressBCinlet_1solidphase/darcy_p0p1cv_pressBCinlet_1solidphase.xml (+94/-0)
tests/darcy_p0p1cv_pressBCinlet_1solidphase/darcy_p0p1cv_pressBCinlet_1solidphase_1d.flml (+363/-0)
tests/darcy_p0p1cv_pressBCinlet_1solidphase/darcy_p0p1cv_pressBCinlet_1solidphase_2d.flml (+379/-0)
tests/darcy_p0p1cv_pressBCinlet_1solidphase/darcy_p0p1cv_pressBCinlet_1solidphase_3d.flml (+394/-0)
tests/darcy_p0p1cv_pressBCinlet_1solidphase/square.geo (+22/-0)
tests/darcy_p0p1cv_pressBCinlet_rotated_domain/Makefile (+23/-0)
tests/darcy_p0p1cv_pressBCinlet_rotated_domain/darcy_p0p1cv_pressBCinlet_rotated_domain.xml (+46/-0)
tests/darcy_p0p1cv_pressBCinlet_rotated_domain/darcy_p0p1cv_pressBCinlet_rotated_domain_2d.flml (+370/-0)
tests/darcy_p0p1cv_pressBCinlet_rotated_domain/square_rotated.geo (+38/-0)
To merge this branch: bzr merge lp:~btollit/fluidity/pressure_CV_weak_pressure_BC
Reviewer Review Type Date Requested Status
Cian Wilson Approve
Review via email: mp+83558@code.launchpad.net

Description of the change

This merge will add a procedure to be able to have non zero pressure Dirichlet boundary conditions when using a CV discretisation for pressure. As for the CG pressure BCs the integrals are included for both weak and strong Dirichlet. For multiphase the phase volume fraction is included via a FE spatial interpolation, akin to their inclusion in interior domain terms.

Code Additions:

- assemble/Pressure_Dirichlet_BCS_CV.F90. Adds the BC integrals via forming the same local matrix as the weak velocity BCs but uses it transposed, which is similar to pressure CG version(s).

Code Changes:

- assemble/Momentum_Equation.F90. If cv_pressure calls the above routine after assembling the main momentum equation terms.

- assemble/Makefile.in. Update for new file/module.

- assemble/Makefile.dependencies. Update for new file/module.

Test Cases Removed:

- tests/mphase_test1_2d. Has no .xml and appears to have not been changed in a long time. Uses porous_media options and was found when looking for suitable pressure BC test cases.

Test Cases Added:

- tests/darcy_p0p1cv_pressBCinlet. Simple channel flow model using darcy flow with a pressure gradient using p0p1cv for 1,2 and 3d. Analytic and very fast.

- tests/darcy_p0p1cv_pressBCinlet_1solidphase. Same as above but with an extra phase to represent the porous media for darcy flow. Analytic and very fast.

- tests/darcy_p0p1cv_pressBCinlet_rotated_domain. Similar to the above but with a rotated domain as the pressure BCs have a normal component so worth checking non axis aligned integrals. Analytic and very fast.

- tests/darcy_p0p1_test_cty_cv_pressBCinlet. Similar to above but with CG pressure and CV continuity. This is added as not many CG pressure BC test cases appear to exist. Analytic and very fast.

- tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain. Same as above but rotated. Analytic and very fast.

- tests/darcy_p0p1_test_cty_cv_velBCinlet. Similar to above but with weak velocity BC instead. Just to test a combination of two previously merged branches and the test case is very similar to above.

Buildbot green (on Nov 25 18:48)

To post a comment you must log in.
3872. By Brendan Tollit

Very small change to a comment.

3873. By Brendan Tollit

Merge trunk into branch

Revision history for this message
Brendan Tollit (btollit) wrote :

Since original merge request, added a very small change to a comment.

Merged latest trunk into branch and re-ran branch buildbot which is green.

Needs a volunteer to review please!

Revision history for this message
Cian Wilson (cwilson) wrote :

Looks good. Sorry for the delay in reviewing.

One comment/suggestion:

In Makefile.in:
  Pressure_Dirichlet_BCS_CV.F90 -> Pressure_Dirichlet_BCS_CV.o

Clearly, as it still compiles this doesn't make much difference!

review: Approve
3874. By Brendan Tollit

Change .F90 to .o spotted by Cian in review.

3875. By Brendan Tollit

Merge trunk into branch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'assemble/Makefile.dependencies'
--- assemble/Makefile.dependencies 2011-10-27 23:11:25 +0000
+++ assemble/Makefile.dependencies 2011-12-23 12:05:25 +0000
@@ -579,7 +579,8 @@
579 ../include/momentum_cg.mod ../include/momentum_dg.mod \579 ../include/momentum_cg.mod ../include/momentum_dg.mod \
580 ../include/momentum_diagnostic_fields.mod ../include/multiphase_module.mod \580 ../include/momentum_diagnostic_fields.mod ../include/multiphase_module.mod \
581 ../include/oceansurfaceforcing.mod ../include/parallel_tools.mod \581 ../include/oceansurfaceforcing.mod ../include/parallel_tools.mod \
582 ../include/petsc_solve_state_module.mod ../include/profiler.mod \582 ../include/petsc_solve_state_module.mod \
583 ../include/pressure_dirichlet_bcs_cv.mod ../include/profiler.mod \
583 ../include/reduced_model_runtime.mod \584 ../include/reduced_model_runtime.mod \
584 ../include/rotated_boundary_conditions.mod ../include/slope_limiters_dg.mod \585 ../include/rotated_boundary_conditions.mod ../include/slope_limiters_dg.mod \
585 ../include/solvers.mod ../include/sparse_matrices_fields.mod \586 ../include/solvers.mod ../include/sparse_matrices_fields.mod \
@@ -645,6 +646,21 @@
645 ../include/fdebug.h ../include/fields.mod ../include/fldebug.mod \646 ../include/fdebug.h ../include/fields.mod ../include/fldebug.mod \
646 ../include/spud.mod ../include/state_module.mod647 ../include/spud.mod ../include/state_module.mod
647648
649../include/pressure_dirichlet_bcs_cv.mod: Pressure_Dirichlet_BCS_CV.o
650 @true
651
652Pressure_Dirichlet_BCS_CV.o ../include/pressure_dirichlet_bcs_cv.mod: \
653 Pressure_Dirichlet_BCS_CV.F90 ../include/boundary_conditions.mod \
654 ../include/cv_face_values.mod ../include/cv_faces.mod \
655 ../include/cv_fields.mod ../include/cv_options.mod \
656 ../include/cv_shape_functions.mod ../include/cv_upwind_values.mod \
657 ../include/cvtools.mod ../include/diagnostic_fields.mod ../include/fdebug.h \
658 ../include/fetools.mod ../include/field_derivatives.mod \
659 ../include/field_options.mod ../include/fields.mod ../include/futils.mod \
660 ../include/global_parameters.mod ../include/multiphase_module.mod \
661 ../include/quadrature.mod ../include/sparsity_patterns_meshes.mod \
662 ../include/spud.mod ../include/state_module.mod
663
648../include/pseudo_supermesh.mod: Pseudo_supermesh.o664../include/pseudo_supermesh.mod: Pseudo_supermesh.o
649 @true665 @true
650666
651667
=== modified file 'assemble/Makefile.in'
--- assemble/Makefile.in 2011-10-21 10:05:25 +0000
+++ assemble/Makefile.in 2011-12-23 12:05:25 +0000
@@ -76,7 +76,7 @@
76 Linear_Shallow_Water.o \76 Linear_Shallow_Water.o \
77 Zoltan_global_variables.o Zoltan_integration.o Zoltan_callbacks.o Zoltan_detectors.o \77 Zoltan_global_variables.o Zoltan_integration.o Zoltan_callbacks.o Zoltan_detectors.o \
78 Diagnostic_Children.o Reduced_Model_Runtime.o Turbine.o Implicit_Solids.o \78 Diagnostic_Children.o Reduced_Model_Runtime.o Turbine.o Implicit_Solids.o \
79 Manifold_Projections.o Hybridized_Helmholtz.o Burgers_Assembly.o79 Manifold_Projections.o Hybridized_Helmholtz.o Burgers_Assembly.o Pressure_Dirichlet_BCS_CV.o
8080
81.SUFFIXES: .F90 .c .cpp .o .a81.SUFFIXES: .F90 .c .cpp .o .a
8282
8383
=== modified file 'assemble/Momentum_Equation.F90'
--- assemble/Momentum_Equation.F90 2011-11-23 17:00:55 +0000
+++ assemble/Momentum_Equation.F90 2011-12-23 12:05:25 +0000
@@ -74,6 +74,7 @@
74 use slope_limiters_dg74 use slope_limiters_dg
75 use implicit_solids75 use implicit_solids
76 use multiphase_module76 use multiphase_module
77 use pressure_dirichlet_bcs_cv
7778
78 implicit none79 implicit none
7980
@@ -589,6 +590,11 @@
589 include_pressure_and_continuity_bcs=.not. cv_pressure)590 include_pressure_and_continuity_bcs=.not. cv_pressure)
590 end if591 end if
591 592
593 ! If CV pressure then add in any dirichlet pressure BC integrals to the mom_rhs.
594 if (cv_pressure) then
595 call add_pressure_dirichlet_bcs_cv(mom_rhs(istate), u, p, state(istate))
596 end if
597
592 ! Add in multiphase interactions (e.g. fluid-particle drag) if necessary598 ! Add in multiphase interactions (e.g. fluid-particle drag) if necessary
593 ! Note: this is done outside of construct_momentum_cg/dg to keep things599 ! Note: this is done outside of construct_momentum_cg/dg to keep things
594 ! neater in Momentum_CG/DG.F90, since we would need to pass around multiple phases 600 ! neater in Momentum_CG/DG.F90, since we would need to pass around multiple phases
595601
=== added file 'assemble/Pressure_Dirichlet_BCS_CV.F90'
--- assemble/Pressure_Dirichlet_BCS_CV.F90 1970-01-01 00:00:00 +0000
+++ assemble/Pressure_Dirichlet_BCS_CV.F90 2011-12-23 12:05:25 +0000
@@ -0,0 +1,280 @@
1! Copyright (C) 2006 Imperial College London and others.
2!
3! Please see the AUTHORS file in the main source directory for a full list
4! of copyright holders.
5!
6! Prof. C Pain
7! Applied Modelling and Computation Group
8! Department of Earth Science and Engineering
9! Imperial College London
10!
11! amcgsoftware@imperial.ac.uk
12!
13! This library is free software; you can redistribute it and/or
14! modify it under the terms of the GNU Lesser General Public
15! License as published by the Free Software Foundation,
16! version 2.1 of the License.
17!
18! This library is distributed in the hope that it will be useful,
19! but WITHOUT ANY WARRANTY; without even the implied warranty of
20! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21! Lesser General Public License for more details.
22!
23! You should have received a copy of the GNU Lesser General Public
24! License along with this library; if not, write to the Free Software
25! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
26! USA
27#include "fdebug.h"
28
29module pressure_dirichlet_bcs_cv
30
31 use quadrature
32 use fields
33 use field_derivatives
34 use state_module
35 use futils
36 use fetools
37 use spud
38 use cv_faces
39 use cv_shape_functions
40 use cvtools
41 use cv_fields
42 use cv_upwind_values
43 use cv_face_values
44 use cv_options
45 use diagnostic_fields, only: calculate_diagnostic_variable
46 use boundary_conditions
47 use global_parameters, only: OPTION_PATH_LEN
48 use field_options, only: get_coordinate_field
49 use sparsity_patterns_meshes
50 use multiphase_module
51
52 implicit none
53
54 private
55
56 public :: add_pressure_dirichlet_bcs_cv
57
58contains
59
60 ! --------------------------------------------------------------------------------------
61
62 subroutine add_pressure_dirichlet_bcs_cv(mom_rhs, u, p, state)
63
64 !!< Add any CV pressure dirichlet BC integrals to the mom_rhs field if required.
65 !!< If this is a multiphase simulation then the phase volume fraction spatial
66 !!< interpolation uses finite elements. This isnt striclty correct if the
67 !!< phase volume fractions were solved with a control volume discretisation
68 !!< and also whether of not they themselves have a weak BC is ignored. If the
69 !!< latter was to be considered then the upwind value should be used.
70
71 ! Note the pressure BC values come from the end of time step Pressure field
72 ! rather than using a theta average. The latter was tried but didnt work
73 ! because OldPressure had no BC info. Taking the end of time step value
74 ! for the BC is also what the pressure CG routine(s) do.
75
76 type(vector_field), intent(inout) :: mom_rhs
77 type(vector_field), intent(in) :: u
78 type(scalar_field), intent(in) :: p
79 type(state_type), intent(inout) :: state ! required for phase volume fraction
80
81 ! local variables
82
83 ! degree of quadrature over cv faces
84 integer :: quaddegree
85
86 real, dimension(:,:), allocatable :: x_ele, x_ele_bdy
87 real, dimension(:,:), allocatable :: normal_bdy
88 real, dimension(:), allocatable :: detwei_bdy
89 integer, dimension(:), allocatable :: u_nodes_bdy
90
91 integer :: ele, sele, iloc, jloc, face, gi, ggi, dim
92
93 ! information about cv faces
94 type(cv_faces_type) :: cvfaces
95 ! shape functions for surface
96 type(element_type) :: x_cvbdyshape
97 type(element_type) :: u_cvbdyshape
98
99 ! pointer to coordinates
100 type(vector_field), pointer :: x
101
102 ! pressure BC info
103 integer, dimension(:), allocatable :: pressure_bc_type
104 real, dimension(:), allocatable :: pressure_bc_val
105 type(scalar_field) :: pressure_bc
106
107 ! local ct matrix
108 real, dimension(:,:,:), allocatable :: ct_mat_local_bdy
109
110 ! Multiphase variables
111 logical :: multiphase
112 ! Volume fraction fields
113 type(scalar_field), pointer :: vfrac
114 type(scalar_field) :: nvfrac
115
116 ! Variables used for FE interpolation of vfrac on surface
117 ! Values of nvfrac at the faces
118 real, dimension(:), allocatable :: nvfrac_gi_f
119 ! CV shape functions for nvfrac (computed only if the Coordinate and
120 ! PhaseVolumeFraction meshes are different, otherwise it is
121 ! assigned x_cvbdyshape)
122 type(element_type) :: nvfrac_cvbdyshape
123
124 ewrite(1,*) 'In add_cv_pressure_weak_dirichlet_bcs'
125
126 x => extract_vector_field(state, "Coordinate")
127
128 allocate(x_ele(x%dim, x%mesh%shape%loc))
129
130 call get_option("/geometry/quadrature/controlvolume_surface_degree", quaddegree, default=1)
131
132 cvfaces = find_cv_faces(vertices = ele_vertices(p, 1), &
133 dimension = mesh_dim(p), &
134 polydegree = p%mesh%shape%degree, &
135 quaddegree = quaddegree)
136
137 x_cvbdyshape = make_cvbdy_element_shape(cvfaces, x%mesh%faces%shape)
138 u_cvbdyshape = make_cvbdy_element_shape(cvfaces, u%mesh%faces%shape)
139
140 assert(surface_element_count(p) == surface_element_count(u))
141
142 ! get the pressure BC field
143 allocate(pressure_bc_type(surface_element_count(p)))
144
145 call get_entire_boundary_condition(p, (/"weakdirichlet", &
146 "dirichlet "/), pressure_bc, pressure_bc_type)
147
148 allocate(x_ele_bdy(x%dim,x%mesh%faces%shape%loc), &
149 detwei_bdy(x_cvbdyshape%ngi), &
150 normal_bdy(x%dim, x_cvbdyshape%ngi), &
151 pressure_bc_val(pressure_bc%mesh%shape%loc))
152
153 allocate(u_nodes_bdy(u%mesh%faces%shape%loc))
154
155 allocate(ct_mat_local_bdy(x%dim, p%mesh%faces%shape%loc, u%mesh%faces%shape%loc))
156
157 ! Check if we need to multiply through by the non-linear volume fraction
158 if(option_count("/material_phase/vector_field::Velocity/prognostic") > 1) then
159 multiphase = .true.
160
161 vfrac => extract_scalar_field(state, "PhaseVolumeFraction")
162 call allocate(nvfrac, vfrac%mesh, "NonlinearPhaseVolumeFraction")
163 call zero(nvfrac)
164 call get_nonlinear_volume_fraction(state, nvfrac)
165
166 assert(surface_element_count(p) == surface_element_count(vfrac))
167
168 ewrite_minmax(nvfrac)
169
170 ! If the Coordinate and PhaseVolumeFraction meshes are different, then we need to
171 ! generate the PhaseVolumeFraction CV shape functions.
172 if(.not.(nvfrac%mesh == x%mesh)) then
173 nvfrac_cvbdyshape = make_cvbdy_element_shape(cvfaces, nvfrac%mesh%faces%shape)
174 else
175 nvfrac_cvbdyshape = x_cvbdyshape
176 ! incease reference for deallocates below
177 call incref(nvfrac_cvbdyshape)
178 end if
179
180 allocate(nvfrac_gi_f(nvfrac_cvbdyshape%ngi))
181
182 else
183 multiphase = .false.
184 nullify(vfrac)
185 end if
186
187 surface_element_loop: do sele = 1, surface_element_count(p)
188
189 ! cycle if this not a dirichlet pressure BC.
190 if (pressure_bc_type(sele) == 0) cycle
191
192 ele = face_ele(x, sele)
193 x_ele = ele_val(x, ele)
194 x_ele_bdy = face_val(x, sele)
195 u_nodes_bdy = face_global_nodes(u, sele)
196
197 ! Get the phase volume fraction face value
198 if(multiphase) then
199 nvfrac_gi_f = face_val_at_quad(nvfrac, sele, nvfrac_cvbdyshape)
200 end if
201
202 call transform_cvsurf_facet_to_physical(x_ele, x_ele_bdy, &
203 x_cvbdyshape, normal_bdy, detwei_bdy)
204
205 ct_mat_local_bdy = 0.0
206
207 ! calculate the ct local matrix
208 surface_nodal_loop_i: do iloc = 1, p%mesh%faces%shape%loc
209
210 surface_face_loop: do face = 1, cvfaces%sfaces
211
212 if(cvfaces%sneiloc(iloc,face) /= 0) then
213
214 surface_quadrature_loop: do gi = 1, cvfaces%shape%ngi
215
216 ggi = (face-1)*cvfaces%shape%ngi + gi
217
218 surface_nodal_loop_j: do jloc = 1, u%mesh%faces%shape%loc
219
220 surface_inner_dimension_loop: do dim = 1, size(normal_bdy,1)
221
222 if(multiphase) then
223 ct_mat_local_bdy(dim, iloc, jloc) = ct_mat_local_bdy(dim, iloc, jloc) + &
224 u_cvbdyshape%n(jloc,ggi)*detwei_bdy(ggi)*nvfrac_gi_f(ggi)*normal_bdy(dim, ggi)
225 else
226 ct_mat_local_bdy(dim, iloc, jloc) = ct_mat_local_bdy(dim, iloc, jloc) + &
227 u_cvbdyshape%n(jloc,ggi)*detwei_bdy(ggi)*normal_bdy(dim, ggi)
228 end if
229
230 end do surface_inner_dimension_loop
231
232 end do surface_nodal_loop_j
233
234 end do surface_quadrature_loop
235
236 end if
237
238 end do surface_face_loop
239
240 end do surface_nodal_loop_i
241
242 ! pressure dirichlet BC is -c*press_bc_val = -press_bc_val*ct, integrated over surface elements appropriate
243 surface_outer_dimension_loop: do dim = 1, size(normal_bdy,1)
244
245 ! for weak and strong pressure dirichlet bcs:
246 ! /
247 ! add -| N_i M_j \vec n p_j, where p_j are the prescribed bc values
248 ! /
249
250 call addto(mom_rhs, dim, u_nodes_bdy, -matmul(ele_val(pressure_bc, sele), ct_mat_local_bdy(dim,:,:)))
251
252 end do surface_outer_dimension_loop
253
254 end do surface_element_loop
255
256 call deallocate(pressure_bc)
257 deallocate(pressure_bc_type)
258 deallocate(pressure_bc_val)
259 call deallocate(x_cvbdyshape)
260 call deallocate(u_cvbdyshape)
261 deallocate(x_ele_bdy, detwei_bdy, normal_bdy)
262
263 deallocate(u_nodes_bdy)
264 deallocate(ct_mat_local_bdy)
265
266 call deallocate(cvfaces)
267 deallocate(x_ele)
268
269 if(multiphase) then
270 call deallocate(nvfrac)
271 deallocate(nvfrac_gi_f)
272 call deallocate(nvfrac_cvbdyshape)
273 end if
274
275 end subroutine add_pressure_dirichlet_bcs_cv
276
277 ! --------------------------------------------------------------------------------------
278
279end module pressure_dirichlet_bcs_cv
280
0281
=== added directory 'tests/darcy_p0p1_test_cty_cv_pressBCinlet'
=== added file 'tests/darcy_p0p1_test_cty_cv_pressBCinlet/Makefile'
--- tests/darcy_p0p1_test_cty_cv_pressBCinlet/Makefile 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_pressBCinlet/Makefile 2011-12-23 12:05:25 +0000
@@ -0,0 +1,32 @@
1SHELL = sh
2
3SIM = darcy_p0p1_test_cty_cv_pressBCinlet
4
5# options for 1d mesh interval script
6MESH_SIZE = 100.0
7LEFT_X = 0.0
8RIGHT_X = 300.0
9
10input: clean
11 interval --dx=$(MESH_SIZE) $(LEFT_X) $(RIGHT_X) $(SIM)_1d
12 gmsh -2 square.geo -o square.msh
13 gmsh -3 cube.geo -o cube.msh
14
15clean:
16 rm -f *.ele
17 rm -f *.node
18 rm -f *.bound
19 rm -f *.edge
20 rm -f *.face
21 rm -f *.vtu
22 rm -f *.pvtu
23 rm -f *.s
24 rm -f *.stat
25 rm -f *.log-0
26 rm -f *.err-0
27 rm -f *.msh
28 rm -f *.halo
29 rm -f fluidity.err*
30 rm -f fluidity.log*
31 rm -f matrixdump*
32 rm -f first_timestep_adapted_mesh*
033
=== added file 'tests/darcy_p0p1_test_cty_cv_pressBCinlet/cube.geo'
--- tests/darcy_p0p1_test_cty_cv_pressBCinlet/cube.geo 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_pressBCinlet/cube.geo 2011-12-23 12:05:25 +0000
@@ -0,0 +1,39 @@
1// define a layer variable
2lay = 5;
3
4// define a len variable
5len = 300.0;
6
7Point(1) = {0.0, 0.0, 0.0, 1.0};
8
9Extrude {len, 0.0, 0.0} {
10 Point{1}; Layers{lay};
11}
12
13Extrude {0.0, len, 0.0} {
14 Line{1}; Layers{lay};
15}
16
17Extrude {0.0, 0.0, len} {
18 Surface{5}; Layers{lay};
19}
20
21// bottom
22Physical Surface(1) = {5};
23
24// top
25Physical Surface(2) = {27};
26
27// left
28Physical Surface(3) = {26};
29
30// right
31Physical Surface(4) = {18};
32
33// front
34Physical Surface(5) = {14};
35
36// back
37Physical Surface(6) = {22};
38
39Physical Volume(1) = {1};
040
=== added file 'tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet.xml'
--- tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet.xml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet.xml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,118 @@
1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE testproblem SYSTEM "regressiontest.dtd">
3
4<testproblem>
5 <name>darcy_p0p1_test_cty_cv_pressBCinlet</name>
6 <owner userid="btollit"/>
7 <tags>flml darcy</tags>
8 <problem_definition length="short" nprocs="1">
9 <command_line>
10../../bin/fluidity darcy_p0p1_test_cty_cv_pressBCinlet_1d.flml
11../../bin/fluidity darcy_p0p1_test_cty_cv_pressBCinlet_2d.flml
12../../bin/fluidity darcy_p0p1_test_cty_cv_pressBCinlet_3d.flml
13 </command_line>
14 <!-- One/two/three dimensional problem for darcy flow with one region and one material using p0p1 element type testing the pressure gradient against analytic and the interstitial velocity. This tests using a diagnostic velocity absorption field associated with a mesh and momentum dg for darcy flows.-->
15 </problem_definition>
16 <variables>
17 <variable name="pressure_1d" language="python">
18import vtktools
19v = vtktools.vtu("darcy_p0p1_test_cty_cv_pressBCinlet_1d_1.vtu")
20pressure_1d = v.GetScalarRange("Pressure")
21 </variable>
22 <variable name="inter_vel_1d" language="python">
23import vtktools
24v = vtktools.vtu("darcy_p0p1_test_cty_cv_pressBCinlet_1d_1.vtu")
25inter_vel_1d = max(v.GetScalarRange("interstitial_velocity"))
26 </variable>
27 <variable name="max_div_vel_1d" language="python">
28import vtktools
29v = vtktools.vtu("darcy_p0p1_test_cty_cv_pressBCinlet_1d_1.vtu")
30max_div_vel_1d = max(v.GetScalarRange("ControlVolumeDivergence"))
31 </variable>
32 <variable name="pressure_2d" language="python">
33import vtktools
34v = vtktools.vtu("darcy_p0p1_test_cty_cv_pressBCinlet_2d_1.vtu")
35pressure_2d = v.GetScalarRange("Pressure")
36 </variable>
37 <variable name="inter_vel_2d" language="python">
38import vtktools
39v = vtktools.vtu("darcy_p0p1_test_cty_cv_pressBCinlet_2d_1.vtu")
40inter_vel_2d = max(v.GetScalarRange("interstitial_velocity"))
41 </variable>
42 <variable name="max_div_vel_2d" language="python">
43import vtktools
44v = vtktools.vtu("darcy_p0p1_test_cty_cv_pressBCinlet_2d_1.vtu")
45max_div_vel_2d = max(v.GetScalarRange("ControlVolumeDivergence"))
46 </variable>
47 <variable name="pressure_3d" language="python">
48import vtktools
49v = vtktools.vtu("darcy_p0p1_test_cty_cv_pressBCinlet_3d_1.vtu")
50pressure_3d = v.GetScalarRange("Pressure")
51 </variable>
52 <variable name="inter_vel_3d" language="python">
53import vtktools
54v = vtktools.vtu("darcy_p0p1_test_cty_cv_pressBCinlet_3d_1.vtu")
55inter_vel_3d = max(v.GetScalarRange("interstitial_velocity"))
56 </variable>
57 <variable name="max_div_vel_3d" language="python">
58import vtktools
59v = vtktools.vtu("darcy_p0p1_test_cty_cv_pressBCinlet_3d_1.vtu")
60max_div_vel_3d = max(v.GetScalarRange("ControlVolumeDivergence"))
61 </variable>
62 </variables>
63 <pass_tests>
64 <test name="change_P for 1d should equal domain_length*visc*darcy_vel_BC/perm, check relative difference to be under tolerance 1.0e-09" language="python">
65change_P = abs(max(pressure_1d) - min(pressure_1d))
66visc = 1.0e-04
67darcy_vel_BC = 5.0
68perm = 1.0e-10
69domain_length = 300.0
70print 'Relative error of pressure difference: ',abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm))
71assert abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm)) &lt; 1.0e-09
72 </test>
73 <test name="interstitial velocity 1d should equal darcy_vel/porosity), check relative difference to be under tolerance 1.0e-09" language="python">
74analytic_vel = 10.0
75print 'Relative error of interstitial velocity: ',abs((inter_vel_1d - analytic_vel)/analytic_vel)
76assert abs((inter_vel_1d - analytic_vel)/analytic_vel) &lt; 1.0e-09
77 </test>
78 <test name="max_div_vel_1d under tolerance 1.0e-09" language="python">
79assert max_div_vel_1d &lt; 1.0e-09
80 </test>
81 <test name="change_P for 2d should equal domain_length*visc*darcy_vel_BC/perm, check relative difference to be under tolerance 1.0e-09" language="python">
82change_P = abs(max(pressure_2d) - min(pressure_2d))
83visc = 1.0e-04
84darcy_vel_BC = 5.0
85perm = 1.0e-10
86domain_length = 300.0
87print 'Relative error of pressure difference: ',abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm))
88assert abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm)) &lt; 1.0e-09
89 </test>
90 <test name="interstitial velocity 2d should equal darcy_vel/porosity), check relative difference to be under tolerance 1.0e-09" language="python">
91analytic_vel = 10.0
92print 'Relative error of interstitial velocity: ',abs((inter_vel_2d - analytic_vel)/analytic_vel)
93assert abs((inter_vel_2d - analytic_vel)/analytic_vel) &lt; 1.0e-09
94 </test>
95 <test name="max_div_vel_2d under tolerance 1.0e-09" language="python">
96assert max_div_vel_2d &lt; 1.0e-09
97 </test>
98 <test name="change_P for 3d should equal domain_length*visc*darcy_vel_BC/perm, check relative difference to be under tolerance 1.0e-09" language="python">
99change_P = abs(max(pressure_3d) - min(pressure_3d))
100visc = 1.0e-04
101darcy_vel_BC = 5.0
102perm = 1.0e-10
103domain_length = 300.0
104print 'Relative error of pressure difference: ',abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm))
105assert abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm)) &lt; 1.0e-09
106 </test>
107 <test name="interstitial velocity 3d should equal darcy_vel/porosity), check relative difference to be under tolerance 1.0e-09" language="python">
108analytic_vel = 10.0
109print 'Relative error of interstitial velocity: ',abs((inter_vel_3d - analytic_vel)/analytic_vel)
110assert abs((inter_vel_3d - analytic_vel)/analytic_vel) &lt; 1.0e-09
111 </test>
112 <test name="max_div_vel_3d under tolerance 1.0e-09" language="python">
113assert max_div_vel_3d &lt; 1.0e-09
114 </test>
115 </pass_tests>
116 <warn_tests>
117 </warn_tests>
118</testproblem>
0119
=== added file 'tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet_1d.flml'
--- tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet_1d.flml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet_1d.flml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,411 @@
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_1d</string_value>
5 <comment>a simple short test case for darcy flow using the element type p0p1 for velocity-pressure
6
7with the continuity equation tested with the control volume dual mesh
8
9the darcy velocity is solved for and the interstitial velocity is a diagnostic from this (assuming a dg solution)
10
11it compares the pressure gradient against the analytic, as well as checking that the interstitial velocity is correct
12
13the darcy flow equation is
14
15sigma*darcy_vel = - grad P
16
17sigma 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)
18
19python diagnostics are used to form the sigma term that is assoicated with a p0 dg mesh (ie. element wise) and the interstitial velocity
20
21this case has a 1 region 1 material with pressure boundary condition inflow.
22
23to 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
25the absorption term is included in the pressure correction (being a necessity as it is the only term in the matrix equation)
26
27the geometry is 1d and one time step is done (as nothing depends on time)
28
29the left and right boundary conditions of pressure are applied strongly.
30
31For 2d and 3d a second approach is also done via solving a pressure poisson equation then calculating the
32velocity diagnostically from this. This uses generic scalar and vector fields and python diagnostics.
33The latter didnt work in 1d. The same vel-press element pair is used as the mixed projection formulation.</comment>
34 </simulation_name>
35 <problem_type>
36 <string_value lines="1">fluids</string_value>
37 </problem_type>
38 <geometry>
39 <dimension>
40 <integer_value rank="0">1</integer_value>
41 </dimension>
42 <mesh name="CoordinateMesh">
43 <from_file file_name="darcy_p0p1_test_cty_cv_pressBCinlet_1d">
44 <format name="triangle"/>
45 <stat>
46 <include_in_stat/>
47 </stat>
48 </from_file>
49 </mesh>
50 <mesh name="VelocityMesh">
51 <from_mesh>
52 <mesh name="CoordinateMesh"/>
53 <mesh_shape>
54 <polynomial_degree>
55 <integer_value rank="0">0</integer_value>
56 </polynomial_degree>
57 </mesh_shape>
58 <mesh_continuity>
59 <string_value>discontinuous</string_value>
60 </mesh_continuity>
61 <stat>
62 <exclude_from_stat/>
63 </stat>
64 </from_mesh>
65 </mesh>
66 <mesh name="PressureMesh">
67 <from_mesh>
68 <mesh name="CoordinateMesh"/>
69 <mesh_shape>
70 <polynomial_degree>
71 <integer_value rank="0">1</integer_value>
72 </polynomial_degree>
73 </mesh_shape>
74 <stat>
75 <exclude_from_stat/>
76 </stat>
77 </from_mesh>
78 </mesh>
79 <mesh name="DGP0">
80 <from_mesh>
81 <mesh name="CoordinateMesh"/>
82 <mesh_shape>
83 <polynomial_degree>
84 <integer_value rank="0">0</integer_value>
85 </polynomial_degree>
86 </mesh_shape>
87 <mesh_continuity>
88 <string_value>discontinuous</string_value>
89 </mesh_continuity>
90 <stat>
91 <exclude_from_stat/>
92 </stat>
93 </from_mesh>
94 </mesh>
95 <mesh name="OutputMesh">
96 <from_mesh>
97 <mesh name="CoordinateMesh"/>
98 <mesh_continuity>
99 <string_value>discontinuous</string_value>
100 </mesh_continuity>
101 <stat>
102 <exclude_from_stat/>
103 </stat>
104 </from_mesh>
105 </mesh>
106 <quadrature>
107 <degree>
108 <integer_value rank="0">3</integer_value>
109 </degree>
110 </quadrature>
111 </geometry>
112 <io>
113 <dump_format>
114 <string_value>vtk</string_value>
115 </dump_format>
116 <dump_period_in_timesteps>
117 <constant>
118 <integer_value rank="0">0</integer_value>
119 </constant>
120 </dump_period_in_timesteps>
121 <output_mesh name="OutputMesh"/>
122 <stat/>
123 </io>
124 <timestepping>
125 <current_time>
126 <real_value rank="0">0.0</real_value>
127 </current_time>
128 <timestep>
129 <real_value rank="0">1.0</real_value>
130 </timestep>
131 <finish_time>
132 <real_value rank="0">1.0</real_value>
133 </finish_time>
134 </timestepping>
135 <material_phase name="fluid">
136 <scalar_field name="Pressure" rank="0">
137 <prognostic>
138 <mesh name="PressureMesh"/>
139 <spatial_discretisation>
140 <continuous_galerkin>
141 <test_continuity_with_cv_dual/>
142 </continuous_galerkin>
143 </spatial_discretisation>
144 <scheme>
145 <poisson_pressure_solution>
146 <string_value lines="1">never</string_value>
147 </poisson_pressure_solution>
148 <use_projection_method/>
149 </scheme>
150 <solver>
151 <iterative_method name="cg"/>
152 <preconditioner name="sor"/>
153 <relative_error>
154 <real_value rank="0">1.0e-10</real_value>
155 </relative_error>
156 <max_iterations>
157 <integer_value rank="0">1000</integer_value>
158 </max_iterations>
159 <never_ignore_solver_failures/>
160 <diagnostics>
161 <monitors/>
162 </diagnostics>
163 </solver>
164 <boundary_conditions name="right_outflow">
165 <surface_ids>
166 <integer_value shape="1" rank="1">2</integer_value>
167 </surface_ids>
168 <type name="dirichlet">
169 <constant>
170 <real_value rank="0">0.0</real_value>
171 </constant>
172 </type>
173 </boundary_conditions>
174 <boundary_conditions name="left_inflow">
175 <surface_ids>
176 <integer_value shape="1" rank="1">1</integer_value>
177 </surface_ids>
178 <type name="dirichlet">
179 <constant>
180 <real_value rank="0">1.5e+09</real_value>
181 </constant>
182 </type>
183 </boundary_conditions>
184 <output/>
185 <stat/>
186 <convergence>
187 <include_in_convergence/>
188 </convergence>
189 <detectors>
190 <exclude_from_detectors/>
191 </detectors>
192 <steady_state>
193 <include_in_steady_state/>
194 </steady_state>
195 <no_interpolation/>
196 </prognostic>
197 </scalar_field>
198 <vector_field name="Velocity" rank="1">
199 <prognostic>
200 <mesh name="VelocityMesh"/>
201 <equation name="Boussinesq"/>
202 <spatial_discretisation>
203 <discontinuous_galerkin>
204 <mass_terms>
205 <exclude_mass_terms/>
206 </mass_terms>
207 <viscosity_scheme>
208 <compact_discontinuous_galerkin/>
209 </viscosity_scheme>
210 <advection_scheme>
211 <none/>
212 <integrate_advection_by_parts>
213 <twice/>
214 </integrate_advection_by_parts>
215 </advection_scheme>
216 </discontinuous_galerkin>
217 <conservative_advection>
218 <real_value rank="0">0.0</real_value>
219 </conservative_advection>
220 </spatial_discretisation>
221 <temporal_discretisation>
222 <theta>
223 <real_value rank="0">1.0</real_value>
224 </theta>
225 <relaxation>
226 <real_value rank="0">1.0</real_value>
227 </relaxation>
228 </temporal_discretisation>
229 <solver>
230 <iterative_method name="gmres">
231 <restart>
232 <integer_value rank="0">30</integer_value>
233 </restart>
234 </iterative_method>
235 <preconditioner name="sor"/>
236 <relative_error>
237 <real_value rank="0">1.0e-10</real_value>
238 </relative_error>
239 <max_iterations>
240 <integer_value rank="0">1000</integer_value>
241 </max_iterations>
242 <never_ignore_solver_failures/>
243 <diagnostics>
244 <monitors/>
245 </diagnostics>
246 </solver>
247 <initial_condition name="WholeMesh">
248 <constant>
249 <real_value shape="1" dim1="dim" rank="1">0.0</real_value>
250 </constant>
251 </initial_condition>
252 <vector_field name="Absorption" rank="1">
253 <diagnostic>
254 <mesh name="DGP0"/>
255 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
256 <string_value lines="20" type="python"># get the prescribed fields
257perm = states["fluid"].scalar_fields["Permeability"]
258visc = states["fluid"].scalar_fields["Viscosity"]
259
260# loop the DMmesh_p0 nodes (which are element centred)
261for n in range(field.node_count):
262 perm_n = perm.node_val(n)
263 visc_n = visc.node_val(n)
264
265 # calc the absorption term
266 sigma_n = visc_n/perm_n
267
268 # set the absorption term
269 field.set(n,sigma_n)</string_value>
270 <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
271
272also assume that the velocity is dg</comment>
273 </algorithm>
274 <output/>
275 <stat>
276 <include_in_stat/>
277 </stat>
278 <convergence>
279 <include_in_convergence/>
280 </convergence>
281 <detectors>
282 <include_in_detectors/>
283 </detectors>
284 <steady_state>
285 <include_in_steady_state/>
286 </steady_state>
287 </diagnostic>
288 <include_pressure_correction/>
289 </vector_field>
290 <output/>
291 <stat>
292 <include_in_stat/>
293 <previous_time_step>
294 <exclude_from_stat/>
295 </previous_time_step>
296 <nonlinear_field>
297 <exclude_from_stat/>
298 </nonlinear_field>
299 </stat>
300 <convergence>
301 <include_in_convergence/>
302 </convergence>
303 <detectors>
304 <include_in_detectors/>
305 </detectors>
306 <steady_state>
307 <include_in_steady_state/>
308 </steady_state>
309 <consistent_interpolation/>
310 </prognostic>
311 </vector_field>
312 <scalar_field name="Porosity" rank="0">
313 <prescribed>
314 <mesh name="DGP0"/>
315 <value name="WholeMesh">
316 <constant>
317 <real_value rank="0">0.5</real_value>
318 </constant>
319 </value>
320 <output/>
321 <stat/>
322 <detectors>
323 <exclude_from_detectors/>
324 </detectors>
325 </prescribed>
326 </scalar_field>
327 <scalar_field name="Permeability" rank="0">
328 <prescribed>
329 <mesh name="DGP0"/>
330 <value name="WholeMesh">
331 <constant>
332 <real_value rank="0">1.0e-10</real_value>
333 </constant>
334 </value>
335 <output/>
336 <stat/>
337 <detectors>
338 <exclude_from_detectors/>
339 </detectors>
340 </prescribed>
341 </scalar_field>
342 <scalar_field name="Viscosity" rank="0">
343 <prescribed>
344 <mesh name="DGP0"/>
345 <value name="WholeMesh">
346 <constant>
347 <real_value rank="0">1.0e-04</real_value>
348 </constant>
349 </value>
350 <output/>
351 <stat/>
352 <detectors>
353 <exclude_from_detectors/>
354 </detectors>
355 </prescribed>
356 </scalar_field>
357 <scalar_field name="ControlVolumeDivergence" rank="0">
358 <diagnostic field_name="Velocity">
359 <algorithm name="Internal" material_phase_support="multiple"/>
360 <mesh name="PressureMesh"/>
361 <output/>
362 <stat/>
363 <convergence>
364 <include_in_convergence/>
365 </convergence>
366 <detectors>
367 <include_in_detectors/>
368 </detectors>
369 <steady_state>
370 <include_in_steady_state/>
371 </steady_state>
372 </diagnostic>
373 </scalar_field>
374 <vector_field name="interstitial_velocity" rank="1">
375 <diagnostic>
376 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
377 <string_value lines="20" type="python">phi = states["fluid"].scalar_fields["Porosity"]
378darcy_vel = states["fluid"].vector_fields["Velocity"]
379
380for ele in range(field.element_count):
381 phi_ele = phi.node_val(ele)
382
383 factor_ele = 1.0/max(phi_ele,1.0e-08)
384
385 vel_ele = []
386 for i in range(len(darcy_vel.ele_val(ele))):
387 vel_ele.append(factor_ele*darcy_vel.ele_val(ele)[i])
388
389 field.set(darcy_vel.ele_nodes(ele),vel_ele)</string_value>
390 <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
391
392also assume that the velocity is dg</comment>
393 </algorithm>
394 <mesh name="VelocityMesh"/>
395 <output/>
396 <stat>
397 <include_in_stat/>
398 </stat>
399 <convergence>
400 <include_in_convergence/>
401 </convergence>
402 <detectors>
403 <include_in_detectors/>
404 </detectors>
405 <steady_state>
406 <include_in_steady_state/>
407 </steady_state>
408 </diagnostic>
409 </vector_field>
410 </material_phase>
411</fluidity_options>
0412
=== added file 'tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet_2d.flml'
--- tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet_2d.flml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet_2d.flml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,427 @@
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 for velocity-pressure
6
7with the continuity equation tested with the control volume dual mesh
8
9the darcy velocity is solved for and the interstitial velocity is a diagnostic from this (assuming a dg solution)
10
11it compares the pressure gradient against the analytic, as well as checking that the interstitial velocity is correct
12
13the darcy flow equation is
14
15sigma*darcy_vel = - grad P
16
17sigma 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)
18
19python diagnostics are used to form the sigma term that is assoicated with a p0 dg mesh (ie. element wise) and the interstitial velocity
20
21this case has a 1 region 1 material with pressure boundary condition inflow.
22
23to 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
25the absorption term is included in the pressure correction (being a necessity as it is the only term in the matrix equation)
26
27the geometry is 2d (although this is a 1d problem) and one time step is done (as nothing depends on time)
28
29the left and right boundary conditions of pressure are applied strongly.
30
31For 2d and 3d a second approach is also done via solving a pressure poisson equation then calculating the
32velocity diagnostically from this. This uses generic scalar and vector fields and python diagnostics.
33The latter didnt work in 1d. The same vel-press element pair is used as the mixed projection formulation.</comment>
34 </simulation_name>
35 <problem_type>
36 <string_value lines="1">fluids</string_value>
37 </problem_type>
38 <geometry>
39 <dimension>
40 <integer_value rank="0">2</integer_value>
41 </dimension>
42 <mesh name="CoordinateMesh">
43 <from_file file_name="square">
44 <format name="gmsh"/>
45 <stat>
46 <include_in_stat/>
47 </stat>
48 </from_file>
49 </mesh>
50 <mesh name="VelocityMesh">
51 <from_mesh>
52 <mesh name="CoordinateMesh"/>
53 <mesh_shape>
54 <polynomial_degree>
55 <integer_value rank="0">0</integer_value>
56 </polynomial_degree>
57 </mesh_shape>
58 <mesh_continuity>
59 <string_value>discontinuous</string_value>
60 </mesh_continuity>
61 <stat>
62 <exclude_from_stat/>
63 </stat>
64 </from_mesh>
65 </mesh>
66 <mesh name="PressureMesh">
67 <from_mesh>
68 <mesh name="CoordinateMesh"/>
69 <mesh_shape>
70 <polynomial_degree>
71 <integer_value rank="0">1</integer_value>
72 </polynomial_degree>
73 </mesh_shape>
74 <stat>
75 <exclude_from_stat/>
76 </stat>
77 </from_mesh>
78 </mesh>
79 <mesh name="DGP0">
80 <from_mesh>
81 <mesh name="CoordinateMesh"/>
82 <mesh_shape>
83 <polynomial_degree>
84 <integer_value rank="0">0</integer_value>
85 </polynomial_degree>
86 </mesh_shape>
87 <mesh_continuity>
88 <string_value>discontinuous</string_value>
89 </mesh_continuity>
90 <stat>
91 <exclude_from_stat/>
92 </stat>
93 </from_mesh>
94 </mesh>
95 <mesh name="OutputMesh">
96 <from_mesh>
97 <mesh name="CoordinateMesh"/>
98 <mesh_continuity>
99 <string_value>discontinuous</string_value>
100 </mesh_continuity>
101 <stat>
102 <exclude_from_stat/>
103 </stat>
104 </from_mesh>
105 </mesh>
106 <quadrature>
107 <degree>
108 <integer_value rank="0">3</integer_value>
109 </degree>
110 </quadrature>
111 </geometry>
112 <io>
113 <dump_format>
114 <string_value>vtk</string_value>
115 </dump_format>
116 <dump_period_in_timesteps>
117 <constant>
118 <integer_value rank="0">0</integer_value>
119 </constant>
120 </dump_period_in_timesteps>
121 <output_mesh name="OutputMesh"/>
122 <stat/>
123 </io>
124 <timestepping>
125 <current_time>
126 <real_value rank="0">0.0</real_value>
127 </current_time>
128 <timestep>
129 <real_value rank="0">1.0</real_value>
130 </timestep>
131 <finish_time>
132 <real_value rank="0">1.0</real_value>
133 </finish_time>
134 </timestepping>
135 <material_phase name="fluid">
136 <scalar_field name="Pressure" rank="0">
137 <prognostic>
138 <mesh name="PressureMesh"/>
139 <spatial_discretisation>
140 <continuous_galerkin>
141 <test_continuity_with_cv_dual/>
142 </continuous_galerkin>
143 </spatial_discretisation>
144 <scheme>
145 <poisson_pressure_solution>
146 <string_value lines="1">never</string_value>
147 </poisson_pressure_solution>
148 <use_projection_method/>
149 </scheme>
150 <solver>
151 <iterative_method name="cg"/>
152 <preconditioner name="sor"/>
153 <relative_error>
154 <real_value rank="0">1.0e-10</real_value>
155 </relative_error>
156 <max_iterations>
157 <integer_value rank="0">1000</integer_value>
158 </max_iterations>
159 <never_ignore_solver_failures/>
160 <diagnostics>
161 <monitors/>
162 </diagnostics>
163 </solver>
164 <boundary_conditions name="right_outflow">
165 <surface_ids>
166 <integer_value shape="1" rank="1">8</integer_value>
167 </surface_ids>
168 <type name="dirichlet">
169 <constant>
170 <real_value rank="0">0.0</real_value>
171 </constant>
172 </type>
173 </boundary_conditions>
174 <boundary_conditions name="left_inflow">
175 <surface_ids>
176 <integer_value shape="1" rank="1">10</integer_value>
177 </surface_ids>
178 <type name="dirichlet">
179 <apply_weakly/>
180 <constant>
181 <real_value rank="0">1.5e+09</real_value>
182 </constant>
183 </type>
184 </boundary_conditions>
185 <output/>
186 <stat/>
187 <convergence>
188 <include_in_convergence/>
189 </convergence>
190 <detectors>
191 <exclude_from_detectors/>
192 </detectors>
193 <steady_state>
194 <include_in_steady_state/>
195 </steady_state>
196 <no_interpolation/>
197 </prognostic>
198 </scalar_field>
199 <vector_field name="Velocity" rank="1">
200 <prognostic>
201 <mesh name="VelocityMesh"/>
202 <equation name="Boussinesq"/>
203 <spatial_discretisation>
204 <discontinuous_galerkin>
205 <mass_terms>
206 <exclude_mass_terms/>
207 </mass_terms>
208 <viscosity_scheme>
209 <compact_discontinuous_galerkin/>
210 </viscosity_scheme>
211 <advection_scheme>
212 <none/>
213 <integrate_advection_by_parts>
214 <twice/>
215 </integrate_advection_by_parts>
216 </advection_scheme>
217 </discontinuous_galerkin>
218 <conservative_advection>
219 <real_value rank="0">0.0</real_value>
220 </conservative_advection>
221 </spatial_discretisation>
222 <temporal_discretisation>
223 <theta>
224 <real_value rank="0">1.0</real_value>
225 </theta>
226 <relaxation>
227 <real_value rank="0">1.0</real_value>
228 </relaxation>
229 </temporal_discretisation>
230 <solver>
231 <iterative_method name="gmres">
232 <restart>
233 <integer_value rank="0">30</integer_value>
234 </restart>
235 </iterative_method>
236 <preconditioner name="sor"/>
237 <relative_error>
238 <real_value rank="0">1.0e-10</real_value>
239 </relative_error>
240 <max_iterations>
241 <integer_value rank="0">1000</integer_value>
242 </max_iterations>
243 <never_ignore_solver_failures/>
244 <diagnostics>
245 <monitors/>
246 </diagnostics>
247 </solver>
248 <initial_condition name="WholeMesh">
249 <constant>
250 <real_value shape="2" dim1="dim" rank="1">0.0 0.0</real_value>
251 </constant>
252 </initial_condition>
253 <boundary_conditions name="no_outflow_top_bottom">
254 <surface_ids>
255 <integer_value shape="2" rank="1">7 9</integer_value>
256 </surface_ids>
257 <type name="dirichlet">
258 <apply_weakly/>
259 <align_bc_with_cartesian>
260 <y_component>
261 <constant>
262 <real_value rank="0">0.0</real_value>
263 </constant>
264 </y_component>
265 </align_bc_with_cartesian>
266 </type>
267 </boundary_conditions>
268 <vector_field name="Absorption" rank="1">
269 <diagnostic>
270 <mesh name="DGP0"/>
271 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
272 <string_value lines="20" type="python"># get the prescribed fields
273perm = states["fluid"].scalar_fields["Permeability"]
274visc = states["fluid"].scalar_fields["Viscosity"]
275
276# loop the DMmesh_p0 nodes (which are element centred)
277for n in range(field.node_count):
278 perm_n = perm.node_val(n)
279 visc_n = visc.node_val(n)
280
281 # calc the absorption term
282 sigma_n = visc_n/perm_n
283
284 # set the absorption term
285 field.set(n,sigma_n)</string_value>
286 <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
287
288also assume that the velocity is dg</comment>
289 </algorithm>
290 <output/>
291 <stat>
292 <include_in_stat/>
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 </diagnostic>
304 <include_pressure_correction/>
305 </vector_field>
306 <output/>
307 <stat>
308 <include_in_stat/>
309 <previous_time_step>
310 <exclude_from_stat/>
311 </previous_time_step>
312 <nonlinear_field>
313 <exclude_from_stat/>
314 </nonlinear_field>
315 </stat>
316 <convergence>
317 <include_in_convergence/>
318 </convergence>
319 <detectors>
320 <include_in_detectors/>
321 </detectors>
322 <steady_state>
323 <include_in_steady_state/>
324 </steady_state>
325 <consistent_interpolation/>
326 </prognostic>
327 </vector_field>
328 <scalar_field name="Porosity" rank="0">
329 <prescribed>
330 <mesh name="DGP0"/>
331 <value name="WholeMesh">
332 <constant>
333 <real_value rank="0">0.5</real_value>
334 </constant>
335 </value>
336 <output/>
337 <stat/>
338 <detectors>
339 <exclude_from_detectors/>
340 </detectors>
341 </prescribed>
342 </scalar_field>
343 <scalar_field name="Permeability" rank="0">
344 <prescribed>
345 <mesh name="DGP0"/>
346 <value name="WholeMesh">
347 <constant>
348 <real_value rank="0">1.0e-10</real_value>
349 </constant>
350 </value>
351 <output/>
352 <stat/>
353 <detectors>
354 <exclude_from_detectors/>
355 </detectors>
356 </prescribed>
357 </scalar_field>
358 <scalar_field name="Viscosity" rank="0">
359 <prescribed>
360 <mesh name="DGP0"/>
361 <value name="WholeMesh">
362 <constant>
363 <real_value rank="0">1.0e-04</real_value>
364 </constant>
365 </value>
366 <output/>
367 <stat/>
368 <detectors>
369 <exclude_from_detectors/>
370 </detectors>
371 </prescribed>
372 </scalar_field>
373 <scalar_field name="ControlVolumeDivergence" rank="0">
374 <diagnostic field_name="Velocity">
375 <algorithm name="Internal" material_phase_support="multiple"/>
376 <mesh name="PressureMesh"/>
377 <output/>
378 <stat/>
379 <convergence>
380 <include_in_convergence/>
381 </convergence>
382 <detectors>
383 <include_in_detectors/>
384 </detectors>
385 <steady_state>
386 <include_in_steady_state/>
387 </steady_state>
388 </diagnostic>
389 </scalar_field>
390 <vector_field name="interstitial_velocity" rank="1">
391 <diagnostic>
392 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
393 <string_value lines="20" type="python">phi = states["fluid"].scalar_fields["Porosity"]
394darcy_vel = states["fluid"].vector_fields["Velocity"]
395
396for ele in range(field.element_count):
397 phi_ele = phi.node_val(ele)
398
399 factor_ele = 1.0/max(phi_ele,1.0e-08)
400
401 vel_ele = []
402 for i in range(len(darcy_vel.ele_val(ele))):
403 vel_ele.append(factor_ele*darcy_vel.ele_val(ele)[i])
404
405 field.set(darcy_vel.ele_nodes(ele),vel_ele)</string_value>
406 <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
407
408also assume that the velocity is dg</comment>
409 </algorithm>
410 <mesh name="VelocityMesh"/>
411 <output/>
412 <stat>
413 <include_in_stat/>
414 </stat>
415 <convergence>
416 <include_in_convergence/>
417 </convergence>
418 <detectors>
419 <include_in_detectors/>
420 </detectors>
421 <steady_state>
422 <include_in_steady_state/>
423 </steady_state>
424 </diagnostic>
425 </vector_field>
426 </material_phase>
427</fluidity_options>
0428
=== added file 'tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet_3d.flml'
--- tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet_3d.flml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_pressBCinlet/darcy_p0p1_test_cty_cv_pressBCinlet_3d.flml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,442 @@
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_3d</string_value>
5 <comment>a simple short test case for darcy flow using the element type p0p1 for velocity-pressure
6
7with the continuity equation tested with the control volume dual mesh
8
9the darcy velocity is solved for and the interstitial velocity is a diagnostic from this (assuming a dg solution)
10
11it compares the pressure gradient against the analytic, as well as checking that the interstitial velocity is correct
12
13the darcy flow equation is
14
15sigma*darcy_vel = - grad P
16
17sigma 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)
18
19python diagnostics are used to form the sigma term that is assoicated with a p0 dg mesh (ie. element wise) and the interstitial velocity
20
21this case has a 1 region 1 material with pressure boundary condition inflow.
22
23to 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
25the absorption term is included in the pressure correction (being a necessity as it is the only term in the matrix equation)
26
27the geometry is 3d (although this is a 1d problem) and one time step is done (as nothing depends on time)
28
29the left and right boundary conditions of pressure are applied strongly.
30
31For 2d and 3d a second approach is also done via solving a pressure poisson equation then calculating the
32velocity diagnostically from this. This uses generic scalar and vector fields and python diagnostics.
33The latter didnt work in 1d. The same vel-press element pair is used as the mixed projection formulation.</comment>
34 </simulation_name>
35 <problem_type>
36 <string_value lines="1">fluids</string_value>
37 </problem_type>
38 <geometry>
39 <dimension>
40 <integer_value rank="0">3</integer_value>
41 </dimension>
42 <mesh name="CoordinateMesh">
43 <from_file file_name="cube">
44 <format name="gmsh"/>
45 <stat>
46 <include_in_stat/>
47 </stat>
48 </from_file>
49 </mesh>
50 <mesh name="VelocityMesh">
51 <from_mesh>
52 <mesh name="CoordinateMesh"/>
53 <mesh_shape>
54 <polynomial_degree>
55 <integer_value rank="0">0</integer_value>
56 </polynomial_degree>
57 </mesh_shape>
58 <mesh_continuity>
59 <string_value>discontinuous</string_value>
60 </mesh_continuity>
61 <stat>
62 <exclude_from_stat/>
63 </stat>
64 </from_mesh>
65 </mesh>
66 <mesh name="PressureMesh">
67 <from_mesh>
68 <mesh name="CoordinateMesh"/>
69 <mesh_shape>
70 <polynomial_degree>
71 <integer_value rank="0">1</integer_value>
72 </polynomial_degree>
73 </mesh_shape>
74 <stat>
75 <exclude_from_stat/>
76 </stat>
77 </from_mesh>
78 </mesh>
79 <mesh name="DGP0">
80 <from_mesh>
81 <mesh name="CoordinateMesh"/>
82 <mesh_shape>
83 <polynomial_degree>
84 <integer_value rank="0">0</integer_value>
85 </polynomial_degree>
86 </mesh_shape>
87 <mesh_continuity>
88 <string_value>discontinuous</string_value>
89 </mesh_continuity>
90 <stat>
91 <exclude_from_stat/>
92 </stat>
93 </from_mesh>
94 </mesh>
95 <mesh name="OutputMesh">
96 <from_mesh>
97 <mesh name="CoordinateMesh"/>
98 <mesh_continuity>
99 <string_value>discontinuous</string_value>
100 </mesh_continuity>
101 <stat>
102 <exclude_from_stat/>
103 </stat>
104 </from_mesh>
105 </mesh>
106 <quadrature>
107 <degree>
108 <integer_value rank="0">3</integer_value>
109 </degree>
110 </quadrature>
111 </geometry>
112 <io>
113 <dump_format>
114 <string_value>vtk</string_value>
115 </dump_format>
116 <dump_period_in_timesteps>
117 <constant>
118 <integer_value rank="0">0</integer_value>
119 </constant>
120 </dump_period_in_timesteps>
121 <output_mesh name="OutputMesh"/>
122 <stat/>
123 </io>
124 <timestepping>
125 <current_time>
126 <real_value rank="0">0.0</real_value>
127 </current_time>
128 <timestep>
129 <real_value rank="0">1.0</real_value>
130 </timestep>
131 <finish_time>
132 <real_value rank="0">1.0</real_value>
133 </finish_time>
134 </timestepping>
135 <material_phase name="fluid">
136 <scalar_field name="Pressure" rank="0">
137 <prognostic>
138 <mesh name="PressureMesh"/>
139 <spatial_discretisation>
140 <continuous_galerkin>
141 <test_continuity_with_cv_dual/>
142 </continuous_galerkin>
143 </spatial_discretisation>
144 <scheme>
145 <poisson_pressure_solution>
146 <string_value lines="1">never</string_value>
147 </poisson_pressure_solution>
148 <use_projection_method/>
149 </scheme>
150 <solver>
151 <iterative_method name="cg"/>
152 <preconditioner name="sor"/>
153 <relative_error>
154 <real_value rank="0">1.0e-10</real_value>
155 </relative_error>
156 <max_iterations>
157 <integer_value rank="0">1000</integer_value>
158 </max_iterations>
159 <never_ignore_solver_failures/>
160 <diagnostics>
161 <monitors/>
162 </diagnostics>
163 </solver>
164 <boundary_conditions name="right_outflow">
165 <surface_ids>
166 <integer_value shape="1" rank="1">4</integer_value>
167 </surface_ids>
168 <type name="dirichlet">
169 <constant>
170 <real_value rank="0">0.0</real_value>
171 </constant>
172 </type>
173 </boundary_conditions>
174 <boundary_conditions name="left_inflow">
175 <surface_ids>
176 <integer_value shape="1" rank="1">3</integer_value>
177 </surface_ids>
178 <type name="dirichlet">
179 <apply_weakly/>
180 <constant>
181 <real_value rank="0">1.5e+09</real_value>
182 </constant>
183 </type>
184 </boundary_conditions>
185 <output/>
186 <stat/>
187 <convergence>
188 <include_in_convergence/>
189 </convergence>
190 <detectors>
191 <exclude_from_detectors/>
192 </detectors>
193 <steady_state>
194 <include_in_steady_state/>
195 </steady_state>
196 <no_interpolation/>
197 </prognostic>
198 </scalar_field>
199 <vector_field name="Velocity" rank="1">
200 <prognostic>
201 <mesh name="VelocityMesh"/>
202 <equation name="Boussinesq"/>
203 <spatial_discretisation>
204 <discontinuous_galerkin>
205 <mass_terms>
206 <exclude_mass_terms/>
207 </mass_terms>
208 <viscosity_scheme>
209 <compact_discontinuous_galerkin/>
210 </viscosity_scheme>
211 <advection_scheme>
212 <none/>
213 <integrate_advection_by_parts>
214 <twice/>
215 </integrate_advection_by_parts>
216 </advection_scheme>
217 </discontinuous_galerkin>
218 <conservative_advection>
219 <real_value rank="0">0.0</real_value>
220 </conservative_advection>
221 </spatial_discretisation>
222 <temporal_discretisation>
223 <theta>
224 <real_value rank="0">1.0</real_value>
225 </theta>
226 <relaxation>
227 <real_value rank="0">1.0</real_value>
228 </relaxation>
229 </temporal_discretisation>
230 <solver>
231 <iterative_method name="gmres">
232 <restart>
233 <integer_value rank="0">30</integer_value>
234 </restart>
235 </iterative_method>
236 <preconditioner name="sor"/>
237 <relative_error>
238 <real_value rank="0">1.0e-10</real_value>
239 </relative_error>
240 <max_iterations>
241 <integer_value rank="0">1000</integer_value>
242 </max_iterations>
243 <never_ignore_solver_failures/>
244 <diagnostics>
245 <monitors/>
246 </diagnostics>
247 </solver>
248 <initial_condition name="WholeMesh">
249 <constant>
250 <real_value shape="3" dim1="dim" rank="1">0.0 0.0 0.0</real_value>
251 </constant>
252 </initial_condition>
253 <boundary_conditions name="no_outflow_top_bottom">
254 <surface_ids>
255 <integer_value shape="2" rank="1">1 2</integer_value>
256 </surface_ids>
257 <type name="dirichlet">
258 <apply_weakly/>
259 <align_bc_with_cartesian>
260 <z_component>
261 <constant>
262 <real_value rank="0">0.0</real_value>
263 </constant>
264 </z_component>
265 </align_bc_with_cartesian>
266 </type>
267 </boundary_conditions>
268 <boundary_conditions name="no_outflow_front_back">
269 <surface_ids>
270 <integer_value shape="2" rank="1">5 6</integer_value>
271 </surface_ids>
272 <type name="dirichlet">
273 <apply_weakly/>
274 <align_bc_with_cartesian>
275 <y_component>
276 <constant>
277 <real_value rank="0">0.0</real_value>
278 </constant>
279 </y_component>
280 </align_bc_with_cartesian>
281 </type>
282 </boundary_conditions>
283 <vector_field name="Absorption" rank="1">
284 <diagnostic>
285 <mesh name="DGP0"/>
286 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
287 <string_value lines="20" type="python"># get the prescribed fields
288perm = states["fluid"].scalar_fields["Permeability"]
289visc = states["fluid"].scalar_fields["Viscosity"]
290
291# loop the DMmesh_p0 nodes (which are element centred)
292for n in range(field.node_count):
293 perm_n = perm.node_val(n)
294 visc_n = visc.node_val(n)
295
296 # calc the absorption term
297 sigma_n = visc_n/perm_n
298
299 # set the absorption term
300 field.set(n,sigma_n)</string_value>
301 <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
302
303also assume that the velocity is dg</comment>
304 </algorithm>
305 <output/>
306 <stat>
307 <include_in_stat/>
308 </stat>
309 <convergence>
310 <include_in_convergence/>
311 </convergence>
312 <detectors>
313 <include_in_detectors/>
314 </detectors>
315 <steady_state>
316 <include_in_steady_state/>
317 </steady_state>
318 </diagnostic>
319 <include_pressure_correction/>
320 </vector_field>
321 <output/>
322 <stat>
323 <include_in_stat/>
324 <previous_time_step>
325 <exclude_from_stat/>
326 </previous_time_step>
327 <nonlinear_field>
328 <exclude_from_stat/>
329 </nonlinear_field>
330 </stat>
331 <convergence>
332 <include_in_convergence/>
333 </convergence>
334 <detectors>
335 <include_in_detectors/>
336 </detectors>
337 <steady_state>
338 <include_in_steady_state/>
339 </steady_state>
340 <consistent_interpolation/>
341 </prognostic>
342 </vector_field>
343 <scalar_field name="Porosity" rank="0">
344 <prescribed>
345 <mesh name="DGP0"/>
346 <value name="WholeMesh">
347 <constant>
348 <real_value rank="0">0.5</real_value>
349 </constant>
350 </value>
351 <output/>
352 <stat/>
353 <detectors>
354 <exclude_from_detectors/>
355 </detectors>
356 </prescribed>
357 </scalar_field>
358 <scalar_field name="Permeability" rank="0">
359 <prescribed>
360 <mesh name="DGP0"/>
361 <value name="WholeMesh">
362 <constant>
363 <real_value rank="0">1.0e-10</real_value>
364 </constant>
365 </value>
366 <output/>
367 <stat/>
368 <detectors>
369 <exclude_from_detectors/>
370 </detectors>
371 </prescribed>
372 </scalar_field>
373 <scalar_field name="Viscosity" rank="0">
374 <prescribed>
375 <mesh name="DGP0"/>
376 <value name="WholeMesh">
377 <constant>
378 <real_value rank="0">1.0e-04</real_value>
379 </constant>
380 </value>
381 <output/>
382 <stat/>
383 <detectors>
384 <exclude_from_detectors/>
385 </detectors>
386 </prescribed>
387 </scalar_field>
388 <scalar_field name="ControlVolumeDivergence" rank="0">
389 <diagnostic field_name="Velocity">
390 <algorithm name="Internal" material_phase_support="multiple"/>
391 <mesh name="PressureMesh"/>
392 <output/>
393 <stat/>
394 <convergence>
395 <include_in_convergence/>
396 </convergence>
397 <detectors>
398 <include_in_detectors/>
399 </detectors>
400 <steady_state>
401 <include_in_steady_state/>
402 </steady_state>
403 </diagnostic>
404 </scalar_field>
405 <vector_field name="interstitial_velocity" rank="1">
406 <diagnostic>
407 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
408 <string_value lines="20" type="python">phi = states["fluid"].scalar_fields["Porosity"]
409darcy_vel = states["fluid"].vector_fields["Velocity"]
410
411for ele in range(field.element_count):
412 phi_ele = phi.node_val(ele)
413
414 factor_ele = 1.0/max(phi_ele,1.0e-08)
415
416 vel_ele = []
417 for i in range(len(darcy_vel.ele_val(ele))):
418 vel_ele.append(factor_ele*darcy_vel.ele_val(ele)[i])
419
420 field.set(darcy_vel.ele_nodes(ele),vel_ele)</string_value>
421 <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
422
423also assume that the velocity is dg</comment>
424 </algorithm>
425 <mesh name="VelocityMesh"/>
426 <output/>
427 <stat>
428 <include_in_stat/>
429 </stat>
430 <convergence>
431 <include_in_convergence/>
432 </convergence>
433 <detectors>
434 <include_in_detectors/>
435 </detectors>
436 <steady_state>
437 <include_in_steady_state/>
438 </steady_state>
439 </diagnostic>
440 </vector_field>
441 </material_phase>
442</fluidity_options>
0443
=== added file 'tests/darcy_p0p1_test_cty_cv_pressBCinlet/square.geo'
--- tests/darcy_p0p1_test_cty_cv_pressBCinlet/square.geo 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_pressBCinlet/square.geo 2011-12-23 12:05:25 +0000
@@ -0,0 +1,22 @@
1// define a layer variable
2lay = 5;
3
4// define a len variable
5len = 300.0;
6
7Point(1) = {0.0, 0.0, 0.0, 1.0};
8
9Extrude {len, 0.0, 0.0} {
10 Point{1}; Layers{lay};
11}
12
13Extrude {0.0, len, 0.0} {
14 Line{1}; Layers{lay};
15}
16
17Physical Line(7) = {1};
18Physical Line(8) = {4};
19Physical Line(9) = {2};
20Physical Line(10) = {3};
21
22Physical Surface(11) = {5};
023
=== added directory 'tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain'
=== added file 'tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/Makefile'
--- tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/Makefile 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/Makefile 2011-12-23 12:05:25 +0000
@@ -0,0 +1,23 @@
1SHELL = sh
2
3input: clean
4 gmsh -2 square_rotated.geo -o square_rotated.msh
5
6clean:
7 rm -f *.ele
8 rm -f *.node
9 rm -f *.bound
10 rm -f *.edge
11 rm -f *.face
12 rm -f *.vtu
13 rm -f *.pvtu
14 rm -f *.s
15 rm -f *.stat
16 rm -f *.log-0
17 rm -f *.err-0
18 rm -f *.msh
19 rm -f *.halo
20 rm -f fluidity.err*
21 rm -f fluidity.log*
22 rm -f matrixdump*
23 rm -f first_timestep_adapted_mesh*
024
=== added file 'tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain.xml'
--- tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain.xml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain.xml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,46 @@
1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE testproblem SYSTEM "regressiontest.dtd">
3
4<testproblem>
5 <name>darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain</name>
6 <owner userid="btollit"/>
7 <tags>flml darcy</tags>
8 <problem_definition length="short" nprocs="1">
9 <command_line>
10../../bin/fluidity darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain_2d.flml
11 </command_line>
12 <!-- Two dimensional problem (actually 1d done in 2d) for darcy flow with one region and one material using p0p1_test_cty_cv element type testing the pressure gradient against analytic and the interstitial velocity. This tests using a diagnostic velocity absorption field associated with a mesh and momentum dg for darcy flow. This will use a rotated gmsh domain to test applying the weak pressure BC at a non cartesian aligned axis.-->
13 </problem_definition>
14 <variables>
15 <variable name="pressure_2d" language="python">
16import vtktools
17v = vtktools.vtu("darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain_2d_1.vtu")
18pressure_2d = v.GetScalarRange("Pressure")
19 </variable>
20 <variable name="inter_vel_2d" language="python">
21import vtktools
22v = vtktools.vtu("darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain_2d_1.vtu")
23inter_vel_2d = max(v.GetScalarRange("interstitial_velocity"))
24 </variable>
25 </variables>
26 <pass_tests>
27 <test name="change_P for 2d should equal domain_length*visc*darcy_vel_BC/perm, check relative difference to be under tolerance 1.0e-09" language="python">
28change_P = abs(max(pressure_2d) - min(pressure_2d))
29visc = 1.0e-04
30darcy_vel_BC = 5.0
31perm = 1.0e-10
32domain_length = 300.0
33print 'Relative error of pressure difference: ',abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm))
34assert abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm)) &lt; 1.0e-09
35 </test>
36 <test name="interstitial velocity 2d should equal darcy_vel/porosity, check relative difference to be under tolerance 1.0e-09" language="python">
37import math
38# the analytic velocity magnitude is 10.0, with an incline of 45 degrees (= pi/4.0 radians)
39analytic_vel = 10.0 * math.sin(math.pi/4.0)
40print 'Relative error of interstitial velocity: ',abs((inter_vel_2d - analytic_vel)/analytic_vel)
41assert abs((inter_vel_2d - analytic_vel)/analytic_vel) &lt; 1.0e-09
42 </test>
43 </pass_tests>
44 <warn_tests>
45 </warn_tests>
46</testproblem>
047
=== added file 'tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain_2d.flml'
--- tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain_2d.flml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain_2d.flml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,372 @@
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_rotated_domain_2d</string_value>
5 </simulation_name>
6 <problem_type>
7 <string_value lines="1">fluids</string_value>
8 </problem_type>
9 <geometry>
10 <dimension>
11 <integer_value rank="0">2</integer_value>
12 </dimension>
13 <mesh name="CoordinateMesh">
14 <from_file file_name="square_rotated">
15 <format name="gmsh"/>
16 <stat>
17 <include_in_stat/>
18 </stat>
19 </from_file>
20 </mesh>
21 <mesh name="VelocityMesh">
22 <from_mesh>
23 <mesh name="CoordinateMesh"/>
24 <mesh_shape>
25 <polynomial_degree>
26 <integer_value rank="0">0</integer_value>
27 </polynomial_degree>
28 </mesh_shape>
29 <mesh_continuity>
30 <string_value>discontinuous</string_value>
31 </mesh_continuity>
32 <stat>
33 <exclude_from_stat/>
34 </stat>
35 </from_mesh>
36 </mesh>
37 <mesh name="PressureMesh">
38 <from_mesh>
39 <mesh name="CoordinateMesh"/>
40 <mesh_shape>
41 <polynomial_degree>
42 <integer_value rank="0">1</integer_value>
43 </polynomial_degree>
44 </mesh_shape>
45 <stat>
46 <exclude_from_stat/>
47 </stat>
48 </from_mesh>
49 </mesh>
50 <mesh name="DGP0">
51 <from_mesh>
52 <mesh name="CoordinateMesh"/>
53 <mesh_shape>
54 <polynomial_degree>
55 <integer_value rank="0">0</integer_value>
56 </polynomial_degree>
57 </mesh_shape>
58 <mesh_continuity>
59 <string_value>discontinuous</string_value>
60 </mesh_continuity>
61 <stat>
62 <exclude_from_stat/>
63 </stat>
64 </from_mesh>
65 </mesh>
66 <mesh name="OutputMesh">
67 <from_mesh>
68 <mesh name="CoordinateMesh"/>
69 <mesh_continuity>
70 <string_value>discontinuous</string_value>
71 </mesh_continuity>
72 <stat>
73 <exclude_from_stat/>
74 </stat>
75 </from_mesh>
76 </mesh>
77 <quadrature>
78 <degree>
79 <integer_value rank="0">5</integer_value>
80 </degree>
81 </quadrature>
82 </geometry>
83 <io>
84 <dump_format>
85 <string_value>vtk</string_value>
86 </dump_format>
87 <dump_period_in_timesteps>
88 <constant>
89 <integer_value rank="0">0</integer_value>
90 </constant>
91 </dump_period_in_timesteps>
92 <output_mesh name="OutputMesh"/>
93 <stat/>
94 </io>
95 <timestepping>
96 <current_time>
97 <real_value rank="0">0.0</real_value>
98 </current_time>
99 <timestep>
100 <real_value rank="0">1.0</real_value>
101 </timestep>
102 <finish_time>
103 <real_value rank="0">1.0</real_value>
104 </finish_time>
105 </timestepping>
106 <material_phase name="fluid">
107 <scalar_field name="Pressure" rank="0">
108 <prognostic>
109 <mesh name="PressureMesh"/>
110 <spatial_discretisation>
111 <continuous_galerkin>
112 <test_continuity_with_cv_dual/>
113 </continuous_galerkin>
114 </spatial_discretisation>
115 <scheme>
116 <poisson_pressure_solution>
117 <string_value lines="1">never</string_value>
118 </poisson_pressure_solution>
119 <use_projection_method/>
120 </scheme>
121 <solver>
122 <iterative_method name="cg"/>
123 <preconditioner name="sor"/>
124 <relative_error>
125 <real_value rank="0">1.0e-10</real_value>
126 </relative_error>
127 <max_iterations>
128 <integer_value rank="0">1000</integer_value>
129 </max_iterations>
130 <never_ignore_solver_failures/>
131 <diagnostics>
132 <monitors/>
133 </diagnostics>
134 </solver>
135 <boundary_conditions name="right_outflow">
136 <surface_ids>
137 <integer_value shape="1" rank="1">8</integer_value>
138 </surface_ids>
139 <type name="dirichlet">
140 <constant>
141 <real_value rank="0">0.0</real_value>
142 </constant>
143 </type>
144 </boundary_conditions>
145 <boundary_conditions name="left_inflow">
146 <surface_ids>
147 <integer_value shape="1" rank="1">10</integer_value>
148 </surface_ids>
149 <type name="dirichlet">
150 <apply_weakly/>
151 <constant>
152 <real_value rank="0">1.5e+09</real_value>
153 </constant>
154 </type>
155 </boundary_conditions>
156 <output/>
157 <stat/>
158 <convergence>
159 <include_in_convergence/>
160 </convergence>
161 <detectors>
162 <exclude_from_detectors/>
163 </detectors>
164 <steady_state>
165 <include_in_steady_state/>
166 </steady_state>
167 <no_interpolation/>
168 </prognostic>
169 </scalar_field>
170 <vector_field name="Velocity" rank="1">
171 <prognostic>
172 <mesh name="VelocityMesh"/>
173 <equation name="Boussinesq"/>
174 <spatial_discretisation>
175 <discontinuous_galerkin>
176 <mass_terms>
177 <exclude_mass_terms/>
178 </mass_terms>
179 <viscosity_scheme>
180 <compact_discontinuous_galerkin/>
181 </viscosity_scheme>
182 <advection_scheme>
183 <none/>
184 <integrate_advection_by_parts>
185 <twice/>
186 </integrate_advection_by_parts>
187 </advection_scheme>
188 </discontinuous_galerkin>
189 <conservative_advection>
190 <real_value rank="0">0.0</real_value>
191 </conservative_advection>
192 </spatial_discretisation>
193 <temporal_discretisation>
194 <theta>
195 <real_value rank="0">1.0</real_value>
196 </theta>
197 <relaxation>
198 <real_value rank="0">1.0</real_value>
199 </relaxation>
200 </temporal_discretisation>
201 <solver>
202 <iterative_method name="gmres">
203 <restart>
204 <integer_value rank="0">30</integer_value>
205 </restart>
206 </iterative_method>
207 <preconditioner name="sor"/>
208 <relative_error>
209 <real_value rank="0">1.0e-10</real_value>
210 </relative_error>
211 <max_iterations>
212 <integer_value rank="0">1000</integer_value>
213 </max_iterations>
214 <never_ignore_solver_failures/>
215 <diagnostics>
216 <monitors/>
217 </diagnostics>
218 </solver>
219 <initial_condition name="WholeMesh">
220 <constant>
221 <real_value shape="2" dim1="dim" rank="1">0.0 0.0</real_value>
222 </constant>
223 </initial_condition>
224 <boundary_conditions name="no_outflow_top_bottom">
225 <surface_ids>
226 <integer_value shape="2" rank="1">7 9</integer_value>
227 </surface_ids>
228 <type name="no_normal_flow"/>
229 </boundary_conditions>
230 <vector_field name="Absorption" rank="1">
231 <diagnostic>
232 <mesh name="DGP0"/>
233 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
234 <string_value lines="20" type="python"># get the prescribed fields
235perm = states["fluid"].scalar_fields["Permeability"]
236visc = states["fluid"].scalar_fields["Viscosity"]
237
238# loop the DMmesh_p0 nodes (which are element centred)
239for n in range(field.node_count):
240 perm_n = perm.node_val(n)
241 visc_n = visc.node_val(n)
242
243 # calc the absorption term
244 sigma_n = visc_n/perm_n
245
246 # set the absorption term
247 field.set(n,sigma_n)</string_value>
248 <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
249
250also assume that the velocity is dg</comment>
251 </algorithm>
252 <output/>
253 <stat>
254 <include_in_stat/>
255 </stat>
256 <convergence>
257 <include_in_convergence/>
258 </convergence>
259 <detectors>
260 <include_in_detectors/>
261 </detectors>
262 <steady_state>
263 <include_in_steady_state/>
264 </steady_state>
265 </diagnostic>
266 <include_pressure_correction/>
267 </vector_field>
268 <output/>
269 <stat>
270 <include_in_stat/>
271 <previous_time_step>
272 <exclude_from_stat/>
273 </previous_time_step>
274 <nonlinear_field>
275 <exclude_from_stat/>
276 </nonlinear_field>
277 </stat>
278 <convergence>
279 <include_in_convergence/>
280 </convergence>
281 <detectors>
282 <include_in_detectors/>
283 </detectors>
284 <steady_state>
285 <include_in_steady_state/>
286 </steady_state>
287 <consistent_interpolation/>
288 </prognostic>
289 </vector_field>
290 <scalar_field name="Porosity" rank="0">
291 <prescribed>
292 <mesh name="DGP0"/>
293 <value name="WholeMesh">
294 <constant>
295 <real_value rank="0">0.5</real_value>
296 </constant>
297 </value>
298 <output/>
299 <stat/>
300 <detectors>
301 <exclude_from_detectors/>
302 </detectors>
303 </prescribed>
304 </scalar_field>
305 <scalar_field name="Permeability" rank="0">
306 <prescribed>
307 <mesh name="DGP0"/>
308 <value name="WholeMesh">
309 <constant>
310 <real_value rank="0">1.0e-10</real_value>
311 </constant>
312 </value>
313 <output/>
314 <stat/>
315 <detectors>
316 <exclude_from_detectors/>
317 </detectors>
318 </prescribed>
319 </scalar_field>
320 <scalar_field name="Viscosity" rank="0">
321 <prescribed>
322 <mesh name="DGP0"/>
323 <value name="WholeMesh">
324 <constant>
325 <real_value rank="0">1.0e-04</real_value>
326 </constant>
327 </value>
328 <output/>
329 <stat/>
330 <detectors>
331 <exclude_from_detectors/>
332 </detectors>
333 </prescribed>
334 </scalar_field>
335 <vector_field name="interstitial_velocity" rank="1">
336 <diagnostic>
337 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
338 <string_value lines="20" type="python">phi = states["fluid"].scalar_fields["Porosity"]
339darcy_vel = states["fluid"].vector_fields["Velocity"]
340
341for ele in range(field.element_count):
342 phi_ele = phi.node_val(ele)
343
344 factor_ele = 1.0/max(phi_ele,1.0e-08)
345
346 vel_ele = []
347 for i in range(len(darcy_vel.ele_val(ele))):
348 vel_ele.append(factor_ele*darcy_vel.ele_val(ele)[i])
349
350 field.set(darcy_vel.ele_nodes(ele),vel_ele)</string_value>
351 <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
352
353also assume that the velocity is dg</comment>
354 </algorithm>
355 <mesh name="VelocityMesh"/>
356 <output/>
357 <stat>
358 <include_in_stat/>
359 </stat>
360 <convergence>
361 <include_in_convergence/>
362 </convergence>
363 <detectors>
364 <include_in_detectors/>
365 </detectors>
366 <steady_state>
367 <include_in_steady_state/>
368 </steady_state>
369 </diagnostic>
370 </vector_field>
371 </material_phase>
372</fluidity_options>
0373
=== added file 'tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/square_rotated.geo'
--- tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/square_rotated.geo 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_pressBCinlet_rotated_domain/square_rotated.geo 2011-12-23 12:05:25 +0000
@@ -0,0 +1,38 @@
1// define a characteristic length
2lc = 60.0;
3
4len = 300.0;
5
6// define points
7Point(1) = {0.0,0.0,0.0,lc};
8Point(2) = {len,0.0,0.0,lc};
9Point(3) = {len,len,0.0,lc};
10Point(4) = {0.0,len,0.0,lc};
11
12// define line's
13Line(1) = {1,2};
14Line(2) = {2,3};
15Line(3) = {3,4};
16Line(4) = {4,1};
17
18// define line loop
19Line Loop(1) = {1,2,3,4};
20
21// define surface
22Plane Surface(1) = {1};
23
24// Rotate the domain about the z axis by 45 degrees (Pi/4)
25Rotate {{0, 0, 1}, {0, 0, 0}, Pi/4} {
26 Surface{1};
27}
28
29// Tag the lines and surface
30Physical Line(7) = {1};
31Physical Line(8) = {2};
32Physical Line(9) = {3};
33Physical Line(10) = {4};
34
35Physical Surface(11) = {1};
36
37// Make the grid regular
38Transfinite Surface"*";
039
=== added directory 'tests/darcy_p0p1_test_cty_cv_velBCinlet'
=== added file 'tests/darcy_p0p1_test_cty_cv_velBCinlet/Makefile'
--- tests/darcy_p0p1_test_cty_cv_velBCinlet/Makefile 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_velBCinlet/Makefile 2011-12-23 12:05:25 +0000
@@ -0,0 +1,32 @@
1SHELL = sh
2
3SIM = darcy_p0p1_test_cty_cv_velBCinlet
4
5# options for 1d mesh interval script
6MESH_SIZE = 100.0
7LEFT_X = 0.0
8RIGHT_X = 300.0
9
10input: clean
11 interval --dx=$(MESH_SIZE) $(LEFT_X) $(RIGHT_X) $(SIM)_1d
12 gmsh -2 square.geo -o square.msh
13 gmsh -3 cube.geo -o cube.msh
14
15clean:
16 rm -f *.ele
17 rm -f *.node
18 rm -f *.bound
19 rm -f *.edge
20 rm -f *.face
21 rm -f *.vtu
22 rm -f *.pvtu
23 rm -f *.s
24 rm -f *.stat
25 rm -f *.log-0
26 rm -f *.err-0
27 rm -f *.msh
28 rm -f *.halo
29 rm -f fluidity.err*
30 rm -f fluidity.log*
31 rm -f matrixdump*
32 rm -f first_timestep_adapted_mesh*
033
=== added file 'tests/darcy_p0p1_test_cty_cv_velBCinlet/cube.geo'
--- tests/darcy_p0p1_test_cty_cv_velBCinlet/cube.geo 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_velBCinlet/cube.geo 2011-12-23 12:05:25 +0000
@@ -0,0 +1,39 @@
1// define a layer variable
2lay = 5;
3
4// define a len variable
5len = 300.0;
6
7Point(1) = {0.0, 0.0, 0.0, 1.0};
8
9Extrude {len, 0.0, 0.0} {
10 Point{1}; Layers{lay};
11}
12
13Extrude {0.0, len, 0.0} {
14 Line{1}; Layers{lay};
15}
16
17Extrude {0.0, 0.0, len} {
18 Surface{5}; Layers{lay};
19}
20
21// bottom
22Physical Surface(1) = {5};
23
24// top
25Physical Surface(2) = {27};
26
27// left
28Physical Surface(3) = {26};
29
30// right
31Physical Surface(4) = {18};
32
33// front
34Physical Surface(5) = {14};
35
36// back
37Physical Surface(6) = {22};
38
39Physical Volume(1) = {1};
040
=== added file 'tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet.xml'
--- tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet.xml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet.xml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,94 @@
1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE testproblem SYSTEM "regressiontest.dtd">
3
4<testproblem>
5 <name>darcy_p0p1_test_cty_cv_velBCinlet</name>
6 <owner userid="btollit"/>
7 <tags>flml darcy</tags>
8 <problem_definition length="short" nprocs="1">
9 <command_line>
10../../bin/fluidity darcy_p0p1_test_cty_cv_velBCinlet_1d.flml
11../../bin/fluidity darcy_p0p1_test_cty_cv_velBCinlet_2d.flml
12../../bin/fluidity darcy_p0p1_test_cty_cv_velBCinlet_3d.flml
13 </command_line>
14 <!-- One/two/three dimensional problem for darcy flow with one region and one material using p0p1_test_cty_cv element type testing the pressure gradient against analytic and the interstitial velocity. This tests using a diagnostic velocity absorption field associated with a mesh and momentum dg for darcy flow-->
15 </problem_definition>
16 <variables>
17 <variable name="pressure_1d" language="python">
18import vtktools
19v = vtktools.vtu("darcy_p0p1_test_cty_cv_velBCinlet_1d_1.vtu")
20pressure_1d = v.GetScalarRange("Pressure")
21 </variable>
22 <variable name="inter_vel_1d" language="python">
23import vtktools
24v = vtktools.vtu("darcy_p0p1_test_cty_cv_velBCinlet_1d_1.vtu")
25inter_vel_1d = max(v.GetScalarRange("interstitial_velocity"))
26 </variable>
27 <variable name="pressure_2d" language="python">
28import vtktools
29v = vtktools.vtu("darcy_p0p1_test_cty_cv_velBCinlet_2d_1.vtu")
30pressure_2d = v.GetScalarRange("Pressure")
31 </variable>
32 <variable name="inter_vel_2d" language="python">
33import vtktools
34v = vtktools.vtu("darcy_p0p1_test_cty_cv_velBCinlet_2d_1.vtu")
35inter_vel_2d = max(v.GetScalarRange("interstitial_velocity"))
36 </variable>
37 <variable name="pressure_3d" language="python">
38import vtktools
39v = vtktools.vtu("darcy_p0p1_test_cty_cv_velBCinlet_3d_1.vtu")
40pressure_3d = v.GetScalarRange("Pressure")
41 </variable>
42 <variable name="inter_vel_3d" language="python">
43import vtktools
44v = vtktools.vtu("darcy_p0p1_test_cty_cv_velBCinlet_3d_1.vtu")
45inter_vel_3d = max(v.GetScalarRange("interstitial_velocity"))
46 </variable>
47 </variables>
48 <pass_tests>
49 <test name="change_P for 1d should equal domain_length*visc*darcy_vel_BC/perm, check relative difference to be under tolerance 1.0e-09" language="python">
50change_P = abs(max(pressure_1d) - min(pressure_1d))
51visc = 1.0e-04
52darcy_vel_BC = 5.0
53perm = 1.0e-10
54domain_length = 300.0
55print 'Relative error of pressure difference: ',abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm))
56assert abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm)) &lt; 1.0e-09
57 </test>
58 <test name="interstitial velocity 1d should equal darcy_vel/porosity), check relative difference to be under tolerance 1.0e-09" language="python">
59analytic_vel = 10.0
60print 'Relative error of interstitial velocity: ',abs((inter_vel_1d - analytic_vel)/analytic_vel)
61assert abs((inter_vel_1d - analytic_vel)/analytic_vel) &lt; 1.0e-09
62 </test>
63 <test name="change_P for 2d should equal domain_length*visc*darcy_vel_BC/perm, check relative difference to be under tolerance 1.0e-09" language="python">
64change_P = abs(max(pressure_2d) - min(pressure_2d))
65visc = 1.0e-04
66darcy_vel_BC = 5.0
67perm = 1.0e-10
68domain_length = 300.0
69print 'Relative error of pressure difference: ',abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm))
70assert abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm)) &lt; 1.0e-09
71 </test>
72 <test name="interstitial velocity 2d should equal darcy_vel/porosity), check relative difference to be under tolerance 1.0e-09" language="python">
73analytic_vel = 10.0
74print 'Relative error of interstitial velocity: ',abs((inter_vel_2d - analytic_vel)/analytic_vel)
75assert abs((inter_vel_2d - analytic_vel)/analytic_vel) &lt; 1.0e-09
76 </test>
77 <test name="change_P for 3d should equal domain_length*visc*darcy_vel_BC/perm, check relative difference to be under tolerance 1.0e-09" language="python">
78change_P = abs(max(pressure_3d) - min(pressure_3d))
79visc = 1.0e-04
80darcy_vel_BC = 5.0
81perm = 1.0e-10
82domain_length = 300.0
83print 'Relative error of pressure difference: ',abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm))
84assert abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm)) &lt; 1.0e-09
85 </test>
86 <test name="interstitial velocity 3d should equal darcy_vel/porosity), check relative difference to be under tolerance 1.0e-09" language="python">
87analytic_vel = 10.0
88print 'Relative error of interstitial velocity: ',abs((inter_vel_3d - analytic_vel)/analytic_vel)
89assert abs((inter_vel_3d - analytic_vel)/analytic_vel) &lt; 1.0e-09
90 </test>
91 </pass_tests>
92 <warn_tests>
93 </warn_tests>
94</testproblem>
095
=== added file 'tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet_1d.flml'
--- tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet_1d.flml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet_1d.flml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,391 @@
1<?xml version='1.0' encoding='utf-8'?>
2<fluidity_options>
3 <simulation_name>
4 <string_value lines="1">darcy_p0p1_test_cty_cv_velBCinlet_1d</string_value>
5 <comment>a simple short test case for darcy flow using the element type p0p1_test_cty_cv for velocity-pressure
6
7the darcy velocity is solved for and the interstitial velocity is a diagnostic from this (assuming a dg solution)
8
9it compares the pressure gradient against the analytic, as well as checking that the interstitial velocity is correct
10
11the darcy flow equation is
12
13sigma*darcy_vel = - grad P
14
15sigma 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
17python diagnostics are used to form the sigma term that is assoicated with a p0 dg mesh (ie. element wise) and the interstitial velocity
18
19this case has a 1 region 1 material with velocity boundary condition inflow.
20
21to 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
23the absorption term is included in the pressure correction (being a necessity as it is the only term in the matrix equation)
24
25the geometry is 1d 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">1</integer_value>
33 </dimension>
34 <mesh name="CoordinateMesh">
35 <from_file file_name="darcy_p0p1_test_cty_cv_velBCinlet_1d">
36 <format name="triangle"/>
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_shape>
46 <polynomial_degree>
47 <integer_value rank="0">0</integer_value>
48 </polynomial_degree>
49 </mesh_shape>
50 <mesh_continuity>
51 <string_value>discontinuous</string_value>
52 </mesh_continuity>
53 <stat>
54 <exclude_from_stat/>
55 </stat>
56 </from_mesh>
57 </mesh>
58 <mesh name="PressureMesh">
59 <from_mesh>
60 <mesh name="CoordinateMesh"/>
61 <mesh_shape>
62 <polynomial_degree>
63 <integer_value rank="0">1</integer_value>
64 </polynomial_degree>
65 </mesh_shape>
66 <stat>
67 <exclude_from_stat/>
68 </stat>
69 </from_mesh>
70 </mesh>
71 <mesh name="DGP0">
72 <from_mesh>
73 <mesh name="CoordinateMesh"/>
74 <mesh_shape>
75 <polynomial_degree>
76 <integer_value rank="0">0</integer_value>
77 </polynomial_degree>
78 </mesh_shape>
79 <mesh_continuity>
80 <string_value>discontinuous</string_value>
81 </mesh_continuity>
82 <stat>
83 <exclude_from_stat/>
84 </stat>
85 </from_mesh>
86 </mesh>
87 <mesh name="OutputMesh">
88 <from_mesh>
89 <mesh name="CoordinateMesh"/>
90 <mesh_continuity>
91 <string_value>discontinuous</string_value>
92 </mesh_continuity>
93 <stat>
94 <exclude_from_stat/>
95 </stat>
96 </from_mesh>
97 </mesh>
98 <quadrature>
99 <degree>
100 <integer_value rank="0">2</integer_value>
101 </degree>
102 </quadrature>
103 </geometry>
104 <io>
105 <dump_format>
106 <string_value>vtk</string_value>
107 </dump_format>
108 <dump_period_in_timesteps>
109 <constant>
110 <integer_value rank="0">0</integer_value>
111 </constant>
112 </dump_period_in_timesteps>
113 <output_mesh name="OutputMesh"/>
114 <stat/>
115 </io>
116 <timestepping>
117 <current_time>
118 <real_value rank="0">0.0</real_value>
119 </current_time>
120 <timestep>
121 <real_value rank="0">1.0</real_value>
122 </timestep>
123 <finish_time>
124 <real_value rank="0">1.0</real_value>
125 </finish_time>
126 </timestepping>
127 <material_phase name="fluid">
128 <scalar_field name="Pressure" rank="0">
129 <prognostic>
130 <mesh name="PressureMesh"/>
131 <spatial_discretisation>
132 <continuous_galerkin>
133 <test_continuity_with_cv_dual/>
134 </continuous_galerkin>
135 </spatial_discretisation>
136 <scheme>
137 <poisson_pressure_solution>
138 <string_value lines="1">never</string_value>
139 </poisson_pressure_solution>
140 <use_projection_method/>
141 </scheme>
142 <solver>
143 <iterative_method name="cg"/>
144 <preconditioner name="sor"/>
145 <relative_error>
146 <real_value rank="0">1.0e-10</real_value>
147 </relative_error>
148 <max_iterations>
149 <integer_value rank="0">1000</integer_value>
150 </max_iterations>
151 <never_ignore_solver_failures/>
152 <diagnostics>
153 <monitors/>
154 </diagnostics>
155 </solver>
156 <boundary_conditions name="right_outflow">
157 <surface_ids>
158 <integer_value shape="1" rank="1">2</integer_value>
159 </surface_ids>
160 <type name="dirichlet">
161 <constant>
162 <real_value rank="0">0.0</real_value>
163 </constant>
164 </type>
165 </boundary_conditions>
166 <output/>
167 <stat/>
168 <convergence>
169 <include_in_convergence/>
170 </convergence>
171 <detectors>
172 <exclude_from_detectors/>
173 </detectors>
174 <steady_state>
175 <include_in_steady_state/>
176 </steady_state>
177 <no_interpolation/>
178 </prognostic>
179 </scalar_field>
180 <vector_field name="Velocity" rank="1">
181 <prognostic>
182 <mesh name="VelocityMesh"/>
183 <equation name="Boussinesq"/>
184 <spatial_discretisation>
185 <discontinuous_galerkin>
186 <mass_terms>
187 <exclude_mass_terms/>
188 </mass_terms>
189 <viscosity_scheme>
190 <compact_discontinuous_galerkin/>
191 </viscosity_scheme>
192 <advection_scheme>
193 <none/>
194 <integrate_advection_by_parts>
195 <twice/>
196 </integrate_advection_by_parts>
197 </advection_scheme>
198 </discontinuous_galerkin>
199 <conservative_advection>
200 <real_value rank="0">0.0</real_value>
201 </conservative_advection>
202 </spatial_discretisation>
203 <temporal_discretisation>
204 <theta>
205 <real_value rank="0">1.0</real_value>
206 </theta>
207 <relaxation>
208 <real_value rank="0">1.0</real_value>
209 </relaxation>
210 </temporal_discretisation>
211 <solver>
212 <iterative_method name="gmres">
213 <restart>
214 <integer_value rank="0">30</integer_value>
215 </restart>
216 </iterative_method>
217 <preconditioner name="sor"/>
218 <relative_error>
219 <real_value rank="0">1.0e-10</real_value>
220 </relative_error>
221 <max_iterations>
222 <integer_value rank="0">1000</integer_value>
223 </max_iterations>
224 <never_ignore_solver_failures/>
225 <diagnostics>
226 <monitors/>
227 </diagnostics>
228 </solver>
229 <initial_condition name="WholeMesh">
230 <constant>
231 <real_value shape="1" dim1="dim" rank="1">0.0</real_value>
232 </constant>
233 </initial_condition>
234 <boundary_conditions name="left_inflow">
235 <surface_ids>
236 <integer_value shape="1" rank="1">1</integer_value>
237 </surface_ids>
238 <type name="dirichlet">
239 <apply_weakly/>
240 <align_bc_with_cartesian>
241 <x_component>
242 <constant>
243 <real_value rank="0">5.0</real_value>
244 </constant>
245 </x_component>
246 </align_bc_with_cartesian>
247 </type>
248 </boundary_conditions>
249 <vector_field name="Absorption" rank="1">
250 <diagnostic>
251 <mesh name="DGP0"/>
252 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
253 <string_value lines="20" type="python"># get the prescribed fields
254perm = states["fluid"].scalar_fields["Permeability"]
255visc = states["fluid"].scalar_fields["Viscosity"]
256
257# loop the DMmesh_p0 nodes (which are element centred)
258for n in range(field.node_count):
259 perm_n = perm.node_val(n)
260 visc_n = visc.node_val(n)
261
262 # calc the absorption term
263 sigma_n = visc_n/perm_n
264
265 # set the absorption term
266 field.set(n,sigma_n)</string_value>
267 <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
268
269also assume that the velocity is dg</comment>
270 </algorithm>
271 <output/>
272 <stat>
273 <include_in_stat/>
274 </stat>
275 <convergence>
276 <include_in_convergence/>
277 </convergence>
278 <detectors>
279 <include_in_detectors/>
280 </detectors>
281 <steady_state>
282 <include_in_steady_state/>
283 </steady_state>
284 </diagnostic>
285 <include_pressure_correction/>
286 </vector_field>
287 <output/>
288 <stat>
289 <include_in_stat/>
290 <previous_time_step>
291 <exclude_from_stat/>
292 </previous_time_step>
293 <nonlinear_field>
294 <exclude_from_stat/>
295 </nonlinear_field>
296 </stat>
297 <convergence>
298 <include_in_convergence/>
299 </convergence>
300 <detectors>
301 <include_in_detectors/>
302 </detectors>
303 <steady_state>
304 <include_in_steady_state/>
305 </steady_state>
306 <consistent_interpolation/>
307 </prognostic>
308 </vector_field>
309 <scalar_field name="Porosity" rank="0">
310 <prescribed>
311 <mesh name="DGP0"/>
312 <value name="WholeMesh">
313 <constant>
314 <real_value rank="0">0.5</real_value>
315 </constant>
316 </value>
317 <output/>
318 <stat/>
319 <detectors>
320 <exclude_from_detectors/>
321 </detectors>
322 </prescribed>
323 </scalar_field>
324 <scalar_field name="Permeability" rank="0">
325 <prescribed>
326 <mesh name="DGP0"/>
327 <value name="WholeMesh">
328 <constant>
329 <real_value rank="0">1.0e-10</real_value>
330 </constant>
331 </value>
332 <output/>
333 <stat/>
334 <detectors>
335 <exclude_from_detectors/>
336 </detectors>
337 </prescribed>
338 </scalar_field>
339 <scalar_field name="Viscosity" rank="0">
340 <prescribed>
341 <mesh name="DGP0"/>
342 <value name="WholeMesh">
343 <constant>
344 <real_value rank="0">1.0e-04</real_value>
345 </constant>
346 </value>
347 <output/>
348 <stat/>
349 <detectors>
350 <exclude_from_detectors/>
351 </detectors>
352 </prescribed>
353 </scalar_field>
354 <vector_field name="interstitial_velocity" rank="1">
355 <diagnostic>
356 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
357 <string_value lines="20" type="python">phi = states["fluid"].scalar_fields["Porosity"]
358darcy_vel = states["fluid"].vector_fields["Velocity"]
359
360for ele in range(field.element_count):
361 phi_ele = phi.node_val(ele)
362
363 factor_ele = 1.0/max(phi_ele,1.0e-08)
364
365 vel_ele = []
366 for i in range(len(darcy_vel.ele_val(ele))):
367 vel_ele.append(factor_ele*darcy_vel.ele_val(ele)[i])
368
369 field.set(darcy_vel.ele_nodes(ele),vel_ele)</string_value>
370 <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
371
372also assume that the velocity is dg</comment>
373 </algorithm>
374 <mesh name="VelocityMesh"/>
375 <output/>
376 <stat>
377 <include_in_stat/>
378 </stat>
379 <convergence>
380 <include_in_convergence/>
381 </convergence>
382 <detectors>
383 <include_in_detectors/>
384 </detectors>
385 <steady_state>
386 <include_in_steady_state/>
387 </steady_state>
388 </diagnostic>
389 </vector_field>
390 </material_phase>
391</fluidity_options>
0392
=== added file 'tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet_2d.flml'
--- tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet_2d.flml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet_2d.flml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,407 @@
1<?xml version='1.0' encoding='utf-8'?>
2<fluidity_options>
3 <simulation_name>
4 <string_value lines="1">darcy_p0p1_test_cty_cv_velBCinlet_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
7the darcy velocity is solved for and the interstitial velocity is a diagnostic from this (assuming a dg solution)
8
9it compares the pressure gradient against the analytic, as well as checking that the interstitial velocity is correct
10
11the darcy flow equation is
12
13sigma*darcy_vel = - grad P
14
15sigma 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
17python diagnostics are used to form the sigma term that is assoicated with a p0 dg mesh (ie. element wise) and the interstitial velocity
18
19this case has a 1 region 1 material with velocity boundary condition inflow.
20
21to 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
23the absorption term is included in the pressure correction (being a necessity as it is the only term in the matrix equation)
24
25the 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_shape>
46 <polynomial_degree>
47 <integer_value rank="0">0</integer_value>
48 </polynomial_degree>
49 </mesh_shape>
50 <mesh_continuity>
51 <string_value>discontinuous</string_value>
52 </mesh_continuity>
53 <stat>
54 <exclude_from_stat/>
55 </stat>
56 </from_mesh>
57 </mesh>
58 <mesh name="PressureMesh">
59 <from_mesh>
60 <mesh name="CoordinateMesh"/>
61 <mesh_shape>
62 <polynomial_degree>
63 <integer_value rank="0">1</integer_value>
64 </polynomial_degree>
65 </mesh_shape>
66 <stat>
67 <exclude_from_stat/>
68 </stat>
69 </from_mesh>
70 </mesh>
71 <mesh name="DGP0">
72 <from_mesh>
73 <mesh name="CoordinateMesh"/>
74 <mesh_shape>
75 <polynomial_degree>
76 <integer_value rank="0">0</integer_value>
77 </polynomial_degree>
78 </mesh_shape>
79 <mesh_continuity>
80 <string_value>discontinuous</string_value>
81 </mesh_continuity>
82 <stat>
83 <exclude_from_stat/>
84 </stat>
85 </from_mesh>
86 </mesh>
87 <mesh name="OutputMesh">
88 <from_mesh>
89 <mesh name="CoordinateMesh"/>
90 <mesh_continuity>
91 <string_value>discontinuous</string_value>
92 </mesh_continuity>
93 <stat>
94 <exclude_from_stat/>
95 </stat>
96 </from_mesh>
97 </mesh>
98 <quadrature>
99 <degree>
100 <integer_value rank="0">2</integer_value>
101 </degree>
102 </quadrature>
103 </geometry>
104 <io>
105 <dump_format>
106 <string_value>vtk</string_value>
107 </dump_format>
108 <dump_period_in_timesteps>
109 <constant>
110 <integer_value rank="0">0</integer_value>
111 </constant>
112 </dump_period_in_timesteps>
113 <output_mesh name="OutputMesh"/>
114 <stat/>
115 </io>
116 <timestepping>
117 <current_time>
118 <real_value rank="0">0.0</real_value>
119 </current_time>
120 <timestep>
121 <real_value rank="0">1.0</real_value>
122 </timestep>
123 <finish_time>
124 <real_value rank="0">1.0</real_value>
125 </finish_time>
126 </timestepping>
127 <material_phase name="fluid">
128 <scalar_field name="Pressure" rank="0">
129 <prognostic>
130 <mesh name="PressureMesh"/>
131 <spatial_discretisation>
132 <continuous_galerkin>
133 <test_continuity_with_cv_dual/>
134 </continuous_galerkin>
135 </spatial_discretisation>
136 <scheme>
137 <poisson_pressure_solution>
138 <string_value lines="1">never</string_value>
139 </poisson_pressure_solution>
140 <use_projection_method/>
141 </scheme>
142 <solver>
143 <iterative_method name="cg"/>
144 <preconditioner name="sor"/>
145 <relative_error>
146 <real_value rank="0">1.0e-10</real_value>
147 </relative_error>
148 <max_iterations>
149 <integer_value rank="0">1000</integer_value>
150 </max_iterations>
151 <never_ignore_solver_failures/>
152 <diagnostics>
153 <monitors/>
154 </diagnostics>
155 </solver>
156 <boundary_conditions name="right_outflow">
157 <surface_ids>
158 <integer_value shape="1" rank="1">8</integer_value>
159 </surface_ids>
160 <type name="dirichlet">
161 <apply_weakly/>
162 <constant>
163 <real_value rank="0">0.0</real_value>
164 </constant>
165 </type>
166 </boundary_conditions>
167 <output/>
168 <stat/>
169 <convergence>
170 <include_in_convergence/>
171 </convergence>
172 <detectors>
173 <exclude_from_detectors/>
174 </detectors>
175 <steady_state>
176 <include_in_steady_state/>
177 </steady_state>
178 <no_interpolation/>
179 </prognostic>
180 </scalar_field>
181 <vector_field name="Velocity" rank="1">
182 <prognostic>
183 <mesh name="VelocityMesh"/>
184 <equation name="Boussinesq"/>
185 <spatial_discretisation>
186 <discontinuous_galerkin>
187 <mass_terms>
188 <exclude_mass_terms/>
189 </mass_terms>
190 <viscosity_scheme>
191 <compact_discontinuous_galerkin/>
192 </viscosity_scheme>
193 <advection_scheme>
194 <none/>
195 <integrate_advection_by_parts>
196 <twice/>
197 </integrate_advection_by_parts>
198 </advection_scheme>
199 </discontinuous_galerkin>
200 <conservative_advection>
201 <real_value rank="0">0.0</real_value>
202 </conservative_advection>
203 </spatial_discretisation>
204 <temporal_discretisation>
205 <theta>
206 <real_value rank="0">1.0</real_value>
207 </theta>
208 <relaxation>
209 <real_value rank="0">1.0</real_value>
210 </relaxation>
211 </temporal_discretisation>
212 <solver>
213 <iterative_method name="gmres">
214 <restart>
215 <integer_value rank="0">30</integer_value>
216 </restart>
217 </iterative_method>
218 <preconditioner name="sor"/>
219 <relative_error>
220 <real_value rank="0">1.0e-10</real_value>
221 </relative_error>
222 <max_iterations>
223 <integer_value rank="0">1000</integer_value>
224 </max_iterations>
225 <never_ignore_solver_failures/>
226 <diagnostics>
227 <monitors/>
228 </diagnostics>
229 </solver>
230 <initial_condition name="WholeMesh">
231 <constant>
232 <real_value shape="2" dim1="dim" rank="1">0.0 0.0</real_value>
233 </constant>
234 </initial_condition>
235 <boundary_conditions name="left_inflow">
236 <surface_ids>
237 <integer_value shape="1" rank="1">10</integer_value>
238 </surface_ids>
239 <type name="dirichlet">
240 <apply_weakly/>
241 <align_bc_with_cartesian>
242 <x_component>
243 <constant>
244 <real_value rank="0">5.0</real_value>
245 </constant>
246 </x_component>
247 </align_bc_with_cartesian>
248 </type>
249 </boundary_conditions>
250 <boundary_conditions name="no_outflow_top_bottom">
251 <surface_ids>
252 <integer_value shape="2" rank="1">7 9</integer_value>
253 </surface_ids>
254 <type name="dirichlet">
255 <apply_weakly/>
256 <align_bc_with_cartesian>
257 <y_component>
258 <constant>
259 <real_value rank="0">0.0</real_value>
260 </constant>
261 </y_component>
262 </align_bc_with_cartesian>
263 </type>
264 </boundary_conditions>
265 <vector_field name="Absorption" rank="1">
266 <diagnostic>
267 <mesh name="DGP0"/>
268 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
269 <string_value lines="20" type="python"># get the prescribed fields
270perm = states["fluid"].scalar_fields["Permeability"]
271visc = states["fluid"].scalar_fields["Viscosity"]
272
273# loop the DMmesh_p0 nodes (which are element centred)
274for n in range(field.node_count):
275 perm_n = perm.node_val(n)
276 visc_n = visc.node_val(n)
277
278 # calc the absorption term
279 sigma_n = visc_n/perm_n
280
281 # set the absorption term
282 field.set(n,sigma_n)</string_value>
283 <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
284
285also assume that the velocity is dg</comment>
286 </algorithm>
287 <output/>
288 <stat>
289 <include_in_stat/>
290 </stat>
291 <convergence>
292 <include_in_convergence/>
293 </convergence>
294 <detectors>
295 <include_in_detectors/>
296 </detectors>
297 <steady_state>
298 <include_in_steady_state/>
299 </steady_state>
300 </diagnostic>
301 <include_pressure_correction/>
302 </vector_field>
303 <output/>
304 <stat>
305 <include_in_stat/>
306 <previous_time_step>
307 <exclude_from_stat/>
308 </previous_time_step>
309 <nonlinear_field>
310 <exclude_from_stat/>
311 </nonlinear_field>
312 </stat>
313 <convergence>
314 <include_in_convergence/>
315 </convergence>
316 <detectors>
317 <include_in_detectors/>
318 </detectors>
319 <steady_state>
320 <include_in_steady_state/>
321 </steady_state>
322 <consistent_interpolation/>
323 </prognostic>
324 </vector_field>
325 <scalar_field name="Porosity" rank="0">
326 <prescribed>
327 <mesh name="DGP0"/>
328 <value name="WholeMesh">
329 <constant>
330 <real_value rank="0">0.5</real_value>
331 </constant>
332 </value>
333 <output/>
334 <stat/>
335 <detectors>
336 <exclude_from_detectors/>
337 </detectors>
338 </prescribed>
339 </scalar_field>
340 <scalar_field name="Permeability" rank="0">
341 <prescribed>
342 <mesh name="DGP0"/>
343 <value name="WholeMesh">
344 <constant>
345 <real_value rank="0">1.0e-10</real_value>
346 </constant>
347 </value>
348 <output/>
349 <stat/>
350 <detectors>
351 <exclude_from_detectors/>
352 </detectors>
353 </prescribed>
354 </scalar_field>
355 <scalar_field name="Viscosity" rank="0">
356 <prescribed>
357 <mesh name="DGP0"/>
358 <value name="WholeMesh">
359 <constant>
360 <real_value rank="0">1.0e-04</real_value>
361 </constant>
362 </value>
363 <output/>
364 <stat/>
365 <detectors>
366 <exclude_from_detectors/>
367 </detectors>
368 </prescribed>
369 </scalar_field>
370 <vector_field name="interstitial_velocity" rank="1">
371 <diagnostic>
372 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
373 <string_value lines="20" type="python">phi = states["fluid"].scalar_fields["Porosity"]
374darcy_vel = states["fluid"].vector_fields["Velocity"]
375
376for ele in range(field.element_count):
377 phi_ele = phi.node_val(ele)
378
379 factor_ele = 1.0/max(phi_ele,1.0e-08)
380
381 vel_ele = []
382 for i in range(len(darcy_vel.ele_val(ele))):
383 vel_ele.append(factor_ele*darcy_vel.ele_val(ele)[i])
384
385 field.set(darcy_vel.ele_nodes(ele),vel_ele)</string_value>
386 <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
387
388also assume that the velocity is dg</comment>
389 </algorithm>
390 <mesh name="VelocityMesh"/>
391 <output/>
392 <stat>
393 <include_in_stat/>
394 </stat>
395 <convergence>
396 <include_in_convergence/>
397 </convergence>
398 <detectors>
399 <include_in_detectors/>
400 </detectors>
401 <steady_state>
402 <include_in_steady_state/>
403 </steady_state>
404 </diagnostic>
405 </vector_field>
406 </material_phase>
407</fluidity_options>
0408
=== added file 'tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet_3d.flml'
--- tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet_3d.flml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_velBCinlet/darcy_p0p1_test_cty_cv_velBCinlet_3d.flml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,404 @@
1<?xml version='1.0' encoding='utf-8'?>
2<fluidity_options>
3 <simulation_name>
4 <string_value lines="1">darcy_p0p1_test_cty_cv_velBCinlet_3d</string_value>
5 <comment>a simple short test case for darcy flow using the element type p0p1_test_cty_cv for velocity-pressure
6
7the darcy velocity is solved for and the interstitial velocity is a diagnostic from this (assuming a dg solution)
8
9it compares the pressure gradient against the analytic, as well as checking that the interstitial velocity is correct
10
11the darcy flow equation is
12
13sigma*darcy_vel = - grad P
14
15sigma 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
17python diagnostics are used to form the sigma term that is assoicated with a p0 dg mesh (ie. element wise) and the interstitial velocity
18
19this case has a 1 region 1 material with velocity boundary condition inflow.
20
21to 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
23the absorption term is included in the pressure correction (being a necessity as it is the only term in the matrix equation)
24
25the geometry is 3d (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">3</integer_value>
33 </dimension>
34 <mesh name="CoordinateMesh">
35 <from_file file_name="cube">
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_shape>
46 <polynomial_degree>
47 <integer_value rank="0">0</integer_value>
48 </polynomial_degree>
49 </mesh_shape>
50 <mesh_continuity>
51 <string_value>discontinuous</string_value>
52 </mesh_continuity>
53 <stat>
54 <exclude_from_stat/>
55 </stat>
56 </from_mesh>
57 </mesh>
58 <mesh name="PressureMesh">
59 <from_mesh>
60 <mesh name="CoordinateMesh"/>
61 <mesh_shape>
62 <polynomial_degree>
63 <integer_value rank="0">1</integer_value>
64 </polynomial_degree>
65 </mesh_shape>
66 <stat>
67 <exclude_from_stat/>
68 </stat>
69 </from_mesh>
70 </mesh>
71 <mesh name="DGP0">
72 <from_mesh>
73 <mesh name="CoordinateMesh"/>
74 <mesh_shape>
75 <polynomial_degree>
76 <integer_value rank="0">0</integer_value>
77 </polynomial_degree>
78 </mesh_shape>
79 <mesh_continuity>
80 <string_value>discontinuous</string_value>
81 </mesh_continuity>
82 <stat>
83 <exclude_from_stat/>
84 </stat>
85 </from_mesh>
86 </mesh>
87 <mesh name="OutputMesh">
88 <from_mesh>
89 <mesh name="CoordinateMesh"/>
90 <mesh_continuity>
91 <string_value>discontinuous</string_value>
92 </mesh_continuity>
93 <stat>
94 <exclude_from_stat/>
95 </stat>
96 </from_mesh>
97 </mesh>
98 <quadrature>
99 <degree>
100 <integer_value rank="0">2</integer_value>
101 </degree>
102 </quadrature>
103 </geometry>
104 <io>
105 <dump_format>
106 <string_value>vtk</string_value>
107 </dump_format>
108 <dump_period_in_timesteps>
109 <constant>
110 <integer_value rank="0">0</integer_value>
111 </constant>
112 </dump_period_in_timesteps>
113 <output_mesh name="OutputMesh"/>
114 <stat/>
115 </io>
116 <timestepping>
117 <current_time>
118 <real_value rank="0">0.0</real_value>
119 </current_time>
120 <timestep>
121 <real_value rank="0">1.0</real_value>
122 </timestep>
123 <finish_time>
124 <real_value rank="0">1.0</real_value>
125 </finish_time>
126 </timestepping>
127 <material_phase name="fluid">
128 <scalar_field name="Pressure" rank="0">
129 <prognostic>
130 <mesh name="PressureMesh"/>
131 <spatial_discretisation>
132 <continuous_galerkin>
133 <test_continuity_with_cv_dual/>
134 </continuous_galerkin>
135 </spatial_discretisation>
136 <scheme>
137 <poisson_pressure_solution>
138 <string_value lines="1">never</string_value>
139 </poisson_pressure_solution>
140 <use_projection_method/>
141 </scheme>
142 <solver>
143 <iterative_method name="cg"/>
144 <preconditioner name="sor"/>
145 <relative_error>
146 <real_value rank="0">1.0e-10</real_value>
147 </relative_error>
148 <max_iterations>
149 <integer_value rank="0">1000</integer_value>
150 </max_iterations>
151 <never_ignore_solver_failures/>
152 <diagnostics>
153 <monitors/>
154 </diagnostics>
155 </solver>
156 <boundary_conditions name="right_outflow">
157 <surface_ids>
158 <integer_value shape="1" rank="1">4</integer_value>
159 </surface_ids>
160 <type name="dirichlet">
161 <apply_weakly/>
162 <constant>
163 <real_value rank="0">0.0</real_value>
164 </constant>
165 </type>
166 </boundary_conditions>
167 <output/>
168 <stat/>
169 <convergence>
170 <include_in_convergence/>
171 </convergence>
172 <detectors>
173 <exclude_from_detectors/>
174 </detectors>
175 <steady_state>
176 <include_in_steady_state/>
177 </steady_state>
178 <no_interpolation/>
179 </prognostic>
180 </scalar_field>
181 <vector_field name="Velocity" rank="1">
182 <prognostic>
183 <mesh name="VelocityMesh"/>
184 <equation name="Boussinesq"/>
185 <spatial_discretisation>
186 <discontinuous_galerkin>
187 <mass_terms>
188 <exclude_mass_terms/>
189 </mass_terms>
190 <viscosity_scheme>
191 <compact_discontinuous_galerkin/>
192 </viscosity_scheme>
193 <advection_scheme>
194 <none/>
195 <integrate_advection_by_parts>
196 <twice/>
197 </integrate_advection_by_parts>
198 </advection_scheme>
199 </discontinuous_galerkin>
200 <conservative_advection>
201 <real_value rank="0">0.0</real_value>
202 </conservative_advection>
203 </spatial_discretisation>
204 <temporal_discretisation>
205 <theta>
206 <real_value rank="0">1.0</real_value>
207 </theta>
208 <relaxation>
209 <real_value rank="0">1.0</real_value>
210 </relaxation>
211 </temporal_discretisation>
212 <solver>
213 <iterative_method name="gmres">
214 <restart>
215 <integer_value rank="0">30</integer_value>
216 </restart>
217 </iterative_method>
218 <preconditioner name="sor"/>
219 <relative_error>
220 <real_value rank="0">1.0e-10</real_value>
221 </relative_error>
222 <max_iterations>
223 <integer_value rank="0">1000</integer_value>
224 </max_iterations>
225 <never_ignore_solver_failures/>
226 <diagnostics>
227 <monitors/>
228 </diagnostics>
229 </solver>
230 <initial_condition name="WholeMesh">
231 <constant>
232 <real_value shape="3" dim1="dim" rank="1">0.0 0.0 0.0</real_value>
233 </constant>
234 </initial_condition>
235 <boundary_conditions name="left_inflow">
236 <surface_ids>
237 <integer_value shape="1" rank="1">3</integer_value>
238 </surface_ids>
239 <type name="dirichlet">
240 <apply_weakly/>
241 <align_bc_with_cartesian>
242 <x_component>
243 <constant>
244 <real_value rank="0">5.0</real_value>
245 </constant>
246 </x_component>
247 </align_bc_with_cartesian>
248 </type>
249 </boundary_conditions>
250 <boundary_conditions name="no_outflow_top_bottom">
251 <surface_ids>
252 <integer_value shape="2" rank="1">1 2</integer_value>
253 </surface_ids>
254 <type name="no_normal_flow"/>
255 </boundary_conditions>
256 <boundary_conditions name="no_outflow_front_back">
257 <surface_ids>
258 <integer_value shape="2" rank="1">5 6</integer_value>
259 </surface_ids>
260 <type name="no_normal_flow"/>
261 </boundary_conditions>
262 <vector_field name="Absorption" rank="1">
263 <diagnostic>
264 <mesh name="DGP0"/>
265 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
266 <string_value lines="20" type="python"># get the prescribed fields
267perm = states["fluid"].scalar_fields["Permeability"]
268visc = states["fluid"].scalar_fields["Viscosity"]
269
270# loop the DMmesh_p0 nodes (which are element centred)
271for n in range(field.node_count):
272 perm_n = perm.node_val(n)
273 visc_n = visc.node_val(n)
274
275 # calc the absorption term
276 sigma_n = visc_n/perm_n
277
278 # set the absorption term
279 field.set(n,sigma_n)</string_value>
280 <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
281
282also assume that the velocity is dg</comment>
283 </algorithm>
284 <output/>
285 <stat>
286 <include_in_stat/>
287 </stat>
288 <convergence>
289 <include_in_convergence/>
290 </convergence>
291 <detectors>
292 <include_in_detectors/>
293 </detectors>
294 <steady_state>
295 <include_in_steady_state/>
296 </steady_state>
297 </diagnostic>
298 <include_pressure_correction/>
299 </vector_field>
300 <output/>
301 <stat>
302 <include_in_stat/>
303 <previous_time_step>
304 <exclude_from_stat/>
305 </previous_time_step>
306 <nonlinear_field>
307 <exclude_from_stat/>
308 </nonlinear_field>
309 </stat>
310 <convergence>
311 <include_in_convergence/>
312 </convergence>
313 <detectors>
314 <include_in_detectors/>
315 </detectors>
316 <steady_state>
317 <include_in_steady_state/>
318 </steady_state>
319 <consistent_interpolation/>
320 </prognostic>
321 </vector_field>
322 <scalar_field name="Porosity" rank="0">
323 <prescribed>
324 <mesh name="DGP0"/>
325 <value name="WholeMesh">
326 <constant>
327 <real_value rank="0">0.5</real_value>
328 </constant>
329 </value>
330 <output/>
331 <stat/>
332 <detectors>
333 <exclude_from_detectors/>
334 </detectors>
335 </prescribed>
336 </scalar_field>
337 <scalar_field name="Permeability" rank="0">
338 <prescribed>
339 <mesh name="DGP0"/>
340 <value name="WholeMesh">
341 <constant>
342 <real_value rank="0">1.0e-10</real_value>
343 </constant>
344 </value>
345 <output/>
346 <stat/>
347 <detectors>
348 <exclude_from_detectors/>
349 </detectors>
350 </prescribed>
351 </scalar_field>
352 <scalar_field name="Viscosity" rank="0">
353 <prescribed>
354 <mesh name="DGP0"/>
355 <value name="WholeMesh">
356 <constant>
357 <real_value rank="0">1.0e-04</real_value>
358 </constant>
359 </value>
360 <output/>
361 <stat/>
362 <detectors>
363 <exclude_from_detectors/>
364 </detectors>
365 </prescribed>
366 </scalar_field>
367 <vector_field name="interstitial_velocity" rank="1">
368 <diagnostic>
369 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
370 <string_value lines="20" type="python">phi = states["fluid"].scalar_fields["Porosity"]
371darcy_vel = states["fluid"].vector_fields["Velocity"]
372
373for ele in range(field.element_count):
374 phi_ele = phi.node_val(ele)
375
376 factor_ele = 1.0/max(phi_ele,1.0e-08)
377
378 vel_ele = []
379 for i in range(len(darcy_vel.ele_val(ele))):
380 vel_ele.append(factor_ele*darcy_vel.ele_val(ele)[i])
381
382 field.set(darcy_vel.ele_nodes(ele),vel_ele)</string_value>
383 <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
384
385also assume that the velocity is dg</comment>
386 </algorithm>
387 <mesh name="VelocityMesh"/>
388 <output/>
389 <stat>
390 <include_in_stat/>
391 </stat>
392 <convergence>
393 <include_in_convergence/>
394 </convergence>
395 <detectors>
396 <include_in_detectors/>
397 </detectors>
398 <steady_state>
399 <include_in_steady_state/>
400 </steady_state>
401 </diagnostic>
402 </vector_field>
403 </material_phase>
404</fluidity_options>
0405
=== added file 'tests/darcy_p0p1_test_cty_cv_velBCinlet/square.geo'
--- tests/darcy_p0p1_test_cty_cv_velBCinlet/square.geo 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1_test_cty_cv_velBCinlet/square.geo 2011-12-23 12:05:25 +0000
@@ -0,0 +1,22 @@
1// define a layer variable
2lay = 5;
3
4// define a len variable
5len = 300.0;
6
7Point(1) = {0.0, 0.0, 0.0, 1.0};
8
9Extrude {len, 0.0, 0.0} {
10 Point{1}; Layers{lay};
11}
12
13Extrude {0.0, len, 0.0} {
14 Line{1}; Layers{lay};
15}
16
17Physical Line(7) = {1};
18Physical Line(8) = {4};
19Physical Line(9) = {2};
20Physical Line(10) = {3};
21
22Physical Surface(11) = {5};
023
=== added directory 'tests/darcy_p0p1cv_pressBCinlet'
=== added file 'tests/darcy_p0p1cv_pressBCinlet/Makefile'
--- tests/darcy_p0p1cv_pressBCinlet/Makefile 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1cv_pressBCinlet/Makefile 2011-12-23 12:05:25 +0000
@@ -0,0 +1,32 @@
1SHELL = sh
2
3SIM = darcy_p0p1cv_pressBCinlet
4
5# options for 1d mesh interval script
6MESH_SIZE = 100.0
7LEFT_X = 0.0
8RIGHT_X = 300.0
9
10input: clean
11 interval --dx=$(MESH_SIZE) $(LEFT_X) $(RIGHT_X) $(SIM)_1d
12 gmsh -2 square.geo -o square.msh
13 gmsh -3 cube.geo -o cube.msh
14
15clean:
16 rm -f *.ele
17 rm -f *.node
18 rm -f *.bound
19 rm -f *.edge
20 rm -f *.face
21 rm -f *.vtu
22 rm -f *.pvtu
23 rm -f *.s
24 rm -f *.stat
25 rm -f *.log-0
26 rm -f *.err-0
27 rm -f *.msh
28 rm -f *.halo
29 rm -f fluidity.err*
30 rm -f fluidity.log*
31 rm -f matrixdump*
32 rm -f first_timestep_adapted_mesh*
033
=== added file 'tests/darcy_p0p1cv_pressBCinlet/cube.geo'
--- tests/darcy_p0p1cv_pressBCinlet/cube.geo 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1cv_pressBCinlet/cube.geo 2011-12-23 12:05:25 +0000
@@ -0,0 +1,39 @@
1// define a layer variable
2lay = 5;
3
4// define a len variable
5len = 300.0;
6
7Point(1) = {0.0, 0.0, 0.0, 1.0};
8
9Extrude {len, 0.0, 0.0} {
10 Point{1}; Layers{lay};
11}
12
13Extrude {0.0, len, 0.0} {
14 Line{1}; Layers{lay};
15}
16
17Extrude {0.0, 0.0, len} {
18 Surface{5}; Layers{lay};
19}
20
21// bottom
22Physical Surface(1) = {5};
23
24// top
25Physical Surface(2) = {27};
26
27// left
28Physical Surface(3) = {26};
29
30// right
31Physical Surface(4) = {18};
32
33// front
34Physical Surface(5) = {14};
35
36// back
37Physical Surface(6) = {22};
38
39Physical Volume(1) = {1};
040
=== added file 'tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet.xml'
--- tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet.xml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet.xml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,94 @@
1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE testproblem SYSTEM "regressiontest.dtd">
3
4<testproblem>
5 <name>darcy_p0p1cv_pressBCinlet</name>
6 <owner userid="btollit"/>
7 <tags>flml darcy</tags>
8 <problem_definition length="short" nprocs="1">
9 <command_line>
10../../bin/fluidity darcy_p0p1cv_pressBCinlet_1d.flml
11../../bin/fluidity darcy_p0p1cv_pressBCinlet_2d.flml
12../../bin/fluidity darcy_p0p1cv_pressBCinlet_3d.flml
13 </command_line>
14 <!-- One/two/three dimensional problem for darcy flow with one region and one material using p0p1cv element type testing the pressure gradient against analytic and the interstitial velocity. This tests using a diagnostic velocity absorption field associated with a mesh and momentum dg for darcy flow. This also tests the use of pressure BC for CV pressure.-->
15 </problem_definition>
16 <variables>
17 <variable name="pressure_1d" language="python">
18import vtktools
19v = vtktools.vtu("darcy_p0p1cv_pressBCinlet_1d_1.vtu")
20pressure_1d = v.GetScalarRange("Pressure")
21 </variable>
22 <variable name="inter_vel_1d" language="python">
23import vtktools
24v = vtktools.vtu("darcy_p0p1cv_pressBCinlet_1d_1.vtu")
25inter_vel_1d = max(v.GetScalarRange("interstitial_velocity"))
26 </variable>
27 <variable name="pressure_2d" language="python">
28import vtktools
29v = vtktools.vtu("darcy_p0p1cv_pressBCinlet_2d_1.vtu")
30pressure_2d = v.GetScalarRange("Pressure")
31 </variable>
32 <variable name="inter_vel_2d" language="python">
33import vtktools
34v = vtktools.vtu("darcy_p0p1cv_pressBCinlet_2d_1.vtu")
35inter_vel_2d = max(v.GetScalarRange("interstitial_velocity"))
36 </variable>
37 <variable name="pressure_3d" language="python">
38import vtktools
39v = vtktools.vtu("darcy_p0p1cv_pressBCinlet_3d_1.vtu")
40pressure_3d = v.GetScalarRange("Pressure")
41 </variable>
42 <variable name="inter_vel_3d" language="python">
43import vtktools
44v = vtktools.vtu("darcy_p0p1cv_pressBCinlet_3d_1.vtu")
45inter_vel_3d = max(v.GetScalarRange("interstitial_velocity"))
46 </variable>
47 </variables>
48 <pass_tests>
49 <test name="change_P for 1d should equal domain_length*visc*darcy_vel_BC/perm, check relative difference to be under tolerance 1.0e-09" language="python">
50change_P = abs(max(pressure_1d) - min(pressure_1d))
51visc = 1.0e-04
52darcy_vel_BC = 5.0
53perm = 1.0e-10
54domain_length = 300.0
55print 'Relative error of pressure difference: ',abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm))
56assert abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm)) &lt; 1.0e-09
57 </test>
58 <test name="interstitial velocity 1d should equal darcy_vel/porosity, check relative difference to be under tolerance 1.0e-09" language="python">
59analytic_vel = 10.0
60print 'Relative error of interstitial velocity: ',abs((inter_vel_1d - analytic_vel)/analytic_vel)
61assert abs((inter_vel_1d - analytic_vel)/analytic_vel) &lt; 1.0e-09
62 </test>
63 <test name="change_P for 2d should equal domain_length*visc*darcy_vel_BC/perm, check relative difference to be under tolerance 1.0e-09" language="python">
64change_P = abs(max(pressure_2d) - min(pressure_2d))
65visc = 1.0e-04
66darcy_vel_BC = 5.0
67perm = 1.0e-10
68domain_length = 300.0
69print 'Relative error of pressure difference: ',abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm))
70assert abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm)) &lt; 1.0e-09
71 </test>
72 <test name="interstitial velocity 2d should equal darcy_vel/porosity, check relative difference to be under tolerance 1.0e-09" language="python">
73analytic_vel = 10.0
74print 'Relative error of interstitial velocity: ',abs((inter_vel_2d - analytic_vel)/analytic_vel)
75assert abs((inter_vel_2d - analytic_vel)/analytic_vel) &lt; 1.0e-09
76 </test>
77 <test name="change_P for 3d should equal domain_length*visc*darcy_vel_BC/perm, check relative difference to be under tolerance 1.0e-09" language="python">
78change_P = abs(max(pressure_3d) - min(pressure_3d))
79visc = 1.0e-04
80darcy_vel_BC = 5.0
81perm = 1.0e-10
82domain_length = 300.0
83print 'Relative error of pressure difference: ',abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm))
84assert abs((change_P - domain_length*visc*darcy_vel_BC/perm)/(domain_length*visc*darcy_vel_BC/perm)) &lt; 1.0e-09
85 </test>
86 <test name="interstitial velocity 3d should equal darcy_vel/porosity, check relative difference to be under tolerance 1.0e-09" language="python">
87analytic_vel = 10.0
88print 'Relative error of interstitial velocity: ',abs((inter_vel_3d - analytic_vel)/analytic_vel)
89assert abs((inter_vel_3d - analytic_vel)/analytic_vel) &lt; 1.0e-09
90 </test>
91 </pass_tests>
92 <warn_tests>
93 </warn_tests>
94</testproblem>
095
=== added file 'tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet_1d.flml'
--- tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet_1d.flml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet_1d.flml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,384 @@
1<?xml version='1.0' encoding='utf-8'?>
2<fluidity_options>
3 <simulation_name>
4 <string_value lines="1">darcy_p0p1cv_pressBCinlet_1d</string_value>
5 <comment>a simple short test case for darcy flow using the element type p0p1cv for velocity-pressure
6
7the darcy velocity is solved for and the interstitial velocity is a diagnostic from this (assuming a dg solution)
8
9it compares the pressure gradient against the analytic, as well as checking that the interstitial velocity is correct
10
11the darcy flow equation is
12
13sigma*darcy_vel = - grad P
14
15sigma 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
17python diagnostics are used to form the sigma term that is assoicated with a p0 dg mesh (ie. element wise) and the interstitial velocity
18
19this case has a 1 region 1 material with pressure boundary condition inflow.
20
21to 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
23the absorption term is included in the pressure correction (being a necessity as it is the only term in the matrix equation)
24
25the geometry is 1d 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">1</integer_value>
33 </dimension>
34 <mesh name="CoordinateMesh">
35 <from_file file_name="darcy_p0p1cv_pressBCinlet_1d">
36 <format name="triangle"/>
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_shape>
46 <polynomial_degree>
47 <integer_value rank="0">0</integer_value>
48 </polynomial_degree>
49 </mesh_shape>
50 <mesh_continuity>
51 <string_value>discontinuous</string_value>
52 </mesh_continuity>
53 <stat>
54 <exclude_from_stat/>
55 </stat>
56 </from_mesh>
57 </mesh>
58 <mesh name="PressureMesh">
59 <from_mesh>
60 <mesh name="CoordinateMesh"/>
61 <mesh_shape>
62 <polynomial_degree>
63 <integer_value rank="0">1</integer_value>
64 </polynomial_degree>
65 </mesh_shape>
66 <stat>
67 <exclude_from_stat/>
68 </stat>
69 </from_mesh>
70 </mesh>
71 <mesh name="DGP0">
72 <from_mesh>
73 <mesh name="CoordinateMesh"/>
74 <mesh_shape>
75 <polynomial_degree>
76 <integer_value rank="0">0</integer_value>
77 </polynomial_degree>
78 </mesh_shape>
79 <mesh_continuity>
80 <string_value>discontinuous</string_value>
81 </mesh_continuity>
82 <stat>
83 <exclude_from_stat/>
84 </stat>
85 </from_mesh>
86 </mesh>
87 <mesh name="OutputMesh">
88 <from_mesh>
89 <mesh name="CoordinateMesh"/>
90 <mesh_continuity>
91 <string_value>discontinuous</string_value>
92 </mesh_continuity>
93 <stat>
94 <exclude_from_stat/>
95 </stat>
96 </from_mesh>
97 </mesh>
98 <quadrature>
99 <degree>
100 <integer_value rank="0">3</integer_value>
101 </degree>
102 </quadrature>
103 </geometry>
104 <io>
105 <dump_format>
106 <string_value>vtk</string_value>
107 </dump_format>
108 <dump_period_in_timesteps>
109 <constant>
110 <integer_value rank="0">0</integer_value>
111 </constant>
112 </dump_period_in_timesteps>
113 <output_mesh name="OutputMesh"/>
114 <stat/>
115 </io>
116 <timestepping>
117 <current_time>
118 <real_value rank="0">0.0</real_value>
119 </current_time>
120 <timestep>
121 <real_value rank="0">1.0</real_value>
122 </timestep>
123 <finish_time>
124 <real_value rank="0">1.0</real_value>
125 </finish_time>
126 </timestepping>
127 <material_phase name="fluid">
128 <scalar_field name="Pressure" rank="0">
129 <prognostic>
130 <mesh name="PressureMesh"/>
131 <spatial_discretisation>
132 <control_volumes/>
133 </spatial_discretisation>
134 <scheme>
135 <poisson_pressure_solution>
136 <string_value lines="1">never</string_value>
137 </poisson_pressure_solution>
138 <use_projection_method/>
139 </scheme>
140 <solver>
141 <iterative_method name="cg"/>
142 <preconditioner name="sor"/>
143 <relative_error>
144 <real_value rank="0">1.0e-10</real_value>
145 </relative_error>
146 <max_iterations>
147 <integer_value rank="0">1000</integer_value>
148 </max_iterations>
149 <never_ignore_solver_failures/>
150 <diagnostics>
151 <monitors/>
152 </diagnostics>
153 </solver>
154 <boundary_conditions name="right_outflow">
155 <surface_ids>
156 <integer_value shape="1" rank="1">2</integer_value>
157 </surface_ids>
158 <type name="dirichlet">
159 <constant>
160 <real_value rank="0">0.0</real_value>
161 </constant>
162 </type>
163 </boundary_conditions>
164 <boundary_conditions name="left_inflow">
165 <surface_ids>
166 <integer_value shape="1" rank="1">1</integer_value>
167 </surface_ids>
168 <type name="dirichlet">
169 <constant>
170 <real_value rank="0">1.5e+09</real_value>
171 </constant>
172 </type>
173 </boundary_conditions>
174 <output/>
175 <stat/>
176 <convergence>
177 <include_in_convergence/>
178 </convergence>
179 <detectors>
180 <exclude_from_detectors/>
181 </detectors>
182 <steady_state>
183 <include_in_steady_state/>
184 </steady_state>
185 <no_interpolation/>
186 </prognostic>
187 </scalar_field>
188 <vector_field name="Velocity" rank="1">
189 <prognostic>
190 <mesh name="VelocityMesh"/>
191 <equation name="Boussinesq"/>
192 <spatial_discretisation>
193 <discontinuous_galerkin>
194 <mass_terms>
195 <exclude_mass_terms/>
196 </mass_terms>
197 <viscosity_scheme>
198 <compact_discontinuous_galerkin/>
199 </viscosity_scheme>
200 <advection_scheme>
201 <none/>
202 <integrate_advection_by_parts>
203 <twice/>
204 </integrate_advection_by_parts>
205 </advection_scheme>
206 </discontinuous_galerkin>
207 <conservative_advection>
208 <real_value rank="0">0.0</real_value>
209 </conservative_advection>
210 </spatial_discretisation>
211 <temporal_discretisation>
212 <theta>
213 <real_value rank="0">1.0</real_value>
214 </theta>
215 <relaxation>
216 <real_value rank="0">1.0</real_value>
217 </relaxation>
218 </temporal_discretisation>
219 <solver>
220 <iterative_method name="gmres">
221 <restart>
222 <integer_value rank="0">30</integer_value>
223 </restart>
224 </iterative_method>
225 <preconditioner name="sor"/>
226 <relative_error>
227 <real_value rank="0">1.0e-10</real_value>
228 </relative_error>
229 <max_iterations>
230 <integer_value rank="0">1000</integer_value>
231 </max_iterations>
232 <never_ignore_solver_failures/>
233 <diagnostics>
234 <monitors/>
235 </diagnostics>
236 </solver>
237 <initial_condition name="WholeMesh">
238 <constant>
239 <real_value shape="1" dim1="dim" rank="1">0.0</real_value>
240 </constant>
241 </initial_condition>
242 <vector_field name="Absorption" rank="1">
243 <diagnostic>
244 <mesh name="DGP0"/>
245 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
246 <string_value lines="20" type="python"># get the prescribed fields
247perm = states["fluid"].scalar_fields["Permeability"]
248visc = states["fluid"].scalar_fields["Viscosity"]
249
250# loop the DMmesh_p0 nodes (which are element centred)
251for n in range(field.node_count):
252 perm_n = perm.node_val(n)
253 visc_n = visc.node_val(n)
254
255 # calc the absorption term
256 sigma_n = visc_n/perm_n
257
258 # set the absorption term
259 field.set(n,sigma_n)</string_value>
260 <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
261
262also assume that the velocity is dg</comment>
263 </algorithm>
264 <output/>
265 <stat>
266 <include_in_stat/>
267 </stat>
268 <convergence>
269 <include_in_convergence/>
270 </convergence>
271 <detectors>
272 <include_in_detectors/>
273 </detectors>
274 <steady_state>
275 <include_in_steady_state/>
276 </steady_state>
277 </diagnostic>
278 <include_pressure_correction/>
279 </vector_field>
280 <output/>
281 <stat>
282 <include_in_stat/>
283 <previous_time_step>
284 <exclude_from_stat/>
285 </previous_time_step>
286 <nonlinear_field>
287 <exclude_from_stat/>
288 </nonlinear_field>
289 </stat>
290 <convergence>
291 <include_in_convergence/>
292 </convergence>
293 <detectors>
294 <include_in_detectors/>
295 </detectors>
296 <steady_state>
297 <include_in_steady_state/>
298 </steady_state>
299 <consistent_interpolation/>
300 </prognostic>
301 </vector_field>
302 <scalar_field name="Porosity" rank="0">
303 <prescribed>
304 <mesh name="DGP0"/>
305 <value name="WholeMesh">
306 <constant>
307 <real_value rank="0">0.5</real_value>
308 </constant>
309 </value>
310 <output/>
311 <stat/>
312 <detectors>
313 <exclude_from_detectors/>
314 </detectors>
315 </prescribed>
316 </scalar_field>
317 <scalar_field name="Permeability" rank="0">
318 <prescribed>
319 <mesh name="DGP0"/>
320 <value name="WholeMesh">
321 <constant>
322 <real_value rank="0">1.0e-10</real_value>
323 </constant>
324 </value>
325 <output/>
326 <stat/>
327 <detectors>
328 <exclude_from_detectors/>
329 </detectors>
330 </prescribed>
331 </scalar_field>
332 <scalar_field name="Viscosity" rank="0">
333 <prescribed>
334 <mesh name="DGP0"/>
335 <value name="WholeMesh">
336 <constant>
337 <real_value rank="0">1.0e-04</real_value>
338 </constant>
339 </value>
340 <output/>
341 <stat/>
342 <detectors>
343 <exclude_from_detectors/>
344 </detectors>
345 </prescribed>
346 </scalar_field>
347 <vector_field name="interstitial_velocity" rank="1">
348 <diagnostic>
349 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
350 <string_value lines="20" type="python">phi = states["fluid"].scalar_fields["Porosity"]
351darcy_vel = states["fluid"].vector_fields["Velocity"]
352
353for ele in range(field.element_count):
354 phi_ele = phi.node_val(ele)
355
356 factor_ele = 1.0/max(phi_ele,1.0e-08)
357
358 vel_ele = []
359 for i in range(len(darcy_vel.ele_val(ele))):
360 vel_ele.append(factor_ele*darcy_vel.ele_val(ele)[i])
361
362 field.set(darcy_vel.ele_nodes(ele),vel_ele)</string_value>
363 <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
364
365also assume that the velocity is dg</comment>
366 </algorithm>
367 <mesh name="VelocityMesh"/>
368 <output/>
369 <stat>
370 <include_in_stat/>
371 </stat>
372 <convergence>
373 <include_in_convergence/>
374 </convergence>
375 <detectors>
376 <include_in_detectors/>
377 </detectors>
378 <steady_state>
379 <include_in_steady_state/>
380 </steady_state>
381 </diagnostic>
382 </vector_field>
383 </material_phase>
384</fluidity_options>
0385
=== added file 'tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet_2d.flml'
--- tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet_2d.flml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet_2d.flml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,392 @@
1<?xml version='1.0' encoding='utf-8'?>
2<fluidity_options>
3 <simulation_name>
4 <string_value lines="1">darcy_p0p1cv_pressBCinlet_2d</string_value>
5 <comment>a simple short test case for darcy flow using the element type p0p1cv for velocity-pressure
6
7the darcy velocity is solved for and the interstitial velocity is a diagnostic from this (assuming a dg solution)
8
9it compares the pressure gradient against the analytic, as well as checking that the interstitial velocity is correct
10
11the darcy flow equation is
12
13sigma*darcy_vel = - grad P
14
15sigma 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
17python diagnostics are used to form the sigma term that is assoicated with a p0 dg mesh (ie. element wise) and the interstitial velocity
18
19this case has a 1 region 1 material with pressure boundary condition inflow.
20
21to 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
23the absorption term is included in the pressure correction (being a necessity as it is the only term in the matrix equation)
24
25the 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_shape>
46 <polynomial_degree>
47 <integer_value rank="0">0</integer_value>
48 </polynomial_degree>
49 </mesh_shape>
50 <mesh_continuity>
51 <string_value>discontinuous</string_value>
52 </mesh_continuity>
53 <stat>
54 <exclude_from_stat/>
55 </stat>
56 </from_mesh>
57 </mesh>
58 <mesh name="PressureMesh">
59 <from_mesh>
60 <mesh name="CoordinateMesh"/>
61 <mesh_shape>
62 <polynomial_degree>
63 <integer_value rank="0">1</integer_value>
64 </polynomial_degree>
65 </mesh_shape>
66 <stat>
67 <exclude_from_stat/>
68 </stat>
69 </from_mesh>
70 </mesh>
71 <mesh name="DGP0">
72 <from_mesh>
73 <mesh name="CoordinateMesh"/>
74 <mesh_shape>
75 <polynomial_degree>
76 <integer_value rank="0">0</integer_value>
77 </polynomial_degree>
78 </mesh_shape>
79 <mesh_continuity>
80 <string_value>discontinuous</string_value>
81 </mesh_continuity>
82 <stat>
83 <exclude_from_stat/>
84 </stat>
85 </from_mesh>
86 </mesh>
87 <mesh name="OutputMesh">
88 <from_mesh>
89 <mesh name="CoordinateMesh"/>
90 <mesh_continuity>
91 <string_value>discontinuous</string_value>
92 </mesh_continuity>
93 <stat>
94 <exclude_from_stat/>
95 </stat>
96 </from_mesh>
97 </mesh>
98 <quadrature>
99 <degree>
100 <integer_value rank="0">3</integer_value>
101 </degree>
102 </quadrature>
103 </geometry>
104 <io>
105 <dump_format>
106 <string_value>vtk</string_value>
107 </dump_format>
108 <dump_period_in_timesteps>
109 <constant>
110 <integer_value rank="0">0</integer_value>
111 </constant>
112 </dump_period_in_timesteps>
113 <output_mesh name="OutputMesh"/>
114 <stat/>
115 </io>
116 <timestepping>
117 <current_time>
118 <real_value rank="0">0.0</real_value>
119 </current_time>
120 <timestep>
121 <real_value rank="0">1.0</real_value>
122 </timestep>
123 <finish_time>
124 <real_value rank="0">1.0</real_value>
125 </finish_time>
126 </timestepping>
127 <material_phase name="fluid">
128 <scalar_field name="Pressure" rank="0">
129 <prognostic>
130 <mesh name="PressureMesh"/>
131 <spatial_discretisation>
132 <control_volumes/>
133 </spatial_discretisation>
134 <scheme>
135 <poisson_pressure_solution>
136 <string_value lines="1">never</string_value>
137 </poisson_pressure_solution>
138 <use_projection_method/>
139 </scheme>
140 <solver>
141 <iterative_method name="cg"/>
142 <preconditioner name="sor"/>
143 <relative_error>
144 <real_value rank="0">1.0e-10</real_value>
145 </relative_error>
146 <max_iterations>
147 <integer_value rank="0">1000</integer_value>
148 </max_iterations>
149 <never_ignore_solver_failures/>
150 <diagnostics>
151 <monitors/>
152 </diagnostics>
153 </solver>
154 <boundary_conditions name="right_outflow">
155 <surface_ids>
156 <integer_value shape="1" rank="1">8</integer_value>
157 </surface_ids>
158 <type name="dirichlet">
159 <apply_weakly/>
160 <constant>
161 <real_value rank="0">0.0</real_value>
162 </constant>
163 </type>
164 </boundary_conditions>
165 <boundary_conditions name="left_inflow">
166 <surface_ids>
167 <integer_value shape="1" rank="1">10</integer_value>
168 </surface_ids>
169 <type name="dirichlet">
170 <apply_weakly/>
171 <constant>
172 <real_value rank="0">1.5e+09</real_value>
173 </constant>
174 </type>
175 </boundary_conditions>
176 <output/>
177 <stat/>
178 <convergence>
179 <include_in_convergence/>
180 </convergence>
181 <detectors>
182 <exclude_from_detectors/>
183 </detectors>
184 <steady_state>
185 <include_in_steady_state/>
186 </steady_state>
187 <no_interpolation/>
188 </prognostic>
189 </scalar_field>
190 <vector_field name="Velocity" rank="1">
191 <prognostic>
192 <mesh name="VelocityMesh"/>
193 <equation name="Boussinesq"/>
194 <spatial_discretisation>
195 <discontinuous_galerkin>
196 <mass_terms>
197 <exclude_mass_terms/>
198 </mass_terms>
199 <viscosity_scheme>
200 <compact_discontinuous_galerkin/>
201 </viscosity_scheme>
202 <advection_scheme>
203 <none/>
204 <integrate_advection_by_parts>
205 <twice/>
206 </integrate_advection_by_parts>
207 </advection_scheme>
208 </discontinuous_galerkin>
209 <conservative_advection>
210 <real_value rank="0">0.0</real_value>
211 </conservative_advection>
212 </spatial_discretisation>
213 <temporal_discretisation>
214 <theta>
215 <real_value rank="0">1.0</real_value>
216 </theta>
217 <relaxation>
218 <real_value rank="0">1.0</real_value>
219 </relaxation>
220 </temporal_discretisation>
221 <solver>
222 <iterative_method name="gmres">
223 <restart>
224 <integer_value rank="0">30</integer_value>
225 </restart>
226 </iterative_method>
227 <preconditioner name="sor"/>
228 <relative_error>
229 <real_value rank="0">1.0e-10</real_value>
230 </relative_error>
231 <max_iterations>
232 <integer_value rank="0">1000</integer_value>
233 </max_iterations>
234 <never_ignore_solver_failures/>
235 <diagnostics>
236 <monitors/>
237 </diagnostics>
238 </solver>
239 <initial_condition name="WholeMesh">
240 <constant>
241 <real_value shape="2" dim1="dim" rank="1">0.0 0.0</real_value>
242 </constant>
243 </initial_condition>
244 <boundary_conditions name="no_outflow_top_bottom">
245 <surface_ids>
246 <integer_value shape="2" rank="1">7 9</integer_value>
247 </surface_ids>
248 <type name="no_normal_flow"/>
249 </boundary_conditions>
250 <vector_field name="Absorption" rank="1">
251 <diagnostic>
252 <mesh name="DGP0"/>
253 <algorithm name="vector_python_diagnostic" material_phase_support="multiple">
254 <string_value lines="20" type="python"># get the prescribed fields
255perm = states["fluid"].scalar_fields["Permeability"]
256visc = states["fluid"].scalar_fields["Viscosity"]
257
258# loop the DMmesh_p0 nodes (which are element centred)
259for n in range(field.node_count):
260 perm_n = perm.node_val(n)
261 visc_n = visc.node_val(n)
262
263 # calc the absorption term
264 sigma_n = visc_n/perm_n
265
266 # set the absorption term
267 field.set(n,sigma_n)</string_value>
268 <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
269
270also assume that the velocity is dg</comment>
271 </algorithm>
272 <output/>
273 <stat>
274 <include_in_stat/>
275 </stat>
276 <convergence>
277 <include_in_convergence/>
278 </convergence>
279 <detectors>
280 <include_in_detectors/>
281 </detectors>
282 <steady_state>
283 <include_in_steady_state/>
284 </steady_state>
285 </diagnostic>
286 <include_pressure_correction/>
287 </vector_field>
288 <output/>
289 <stat>
290 <include_in_stat/>
291 <previous_time_step>
292 <exclude_from_stat/>
293 </previous_time_step>
294 <nonlinear_field>
295 <exclude_from_stat/>
296 </nonlinear_field>
297 </stat>
298 <convergence>
299 <include_in_convergence/>
300 </convergence>
301 <detectors>
302 <include_in_detectors/>
303 </detectors>
304 <steady_state>
305 <include_in_steady_state/>
306 </steady_state>
307 <consistent_interpolation/>
308 </prognostic>
309 </vector_field>
310 <scalar_field name="Porosity" rank="0">
311 <prescribed>
312 <mesh name="DGP0"/>
313 <value name="WholeMesh">
314 <constant>
315 <real_value rank="0">0.5</real_value>
316 </constant>
317 </value>
318 <output/>
319 <stat/>
320 <detectors>
321 <exclude_from_detectors/>
322 </detectors>
323 </prescribed>
324 </scalar_field>
325 <scalar_field name="Permeability" rank="0">
326 <prescribed>
327 <mesh name="DGP0"/>
328 <value name="WholeMesh">
329 <constant>
330 <real_value rank="0">1.0e-10</real_value>
331 </constant>
332 </value>
333 <output/>
334 <stat/>
335 <detectors>
336 <exclude_from_detectors/>
337 </detectors>
338 </prescribed>
339 </scalar_field>
340 <scalar_field name="Viscosity" rank="0">
341 <prescribed>
342 <mesh name="DGP0"/>
343 <value name="WholeMesh">
344 <constant>
345 <real_value rank="0">1.0e-04</real_value>
346 </constant>
347 </value>
348 <output/>
349 <stat/>
350 <detectors>
351 <exclude_from_detectors/>
352 </detectors>
353 </prescribed>
354 </scalar_field>
355 <vector_field name="interstitial_velocity" 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"]
359darcy_vel = states["fluid"].vector_fields["Velocity"]
360
361for 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 <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
372
373also assume that the velocity is dg</comment>
374 </algorithm>
375 <mesh name="VelocityMesh"/>
376 <output/>
377 <stat>
378 <include_in_stat/>
379 </stat>
380 <convergence>
381 <include_in_convergence/>
382 </convergence>
383 <detectors>
384 <include_in_detectors/>
385 </detectors>
386 <steady_state>
387 <include_in_steady_state/>
388 </steady_state>
389 </diagnostic>
390 </vector_field>
391 </material_phase>
392</fluidity_options>
0393
=== added file 'tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet_3d.flml'
--- tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet_3d.flml 1970-01-01 00:00:00 +0000
+++ tests/darcy_p0p1cv_pressBCinlet/darcy_p0p1cv_pressBCinlet_3d.flml 2011-12-23 12:05:25 +0000
@@ -0,0 +1,398 @@
1<?xml version='1.0' encoding='utf-8'?>
2<fluidity_options>
3 <simulation_name>
4 <string_value lines="1">darcy_p0p1cv_pressBCinlet_3d</string_value>
5 <comment>a simple short test case for darcy flow using the element type p0p1cv for velocity-pressure
6
7the darcy velocity is solved for and the interstitial velocity is a diagnostic from this (assuming a dg solution)
8
9it compares the pressure gradient against the analytic, as well as checking that the interstitial velocity is correct
10
11the darcy flow equation is
12
13sigma*darcy_vel = - grad P
14
15sigma 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
17python diagnostics are used to form the sigma term that is assoicated with a p0 dg mesh (ie. element wise) and the interstitial velocity
18
19this case has a 1 region 1 material with pressure boundary condition inflow.
20
21to 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
23the absorption term is included in the pressure correction (being a necessity as it is the only term in the matrix equation)
24
25the geometry is 3d (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">3</integer_value>
33 </dimension>
34 <mesh name="CoordinateMesh">
35 <from_file file_name="cube">
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_shape>
46 <polynomial_degree>
47 <integer_value rank="0">0</integer_value>
48 </polynomial_degree>
49 </mesh_shape>
50 <mesh_continuity>
51 <string_value>discontinuous</string_value>
52 </mesh_continuity>
53 <stat>
54 <exclude_from_stat/>
55 </stat>
56 </from_mesh>
57 </mesh>
58 <mesh name="PressureMesh">
59 <from_mesh>
60 <mesh name="CoordinateMesh"/>
61 <mesh_shape>
62 <polynomial_degree>
63 <integer_value rank="0">1</integer_value>
64 </polynomial_degree>
65 </mesh_shape>
66 <stat>
67 <exclude_from_stat/>
68 </stat>
69 </from_mesh>
70 </mesh>
71 <mesh name="DGP0">
72 <from_mesh>
73 <mesh name="CoordinateMesh"/>
74 <mesh_shape>
75 <polynomial_degree>
76 <integer_value rank="0">0</integer_value>
77 </polynomial_degree>
78 </mesh_shape>
79 <mesh_continuity>
80 <string_value>discontinuous</string_value>
81 </mesh_continuity>
82 <stat>
83 <exclude_from_stat/>
84 </stat>
85 </from_mesh>
86 </mesh>
87 <mesh name="OutputMesh">
88 <from_mesh>
89 <mesh name="CoordinateMesh"/>
90 <mesh_continuity>
91 <string_value>discontinuous</string_value>
92 </mesh_continuity>
93 <stat>
94 <exclude_from_stat/>
95 </stat>
96 </from_mesh>
97 </mesh>
98 <quadrature>
99 <degree>
100 <integer_value rank="0">3</integer_value>
101 </degree>
102 </quadrature>
103 </geometry>
104 <io>
105 <dump_format>
106 <string_value>vtk</string_value>
107 </dump_format>
108 <dump_period_in_timesteps>
109 <constant>
110 <integer_value rank="0">0</integer_value>
111 </constant>
112 </dump_period_in_timesteps>
113 <output_mesh name="OutputMesh"/>
114 <stat/>
115 </io>
116 <timestepping>
117 <current_time>
118 <real_value rank="0">0.0</real_value>
119 </current_time>
120 <timestep>
121 <real_value rank="0">1.0</real_value>
122 </timestep>
123 <finish_time>
124 <real_value rank="0">1.0</real_value>
125 </finish_time>
126 </timestepping>
127 <material_phase name="fluid">
128 <scalar_field name="Pressure" rank="0">
129 <prognostic>
130 <mesh name="PressureMesh"/>
131 <spatial_discretisation>
132 <control_volumes/>
133 </spatial_discretisation>
134 <scheme>
135 <poisson_pressure_solution>
136 <string_value lines="1">never</string_value>
137 </poisson_pressure_solution>
138 <use_projection_method/>
139 </scheme>
140 <solver>
141 <iterative_method name="cg"/>
142 <preconditioner name="sor"/>
143 <relative_error>
144 <real_value rank="0">1.0e-10</real_value>
145 </relative_error>
146 <max_iterations>
147 <integer_value rank="0">1000</integer_value>
148 </max_iterations>
149 <never_ignore_solver_failures/>
150 <diagnostics>
151 <monitors/>
152 </diagnostics>
153 </solver>
154 <boundary_conditions name="right_outflow">
155 <surface_ids>
156 <integer_value shape="1" rank="1">4</integer_value>
157 </surface_ids>
158 <type name="dirichlet">
159 <apply_weakly/>
160 <constant>
161 <real_value rank="0">0.0</real_value>
162 </constant>
163 </type>
164 </boundary_conditions>
165 <boundary_conditions name="left_inflow">
166 <surface_ids>
167 <integer_value shape="1" rank="1">3</integer_value>
168 </surface_ids>
169 <type name="dirichlet">
170 <apply_weakly/>
171 <constant>
172 <real_value rank="0">1.5e+09</real_value>
173 </constant>
174 </type>
175 </boundary_conditions>
176 <output/>
177 <stat/>
178 <convergence>
179 <include_in_convergence/>
180 </convergence>
181 <detectors>
182 <exclude_from_detectors/>
183 </detectors>
184 <steady_state>
185 <include_in_steady_state/>
186 </steady_state>
187 <no_interpolation/>
188 </prognostic>
189 </scalar_field>
190 <vector_field name="Velocity" rank="1">
191 <prognostic>
192 <mesh name="VelocityMesh"/>
193 <equation name="Boussinesq"/>
194 <spatial_discretisation>
195 <discontinuous_galerkin>
196 <mass_terms>
197 <exclude_mass_terms/>
198 </mass_terms>
199 <viscosity_scheme>
200 <compact_discontinuous_galerkin/>
201 </viscosity_scheme>
202 <advection_scheme>
203 <none/>
204 <integrate_advection_by_parts>
205 <twice/>
206 </integrate_advection_by_parts>
207 </advection_scheme>
208 </discontinuous_galerkin>
209 <conservative_advection>
210 <real_value rank="0">0.0</real_value>
211 </conservative_advection>
212 </spatial_discretisation>
213 <temporal_discretisation>
214 <theta>
215 <real_value rank="0">1.0</real_value>
216 </theta>
217 <relaxation>
218 <real_value rank="0">1.0</real_value>
219 </relaxation>
The diff has been truncated for viewing.