secondary_continuum_aux.F90 coverage: 100.00 %func 100.00 %block
1) ! added by S. Karra 07/11/12
2)
3) module Secondary_Continuum_Aux_module
4)
5) use Reactive_Transport_Aux_module
6)
7) use PFLOTRAN_Constants_module
8)
9) implicit none
10)
11) private
12)
13) #include "petsc/finclude/petscsys.h"
14)
15) type, public :: slab_type
16) PetscReal :: length ! input - length of slab
17) PetscReal :: area ! input - surface area
18) end type slab_type
19)
20) type, public :: nested_cube_type
21) PetscReal :: matrix_block_size ! input - side of cube
22) PetscReal :: fracture_spacing ! input - fracture spacing
23) end type nested_cube_type
24)
25) type, public :: nested_sphere_type
26) PetscReal :: radius ! input - radius of sphere
27) end type nested_sphere_type
28)
29) type, public :: sec_continuum_type
30) PetscInt :: itype ! input - type of sec. continuum (slab, nested_cube, nested_sphere,....)
31) type(slab_type) :: slab
32) type(nested_cube_type) :: nested_cube
33) type(nested_sphere_type) :: nested_sphere
34) PetscReal, pointer :: distance(:) ! This is the array of positions of cells centers from the center
35) end type sec_continuum_type ! farthest is the cell center closest to interface between prim. and sec. continuua
36)
37) type, public :: sec_heat_type
38) PetscInt :: ncells ! number of secondary grid cells
39) PetscReal :: aperture ! fracture aperture
40) PetscReal :: epsilon ! vol. frac. of primary continuum
41) type(sec_continuum_type) :: sec_continuum
42) PetscReal, pointer :: sec_temp(:) ! array of temp. at secondary grid cells
43) PetscReal, pointer :: area(:) ! surface area
44) PetscReal, pointer :: vol(:) ! volume face node face
45) PetscReal, pointer :: dm_plus(:) ! see fig. |----------o----------|
46) PetscReal, pointer :: dm_minus(:) ! see fig. <dm_minus> <dm_plus>
47) PetscReal :: interfacial_area ! interfacial area between prim. and sec. per unit volume of prim.+sec.
48) PetscBool :: log_spacing ! flag to check if log spacing is set
49) PetscReal :: outer_spacing ! value of the outer most grid cell spacing
50) end type sec_heat_type
51)
52) type, public :: sec_transport_type
53) PetscInt :: ncells ! number of secondary grid cells
54) PetscReal :: aperture ! fracture aperture
55) PetscReal :: epsilon ! vol. frac. of primary continuum
56) type(sec_continuum_type) :: sec_continuum
57) type(reactive_transport_auxvar_type), pointer :: sec_rt_auxvar(:) ! for each secondary grid cell
58) PetscReal, pointer :: area(:) ! surface area
59) PetscReal, pointer :: vol(:) ! volume face node face
60) PetscReal, pointer :: dm_plus(:) ! see fig. |----------o----------|
61) PetscReal, pointer :: dm_minus(:) ! see fig. <dm_minus> <dm_plus>
62) PetscReal :: interfacial_area ! interfacial area between prim. and sec. per unit volume of prim.+sec.
63) PetscBool :: log_spacing ! flag to check if log spacing is set
64) PetscReal :: outer_spacing ! value of the outer most grid cell spacing
65) PetscReal, pointer :: sec_jac(:,:) ! stores the secondary continuum jacobian value (naqcomp x naqcomp)
66) PetscBool :: sec_jac_update ! flag to check if secondary jacobian is updated
67) PetscReal, pointer :: cxm(:,:,:) ! stores the coeff of left diag in block triag system (ncomp x ncomp x ncells-1)
68) PetscReal, pointer :: cxp(:,:,:) ! stores the coeff of right diag in block triag system (ncomp x ncomp x ncells-1)
69) PetscReal, pointer :: cdl(:,:,:) ! stores the coeff of central diag in block triag system (ncomp x ncomp x ncells)
70) PetscReal, pointer :: r(:) ! stores the solution of the forward solve
71) PetscReal, pointer :: updated_conc(:,:) ! stores the update of molalities at end of each primary iteration
72) end type sec_transport_type
73)
74)
75) type, public :: sc_heat_type
76) type(sec_heat_type), pointer :: sec_heat_vars(:)
77) end type sc_heat_type
78)
79) type, public :: sc_rt_type
80) type(sec_transport_type), pointer :: sec_transport_vars(:)
81) end type sc_rt_type
82)
83) public :: SecondaryAuxHeatCreate, SecondaryAuxHeatDestroy, &
84) SecondaryAuxRTCreate, SecondaryAuxRTDestroy
85)
86) contains
87)
88) ! ************************************************************************** !
89)
90) function SecondaryAuxHeatCreate(option)
91) !
92) ! Allocate and initialize secondary continuum heat
93) ! auxiliary object
94) !
95) ! Author: Satish Karra, LANL
96) ! Date: 01/10/13
97) !
98)
99) use Option_module
100)
101) implicit none
102)
103) type(option_type) :: option
104) type(sc_heat_type), pointer :: SecondaryAuxHeatCreate
105)
106) type(sc_heat_type), pointer :: aux
107)
108) allocate(aux)
109) nullify(aux%sec_heat_vars)
110)
111) SecondaryAuxHeatCreate => aux
112)
113) end function SecondaryAuxHeatCreate
114)
115) ! ************************************************************************** !
116)
117) subroutine SecondaryAuxHeatDestroy(aux)
118) !
119) ! Deallocates a secondary continuum heat
120) ! auxiliary object
121) !
122) ! Author: Satish Karra, LANL
123) ! Date: 01/10/13
124) !
125)
126) implicit none
127)
128) type(sc_heat_type), pointer :: aux
129)
130) if (.not.associated(aux)) return
131)
132) deallocate(aux)
133) nullify(aux)
134)
135) end subroutine SecondaryAuxHeatDestroy
136)
137) ! ************************************************************************** !
138)
139) function SecondaryAuxRTCreate(option)
140) !
141) ! Allocate and initialize secondary continuum
142) ! reactive transport auxiliary object
143) !
144) ! Author: Satish Karra, LANL
145) ! Date: 01/10/13
146) !
147)
148) use Option_module
149)
150) implicit none
151)
152) type(option_type) :: option
153) type(sc_rt_type), pointer :: SecondaryAuxRTCreate
154)
155) type(sc_rt_type), pointer :: aux
156)
157) allocate(aux)
158) nullify(aux%sec_transport_vars)
159)
160) SecondaryAuxRTCreate => aux
161)
162) end function SecondaryAuxRTCreate
163)
164) ! ************************************************************************** !
165)
166) subroutine SecondaryAuxVarRTDestroy(auxvar)
167) !
168) ! Deallocates a secondary continuum reactive
169) ! transport auxiliary variable object
170) !
171) ! Author: Satish Karra, LANL
172) ! Date: 02/10/13
173) !
174)
175) use Utility_module, only: DeallocateArray
176)
177) implicit none
178)
179) type(sec_transport_type) :: auxvar
180)
181) call RTAuxVarDestroy(auxvar%sec_rt_auxvar)
182) call DeallocateArray(auxvar%area)
183) call DeallocateArray(auxvar%vol)
184) call DeallocateArray(auxvar%dm_plus)
185) call DeallocateArray(auxvar%dm_minus)
186) call DeallocateArray(auxvar%sec_jac)
187) call DeallocateArray(auxvar%cxm)
188) call DeallocateArray(auxvar%cxp)
189) call DeallocateArray(auxvar%cdl)
190) call DeallocateArray(auxvar%r)
191)
192) end subroutine SecondaryAuxVarRTDestroy
193)
194) ! ************************************************************************** !
195)
196) subroutine SecondaryAuxRTDestroy(aux)
197) !
198) ! Deallocates a secondary continuum reactive
199) ! transport auxiliary object
200) !
201) ! Author: Satish Karra, LANL
202) ! Date: 01/10/13
203) !
204)
205) implicit none
206)
207) type(sc_rt_type), pointer :: aux
208) PetscInt :: iaux
209)
210) if (.not.associated(aux)) return
211)
212) do iaux = 1, size(aux%sec_transport_vars)
213) call SecondaryAuxVarRTDestroy(aux%sec_transport_vars(iaux))
214) enddo
215)
216) deallocate(aux)
217) nullify(aux)
218)
219) end subroutine SecondaryAuxRTDestroy
220)
221) end module Secondary_Continuum_Aux_module
222)