geomechanics_field.F90       coverage:  100.00 %func     74.55 %block


     1) module Geomechanics_Field_module
     2) 
     3)   use PFLOTRAN_Constants_module
     4) ! IMPORTANT NOTE: This module can have no dependencies on other modules!!!
     5)  
     6)   implicit none
     7) 
     8)   private
     9) 
    10) #include "petsc/finclude/petscsys.h"
    11) #include "petsc/finclude/petscvec.h"
    12) #include "petsc/finclude/petscvec.h90"
    13) 
    14)   type, public :: geomech_field_type
    15)     Vec :: work
    16)     Vec :: work_loc
    17)     ! residual vectors
    18)     Vec :: disp_r
    19)     Vec :: press          ! store pressure from subsurf
    20)     Vec :: press_loc
    21)     Vec :: press_init_loc ! store initial pressure
    22)     Vec :: temp           ! store temperature from subsurf
    23)     Vec :: temp_loc
    24)     Vec :: temp_init_loc  ! store initial temperature
    25)     Vec :: subsurf_vec_1dof ! MPI
    26)     Vec :: imech_loc
    27)     Vec :: strain
    28)     Vec :: strain_loc
    29)     Vec :: stress
    30)     Vec :: stress_loc
    31)     Vec :: strain_subsurf  ! Stores strains after scattering from geomech to subsurf
    32)     Vec :: stress_subsurf  ! Stores stresses after scattering from geomech to subsurf
    33)     Vec :: strain_subsurf_loc
    34)     Vec :: stress_subsurf_loc
    35)     
    36)     Vec :: porosity_init_loc
    37)     
    38)     ! Solution vectors (xx = current iterate)
    39)     Vec :: disp_xx, disp_xx_loc
    40)     Vec :: disp_xx_init_loc
    41)   end type geomech_field_type
    42) 
    43)   public :: GeomechFieldCreate, &
    44)             GeomechFieldDestroy
    45) 
    46) contains
    47) 
    48) ! ************************************************************************** !
    49) 
    50) function GeomechFieldCreate()
    51)   ! 
    52)   ! Allocates and initializes a new geomechanics
    53)   ! Field object
    54)   ! 
    55)   ! Author: Satish Karra, LANL
    56)   ! Date: 06/05/13
    57)   ! 
    58) 
    59)   implicit none
    60)   
    61)   type(geomech_field_type), pointer :: GeomechFieldCreate
    62)   type(geomech_field_type), pointer :: geomech_field
    63)   
    64)   allocate(geomech_field)
    65) 
    66)   ! nullify PetscVecs
    67)   geomech_field%work = 0
    68)   geomech_field%work_loc = 0
    69)   
    70)   geomech_field%disp_r = 0
    71)   geomech_field%disp_xx = 0
    72)   geomech_field%disp_xx_loc = 0
    73)   geomech_field%disp_xx_init_loc = 0
    74)   
    75)   geomech_field%press = 0
    76)   geomech_field%press_loc = 0
    77)   geomech_field%press_init_loc = 0
    78)   geomech_field%temp = 0
    79)   geomech_field%temp_loc = 0
    80)   geomech_field%temp_init_loc = 0
    81)   geomech_field%subsurf_vec_1dof = 0
    82)   geomech_field%imech_loc = 0
    83) 
    84)   geomech_field%strain = 0
    85)   geomech_field%strain_loc = 0
    86)   geomech_field%stress = 0
    87)   geomech_field%stress_loc = 0 
    88) 
    89)   geomech_field%strain_subsurf = 0
    90)   geomech_field%stress_subsurf = 0
    91)   geomech_field%strain_subsurf_loc = 0
    92)   geomech_field%stress_subsurf_loc = 0
    93)   
    94)   geomech_field%porosity_init_loc = 0
    95) 
    96)   GeomechFieldCreate => geomech_field
    97) 
    98) end function GeomechFieldCreate
    99) 
   100) ! ************************************************************************** !
   101) 
   102) subroutine GeomechFieldDestroy(geomech_field)
   103)   ! 
   104)   ! Deallocates a geomechanics field object
   105)   ! 
   106)   ! Author: Satish Karra, LANL
   107)   ! Date: 06/05/13
   108)   ! 
   109) 
   110)   implicit none
   111)   
   112)   type(geomech_field_type), pointer :: geomech_field
   113)   PetscErrorCode :: ierr
   114)   
   115)   if (.not.associated(geomech_field)) return
   116)   
   117)   ! Destroy PetscVecs
   118)   if (geomech_field%work /= 0) then
   119)     call VecDestroy(geomech_field%work,ierr);CHKERRQ(ierr)
   120)   endif
   121)   if (geomech_field%work_loc  /= 0) then
   122)     call VecDestroy(geomech_field%work_loc,ierr);CHKERRQ(ierr)
   123)   endif
   124) 
   125)   if (geomech_field%disp_r /= 0) then
   126)     call VecDestroy(geomech_field%disp_r,ierr);CHKERRQ(ierr)
   127)   endif
   128)   if (geomech_field%disp_xx /= 0) then
   129)     call VecDestroy(geomech_field%disp_xx,ierr);CHKERRQ(ierr)
   130)   endif
   131)   if (geomech_field%disp_xx_loc /= 0) then
   132)     call VecDestroy(geomech_field%disp_xx_loc,ierr);CHKERRQ(ierr)
   133)   endif
   134)   if (geomech_field%disp_xx_init_loc /= 0) then
   135)     call VecDestroy(geomech_field%disp_xx_init_loc,ierr);CHKERRQ(ierr)
   136)   endif
   137)   
   138)   if (geomech_field%press /= 0) then
   139)     call VecDestroy(geomech_field%press,ierr);CHKERRQ(ierr)
   140)   endif
   141)   if (geomech_field%press_loc /= 0) then
   142)     call VecDestroy(geomech_field%press_loc,ierr);CHKERRQ(ierr)
   143)   endif
   144)   if (geomech_field%press_init_loc /= 0) then
   145)     call VecDestroy(geomech_field%press_init_loc,ierr);CHKERRQ(ierr)
   146)   endif
   147)   if (geomech_field%temp /= 0) then
   148)     call VecDestroy(geomech_field%temp,ierr);CHKERRQ(ierr)
   149)   endif
   150)   if (geomech_field%temp_loc /= 0) then
   151)     call VecDestroy(geomech_field%temp_loc,ierr);CHKERRQ(ierr)
   152)   endif
   153)   if (geomech_field%temp_init_loc /= 0) then
   154)     call VecDestroy(geomech_field%temp_init_loc,ierr);CHKERRQ(ierr)
   155)   endif
   156) 
   157)   if (geomech_field%subsurf_vec_1dof /= 0 ) then
   158)     call VecDestroy(geomech_field%subsurf_vec_1dof,ierr);CHKERRQ(ierr)
   159)   endif
   160)   if (geomech_field%imech_loc /= 0) then
   161)     call VecDestroy(geomech_field%imech_loc,ierr);CHKERRQ(ierr)
   162)   endif
   163) 
   164)   if (geomech_field%strain /= 0) then
   165)     call VecDestroy(geomech_field%strain,ierr);CHKERRQ(ierr)
   166)   endif
   167)   if (geomech_field%strain_loc /= 0) then
   168)     call VecDestroy(geomech_field%strain_loc,ierr);CHKERRQ(ierr)
   169)   endif
   170)   if (geomech_field%stress /= 0) then
   171)     call VecDestroy(geomech_field%stress,ierr);CHKERRQ(ierr)
   172)   endif
   173)   if (geomech_field%stress_loc /= 0) then
   174)     call VecDestroy(geomech_field%stress_loc,ierr);CHKERRQ(ierr)
   175)   endif
   176) 
   177)   if (geomech_field%strain_subsurf /= 0) then
   178)     call VecDestroy(geomech_field%strain_subsurf,ierr);CHKERRQ(ierr)
   179)   endif
   180)   if (geomech_field%stress_subsurf /= 0) then
   181)     call VecDestroy(geomech_field%stress_subsurf,ierr);CHKERRQ(ierr)
   182)   endif
   183)   if (geomech_field%strain_subsurf_loc /= 0) then
   184)     call VecDestroy(geomech_field%strain_subsurf_loc,ierr);CHKERRQ(ierr)
   185)   endif
   186)   if (geomech_field%stress_subsurf_loc /= 0) then
   187)     call VecDestroy(geomech_field%stress_subsurf_loc,ierr);CHKERRQ(ierr)
   188)   endif
   189) 
   190)   if (geomech_field%porosity_init_loc /= 0) then
   191)     call VecDestroy(geomech_field%porosity_init_loc,ierr);CHKERRQ(ierr)
   192)   endif
   193) 
   194)   if (associated(geomech_field)) deallocate(geomech_field)
   195)   nullify(geomech_field)
   196) 
   197) end subroutine GeomechFieldDestroy
   198) 
   199) end module Geomechanics_Field_module

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