realization_base.F90       coverage:  85.71 %func     84.38 %block


     1) module Realization_Base_class
     2) 
     3)   use Patch_module
     4) 
     5)   use Discretization_module
     6)   use Option_module
     7)   use Input_Aux_module
     8)   use Debug_module
     9)   use Output_Aux_module
    10)   use Field_module
    11)   use Reaction_Aux_module
    12)   use Data_Mediator_Base_class
    13)   use Communicator_Base_module
    14)   use Waypoint_module
    15) 
    16)   use PFLOTRAN_Constants_module
    17) 
    18)   implicit none
    19) 
    20)   private
    21) 
    22) #include "petsc/finclude/petscsys.h"
    23)   type, public :: realization_base_type
    24) 
    25)     PetscInt :: id
    26)     type(discretization_type), pointer :: discretization
    27)     class(communicator_type), pointer :: comm1
    28)     type(patch_list_type), pointer :: patch_list
    29)     type(patch_type), pointer :: patch
    30) 
    31)     type(option_type), pointer :: option
    32)     type(input_type), pointer :: input
    33)     type(field_type), pointer :: field
    34)     type(debug_type), pointer :: debug
    35)     type(output_option_type), pointer :: output_option
    36)     class(data_mediator_base_type), pointer :: flow_data_mediator_list
    37)     class(data_mediator_base_type), pointer :: tran_data_mediator_list
    38)     
    39)     type(reaction_type), pointer :: reaction
    40)     
    41)   end type realization_base_type
    42)   
    43)   public :: RealizationBaseInit, &
    44)             RealizationGetVariable, &
    45)             RealizGetVariableValueAtCell, &
    46)             RealizationSetVariable, &
    47)             RealizCreateTranMassTransferVec, &
    48)             RealizCreateFlowMassTransferVec, &
    49)             RealizationBaseStrip
    50) 
    51) contains
    52) 
    53) ! ************************************************************************** !
    54) 
    55) subroutine RealizationBaseInit(realization_base,option)
    56)   ! 
    57)   ! Initializes variables/objects in base realization class
    58)   ! 
    59)   ! Author: Glenn Hammond
    60)   ! Date: 01/16/13
    61)   ! 
    62) 
    63)   implicit none
    64)   
    65)   class(realization_base_type) :: realization_base
    66)   type(option_type), pointer :: option
    67)   
    68)   realization_base%id = 0
    69)   if (associated(option)) then
    70)     realization_base%option => option
    71)   else
    72)     realization_base%option => OptionCreate()
    73)   endif
    74)   nullify(realization_base%input)
    75)   realization_base%discretization => DiscretizationCreate()
    76)   nullify(realization_base%comm1)  
    77)   realization_base%field => FieldCreate()
    78)   realization_base%debug => DebugCreate()
    79)   nullify(realization_base%output_option)
    80) 
    81)   realization_base%patch_list => PatchCreateList()
    82) 
    83)   nullify(realization_base%reaction)
    84) 
    85)   nullify(realization_base%patch)
    86)   nullify(realization_base%flow_data_mediator_list)
    87)   nullify(realization_base%tran_data_mediator_list)
    88) 
    89) end subroutine RealizationBaseInit
    90) 
    91) ! ************************************************************************** !
    92) 
    93) subroutine RealizationGetVariable(realization_base,vec,ivar,isubvar,isubvar1)
    94)   ! 
    95)   ! Extracts variables indexed by ivar and isubvar from a
    96)   ! realization
    97)   ! 
    98)   ! Author: Glenn Hammond
    99)   ! Date: 09/12/08
   100)   ! 
   101) 
   102)   use Option_module
   103) 
   104)   implicit none
   105) 
   106) #include "petsc/finclude/petscvec.h"
   107) #include "petsc/finclude/petscvec.h90"
   108) 
   109)   class(realization_base_type) :: realization_base
   110)   Vec :: vec
   111)   PetscInt :: ivar
   112)   PetscInt :: isubvar
   113)   PetscInt, optional :: isubvar1
   114)   
   115)   call PatchGetVariable(realization_base%patch,realization_base%field, &
   116)                        realization_base%reaction,realization_base%option, &
   117)                        realization_base%output_option,vec,ivar,isubvar,isubvar1)
   118) 
   119) end subroutine RealizationGetVariable
   120) 
   121) ! ************************************************************************** !
   122) 
   123) function RealizGetVariableValueAtCell(realization_base,ivar,isubvar,ghosted_id, &
   124)                                      isubvar1)
   125)   ! 
   126)   ! Extracts variables indexed by ivar and isubvar
   127)   ! from a realization
   128)   ! 
   129)   ! Author: Glenn Hammond
   130)   ! Date: 09/12/08
   131)   ! 
   132) 
   133)   use Option_module
   134) 
   135)   implicit none
   136)   
   137)   PetscReal :: RealizGetVariableValueAtCell
   138)   class(realization_base_type) :: realization_base
   139)   PetscInt :: ivar
   140)   PetscInt :: isubvar
   141)   PetscInt, optional :: isubvar1
   142)   PetscInt :: ghosted_id
   143)   
   144)   PetscReal :: value
   145)   
   146)   value = PatchGetVariableValueAtCell(realization_base%patch,realization_base%field, &
   147)                                      realization_base%reaction, &
   148)                                      realization_base%option, &
   149)                                      realization_base%output_option, &
   150)                                      ivar,isubvar,ghosted_id,isubvar1)
   151)   RealizGetVariableValueAtCell = value
   152) 
   153) end function RealizGetVariableValueAtCell
   154) 
   155) ! ************************************************************************** !
   156) 
   157) subroutine RealizationSetVariable(realization_base,vec,vec_format,ivar,isubvar)
   158)   ! 
   159)   ! Sets variables indexed by ivar and isubvar in a
   160)   ! realization
   161)   ! 
   162)   ! Author: Glenn Hammond
   163)   ! Date: 09/12/08
   164)   ! 
   165) 
   166)   use Option_module
   167) 
   168)   implicit none
   169) 
   170) #include "petsc/finclude/petscvec.h"
   171) #include "petsc/finclude/petscvec.h90"
   172) 
   173)   class(realization_base_type) :: realization_base
   174)   Vec :: vec
   175)   PetscInt :: vec_format
   176)   PetscInt :: ivar
   177)   PetscInt :: isubvar
   178) 
   179)   call PatchSetVariable(realization_base%patch,realization_base%field, &
   180)                        realization_base%option, &
   181)                        vec,vec_format,ivar,isubvar)
   182) 
   183) end subroutine RealizationSetVariable
   184) 
   185) ! ************************************************************************** !
   186) 
   187) subroutine RealizCreateFlowMassTransferVec(this)
   188)   ! 
   189)   ! Creates the Vec where mass transfer is summed prior to being added to
   190)   ! the reactive transport residual.
   191)   ! 
   192)   ! Author: Glenn Hammond
   193)   ! Date: 03/20/15
   194)   ! 
   195)   implicit none
   196)   
   197)   class(realization_base_type) :: this
   198)   
   199)   PetscInt :: ierr
   200)   
   201)   if (this%field%flow_mass_transfer == 0) then
   202)     call VecDuplicate(this%field%flow_xx,this%field%flow_mass_transfer, &
   203)                       ierr);CHKERRQ(ierr)
   204)   endif
   205) 
   206) end subroutine RealizCreateFlowMassTransferVec
   207) 
   208) ! ************************************************************************** !
   209) 
   210) subroutine RealizCreateTranMassTransferVec(this)
   211)   ! 
   212)   ! Creates the Vec where mass transfer is summed prior to being added to
   213)   ! the reactive transport residual.
   214)   ! 
   215)   ! Author: Glenn Hammond
   216)   ! Date: 03/20/15
   217)   ! 
   218)   implicit none
   219)   
   220)   class(realization_base_type) :: this
   221)   
   222)   PetscInt :: ierr
   223)   
   224)   if (this%field%tran_mass_transfer == 0) then
   225)     call VecDuplicate(this%field%tran_xx,this%field%tran_mass_transfer, &
   226)                       ierr);CHKERRQ(ierr)
   227)   endif
   228) 
   229) end subroutine RealizCreateTranMassTransferVec
   230) 
   231) ! ************************************************************************** !
   232) 
   233) subroutine RealizationBaseStrip(this)
   234)   ! 
   235)   ! Deallocates members of base realization
   236)   ! 
   237)   ! Author: Glenn Hammond
   238)   ! Date: 01/13/14
   239)   ! 
   240)   use Data_Mediator_module
   241)   
   242)   implicit none
   243)   
   244)   class(realization_base_type) :: this
   245)   
   246)   call FieldDestroy(this%field)
   247) 
   248)   nullify(this%output_option)
   249)   
   250)   call DiscretizationDestroy(this%discretization)
   251)   
   252)   if (associated(this%comm1)) then
   253)     call this%comm1%Destroy()
   254)     deallocate(this%comm1)
   255)   endif
   256)   nullify(this%comm1)
   257)   
   258)   call PatchDestroyList(this%patch_list)
   259)   nullify(this%patch)
   260) 
   261)   call DebugDestroy(this%debug)
   262)   
   263)   call DataMediatorDestroy(this%flow_data_mediator_list)
   264)   call DataMediatorDestroy(this%tran_data_mediator_list)
   265) 
   266) end subroutine RealizationBaseStrip
   267) 
   268) end module Realization_Base_class

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