simulation_geomechanics.F90       coverage:  75.00 %func     64.89 %block


     1) module Simulation_Geomechanics_class
     2) 
     3)   use Option_module
     4)   use Simulation_Subsurface_class
     5)   use Geomechanics_Regression_module
     6)   use PMC_Base_class
     7)   use PMC_Subsurface_class
     8)   use PMC_Geomechanics_class
     9)   use Realization_Subsurface_class
    10)   use Geomechanics_Realization_class
    11)   use PFLOTRAN_Constants_module
    12)   use Waypoint_module
    13)   use Simulation_Aux_module
    14)   use Output_Aux_module 
    15)   
    16)   implicit none
    17) 
    18)   private
    19) 
    20) #include "petsc/finclude/petscsys.h"
    21) #include "petsc/finclude/petscvec.h"
    22) #include "petsc/finclude/petscvec.h90"
    23)   
    24)   type, public, extends(simulation_subsurface_type) :: &
    25)     simulation_geomechanics_type
    26)     ! pointer to geomechanics coupler
    27)     class(pmc_geomechanics_type), pointer :: geomech_process_model_coupler
    28)     class(realization_geomech_type), pointer :: geomech_realization
    29)     type(waypoint_list_type), pointer :: waypoint_list_geomechanics
    30)     type(geomechanics_regression_type), pointer :: geomech_regression
    31)   contains
    32)     procedure, public :: Init => GeomechanicsSimulationInit
    33)     procedure, public :: InitializeRun => GeomechanicsSimulationInitializeRun
    34)     procedure, public :: InputRecord => GeomechanicsSimInputRecord
    35)     procedure, public :: ExecuteRun => GeomechanicsSimulationExecuteRun
    36)     procedure, public :: FinalizeRun => GeomechanicsSimulationFinalizeRun
    37)     procedure, public :: Strip => GeomechanicsSimulationStrip
    38)   end type simulation_geomechanics_type
    39)   
    40)   public :: GeomechanicsSimulationCreate, &
    41)             GeomechanicsSimulationDestroy
    42)   
    43) contains
    44) 
    45) ! ************************************************************************** !
    46) 
    47) function GeomechanicsSimulationCreate(option)
    48)   ! 
    49)   ! This routine
    50)   ! 
    51)   ! Author: Gautam Bisht, LBNL
    52)   ! Date: 01/01/14
    53)   ! 
    54) 
    55)   use Option_module
    56) 
    57)   implicit none
    58) 
    59)   type(option_type), pointer :: option
    60) 
    61)   class(simulation_geomechanics_type), pointer :: GeomechanicsSimulationCreate
    62) 
    63)   print *,'GeomechanicsSimulationCreate'
    64) 
    65)   allocate(GeomechanicsSimulationCreate)
    66)   call GeomechanicsSimulationCreate%Init(option)
    67) 
    68) end function GeomechanicsSimulationCreate
    69) 
    70) ! ************************************************************************** !
    71) 
    72) subroutine GeomechanicsSimulationInit(this, option)
    73)   ! 
    74)   ! This routine
    75)   ! 
    76)   ! Author: Gautam Bisht, LBNL
    77)   ! Date: 01/01/14
    78)   ! Modified: Satish Karra, 06/01/2016
    79)   ! 
    80)   use Waypoint_module
    81)   use Option_module
    82) 
    83)   implicit none
    84) 
    85)   class(simulation_geomechanics_type) :: this
    86)   type(option_type), pointer :: option
    87) 
    88)   call SubsurfaceSimulationInit(this, option)
    89)   nullify(this%geomech_realization)
    90)   nullify(this%geomech_regression)
    91)   this%waypoint_list_geomechanics => WaypointListCreate()
    92) 
    93) end subroutine GeomechanicsSimulationInit
    94) 
    95) ! ************************************************************************** !
    96) 
    97) subroutine GeomechanicsSimulationInitializeRun(this)
    98)   ! 
    99)   ! This routine
   100)   ! 
   101)   ! Author: Gautam Bisht, LBNL
   102)   ! Date: 01/01/14
   103)   ! 
   104) 
   105)   use Output_module
   106)   use PMC_Geomechanics_class
   107) 
   108)   implicit none
   109) 
   110)   class(simulation_geomechanics_type) :: this
   111) 
   112)   call printMsg(this%option,'Simulation%InitializeRun()')
   113)   call this%process_model_coupler_list%InitializeRun()
   114) 
   115)   if (this%option%restart_flag) then
   116)     call printErrMsg(this%option,'add code for restart of GeomechanicsSimulation')
   117)   endif
   118) 
   119) end subroutine GeomechanicsSimulationInitializeRun
   120) 
   121) ! ************************************************************************** !
   122) 
   123) subroutine GeomechanicsSimInputRecord(this)
   124)   ! 
   125)   ! Writes ingested information to the input record file.
   126)   ! 
   127)   ! Author: Jenn Frederick, SNL
   128)   ! Date: 03/17/2016
   129)   ! 
   130)   use Output_module
   131)   
   132)   implicit none
   133)   
   134)   class(simulation_geomechanics_type) :: this
   135) 
   136)   character(len=MAXWORDLENGTH) :: word
   137)   PetscInt :: id = INPUT_RECORD_UNIT
   138)  
   139)   write(id,'(a29)',advance='no') 'simulation type: '
   140)   write(id,'(a)') 'geomechanics'
   141) 
   142)   ! print output file information
   143)   call OutputInputRecord(this%output_option,this%waypoint_list_geomechanics)
   144) 
   145) end subroutine GeomechanicsSimInputRecord
   146) 
   147) ! ************************************************************************** !
   148) 
   149) subroutine GeomechanicsSimulationExecuteRun(this)
   150)   ! 
   151)   ! This routine
   152)   ! 
   153)   ! Author: Gautam Bisht, LBNL
   154)   ! Date: 01/01/14
   155)   ! 
   156) 
   157)   use Waypoint_module
   158)   use Simulation_Base_class
   159)   use Timestepper_Base_class, only : TS_CONTINUE
   160) 
   161)   implicit none
   162)   
   163)   class(simulation_geomechanics_type) :: this
   164)   
   165)   PetscReal :: time
   166)   PetscReal :: final_time
   167)   PetscReal :: dt
   168)   PetscViewer :: viewer
   169) 
   170)   time = this%option%time
   171) 
   172)   final_time = SimulationGetFinalWaypointTime(this)
   173) 
   174)   call printMsg(this%option,'GeomechanicsSimulationExecuteRun()')
   175) 
   176)   if (.not.associated(this%geomech_realization)) then
   177)     call this%RunToTime(final_time)
   178) 
   179)   else
   180) 
   181)     ! If simulation is decoupled subsurfac-geomech simulation, set
   182)     ! dt_coupling to be dt_max
   183)     if (this%geomech_realization%dt_coupling == 0.d0) then
   184)       this%option%io_buffer = 'Set non-zero COUPLING_TIME_SIZE in GEOMECHANICS_TIME.'
   185)       call printErrMsg(this%option)
   186)     else
   187)       do
   188)         if (time + this%geomech_realization%dt_coupling > final_time) then
   189)           dt = final_time-time
   190)         else
   191)           dt = this%geomech_realization%dt_coupling
   192)         endif
   193) 
   194)         time = time + dt
   195)         this%geomech_process_model_coupler%timestepper%dt = dt
   196)         call this%RunToTime(time)
   197) 
   198)         if (this%stop_flag /= TS_CONTINUE) exit ! end simulation
   199)  
   200)         if (time >= final_time) exit
   201)       enddo
   202)     endif
   203)   endif
   204) 
   205) end subroutine GeomechanicsSimulationExecuteRun
   206) 
   207) 
   208) ! ************************************************************************** !
   209) 
   210) subroutine GeomechanicsSimulationFinalizeRun(this)
   211)   ! 
   212)   ! This routine
   213)   ! 
   214)   ! Author: Gautam Bisht, LBNL
   215)   ! Date: 01/01/14
   216)   ! Modified by Satish Karra, 06/22/16
   217) 
   218)   use Timestepper_Steady_class
   219) 
   220)   implicit none
   221) 
   222)   class(simulation_geomechanics_type) :: this
   223)   class(timestepper_steady_type), pointer :: geomech_timestepper
   224) 
   225)   call printMsg(this%option,'GeomechanicsSimulationFinalizeRun')
   226) 
   227)   call SubsurfaceFinalizeRun(this)
   228)   !call GeomechanicsFinalizeRun(this)
   229)   nullify(geomech_timestepper)
   230)   if (associated(this%geomech_process_model_coupler)) then
   231)     select type(ts => this%geomech_process_model_coupler%timestepper)
   232)       class is(timestepper_steady_type)
   233)         geomech_timestepper => ts
   234)     end select
   235)   endif
   236)   call GeomechanicsRegressionOutput(this%geomech_regression, &
   237)                                     this%geomech_realization, &
   238)                                     geomech_timestepper)  
   239) 
   240) 
   241) end subroutine GeomechanicsSimulationFinalizeRun
   242) 
   243) ! ************************************************************************** !
   244) 
   245) subroutine GeomechanicsSimulationStrip(this)
   246)   ! 
   247)   ! This routine
   248)   ! 
   249)   ! Author: Gautam Bisht, LBNL
   250)   ! Date: 01/01/14
   251)   ! Modified by Satish Karra, 06/01/16
   252)   ! 
   253) 
   254)   implicit none
   255)   
   256)   class(simulation_geomechanics_type) :: this
   257)   
   258)   call printMsg(this%option,'GeomechanicsSimulationStrip()')
   259)   
   260)   call SubsurfaceSimulationStrip(this)
   261)   call GeomechanicsRegressionDestroy(this%geomech_regression)
   262)   call WaypointListDestroy(this%waypoint_list_subsurface)
   263)   call WaypointListDestroy(this%waypoint_list_geomechanics)
   264)    
   265) end subroutine GeomechanicsSimulationStrip
   266) 
   267) ! ************************************************************************** !
   268) 
   269) subroutine GeomechanicsSimulationDestroy(simulation)
   270)   ! 
   271)   ! This routine
   272)   ! 
   273)   ! Author: Gautam Bisht, LBNL
   274)   ! Date: 01/01/14
   275)   ! 
   276) 
   277)   implicit none
   278)   
   279)   class(simulation_geomechanics_type), pointer :: simulation
   280)   
   281)   call printMsg(simulation%option,'GeomehanicsSimulationDestroy()')
   282)   
   283)   if (.not.associated(simulation)) return
   284)   
   285)   call simulation%Strip()
   286)   deallocate(simulation)
   287)   nullify(simulation)
   288)   
   289) end subroutine GeomechanicsSimulationDestroy
   290) 
   291) end module Simulation_Geomechanics_class

generated by
Intel(R) C++/Fortran Compiler code-coverage tool
Web-Page Owner: Nobody