pm_subsurface_flow.F90 coverage: 75.00 %func 81.13 %block
1) module PM_Subsurface_Flow_class
2)
3) use PM_Base_class
4) !geh: using Init_Subsurface_module here fails with gfortran (internal compiler error)
5) ! use Init_Subsurface_module
6) use Realization_Subsurface_class
7) use Communicator_Base_module
8) use Option_module
9)
10) use PFLOTRAN_Constants_module
11)
12) implicit none
13)
14) private
15)
16) #include "petsc/finclude/petscsys.h"
17)
18) #include "petsc/finclude/petscvec.h"
19) #include "petsc/finclude/petscvec.h90"
20) #include "petsc/finclude/petscmat.h"
21) #include "petsc/finclude/petscmat.h90"
22) #include "petsc/finclude/petscsnes.h"
23)
24) type, public, extends(pm_base_type) :: pm_subsurface_flow_type
25) class(realization_subsurface_type), pointer :: realization
26) class(communicator_type), pointer :: comm1
27) PetscBool :: store_porosity_for_ts_cut
28) PetscBool :: store_porosity_for_transport
29) PetscBool :: check_post_convergence
30) ! these govern the size of subsequent time steps
31) PetscReal :: max_pressure_change
32) PetscReal :: max_temperature_change
33) PetscReal :: max_saturation_change
34) PetscReal :: max_xmol_change
35) PetscReal :: pressure_change_governor
36) PetscReal :: temperature_change_governor
37) PetscReal :: saturation_change_governor
38) PetscReal :: xmol_change_governor
39) PetscReal :: cfl_governor
40) ! these limit (truncate) the maximum change in a Newton iteration
41) ! truncation occurs within PMXXXCheckUpdatePre
42) PetscReal :: pressure_dampening_factor
43) PetscReal :: saturation_change_limit
44) PetscReal :: pressure_change_limit
45) PetscReal :: temperature_change_limit
46) contains
47) !geh: commented out subroutines can only be called externally
48) procedure, public :: Setup => PMSubsurfaceFlowSetup
49) procedure, public :: SetupSolvers => PMSubsurfaceFlowSetupSolvers
50) procedure, public :: PMSubsurfaceFlowSetRealization
51) procedure, public :: InitializeRun => PMSubsurfaceFlowInitializeRun
52) ! procedure, public :: FinalizeRun => PMSubsurfaceFlowFinalizeRun
53) ! procedure, public :: InitializeTimestep => PMSubsurfaceFlowInitializeTimestep
54) procedure, public :: FinalizeTimestep => PMSubsurfaceFlowFinalizeTimestep
55) procedure, public :: PreSolve => PMSubsurfaceFlowPreSolve
56) procedure, public :: PostSolve => PMSubsurfaceFlowPostSolve
57) procedure, public :: AcceptSolution => PMSubsurfaceFlowAcceptSolution
58) ! procedure, public :: TimeCut => PMSubsurfaceFlowTimeCut
59) ! procedure, public :: UpdateSolution => PMSubsurfaceFlowUpdateSolution
60) procedure, public :: UpdateAuxvars => PMSubsurfaceFlowUpdateAuxvars
61) procedure, public :: CheckpointBinary => PMSubsurfaceFlowCheckpointBinary
62) procedure, public :: RestartBinary => PMSubsurfaceFlowRestartBinary
63) #if defined(PETSC_HAVE_HDF5)
64) procedure, public :: CheckpointHDF5 => PMSubsurfaceFlowCheckpointHDF5
65) procedure, public :: RestartHDF5 => PMSubsurfaceFlowRestartHDF5
66) #endif
67) procedure, public :: InputRecord => PMSubsurfaceFlowInputRecord
68) ! procedure, public :: Destroy => PMSubsurfaceFlowDestroy
69) end type pm_subsurface_flow_type
70)
71) public :: PMSubsurfaceFlowCreate, &
72) PMSubsurfaceFlowSetup, &
73) PMSubsurfaceFlowSetupSolvers, &
74) PMSubsurfaceFlowInitializeTimestepA, &
75) PMSubsurfaceFlowInitializeTimestepB, &
76) PMSubsurfaceFlowInitializeRun, &
77) PMSubsurfaceFlowUpdateSolution, &
78) PMSubsurfaceFlowUpdatePropertiesNI, &
79) PMSubsurfaceFlowTimeCut, &
80) PMSubsurfaceFlowLimitDTByCFL, &
81) PMSubsurfaceFlowCheckpointBinary, &
82) PMSubsurfaceFlowRestartBinary, &
83) PMSubsurfaceFlowReadSelectCase, &
84) PMSubsurfaceFlowDestroy
85)
86) contains
87)
88) ! ************************************************************************** !
89)
90) subroutine PMSubsurfaceFlowCreate(this)
91) !
92) ! Intializes shared members of subsurface process models
93) !
94) ! Author: Glenn Hammond
95) ! Date: 04/21/14
96)
97) implicit none
98)
99) class(pm_subsurface_flow_type) :: this
100)
101) nullify(this%realization)
102) nullify(this%comm1)
103) this%store_porosity_for_ts_cut = PETSC_FALSE
104) this%store_porosity_for_transport = PETSC_FALSE
105) this%check_post_convergence = PETSC_FALSE
106)
107) ! defaults
108) this%max_pressure_change = 0.d0
109) this%max_temperature_change = 0.d0
110) this%max_saturation_change = 0.d0
111) this%max_xmol_change = 0.d0
112) this%pressure_change_governor = 5.d5
113) this%temperature_change_governor = 5.d0
114) this%saturation_change_governor = 0.5d0
115) this%xmol_change_governor = 1.d0
116) this%cfl_governor = UNINITIALIZED_DOUBLE
117) this%pressure_dampening_factor = UNINITIALIZED_DOUBLE
118) this%saturation_change_limit = UNINITIALIZED_DOUBLE
119) this%pressure_change_limit = UNINITIALIZED_DOUBLE
120) this%temperature_change_limit = UNINITIALIZED_DOUBLE
121)
122) call PMBaseInit(this)
123)
124) end subroutine PMSubsurfaceFlowCreate
125)
126) ! ************************************************************************** !
127)
128) subroutine PMSubsurfaceFlowReadSelectCase(this,input,keyword,found,option)
129) !
130) ! Reads input file parameters associated with the subsurface flow process
131) ! model
132) !
133) ! Author: Glenn Hammond
134) ! Date: 01/05/16
135)
136) use Input_Aux_module
137) use String_module
138) use Option_module
139)
140) implicit none
141)
142) class(pm_subsurface_flow_type) :: this
143) type(input_type) :: input
144)
145) character(len=MAXWORDLENGTH) :: keyword
146) PetscBool :: found
147) type(option_type) :: option
148)
149) found = PETSC_TRUE
150) select case(trim(keyword))
151)
152) case('MAX_PRESSURE_CHANGE')
153) call InputReadDouble(input,option,this%pressure_change_governor)
154) call InputDefaultMsg(input,option,'dpmxe')
155)
156) case('MAX_TEMPERATURE_CHANGE')
157) call InputReadDouble(input,option,this%temperature_change_governor)
158) call InputDefaultMsg(input,option,'dtmpmxe')
159)
160) case('MAX_CONCENTRATION_CHANGE')
161) call InputReadDouble(input,option,this%xmol_change_governor)
162) call InputDefaultMsg(input,option,'dcmxe')
163)
164) case('MAX_SATURATION_CHANGE')
165) call InputReadDouble(input,option,this%saturation_change_governor)
166) call InputDefaultMsg(input,option,'dsmxe')
167)
168) case('PRESSURE_DAMPENING_FACTOR')
169) call InputReadDouble(input,option,this%pressure_dampening_factor)
170) call InputErrorMsg(input,option,'PRESSURE_DAMPENING_FACTOR', &
171) 'SUBSURFACE_FLOW OPTIONS')
172)
173) case('SATURATION_CHANGE_LIMIT')
174) call InputReadDouble(input,option,this%saturation_change_limit)
175) call InputErrorMsg(input,option,'SATURATION_CHANGE_LIMIT', &
176) 'SUBSURFACE_FLOW OPTIONS')
177)
178) case('PRESSURE_CHANGE_LIMIT')
179) call InputReadDouble(input,option,this%pressure_change_limit)
180) call InputErrorMsg(input,option,'PRESSURE_CHANGE_LIMIT', &
181) 'SUBSURFACE_FLOW OPTIONS')
182)
183) case('TEMPERATURE_CHANGE_LIMIT')
184) call InputReadDouble(input,option,this%temperature_change_limit)
185) call InputErrorMsg(input,option,'TEMPERATURE_CHANGE_LIMIT', &
186) 'SUBSURFACE_FLOW OPTIONS')
187)
188) case('MAX_CFL')
189) call InputReadDouble(input,option,this%cfl_governor)
190) call InputErrorMsg(input,option,'MAX_CFL', &
191) 'SUBSURFACE_FLOW OPTIONS')
192)
193) case('NUMERICAL_JACOBIAN')
194) option%flow%numerical_derivatives = PETSC_TRUE
195)
196) case default
197) found = PETSC_FALSE
198) end select
199)
200) end subroutine PMSubsurfaceFlowReadSelectCase
201)
202) ! ************************************************************************** !
203)
204) subroutine PMSubsurfaceFlowSetup(this)
205) !
206) ! Initializes variables associated with subsurface process models
207) !
208) ! Author: Glenn Hammond
209) ! Date: 04/21/14
210)
211) use Discretization_module
212) use Communicator_Structured_class
213) use Communicator_Unstructured_class
214) use Grid_module
215)
216) implicit none
217)
218) class(pm_subsurface_flow_type) :: this
219)
220) PetscErrorCode :: ierr
221)
222) ! set the communicator
223) this%comm1 => this%realization%comm1
224) if (associated(this%realization%reaction)) then
225) if (this%realization%reaction%update_porosity .or. &
226) this%realization%reaction%update_tortuosity .or. &
227) this%realization%reaction%update_permeability .or. &
228) this%realization%reaction%update_mnrl_surf_with_porosity) then
229) this%store_porosity_for_ts_cut = PETSC_TRUE
230) this%store_porosity_for_transport = PETSC_TRUE
231) endif
232) endif
233) if (this%option%flow%transient_porosity) then
234) this%store_porosity_for_ts_cut = PETSC_TRUE
235) if (this%option%ntrandof > 0) then
236) this%store_porosity_for_transport = PETSC_TRUE
237) endif
238) endif
239)
240) end subroutine PMSubsurfaceFlowSetup
241)
242) ! ************************************************************************** !
243)
244) subroutine PMSubsurfaceFlowSetupSolvers(this,solver)
245) !
246) ! Sets up SNES solvers.
247) !
248) ! Author: Glenn Hammond
249) ! Date: 12/03/14
250)
251) use Solver_module
252)
253) implicit none
254)
255) class(pm_subsurface_flow_type) :: this
256) type(solver_type) :: solver
257)
258) PetscErrorCode :: ierr
259)
260) end subroutine PMSubsurfaceFlowSetupSolvers
261)
262) ! ************************************************************************** !
263)
264) subroutine PMSubsurfaceFlowSetRealization(this,realization)
265) !
266) ! Author: Glenn Hammond
267) ! Date: 04/21/14
268)
269) use Realization_Subsurface_class
270) use Grid_module
271)
272) implicit none
273)
274) class(pm_subsurface_flow_type) :: this
275) class(realization_subsurface_type), pointer :: realization
276)
277) this%realization => realization
278) this%realization_base => realization
279)
280) this%solution_vec = realization%field%flow_xx
281) this%residual_vec = realization%field%flow_r
282)
283) end subroutine PMSubsurfaceFlowSetRealization
284)
285) ! ************************************************************************** !
286)
287) recursive subroutine PMSubsurfaceFlowInitializeRun(this)
288) !
289) ! Initializes the time stepping
290) !
291) ! Author: Glenn Hammond
292) ! Date: 04/21/14
293) use Condition_Control_module
294) use Material_module
295) use Variables_module, only : POROSITY
296) use Material_Aux_class, only : POROSITY_MINERAL, POROSITY_CURRENT
297)
298) implicit none
299)
300) class(pm_subsurface_flow_type) :: this
301) PetscBool :: update_initial_porosity
302)
303) ! must come before RealizUnInitializedVarsTran
304) call RealizSetSoilReferencePressure(this%realization)
305) ! check for uninitialized flow variables
306) call RealizUnInitializedVarsTran(this%realization)
307)
308) ! overridden in pm_general only
309) if (associated(this%realization%reaction)) then
310) if (this%realization%reaction%update_porosity) then
311) call RealizationCalcMineralPorosity(this%realization)
312) call MaterialGetAuxVarVecLoc(this%realization%patch%aux%Material, &
313) this%realization%field%work_loc, &
314) POROSITY,POROSITY_MINERAL)
315) call this%comm1%LocalToGlobal(this%realization%field%work_loc, &
316) this%realization%field%porosity0)
317) endif
318) endif
319)
320) ! restart
321) if (this%option%restart_flag .and. this%option%overwrite_restart_flow) then
322) call RealizationRevertFlowParameters(this%realization)
323) !geh: for testing only. In general, we only revert parameter, not flow.
324) ! call CondControlAssignFlowInitCond(this%realization)
325) ! call this%UpdateAuxVars()
326) endif
327) ! update material properties that are a function of mineral vol fracs
328) update_initial_porosity = PETSC_TRUE
329) if (associated(this%realization%reaction)) then
330) if (this%realization%reaction%update_porosity .or. &
331) this%realization%reaction%update_tortuosity .or. &
332) this%realization%reaction%update_permeability .or. &
333) this%realization%reaction%update_mineral_surface_area) then
334) call RealizationUpdatePropertiesTS(this%realization)
335) update_initial_porosity = PETSC_FALSE
336) endif
337) endif
338) if (update_initial_porosity) then
339) call this%comm1%GlobalToLocal(this%realization%field%porosity0, &
340) this%realization%field%work_loc)
341) ! push values to porosity_base
342) call MaterialSetAuxVarVecLoc(this%realization%patch%aux%Material, &
343) this%realization%field%work_loc, &
344) POROSITY,POROSITY_MINERAL)
345) call MaterialSetAuxVarVecLoc(this%realization%patch%aux%Material, &
346) this%realization%field%work_loc, &
347) POROSITY,POROSITY_CURRENT)
348) endif
349)
350) call this%PreSolve()
351) call this%UpdateAuxVars()
352) call this%UpdateSolution()
353)
354) end subroutine PMSubsurfaceFlowInitializeRun
355)
356) ! ************************************************************************** !
357)
358) subroutine PMSubsurfaceFlowInitializeTimestepA(this)
359) !
360) ! Author: Glenn Hammond
361) ! Date: 04/21/14
362)
363) use Global_module
364) use Variables_module, only : POROSITY, PERMEABILITY_X, &
365) PERMEABILITY_Y, PERMEABILITY_Z
366) use Material_module
367) use Material_Aux_class, only : POROSITY_MINERAL
368)
369) implicit none
370)
371) class(pm_subsurface_flow_type) :: this
372)
373) this%option%flow_dt = this%option%dt
374)
375) if (this%store_porosity_for_ts_cut) then
376) ! store base properties for reverting at time step cut
377) call MaterialGetAuxVarVecLoc(this%realization%patch%aux%Material, &
378) this%realization%field%work_loc,POROSITY, &
379) POROSITY_MINERAL)
380) call this%comm1%LocalToGlobal(this%realization%field%work_loc, &
381) this%realization%field%porosity_base_store)
382) endif
383)
384) end subroutine PMSubsurfaceFlowInitializeTimestepA
385)
386) ! ************************************************************************** !
387)
388) subroutine PMSubsurfaceFlowInitializeTimestepB(this)
389) !
390) ! Author: Glenn Hammond
391) ! Date: 04/21/14
392)
393) use Global_module
394) use Variables_module, only : POROSITY, PERMEABILITY_X, &
395) PERMEABILITY_Y, PERMEABILITY_Z
396) use Material_module
397) use Material_Aux_class, only : POROSITY_CURRENT
398)
399) implicit none
400)
401) class(pm_subsurface_flow_type) :: this
402)
403) if (this%option%ntrandof > 0) then ! store initial saturations for transport
404) call GlobalUpdateAuxVars(this%realization,TIME_T,this%option%time)
405) if (this%store_porosity_for_transport) then
406) ! store time t properties for transport
407) call MaterialGetAuxVarVecLoc(this%realization%patch%aux%Material, &
408) this%realization%field%work_loc,POROSITY, &
409) POROSITY_CURRENT)
410) call this%comm1%LocalToGlobal(this%realization%field%work_loc, &
411) this%realization%field%porosity_t)
412) endif
413) endif
414)
415) ! update porosity for time t+dt
416) if (associated(this%realization%reaction)) then
417) if (this%realization%reaction%update_porosity .or. &
418) this%realization%reaction%update_tortuosity .or. &
419) this%realization%reaction%update_permeability .or. &
420) this%realization%reaction%update_mineral_surface_area) then
421) call RealizationUpdatePropertiesTS(this%realization)
422) endif
423) endif
424)
425) end subroutine PMSubsurfaceFlowInitializeTimestepB
426)
427) ! ************************************************************************** !
428)
429) subroutine PMSubsurfaceFlowPreSolve(this)
430) !
431) ! Author: Glenn Hammond
432) ! Date: 04/21/14
433)
434) use Global_module
435)
436) implicit none
437)
438) class(pm_subsurface_flow_type) :: this
439)
440) this%option%io_buffer = 'PMSubsurfaceFlowPreSolve() must be extended.'
441) call printErrMsg(this%option)
442)
443) end subroutine PMSubsurfaceFlowPreSolve
444)
445) ! ************************************************************************** !
446)
447) subroutine PMSubsurfaceFlowPostSolve(this)
448) !
449) ! PMSubsurfaceFlowUpdatePostSolve:
450) !
451) ! Author: Glenn Hammond
452) ! Date: 03/14/13
453) !
454)
455) use Global_module
456)
457) implicit none
458)
459) class(pm_subsurface_flow_type) :: this
460)
461) this%option%io_buffer = 'PMSubsurfaceFlowPostSolve() must be extended.'
462) call printErrMsg(this%option)
463)
464) end subroutine PMSubsurfaceFlowPostSolve
465)
466) ! ************************************************************************** !
467)
468) function PMSubsurfaceFlowAcceptSolution(this)
469) !
470) ! Author: Glenn Hammond
471) ! Date: 04/21/14
472)
473) implicit none
474)
475) class(pm_subsurface_flow_type) :: this
476)
477) PetscBool :: PMSubsurfaceFlowAcceptSolution
478)
479) ! do nothing
480) PMSubsurfaceFlowAcceptSolution = PETSC_TRUE
481)
482) end function PMSubsurfaceFlowAcceptSolution
483)
484) ! ************************************************************************** !
485)
486) subroutine PMSubsurfaceFlowUpdatePropertiesNI(this)
487) !
488) ! Updates parameters/properties at each Newton iteration
489) !
490) ! Author: Glenn Hammond
491) ! Date: 04/21/14
492)
493) implicit none
494)
495) class(pm_subsurface_flow_type) :: this
496)
497) call RealizationUpdatePropertiesNI(this%realization)
498)
499) end subroutine PMSubsurfaceFlowUpdatePropertiesNI
500)
501) ! ************************************************************************** !
502)
503) subroutine PMSubsurfaceFlowTimeCut(this)
504) !
505) ! Author: Glenn Hammond
506) ! Date: 04/21/14
507) use Material_module
508) use Variables_module, only : POROSITY
509) use Material_Aux_class, only : POROSITY_MINERAL
510)
511) implicit none
512)
513) class(pm_subsurface_flow_type) :: this
514)
515) PetscErrorCode :: ierr
516)
517) this%option%flow_dt = this%option%dt
518) call VecCopy(this%realization%field%flow_yy, &
519) this%realization%field%flow_xx,ierr);CHKERRQ(ierr)
520) if (this%store_porosity_for_transport) then
521) ! store base properties for reverting at time step cut
522) call this%comm1%GlobalToLocal(this%realization%field%porosity_base_store, &
523) this%realization%field%work_loc)
524) call MaterialSetAuxVarVecLoc(this%realization%patch%aux%Material, &
525) this%realization%field%work_loc,POROSITY, &
526) POROSITY_MINERAL)
527) endif
528)
529) end subroutine PMSubsurfaceFlowTimeCut
530)
531) ! ************************************************************************** !
532)
533) subroutine PMSubsurfaceFlowLimitDTByCFL(this,dt)
534) !
535) ! Author: Glenn Hammond
536) ! Date: 05/09/16
537) !
538) use Option_module
539) use Output_Aux_module
540)
541) implicit none
542)
543) class(pm_subsurface_flow_type) :: this
544) PetscReal :: dt
545)
546) PetscReal :: max_dt_cfl_1
547) PetscReal :: prev_dt
548) type(output_option_type), pointer :: output_option
549)
550) if (Initialized(this%cfl_governor)) then
551) call RealizationCalculateCFL1Timestep(this%realization,max_dt_cfl_1)
552) if (dt/this%cfl_governor > max_dt_cfl_1) then
553) prev_dt = dt
554) dt = max_dt_cfl_1*this%cfl_governor
555) output_option => this%realization%output_option
556) if (OptionPrintToScreen(this%option)) then
557) write(*, &
558) '(" CFL Limiting (",f4.1,"): ",1pe12.4," -> ",1pe12.4," [",a,"]")') &
559) this%cfl_governor,prev_dt/output_option%tconv, &
560) dt/output_option%tconv,trim(output_option%tunit)
561) endif
562) if (OptionPrintToFile(this%option)) then
563) write(this%option%fid_out, &
564) '(" CFL Limiting (",f4.1,"): ",1pe12.4," -> ",1pe12.4," [",a,"]")') &
565) this%cfl_governor,prev_dt/output_option%tconv, &
566) dt/output_option%tconv,trim(output_option%tunit)
567) endif
568) endif
569) endif
570)
571) end subroutine PMSubsurfaceFlowLimitDTByCFL
572)
573) ! ************************************************************************** !
574)
575) subroutine PMSubsurfaceFlowFinalizeTimestep(this)
576) !
577) ! Author: Glenn Hammond
578) ! Date: 04/21/14
579) use Material_module
580) use Global_module
581) use Variables_module, only : POROSITY
582) use Material_Aux_class, only : POROSITY_CURRENT
583)
584) implicit none
585)
586) class(pm_subsurface_flow_type) :: this
587)
588) if (this%option%ntrandof > 0) then
589) ! store final saturations, etc. for transport
590) call GlobalUpdateAuxVars(this%realization,TIME_TpDT,this%option%time)
591) if (this%store_porosity_for_transport) then
592) ! store time t properties for transport
593) call MaterialGetAuxVarVecLoc(this%realization%patch%aux%Material, &
594) this%realization%field%work_loc,POROSITY, &
595) POROSITY_CURRENT)
596) call this%comm1%LocalToGlobal(this%realization%field%work_loc, &
597) this%realization%field%porosity_tpdt)
598) endif
599) endif
600)
601) call this%MaxChange()
602)
603) end subroutine PMSubsurfaceFlowFinalizeTimestep
604)
605) ! ************************************************************************** !
606)
607) subroutine PMSubsurfaceFlowUpdateSolution(this)
608) !
609) ! Author: Glenn Hammond
610) ! Date: 04/21/14
611)
612) use Condition_module
613) use Integral_Flux_module
614) use SrcSink_Sandbox_module
615)
616) implicit none
617)
618) class(pm_subsurface_flow_type) :: this
619)
620) PetscBool :: force_update_flag = PETSC_FALSE
621) PetscErrorCode :: ierr
622)
623) call VecCopy(this%realization%field%flow_xx, &
624) this%realization%field%flow_yy,ierr);CHKERRQ(ierr)
625)
626) ! begin from RealizationUpdate()
627) call FlowConditionUpdate(this%realization%flow_conditions, &
628) this%realization%option, &
629) this%realization%option%time)
630) call SSSandboxUpdate(ss_sandbox_list,this%realization%option%time, &
631) this%realization%option,this%realization%output_option)
632) ! right now, RealizUpdateAllCouplerAuxVars only updates flow
633) call RealizUpdateAllCouplerAuxVars(this%realization,force_update_flag)
634) if (associated(this%realization%uniform_velocity_dataset)) then
635) call RealizUpdateUniformVelocity(this%realization)
636) endif
637) if (this%option%flow%store_fluxes) then
638) call IntegralFluxUpdate(this%realization%patch%integral_flux_list, &
639) this%realization%patch%internal_flow_fluxes, &
640) this%realization%patch%boundary_flow_fluxes, &
641) INTEGRATE_FLOW,this%option)
642) endif
643) ! end from RealizationUpdate()
644)
645) end subroutine PMSubsurfaceFlowUpdateSolution
646)
647) ! ************************************************************************** !
648)
649) subroutine PMSubsurfaceFlowUpdateAuxVars(this)
650) !
651) ! Author: Glenn Hammond
652) ! Date: 04/21/14
653)
654) implicit none
655)
656) class(pm_subsurface_flow_type) :: this
657)
658) this%option%io_buffer = 'PMSubsurfaceFlowUpdateAuxVars() must be extended.'
659) call printErrMsg(this%option)
660)
661) end subroutine PMSubsurfaceFlowUpdateAuxVars
662)
663) ! ************************************************************************** !
664)
665) subroutine PMSubsurfaceFlowCheckpointBinary(this,viewer)
666) !
667) ! Checkpoints data associated with Subsurface PM
668) !
669) ! Author: Glenn Hammond
670) ! Date: 04/21/14
671)
672) use Checkpoint_module
673)
674) implicit none
675) #include "petsc/finclude/petscviewer.h"
676)
677) class(pm_subsurface_flow_type) :: this
678) PetscViewer :: viewer
679)
680) call CheckpointFlowProcessModelBinary(viewer,this%realization)
681)
682) end subroutine PMSubsurfaceFlowCheckpointBinary
683)
684) ! ************************************************************************** !
685)
686) subroutine PMSubsurfaceFlowRestartBinary(this,viewer)
687) !
688) ! Restarts data associated with Subsurface PM
689) !
690) ! Author: Glenn Hammond
691) ! Date: 04/21/14
692)
693) use Checkpoint_module
694)
695) implicit none
696) #include "petsc/finclude/petscviewer.h"
697)
698) class(pm_subsurface_flow_type) :: this
699) PetscViewer :: viewer
700)
701) call RestartFlowProcessModelBinary(viewer,this%realization)
702) call this%UpdateAuxVars()
703) call this%UpdateSolution()
704)
705) end subroutine PMSubsurfaceFlowRestartBinary
706)
707) ! ************************************************************************** !
708)
709) #if defined(PETSC_HAVE_HDF5)
710) subroutine PMSubsurfaceFlowCheckpointHDF5(this, pm_grp_id)
711) !
712) ! Checkpoints data associated with Subsurface PM
713) !
714) ! Author: Gautam Bisht, LBNL
715) ! Date: 07/30/15
716)
717) use Checkpoint_module
718) use hdf5
719)
720) implicit none
721)
722) class(pm_subsurface_flow_type) :: this
723) #if defined(SCORPIO_WRITE)
724) integer :: pm_grp_id
725) #else
726) integer(HID_T) :: pm_grp_id
727) #endif
728)
729) call CheckpointFlowProcessModelHDF5(pm_grp_id, this%realization)
730)
731) end subroutine PMSubsurfaceFlowCheckpointHDF5
732)
733) ! ************************************************************************** !
734)
735) subroutine PMSubsurfaceFlowRestartHDF5(this, pm_grp_id)
736) !
737) ! Checkpoints data associated with Subsurface PM
738) !
739) ! Author: Gautam Bisht, LBNL
740) ! Date: 07/30/15
741)
742) use Checkpoint_module
743) use hdf5
744)
745) implicit none
746)
747) class(pm_subsurface_flow_type) :: this
748) #if defined(SCORPIO_WRITE)
749) integer :: pm_grp_id
750) #else
751) integer(HID_T) :: pm_grp_id
752) #endif
753)
754) call RestartFlowProcessModelHDF5(pm_grp_id, this%realization)
755) call this%UpdateAuxVars()
756) call this%UpdateSolution()
757)
758)
759) end subroutine PMSubsurfaceFlowRestartHDF5
760) #endif
761)
762) ! ************************************************************************** !
763)
764) recursive subroutine PMSubsurfaceFlowFinalizeRun(this)
765) !
766) ! Finalizes the time stepping
767) !
768) ! Author: Glenn Hammond
769) ! Date: 04/21/14
770)
771) implicit none
772)
773) class(pm_subsurface_flow_type) :: this
774)
775) ! do something here
776)
777) if (associated(this%next)) then
778) call this%next%FinalizeRun()
779) endif
780)
781) end subroutine PMSubsurfaceFlowFinalizeRun
782)
783) ! ************************************************************************** !
784)
785) subroutine PMSubsurfaceFlowInputRecord(this)
786) !
787) ! Writes ingested information to the input record file.
788) !
789) ! Author: Jenn Frederick, SNL
790) ! Date: 03/21/2016
791) !
792)
793) implicit none
794)
795) class(pm_subsurface_flow_type) :: this
796)
797) character(len=MAXWORDLENGTH) :: word
798) PetscInt :: id
799)
800) id = INPUT_RECORD_UNIT
801)
802) write(id,'(a29)',advance='no') 'pm: '
803) write(id,'(a)') this%name
804)
805) end subroutine PMSubsurfaceFlowInputRecord
806)
807) ! ************************************************************************** !
808)
809) subroutine PMSubsurfaceFlowDestroy(this)
810) !
811) ! Destroys Subsurface process model
812) !
813) ! Author: Glenn Hammond
814) ! Date: 04/21/14
815)
816) implicit none
817)
818) class(pm_subsurface_flow_type) :: this
819)
820) ! destroyed in realization
821) nullify(this%comm1)
822) nullify(this%option)
823) nullify(this%output_option)
824)
825) end subroutine PMSubsurfaceFlowDestroy
826)
827) end module PM_Subsurface_Flow_class