reaction_mineral_aux.F90       coverage:  82.35 %func     81.88 %block


     1) module Reaction_Mineral_Aux_module
     2)   
     3)   use Reaction_Database_Aux_module
     4) 
     5)   use PFLOTRAN_Constants_module
     6) 
     7)   implicit none
     8)   
     9)   private 
    10) 
    11) #include "petsc/finclude/petscsys.h"
    12) 
    13)   ! mineral types
    14)   PetscInt, parameter, public :: MINERAL_REFERENCE = 1
    15)   PetscInt, parameter, public :: MINERAL_KINETIC = 2
    16)   PetscInt, parameter, public :: MINERAL_EQUILIBRIUM = 3
    17) 
    18)   type, public :: mineral_rxn_type
    19)     PetscInt :: id
    20)     PetscInt :: itype
    21)     character(len=MAXWORDLENGTH) :: name
    22)     PetscReal :: molar_volume
    23)     PetscReal :: molar_weight
    24)     PetscBool :: print_me
    25)     type(database_rxn_type), pointer :: dbaserxn
    26)     type(transition_state_rxn_type), pointer :: tstrxn
    27)     type(mineral_rxn_type), pointer :: next
    28)   end type mineral_rxn_type
    29) 
    30)   type, public :: transition_state_rxn_type
    31)     PetscReal :: min_scale_factor
    32)     PetscReal :: affinity_factor_sigma
    33)     PetscReal :: affinity_factor_beta
    34)     PetscReal :: affinity_threshold
    35)     PetscReal :: rate_limiter
    36)     PetscReal :: surf_area_vol_frac_pwr
    37)     PetscReal :: surf_area_porosity_pwr
    38)     PetscInt :: irreversible
    39)     PetscReal :: rate
    40)     PetscReal :: activation_energy
    41)     character(len=MAXWORDLENGTH) :: armor_min_name
    42)     PetscReal :: armor_pwr
    43)     PetscReal :: armor_crit_vol_frac
    44)     type(transition_state_prefactor_type), pointer :: prefactor
    45)     type(transition_state_rxn_type), pointer :: next
    46)   end type transition_state_rxn_type
    47)   
    48)   type, public :: transition_state_prefactor_type
    49)     type(ts_prefactor_species_type), pointer :: species
    50)     ! these supercede the those above in transition_state_rxn_type
    51)     PetscReal :: rate
    52)     PetscReal :: activation_energy
    53)     type(transition_state_prefactor_type), pointer :: next
    54)   end type transition_state_prefactor_type
    55) 
    56)   type, public :: ts_prefactor_species_type
    57)     character(len=MAXWORDLENGTH) :: name
    58)     PetscInt :: id
    59)     PetscReal :: alpha
    60)     PetscReal :: beta
    61)     PetscReal :: attenuation_coef
    62)     type(ts_prefactor_species_type), pointer :: next
    63)   end type ts_prefactor_species_type
    64)   
    65)   type, public :: mineral_constraint_type
    66)     ! Any changes here must be incorporated within ReactionProcessConstraint()
    67)     ! where constraints are reordered
    68)     character(len=MAXWORDLENGTH), pointer :: names(:)
    69)     PetscReal, pointer :: constraint_vol_frac(:)
    70)     PetscReal, pointer :: constraint_area(:)
    71)     character(len=MAXWORDLENGTH), pointer :: constraint_vol_frac_string(:)
    72)     character(len=MAXWORDLENGTH), pointer :: constraint_area_string(:)
    73)     PetscBool, pointer :: external_vol_frac_dataset(:)
    74)     PetscBool, pointer :: external_area_dataset(:)
    75)   end type mineral_constraint_type
    76)   
    77)   type, public :: mineral_type
    78)   
    79)     PetscInt :: nmnrl
    80)     PetscBool :: print_all
    81)     PetscBool :: print_saturation_index
    82)     character(len=MAXWORDLENGTH), pointer :: mineral_names(:)
    83)     
    84)     type(mineral_rxn_type), pointer :: mineral_list
    85) 
    86)     ! for saturation states
    87)     PetscInt, pointer :: mnrlspecid(:,:)
    88)     PetscReal, pointer :: mnrlstoich(:,:)
    89)     PetscInt, pointer :: mnrlh2oid(:)
    90)     PetscReal, pointer :: mnrlh2ostoich(:)
    91)     PetscReal, pointer :: mnrl_logK(:)
    92)     PetscReal, pointer :: mnrl_logKcoef(:,:)
    93)     PetscBool, pointer :: mnrl_print(:)
    94)     
    95)     ! for kinetic reactions
    96)     PetscInt :: nkinmnrl
    97)     character(len=MAXWORDLENGTH), pointer :: kinmnrl_names(:)
    98)     character(len=MAXWORDLENGTH), pointer :: kinmnrl_armor_min_names(:)
    99)     PetscBool, pointer :: kinmnrl_print(:)
   100)     PetscInt, pointer :: kinmnrlspecid(:,:)
   101)     PetscReal, pointer :: kinmnrlstoich(:,:)
   102)     PetscInt, pointer :: kinmnrlh2oid(:)
   103)     PetscReal, pointer :: kinmnrlh2ostoich(:)
   104)     PetscReal, pointer :: kinmnrl_logK(:)
   105)     PetscReal, pointer :: kinmnrl_logKcoef(:,:)
   106)     PetscReal, pointer :: kinmnrl_rate_constant(:)
   107)     PetscReal, pointer :: kinmnrl_activation_energy(:)
   108)     PetscReal, pointer :: kinmnrl_molar_vol(:)
   109)     PetscReal, pointer :: kinmnrl_molar_wt(:)
   110)     PetscInt, pointer :: kinmnrl_num_prefactors(:)
   111)     PetscInt, pointer :: kinmnrl_prefactor_id(:,:,:)
   112)     PetscReal, pointer :: kinmnrl_pref_alpha(:,:,:)
   113)     PetscReal, pointer :: kinmnrl_pref_beta(:,:,:)
   114)     PetscReal, pointer :: kinmnrl_pref_atten_coef(:,:,:)
   115)     PetscReal, pointer :: kinmnrl_pref_rate(:,:)
   116)     PetscReal, pointer :: kinmnrl_pref_activation_energy(:,:)
   117)     PetscReal, pointer :: kinmnrl_min_scale_factor(:)
   118)     PetscReal, pointer :: kinmnrl_Temkin_const(:)
   119)     PetscReal, pointer :: kinmnrl_affinity_power(:)
   120)     PetscReal, pointer :: kinmnrl_affinity_threshold(:)
   121)     PetscReal, pointer :: kinmnrl_rate_limiter(:)
   122)     PetscReal, pointer :: kinmnrl_surf_area_vol_frac_pwr(:)
   123)     PetscReal, pointer :: kinmnrl_surf_area_porosity_pwr(:)
   124)     PetscReal, pointer :: kinmnrl_armor_crit_vol_frac(:)
   125)     PetscReal, pointer :: kinmnrl_armor_pwr(:)
   126)     PetscInt, pointer :: kinmnrl_irreversible(:)
   127)    
   128)   end type mineral_type
   129)   
   130)   interface GetMineralIDFromName
   131)     module procedure GetMineralIDFromName1
   132)     module procedure GetMineralIDFromName2
   133)   end interface
   134)   
   135)   public :: MineralCreate, &
   136)             GetMineralCount, &
   137)             GetMineralNames, &
   138)             GetMineralIDFromName, &
   139)             GetKineticMineralIDFromName, &
   140)             TransitionStateTheoryRxnCreate, &
   141)             TransitionStatePrefactorCreate, &
   142)             TSPrefactorSpeciesCreate, &
   143)             TransitionStateTheoryRxnDestroy, &
   144)             MineralRxnCreate, &
   145)             MineralRxnDestroy, &
   146)             MineralConstraintCreate, &
   147)             MineralConstraintDestroy, &
   148)             MineralDestroy
   149)              
   150) contains
   151) 
   152) ! ************************************************************************** !
   153) 
   154) function MineralCreate()
   155)   ! 
   156)   ! Allocate and initialize mineral reaction object
   157)   ! 
   158)   ! Author: Glenn Hammond
   159)   ! Date: 08/16/12
   160)   ! 
   161) 
   162)   implicit none
   163)   
   164)   type(mineral_type), pointer :: MineralCreate
   165)   
   166)   type(mineral_type), pointer :: mineral
   167) 
   168)   allocate(mineral)  
   169)     
   170)   nullify(mineral%mineral_list)
   171)   mineral%print_all = PETSC_FALSE
   172)   mineral%print_saturation_index = PETSC_FALSE
   173)   
   174)   ! for saturation states
   175)   mineral%nmnrl = 0  
   176)   nullify(mineral%mineral_names)
   177)   nullify(mineral%mnrl_print)
   178)   nullify(mineral%mnrlspecid)
   179)   nullify(mineral%mnrlh2oid)
   180)   nullify(mineral%mnrlstoich)
   181)   nullify(mineral%mnrlh2ostoich)
   182)   nullify(mineral%mnrl_logK)
   183)   nullify(mineral%mnrl_logKcoef)
   184)   
   185)   ! for kinetic mineral reactions
   186)   mineral%nkinmnrl = 0  
   187)   nullify(mineral%kinmnrl_names)
   188)   nullify(mineral%kinmnrl_print)
   189)   nullify(mineral%kinmnrlspecid)
   190)   nullify(mineral%kinmnrlstoich)
   191)   nullify(mineral%kinmnrlh2oid)
   192)   nullify(mineral%kinmnrlh2ostoich)
   193)   nullify(mineral%kinmnrl_logK)
   194)   nullify(mineral%kinmnrl_logKcoef)
   195)   nullify(mineral%kinmnrl_rate_constant)
   196)   nullify(mineral%kinmnrl_activation_energy)
   197)   nullify(mineral%kinmnrl_molar_vol)
   198)   nullify(mineral%kinmnrl_molar_wt)
   199) 
   200)   nullify(mineral%kinmnrl_num_prefactors)
   201)   nullify(mineral%kinmnrl_prefactor_id)
   202)   nullify(mineral%kinmnrl_pref_alpha)
   203)   nullify(mineral%kinmnrl_pref_beta)
   204)   nullify(mineral%kinmnrl_pref_atten_coef)
   205)   nullify(mineral%kinmnrl_pref_rate)
   206)   nullify(mineral%kinmnrl_pref_activation_energy)
   207) 
   208)   nullify(mineral%kinmnrl_min_scale_factor)
   209)   nullify(mineral%kinmnrl_Temkin_const)
   210)   nullify(mineral%kinmnrl_affinity_power)
   211)   nullify(mineral%kinmnrl_affinity_threshold)
   212)   nullify(mineral%kinmnrl_irreversible)
   213)   nullify(mineral%kinmnrl_rate_limiter)
   214)   nullify(mineral%kinmnrl_surf_area_vol_frac_pwr)
   215)   nullify(mineral%kinmnrl_surf_area_porosity_pwr)
   216) 
   217)   nullify(mineral%kinmnrl_armor_min_names)
   218)   nullify(mineral%kinmnrl_armor_crit_vol_frac)
   219)   nullify(mineral%kinmnrl_armor_pwr)
   220) 
   221)   MineralCreate => mineral
   222)   
   223) end function MineralCreate
   224) 
   225) ! ************************************************************************** !
   226) 
   227) function MineralRxnCreate()
   228)   ! 
   229)   ! Allocate and initialize a mineral object
   230)   ! 
   231)   ! Author: Glenn Hammond
   232)   ! Date: 05/02/08
   233)   ! 
   234) 
   235)   implicit none
   236)   
   237)   type(mineral_rxn_type), pointer :: MineralRxnCreate
   238)   
   239)   type(mineral_rxn_type), pointer :: mineral
   240) 
   241)   allocate(mineral)  
   242)   mineral%id = 0
   243)   mineral%itype = 0
   244)   mineral%name = ''
   245)   mineral%molar_volume = 0.d0
   246)   mineral%molar_weight = 0.d0
   247)   mineral%print_me = PETSC_FALSE
   248)   nullify(mineral%tstrxn)
   249)   nullify(mineral%next)
   250)   
   251)   MineralRxnCreate => mineral
   252)   
   253) end function MineralRxnCreate
   254) 
   255) ! ************************************************************************** !
   256) 
   257) function TransitionStateTheoryRxnCreate()
   258)   ! 
   259)   ! Allocate and initialize a transition state
   260)   ! theory reaction
   261)   ! 
   262)   ! Author: Glenn Hammond
   263)   ! Date: 09/01/08
   264)   ! 
   265) 
   266)   implicit none
   267)     
   268)   type(transition_state_rxn_type), pointer :: TransitionStateTheoryRxnCreate
   269) 
   270)   type(transition_state_rxn_type), pointer :: tstrxn
   271) 
   272)   allocate(tstrxn)
   273)   tstrxn%min_scale_factor = UNINITIALIZED_DOUBLE
   274)   tstrxn%affinity_factor_sigma = UNINITIALIZED_DOUBLE
   275)   tstrxn%affinity_factor_beta = UNINITIALIZED_DOUBLE
   276)   tstrxn%affinity_threshold = 0.d0
   277)   tstrxn%surf_area_vol_frac_pwr = 0.d0
   278)   tstrxn%surf_area_porosity_pwr = 0.d0
   279)   tstrxn%rate_limiter = 0.d0
   280)   tstrxn%irreversible = 0
   281)   tstrxn%activation_energy = 0.d0
   282)   tstrxn%armor_min_name = ''
   283)   tstrxn%armor_pwr = 0.d0
   284)   tstrxn%armor_crit_vol_frac = 0.d0
   285)   tstrxn%rate = 0.d0
   286)   nullify(tstrxn%prefactor)
   287)   nullify(tstrxn%next)
   288)   
   289)   TransitionStateTheoryRxnCreate => tstrxn
   290)   
   291) end function TransitionStateTheoryRxnCreate
   292) 
   293) ! ************************************************************************** !
   294) 
   295) function TransitionStatePrefactorCreate()
   296)   ! 
   297)   ! Allocate and initialize a transition state
   298)   ! theory prefactor
   299)   ! 
   300)   ! Author: Glenn Hammond
   301)   ! Date: 07/29/11
   302)   ! 
   303) 
   304)   implicit none
   305)     
   306)   type(transition_state_prefactor_type), pointer :: TransitionStatePrefactorCreate
   307) 
   308)   type(transition_state_prefactor_type), pointer :: prefactor
   309) 
   310)   allocate(prefactor)
   311)   prefactor%rate = 0.d0
   312)   prefactor%activation_energy = 0.d0
   313)   nullify(prefactor%species)
   314)   nullify(prefactor%next)
   315)   
   316)   TransitionStatePrefactorCreate => prefactor
   317)   
   318) end function TransitionStatePrefactorCreate
   319) 
   320) ! ************************************************************************** !
   321) 
   322) function TSPrefactorSpeciesCreate()
   323)   ! 
   324)   ! Allocate and initialize a transition state
   325)   ! theory prefactor species
   326)   ! 
   327)   ! Author: Glenn Hammond
   328)   ! Date: 08/01/11
   329)   ! 
   330) 
   331)   implicit none
   332)     
   333)   type(ts_prefactor_species_type), pointer :: TSPrefactorSpeciesCreate
   334) 
   335)   type(ts_prefactor_species_type), pointer :: species
   336) 
   337)   allocate(species)
   338)   species%name = ''
   339)   species%id = 0
   340)   species%alpha = 0.d0
   341)   species%beta = 0.d0
   342)   species%attenuation_coef = 0.d0
   343)   nullify(species%next)
   344)   
   345)   TSPrefactorSpeciesCreate => species
   346)   
   347) end function TSPrefactorSpeciesCreate
   348) 
   349) ! ************************************************************************** !
   350) 
   351) function MineralConstraintCreate(mineral,option)
   352)   ! 
   353)   ! Creates a mineral constraint object
   354)   ! 
   355)   ! Author: Glenn Hammond
   356)   ! Date: 10/14/08
   357)   ! 
   358) 
   359)   use Option_module
   360)   
   361)   implicit none
   362)   
   363)   type(mineral_type) :: mineral
   364)   type(option_type) :: option
   365)   type(mineral_constraint_type), pointer :: MineralConstraintCreate
   366) 
   367)   type(mineral_constraint_type), pointer :: constraint  
   368) 
   369)   allocate(constraint)
   370)   allocate(constraint%names(mineral%nkinmnrl))
   371)   constraint%names = ''
   372)   allocate(constraint%constraint_vol_frac(mineral%nkinmnrl))
   373)   constraint%constraint_vol_frac = 0.d0
   374)   allocate(constraint%constraint_area(mineral%nkinmnrl))
   375)   constraint%constraint_area = 0.d0
   376)   allocate(constraint%constraint_vol_frac_string(mineral%nkinmnrl))
   377)   constraint%constraint_vol_frac_string = ''
   378)   allocate(constraint%constraint_area_string(mineral%nkinmnrl))
   379)   constraint%constraint_area_string = ''
   380)   allocate(constraint%external_vol_frac_dataset(mineral%nkinmnrl))
   381)   constraint%external_vol_frac_dataset = PETSC_FALSE
   382)   allocate(constraint%external_area_dataset(mineral%nkinmnrl))
   383)   constraint%external_area_dataset = PETSC_FALSE
   384) 
   385)   MineralConstraintCreate => constraint
   386) 
   387) end function MineralConstraintCreate
   388) 
   389) ! ************************************************************************** !
   390) 
   391) function GetMineralNames(mineral)
   392)   ! 
   393)   ! Returns the names of minerals in an array
   394)   ! 
   395)   ! Author: Glenn Hammond
   396)   ! Date: 09/04/08
   397)   ! 
   398) 
   399)   implicit none
   400)   
   401)   character(len=MAXWORDLENGTH), pointer :: GetMineralNames(:)
   402)   type(mineral_type) :: mineral
   403) 
   404)   PetscInt :: count
   405)   character(len=MAXWORDLENGTH), pointer :: names(:)
   406)   type(mineral_rxn_type), pointer :: cur_mineral
   407) 
   408)   count = GetMineralCount(mineral)
   409)   allocate(names(count))
   410)   
   411)   count = 1
   412)   cur_mineral => mineral%mineral_list
   413)   do
   414)     if (.not.associated(cur_mineral)) exit
   415)     names(count) = cur_mineral%name
   416)     count = count + 1
   417)     cur_mineral => cur_mineral%next
   418)   enddo
   419) 
   420)   GetMineralNames => names
   421)   
   422) end function GetMineralNames
   423) 
   424) ! ************************************************************************** !
   425) 
   426) function GetMineralCount(mineral)
   427)   ! 
   428)   ! Returns the number of minerals
   429)   ! 
   430)   ! Author: Glenn Hammond
   431)   ! Date: 06/02/08
   432)   ! 
   433) 
   434)   implicit none
   435)   
   436)   PetscInt :: GetMineralCount
   437)   type(mineral_type) :: mineral
   438) 
   439)   type(mineral_rxn_type), pointer :: cur_mineral
   440) 
   441)   GetMineralCount = 0
   442)   cur_mineral => mineral%mineral_list
   443)   do
   444)     if (.not.associated(cur_mineral)) exit
   445)     GetMineralCount = GetMineralCount + 1
   446)     cur_mineral => cur_mineral%next
   447)   enddo
   448) 
   449) end function GetMineralCount
   450) 
   451) ! ************************************************************************** !
   452) 
   453) function GetMineralIDFromName1(name,mineral,option)
   454)   ! 
   455)   ! Returns the id of mineral with the corresponding name
   456)   ! 
   457)   ! Author: Glenn Hammond
   458)   ! Date: 09/04/08
   459)   ! 
   460)   use Option_module
   461)   use String_module
   462)   
   463)   implicit none
   464)   
   465)   type(mineral_type) :: mineral
   466)   character(len=MAXWORDLENGTH) :: name
   467)   type(option_type) :: option
   468) 
   469)   PetscInt :: GetMineralIDFromName1
   470) 
   471)   GetMineralIDFromName1 = &
   472)     GetMineralIDFromName(name,mineral,PETSC_FALSE,PETSC_TRUE,option)
   473)  
   474) end function GetMineralIDFromName1
   475) 
   476) ! ************************************************************************** !
   477) 
   478) function GetMineralIDFromName2(name,mineral,must_be_kinetic,return_error, &
   479)                                option)
   480)   ! 
   481)   ! Returns the id of mineral with the corresponding name
   482)   ! 
   483)   ! Author: Glenn Hammond
   484)   ! Date: 09/04/08
   485)   ! 
   486)   use Option_module
   487)   use String_module
   488)   
   489)   implicit none
   490)   
   491)   type(mineral_type) :: mineral
   492)   character(len=MAXWORDLENGTH) :: name
   493)   PetscBool :: must_be_kinetic
   494)   PetscBool :: return_error
   495)   type(option_type) :: option
   496) 
   497)   PetscInt :: GetMineralIDFromName2
   498)   type(mineral_rxn_type), pointer :: cur_mineral
   499)   PetscInt :: ikinmnrl
   500) 
   501)   GetMineralIDFromName2 = -1
   502)  
   503)   cur_mineral => mineral%mineral_list
   504)   ikinmnrl = 0
   505)   do
   506)     if (.not.associated(cur_mineral)) exit
   507)     if (cur_mineral%itype == MINERAL_KINETIC) then
   508)       ikinmnrl = ikinmnrl + 1
   509)     endif
   510)     if (StringCompare(name,cur_mineral%name,MAXWORDLENGTH)) then
   511)       if (must_be_kinetic .and. cur_mineral%itype /= MINERAL_KINETIC) exit
   512)       if (must_be_kinetic) then
   513)         GetMineralIDFromName2 = ikinmnrl
   514)         exit
   515)       endif
   516)       GetMineralIDFromName2 = cur_mineral%id
   517)       exit
   518)     endif
   519)     cur_mineral => cur_mineral%next
   520)   enddo
   521) 
   522)   if (return_error .and. GetMineralIDFromName2 <= 0) then
   523)     option%io_buffer = 'Mineral "' // trim(name) // &
   524)       '" not found among minerals in GetMineralIDFromName().'
   525)     call printErrMsg(option)
   526)   endif
   527) 
   528) end function GetMineralIDFromName2
   529) 
   530) ! ************************************************************************** !
   531) 
   532) function GetKineticMineralIDFromName(name,mineral,option)
   533)   ! 
   534)   ! Returns the id of kinetic mineral with the
   535)   ! corresponding name
   536)   ! 
   537)   ! Author: Glenn Hammond
   538)   ! Date: 03/11/13
   539)   ! 
   540)   use Option_module
   541)   use String_module
   542)   
   543)   implicit none
   544)   
   545)   character(len=MAXWORDLENGTH) :: name
   546)   type(mineral_type) :: mineral
   547)   type(option_type) :: option
   548) 
   549)   PetscInt :: GetKineticMineralIDFromName
   550) 
   551)   GetKineticMineralIDFromName = &
   552)     GetMineralIDFromName(name,mineral,PETSC_TRUE,PETSC_TRUE,option)
   553) 
   554) end function GetKineticMineralIDFromName
   555) 
   556) ! ************************************************************************** !
   557) 
   558) subroutine MineralRxnDestroy(mineral)
   559)   ! 
   560)   ! MineralDestroy: Deallocates a mineral rxn object
   561)   ! 
   562)   ! Author: Glenn Hammond
   563)   ! Date: 05/29/08
   564)   ! 
   565) 
   566)   implicit none
   567)     
   568)   type(mineral_rxn_type), pointer :: mineral
   569) 
   570)   if (associated(mineral%dbaserxn)) &
   571)     call DatabaseRxnDestroy(mineral%dbaserxn)
   572)   if (associated(mineral%tstrxn)) &
   573)     call TransitionStateTheoryRxnDestroy(mineral%tstrxn)
   574) 
   575)   deallocate(mineral)  
   576)   nullify(mineral)
   577) 
   578) end subroutine MineralRxnDestroy
   579) 
   580) ! ************************************************************************** !
   581) 
   582) recursive subroutine TransitionStateTheoryRxnDestroy(tstrxn)
   583)   ! 
   584)   ! Deallocates a transition state reaction
   585)   ! 
   586)   ! Author: Glenn Hammond
   587)   ! Date: 05/29/08
   588)   ! 
   589) 
   590)   implicit none
   591)     
   592)   type(transition_state_rxn_type), pointer :: tstrxn
   593) 
   594)   if (.not.associated(tstrxn)) return
   595)   
   596)   call TransitionStateTheoryRxnDestroy(tstrxn%next)
   597)   call TransitionStatePrefactorDestroy(tstrxn%prefactor)
   598) 
   599)   deallocate(tstrxn)  
   600)   nullify(tstrxn)
   601) 
   602) end subroutine TransitionStateTheoryRxnDestroy
   603) 
   604) ! ************************************************************************** !
   605) 
   606) recursive subroutine TransitionStatePrefactorDestroy(prefactor)
   607)   ! 
   608)   ! Deallocates a transition state prefactor
   609)   ! 
   610)   ! Author: Glenn Hammond
   611)   ! Date: 07/29/11
   612)   ! 
   613) 
   614)   implicit none
   615)     
   616)   type(transition_state_prefactor_type), pointer :: prefactor
   617) 
   618)   if (.not.associated(prefactor)) return
   619)   
   620)   call TransitionStatePrefactorDestroy(prefactor%next)
   621)   call TSPrefactorSpeciesDestroy(prefactor%species)
   622) 
   623)   deallocate(prefactor)  
   624)   nullify(prefactor)
   625) 
   626) end subroutine TransitionStatePrefactorDestroy
   627) 
   628) ! ************************************************************************** !
   629) 
   630) recursive subroutine TSPrefactorSpeciesDestroy(species)
   631)   ! 
   632)   ! Deallocates a transition state prefactor
   633)   ! 
   634)   ! Author: Glenn Hammond
   635)   ! Date: 08/01/11
   636)   ! 
   637) 
   638)   implicit none
   639)     
   640)   type(ts_prefactor_species_type), pointer :: species
   641) 
   642)   if (.not.associated(species)) return
   643)   
   644)   call TSPrefactorSpeciesDestroy(species%next)
   645) 
   646)   deallocate(species)  
   647)   nullify(species)
   648) 
   649) end subroutine TSPrefactorSpeciesDestroy
   650) 
   651) ! ************************************************************************** !
   652) 
   653) subroutine MineralConstraintDestroy(constraint)
   654)   ! 
   655)   ! Destroys a mineral constraint object
   656)   ! 
   657)   ! Author: Glenn Hammond
   658)   ! Date: 10/14/08
   659)   ! 
   660) 
   661)   use Utility_module, only: DeallocateArray
   662)   
   663)   implicit none
   664)   
   665)   type(mineral_constraint_type), pointer :: constraint
   666)   
   667)   if (.not.associated(constraint)) return
   668)   
   669)   call DeallocateArray(constraint%names)
   670)   call DeallocateArray(constraint%constraint_vol_frac)
   671)   call DeallocateArray(constraint%constraint_area)
   672)   call DeallocateArray(constraint%constraint_vol_frac_string)
   673)   call DeallocateArray(constraint%constraint_area_string)
   674)   call DeallocateArray(constraint%external_area_dataset)
   675)   call DeallocateArray(constraint%external_vol_frac_dataset)
   676)   
   677)   deallocate(constraint)
   678)   nullify(constraint)
   679) 
   680) end subroutine MineralConstraintDestroy
   681) 
   682) ! ************************************************************************** !
   683) 
   684) subroutine MineralDestroy(mineral)
   685)   ! 
   686)   ! Deallocates a mineral object
   687)   ! 
   688)   ! Author: Glenn Hammond
   689)   ! Date: 05/29/08
   690)   ! 
   691) 
   692)   use Utility_module, only: DeallocateArray
   693)   
   694)   implicit none
   695) 
   696)   type(mineral_type), pointer :: mineral
   697)   
   698)   type(mineral_rxn_type), pointer :: cur_mineral, prev_mineral
   699) 
   700)   if (.not.associated(mineral)) return
   701)   
   702)   ! mineral species
   703)   cur_mineral => mineral%mineral_list
   704)   do
   705)     if (.not.associated(cur_mineral)) exit
   706)     prev_mineral => cur_mineral
   707)     cur_mineral => cur_mineral%next
   708)     call MineralRxnDestroy(prev_mineral)
   709)   enddo    
   710)   nullify(mineral%mineral_list)
   711)   
   712)   call DeallocateArray(mineral%mineral_names)
   713)   call DeallocateArray(mineral%kinmnrl_names)
   714)   call DeallocateArray(mineral%mnrl_print)
   715)   call DeallocateArray(mineral%kinmnrl_print)
   716)   call DeallocateArray(mineral%mnrlspecid)
   717)   call DeallocateArray(mineral%mnrlstoich)
   718)   call DeallocateArray(mineral%mnrlh2oid)
   719)   call DeallocateArray(mineral%mnrlh2ostoich)
   720)   call DeallocateArray(mineral%mnrl_logK)
   721)   call DeallocateArray(mineral%mnrl_logKcoef)
   722)   
   723)   call DeallocateArray(mineral%kinmnrlspecid)
   724)   call DeallocateArray(mineral%kinmnrlstoich)
   725)   call DeallocateArray(mineral%kinmnrlh2oid)
   726)   call DeallocateArray(mineral%kinmnrlh2ostoich)
   727)   call DeallocateArray(mineral%kinmnrl_logK)
   728)   call DeallocateArray(mineral%kinmnrl_logKcoef)
   729)   call DeallocateArray(mineral%kinmnrl_rate_constant)
   730)   call DeallocateArray(mineral%kinmnrl_molar_vol)
   731)   call DeallocateArray(mineral%kinmnrl_molar_wt)
   732) 
   733)   call DeallocateArray(mineral%kinmnrl_num_prefactors)
   734)   call DeallocateArray(mineral%kinmnrl_prefactor_id)
   735)   call DeallocateArray(mineral%kinmnrl_pref_alpha)
   736)   call DeallocateArray(mineral%kinmnrl_pref_beta)
   737)   call DeallocateArray(mineral%kinmnrl_pref_atten_coef)
   738)   call DeallocateArray(mineral%kinmnrl_pref_rate)
   739)   call DeallocateArray(mineral%kinmnrl_pref_activation_energy)
   740)   
   741)   call DeallocateArray(mineral%kinmnrl_min_scale_factor)
   742)   call DeallocateArray(mineral%kinmnrl_Temkin_const)
   743)   call DeallocateArray(mineral%kinmnrl_affinity_power)
   744)   call DeallocateArray(mineral%kinmnrl_affinity_threshold)
   745)   call DeallocateArray(mineral%kinmnrl_activation_energy)
   746)   call DeallocateArray(mineral%kinmnrl_rate_limiter)
   747)   call DeallocateArray(mineral%kinmnrl_surf_area_vol_frac_pwr)
   748)   call DeallocateArray(mineral%kinmnrl_surf_area_porosity_pwr)
   749)   call DeallocateArray(mineral%kinmnrl_armor_min_names)
   750)   call DeallocateArray(mineral%kinmnrl_armor_pwr)
   751)   call DeallocateArray(mineral%kinmnrl_armor_crit_vol_frac)
   752)   call DeallocateArray(mineral%kinmnrl_irreversible)
   753)   
   754)   deallocate(mineral)
   755)   nullify(mineral)
   756) 
   757) end subroutine MineralDestroy
   758) 
   759) end module Reaction_Mineral_Aux_module

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