pflotran_constants.F90 coverage: 80.00 %func 48.78 %block
1) module PFLOTRAN_Constants_module
2)
3) ! IMPORTANT NOTE: This module can have no dependencies on other modules!!!
4)
5) implicit none
6)
7) private
8)
9) #include "petsc/finclude/petscsys.h"
10)
11) ! MUST INCREMENT THIS NUMBER EVERYTIME A CHECKPOINT FILE IS MODIFIED TO PREVENT
12) ! COMPATIBILITY ISSUES - geh.
13) PetscInt, parameter, public :: CHECKPOINT_REVISION_NUMBER = 1
14)
15) PetscInt, parameter, public :: MAXSTRINGLENGTH = 512
16) PetscInt, parameter, public :: MAXWORDLENGTH = 32
17) PetscInt, parameter, public :: OUT_UNIT = 15
18) PetscInt, parameter, public :: OUTPUT_UNIT = 16
19) PetscInt, parameter, public :: IN_UNIT = 17
20) ! If you increase MAX_IN_UNIT, you MUST ensure that no other units #
21) ! lie between IN_UNIT and MAX_IN_UNIT, as these units are reserved
22) ! for embedded input files.
23) PetscInt, parameter, public :: MAX_IN_UNIT = 25
24) PetscInt, parameter, public :: IUNIT_TEMP = 86
25) ! EKG_UNIT = 87
26) PetscInt, parameter, public :: INPUT_RECORD_UNIT = 88
27) PetscInt, parameter, public :: HHISTORY_LENGTH = 1000
28) ! HHISTORY_LENGTH is the length of the array used to store the differencing
29) ! values h.
30)
31) ! formula weights
32) PetscReal, parameter, public :: FMWNACL = 58.44277d0
33) PetscReal, parameter, public :: FMWH2O = 18.01534d0 ! kg/kmol h2o
34) PetscReal, parameter, public :: FMWCO2 = 44.0098d0
35) PetscReal, parameter, public :: FMWAIR = 28.96d0
36) PetscReal, parameter, public :: FMWGLYC = 76.09d0 ! propylene glycol (C3H8O2)
37) PetscReal, parameter, public :: FMWOIL = 142.D0 ! used as deafault value
38)
39) ! constants
40) PetscReal, parameter, public :: H2O_CRITICAL_TEMPERATURE = 647.3d0 ! K
41) #if defined(MATCH_TOUGH2)
42) PetscReal, parameter, public :: H2O_CRITICAL_PRESSURE = 22.12d6 ! Pa
43) #else
44) PetscReal, parameter, public :: H2O_CRITICAL_PRESSURE = 22.064d6 ! Pa
45) #endif
46)
47) ! conversion factors
48) PetscReal, parameter, public :: LOG_TO_LN = 2.30258509299d0
49) PetscReal, parameter, public :: LN_TO_LOG = 0.434294481904d0
50)
51) ! constants
52) ! from http://physics.nist.gov/cgi-bin/cuu/Value?r
53) PetscReal, parameter, public :: IDEAL_GAS_CONSTANT = 8.31446d0 ! J/mol-K
54) PetscReal, parameter, public :: HEAT_OF_FUSION = 3.34d5 ! J/kg
55) PetscReal, parameter, public :: PI = 3.14159265359d0
56) PetscReal, parameter, public :: Faraday = 96485.3365d0 ! C/mol
57)
58) PetscInt, parameter, public :: ZERO_INTEGER = 0
59) PetscInt, parameter, public :: ONE_INTEGER = 1
60) PetscInt, parameter, public :: TWO_INTEGER = 2
61) PetscInt, parameter, public :: THREE_INTEGER = 3
62) PetscInt, parameter, public :: FOUR_INTEGER = 4
63) PetscInt, parameter, public :: FIVE_INTEGER = 5
64) PetscInt, parameter, public :: SIX_INTEGER = 6
65) PetscInt, parameter, public :: SEVEN_INTEGER = 7
66) PetscInt, parameter, public :: EIGHT_INTEGER = 8
67) PetscInt, parameter, public :: NINE_INTEGER = 9
68) PetscInt, parameter, public :: TEN_INTEGER = 10
69) PetscInt, parameter, public :: ELEVEN_INTEGER = 11
70) PetscInt, parameter, public :: TWELVE_INTEGER = 12
71) PetscInt, parameter, public :: NEG_ONE_INTEGER = -1
72)
73) PetscMPIInt, parameter, public :: ZERO_INTEGER_MPI = ZERO_INTEGER
74) PetscMPIInt, parameter, public :: ONE_INTEGER_MPI = ONE_INTEGER
75) PetscMPIInt, parameter, public :: TWO_INTEGER_MPI = TWO_INTEGER
76) PetscMPIInt, parameter, public :: THREE_INTEGER_MPI = THREE_INTEGER
77) PetscMPIInt, parameter, public :: FOUR_INTEGER_MPI = FOUR_INTEGER
78) PetscMPIInt, parameter, public :: SIX_INTEGER_MPI = SIX_INTEGER
79) PetscMPIInt, parameter, public :: SEVEN_INTEGER_MPI = SEVEN_INTEGER
80) PetscMPIInt, parameter, public :: TWELVE_INTEGER_MPI = TWELVE_INTEGER
81) PetscMPIInt, parameter, public :: MAXSTRINGLENGTH_MPI = MAXSTRINGLENGTH
82)
83) PetscInt, parameter, public :: X_DIRECTION = 1
84) PetscInt, parameter, public :: Y_DIRECTION = 2
85) PetscInt, parameter, public :: Z_DIRECTION = 3
86) PetscInt, parameter, public :: LOWER = 1
87) PetscInt, parameter, public :: UPPER = 2
88)
89) PetscInt, parameter, public :: TIME_NULL = 0
90) PetscInt, parameter, public :: TIME_T = 1
91) PetscInt, parameter, public :: TIME_TpDT = 2
92)
93) PetscInt, parameter, public :: SORPTION_LINEAR = 1
94) PetscInt, parameter, public :: SORPTION_LANGMUIR = 2
95) PetscInt, parameter, public :: SORPTION_FREUNDLICH = 3
96)
97) ! Classes
98) PetscInt, parameter, public :: NULL_CLASS = 0
99) PetscInt, parameter, public :: FLOW_CLASS = 1
100) PetscInt, parameter, public :: TRANSPORT_CLASS = 2
101)
102) ! Macros that are used as 'dm_index' values. --RTM
103) PetscInt, parameter, public :: ONEDOF = 1
104) PetscInt, parameter, public :: NPHASEDOF = 2
105) PetscInt, parameter, public :: THREENPDOF = 3
106) PetscInt, parameter, public :: NFLOWDOF = 4
107) PetscInt, parameter, public :: NTRANDOF = 5
108) PetscInt, parameter, public :: SURF_ONEDOF = 6
109) PetscInt, parameter, public :: NGEODOF = 7
110)
111) PetscInt, parameter, public :: GLOBAL = 1
112) PetscInt, parameter, public :: LOCAL = 2
113) PetscInt, parameter, public :: NATURAL = 3
114)
115) PetscInt, parameter, public :: NULL_MODE = 0
116)
117) ! flow modes
118) PetscInt, parameter, public :: MPH_MODE = 1
119) PetscInt, parameter, public :: RICHARDS_MODE = 2
120) PetscInt, parameter, public :: IMS_MODE = 3
121) PetscInt, parameter, public :: FLASH2_MODE = 4
122) PetscInt, parameter, public :: G_MODE = 5
123) PetscInt, parameter, public :: MIS_MODE = 6
124) PetscInt, parameter, public :: TH_MODE = 7
125) PetscInt, parameter, public :: TOIL_IMS_MODE = 8
126)
127) ! transport modes
128) PetscInt, parameter, public :: EXPLICIT_ADVECTION = 1
129)
130) ! condition types
131) PetscInt, parameter, public :: NULL_CONDITION = 0
132) PetscInt, parameter, public :: DIRICHLET_BC = 1
133) PetscInt, parameter, public :: NEUMANN_BC = 2
134) PetscInt, parameter, public :: DIRICHLET_ZERO_GRADIENT_BC = 3
135) PetscInt, parameter, public :: ZERO_GRADIENT_BC = 4
136) PetscInt, parameter, public :: HYDROSTATIC_BC = 5
137) PetscInt, parameter, public :: SEEPAGE_BC = 6
138) PetscInt, parameter, public :: MASS_RATE_SS = 7
139) PetscInt, parameter, public :: VOLUMETRIC_RATE_SS = 8
140) PetscInt, parameter, public :: SCALED_MASS_RATE_SS = 9
141) PetscInt, parameter, public :: SCALED_VOLUMETRIC_RATE_SS = 10
142) PetscInt, parameter, public :: CONCENTRATION_SS = 11
143) PetscInt, parameter, public :: EQUILIBRIUM_SS = 12
144) PetscInt, parameter, public :: CONDUCTANCE_BC = 13
145) PetscInt, parameter, public :: UNIT_GRADIENT_BC = 14
146) PetscInt, parameter, public :: SATURATION_BC = 15
147) PetscInt, parameter, public :: HET_VOL_RATE_SS = 16
148) PetscInt, parameter, public :: HET_MASS_RATE_SS = 17
149) PetscInt, parameter, public :: HET_DIRICHLET = 18
150) PetscInt, parameter, public :: ENERGY_RATE_SS = 19
151) PetscInt, parameter, public :: SCALED_ENERGY_RATE_SS = 20
152) PetscInt, parameter, public :: HET_ENERGY_RATE_SS = 21
153) PetscInt, parameter, public :: HET_SURF_SEEPAGE_BC = 22
154) PetscInt, parameter, public :: WELL_SS = 100
155) PetscInt, parameter, public :: SPILLOVER_BC = 23
156)
157) ! source/sink scaling options
158) PetscInt, parameter, public :: SCALE_BY_PERM = 1
159) PetscInt, parameter, public :: SCALE_BY_NEIGHBOR_PERM = 2
160) PetscInt, parameter, public :: SCALE_BY_VOLUME = 3
161)
162) ! connection types
163) PetscInt, parameter, public :: INTERNAL_CONNECTION_TYPE = 1
164) PetscInt, parameter, public :: BOUNDARY_CONNECTION_TYPE = 2
165) PetscInt, parameter, public :: INITIAL_CONNECTION_TYPE = 3
166) PetscInt, parameter, public :: SRC_SINK_CONNECTION_TYPE = 4
167)
168) ! dofs for each mode
169) PetscInt, parameter, public :: THC_PRESSURE_DOF = 1
170) PetscInt, parameter, public :: THC_TEMPERATURE_DOF = 2
171) PetscInt, parameter, public :: THC_CONCENTRATION_DOF = 3
172) PetscInt, parameter, public :: THC_MASS_RATE_DOF = 4
173) PetscInt, parameter, public :: THC_ENTHALPY_DOF = 5
174)
175) PetscInt, parameter, public :: TH_PRESSURE_DOF = 1
176) PetscInt, parameter, public :: TH_TEMPERATURE_DOF = 2
177)
178) PetscInt, parameter, public :: MPH_PRESSURE_DOF = 1
179) PetscInt, parameter, public :: MPH_TEMPERATURE_DOF = 2
180) PetscInt, parameter, public :: MPH_CONCENTRATION_DOF = 3
181)
182) PetscInt, parameter, public :: RICHARDS_PRESSURE_DOF = 1
183) PetscInt, parameter, public :: RICHARDS_CONDUCTANCE_DOF = 2
184)
185) PetscInt, parameter, public :: MIS_PRESSURE_DOF = 1
186) PetscInt, parameter, public :: MIS_CONCENTRATION_DOF = 2
187)
188) ! mphase equation of state
189) PetscInt, parameter, public :: EOS_SPAN_WAGNER = 1
190) PetscInt, parameter, public :: EOS_MRK = 2
191)
192) ! phase ids
193) PetscInt, parameter, public :: LIQUID_PHASE = 1
194) PetscInt, parameter, public :: GAS_PHASE = 2
195)
196) ! approaches to coupling reactive transport
197) PetscInt, parameter, public :: GLOBAL_IMPLICIT = 0
198) PetscInt, parameter, public :: OPERATOR_SPLIT = 1
199)
200) ! ids of non-petsc arrays
201) PetscInt, parameter, public :: MATERIAL_ID_ARRAY = 1
202) PetscInt, parameter, public :: SATURATION_FUNCTION_ID_ARRAY = 2
203)
204) ! interpolation methods
205) PetscInt, parameter, public :: INTERPOLATION_NULL = 0
206) PetscInt, parameter, public :: INTERPOLATION_STEP = 1
207) PetscInt, parameter, public :: INTERPOLATION_LINEAR = 2
208)
209) ! surface/subsurface flags
210) PetscInt, parameter, public :: SUBSURFACE = 0
211) PetscInt, parameter, public :: SURFACE = 1
212)
213) PetscInt, parameter, public :: DECOUPLED = 0
214) PetscInt, parameter, public :: SEQ_COUPLED = 1
215) PetscInt, parameter, public :: FULLY_COUPLED = 2
216)
217) PetscInt, parameter, public :: KINEMATIC_WAVE = 1
218) PetscInt, parameter, public :: DIFFUSION_WAVE = 2
219)
220) PetscReal, parameter, public :: MIN_SURFACE_WATER_HEIGHT = 1.0d-14
221)
222) ! print secondary continuum variable ids
223) PetscInt, parameter, public :: PRINT_SEC_TEMP = 0
224) PetscInt, parameter, public :: PRINT_SEC_CONC = 1
225) PetscInt, parameter, public :: PRINT_SEC_MIN_VOLFRAC = 2
226) PetscInt, parameter, public :: PRINT_SEC_MIN_RATE = 3
227) PetscInt, parameter, public :: PRINT_SEC_MIN_SI = 4
228)
229) PetscInt, parameter, public :: PROCEED = 0
230) PetscInt, parameter, public :: DONE = 1
231) PetscInt, parameter, public :: FAIL = 2
232)
233) ! Grid type
234) PetscInt, parameter, public :: NULL_GRID = 0
235) PetscInt, parameter, public :: STRUCTURED_GRID = 1
236) PetscInt, parameter, public :: UNSTRUCTURED_GRID = 2
237) PetscInt, parameter, public :: IMPLICIT_UNSTRUCTURED_GRID = 3
238) PetscInt, parameter, public :: EXPLICIT_UNSTRUCTURED_GRID = 4
239) PetscInt, parameter, public :: POLYHEDRA_UNSTRUCTURED_GRID = 5
240) PetscInt, parameter, public :: ONE_DIM_GRID = 1
241) PetscInt, parameter, public :: TWO_DIM_GRID = 2
242) PetscInt, parameter, public :: THREE_DIM_GRID = 3
243)
244) ! Geomechanics
245) PetscInt, parameter, public :: GEOMECH_DISP_X_DOF = 1
246) PetscInt, parameter, public :: GEOMECH_DISP_Y_DOF = 2
247) PetscInt, parameter, public :: GEOMECH_DISP_Z_DOF = 3
248) PetscInt, parameter, public :: GEOMECH_ONE_WAY_COUPLED = 4
249) PetscInt, parameter, public :: GEOMECH_TWO_WAY_COUPLED = 5
250)
251) ! Macros that are used as 'vscatter_index' values
252) PetscInt, parameter, public :: SURF_TO_SUBSURF = 1
253) PetscInt, parameter, public :: SUBSURF_TO_SURF = 2
254) PetscInt, parameter, public :: SUBSURF_TO_HYDROGEOPHY = 3
255) PetscInt, parameter, public :: SUBSURF_TO_GEOMECHANICS = 4
256) PetscInt, parameter, public :: GEOMECHANICS_TO_SUBSURF = 5
257)
258) ! Ice/water/vapor partitioning model
259) PetscInt, parameter, public :: PAINTER_EXPLICIT = 1
260) PetscInt, parameter, public :: PAINTER_KARRA_IMPLICIT = 2
261) PetscInt, parameter, public :: PAINTER_KARRA_EXPLICIT = 3
262) PetscInt, parameter, public :: DALL_AMICO = 4
263) PetscInt, parameter, public :: PAINTER_KARRA_EXPLICIT_NOCRYO = 5
264)
265) ! Relative permeability averaging
266) PetscInt, parameter, public :: UPWIND = 1
267) PetscInt, parameter, public :: HARMONIC = 2
268) PetscInt, parameter, public :: DYNAMIC_HARMONIC = 3
269)
270) ! uninitialized values
271) PetscInt, parameter, public :: UNINITIALIZED_INTEGER = -999
272) PetscReal, parameter, public :: UNINITIALIZED_DOUBLE = -999.d0
273)
274) ! Dummy value
275) PetscReal, parameter, public :: DUMMY_VALUE = UNINITIALIZED_DOUBLE
276)
277) interface Uninitialized
278) module procedure UninitializedInteger
279) module procedure UninitializedDouble
280) end interface
281)
282) interface Initialized
283) module procedure InitializedInteger
284) module procedure InitializedDouble
285) end interface
286)
287) public :: Initialized, &
288) Uninitialized, &
289) UninitializedMessage
290)
291) contains
292)
293) ! ************************************************************************** !
294)
295) function InitializedInteger(value)
296) !
297) ! Tests whether a variable is initialized based orginally being set to
298) ! the value UNINITIALIZED_INTEGER
299) !
300) ! Author: Glenn Hammond
301) ! Date: 09/29/14
302) !
303) implicit none
304)
305) PetscInt :: value
306) PetscBool :: InitializedInteger
307)
308) InitializedInteger = .not.Uninitialized(value)
309)
310) end function InitializedInteger
311)
312)
313) ! ************************************************************************** !
314)
315) function UninitializedInteger(value)
316) !
317) ! Tests whether a variable is uninitialized based orginally being set to
318) ! the value UNINITIALIZED_INTEGER
319) !
320) ! Author: Glenn Hammond
321) ! Date: 09/29/14
322) !
323) implicit none
324)
325) PetscInt :: value
326) PetscBool :: UninitializedInteger
327)
328) UninitializedInteger = (value == UNINITIALIZED_INTEGER)
329)
330) end function UninitializedInteger
331)
332) ! ************************************************************************** !
333)
334) function InitializedDouble(value)
335) !
336) ! Tests whether a variable is initialized based orginally being set to
337) ! the value UNINITIALIZED_INTEGER
338) !
339) ! Author: Glenn Hammond
340) ! Date: 09/29/14
341) !
342) implicit none
343)
344) PetscReal :: value
345) PetscBool :: InitializedDouble
346)
347) InitializedDouble = .not.Uninitialized(value)
348)
349) end function InitializedDouble
350)
351) ! ************************************************************************** !
352)
353) function UninitializedDouble(value)
354) !
355) ! Tests whether a variable is uninitialized based orginally being set to
356) ! the value UNINITIALIZED_INTEGER
357) !
358) ! Author: Glenn Hammond
359) ! Date: 09/29/14
360) !
361) implicit none
362)
363) PetscReal :: value
364) PetscBool :: UninitializedDouble
365)
366) UninitializedDouble = (dabs(value-UNINITIALIZED_DOUBLE) < 1.d-20)
367)
368) end function UninitializedDouble
369)
370) ! ************************************************************************** !
371)
372) function UninitializedMessage(variable_name,routine_name)
373) !
374) ! Tests whether a variable is uninitialized based orginally being set to
375) ! the value UNINITIALIZED_INTEGER
376) !
377) ! Author: Glenn Hammond
378) ! Date: 09/29/14
379) !
380) implicit none
381)
382) character(len=*) :: variable_name
383) character(len=*) :: routine_name
384)
385) character(len=MAXSTRINGLENGTH) :: UninitializedMessage
386)
387) if (len_trim(routine_name) > 1) then
388) UninitializedMessage = trim(variable_name) // &
389) ' uninitialized in ' // &
390) trim(routine_name) // '.'
391) else
392) UninitializedMessage = trim(variable_name) // &
393) ' uninitialized.'
394) endif
395)
396) end function UninitializedMessage
397)
398) end module PFLOTRAN_Constants_module