Commits

Peter Lichtner committed cc489c7

Added surface armoring keyword to kinetic rates---in progress.

Comments (0)

Files changed (4)

src/pflotran/database.F90

       allocate(mineral%kinmnrl_surf_area_porosity_pwr(mineral%nkinmnrl))
       mineral%kinmnrl_surf_area_porosity_pwr = 0.d0    
     endif
+
+    ! Determine whether armor mineral name defined
+    cur_mineral => mineral%mineral_list
+    found = PETSC_FALSE
+    do
+      if (.not.associated(cur_mineral)) exit
+      if (associated(cur_mineral%tstrxn)) then 
+        if (.not. cur_mineral%tstrxn%armor_min_name == '') then
+          found = PETSC_TRUE
+          exit
+        endif
+      endif
+      cur_mineral => cur_mineral%next
+    enddo
+    if (found) then
+      allocate(mineral%kinmnrl_armor_min_names(mineral%nkinmnrl))
+      mineral%kinmnrl_armor_min_names = ''
+    endif
+
+
+    ! Determine whether armor mineral volume fraction power defined
+    cur_mineral => mineral%mineral_list
+    found = PETSC_FALSE
+    do
+      if (.not.associated(cur_mineral)) exit
+      if (associated(cur_mineral%tstrxn)) then 
+        if (.not.Equal(cur_mineral%tstrxn%armor_pwr, &
+                       0.d0)) then
+          found = PETSC_TRUE
+          exit
+        endif
+      endif
+      cur_mineral => cur_mineral%next
+    enddo
+    if (found) then
+      allocate(mineral%kinmnrl_armor_pwr(mineral%nkinmnrl))
+      mineral%kinmnrl_armor_pwr = 0.d0
+    endif
+    
+    ! Determine whether armor critical volume fraction defined
+    cur_mineral => mineral%mineral_list
+    found = PETSC_FALSE
+    do
+      if (.not.associated(cur_mineral)) exit
+      if (associated(cur_mineral%tstrxn)) then 
+        if (.not.Equal(cur_mineral%tstrxn%armor_crit_vol_frac, &
+                       0.d0)) then
+          found = PETSC_TRUE
+          exit
+        endif
+      endif
+      cur_mineral => cur_mineral%next
+    enddo
+    if (found) then
+      allocate(mineral%kinmnrl_armor_crit_vol_frac(mineral%nkinmnrl))
+      mineral%kinmnrl_armor_crit_vol_frac = 0.d0
+    endif
     
     cur_mineral => mineral%mineral_list
     imnrl = 1

src/pflotran/mineral.F90

           if (InputCheckExit(input,option)) exit
           call InputReadWord(input,option,word,PETSC_TRUE)
           error_string = 'CHEMISTRY,MINERAL_KINETICS'
-          call InputErrorMsg(input,option,'word',error_string) 
+          call InputErrorMsg(input,option,'word',error_string)
+
           select case(trim(word))
             case('RATE_CONSTANT')
 !             read rate constant
               ! read units if they exist
               call InputReadWord(input,option,word,PETSC_TRUE)
               if (InputError(input)) then
-                input%err_buf = trim(cur_mineral%name) // 'RATE UNITS'
+                input%err_buf = trim(cur_mineral%name) // ' RATE UNITS'
                 call InputDefaultMsg(input,option)
               else
                 tstrxn%rate = tstrxn%rate * UnitsConvertToInternal(word,option)
             case('SURFACE_AREA_VOL_FRAC_POWER')
               call InputReadDouble(input,option,tstrxn%surf_area_vol_frac_pwr)
               call InputErrorMsg(input,option, &
-                                 'surface area voluem fraction power', &
+                                 'surface area volume fraction power', &
                                  error_string)
             case('RATE_LIMITER')
 !             read rate limiter for precipitation
 !             read flag for irreversible reaction
               tstrxn%irreversible = 1
               call InputErrorMsg(input,option,'irreversible',error_string)
+
+            case('ARMORING')
+!             read amoring mineral and parameters for surface area armoring
+              do
+                call InputReadFlotranString(input,option)
+                call InputReadStringErrorMsg(input,option,card)
+                if (InputCheckExit(input,option)) exit
+                call InputReadWord(input,option,word,PETSC_TRUE)
+                call InputErrorMsg(input,option,'word',error_string)
+
+                print *,'Armor-2: ',word
+
+                select case(trim(word))
+                  case('ARMOR_MINERAL')
+                    ! read mineral name
+                    call InputReadWord(input,option,tstrxn%armor_min_name,PETSC_TRUE)
+                    call InputErrorMsg(input,option,'name',error_string)
+                  case('ARMOR_PWR')
+                    ! read power law exponent
+                    call InputReadDouble(input,option,tstrxn%armor_pwr)
+                    call InputErrorMsg(input,option,'armor_pwr',error_string)
+                  case('ARMOR_CRIT_VOL_FRAC')
+                    ! read critical volume fraction
+                    call InputReadDouble(input,option,tstrxn%armor_crit_vol_frac)
+                    call InputErrorMsg(input,option,'armor_crit_vol_frac',error_string)
+                end select
+              enddo
+
             case('PREFACTOR')
               error_string = 'CHEMISTRY,MINERAL_KINETICS,PREFACTOR'
               prefactor => TransitionStatePrefactorCreate()

src/pflotran/mineral_aux.F90

     PetscInt :: irreversible
     PetscReal :: rate
     PetscReal :: activation_energy
+    character(len=MAXWORDLENGTH) :: armor_min_name
+    PetscReal :: armor_pwr
+    PetscReal :: armor_crit_vol_frac
     type(transition_state_prefactor_type), pointer :: prefactor
     type(transition_state_rxn_type), pointer :: next
   end type transition_state_rxn_type
     ! for kinetic reactions
     PetscInt :: nkinmnrl
     character(len=MAXWORDLENGTH), pointer :: kinmnrl_names(:)
+    character(len=MAXWORDLENGTH), pointer :: kinmnrl_armor_min_names(:)
     PetscBool, pointer :: kinmnrl_print(:)
     PetscInt, pointer :: kinmnrlspecid(:,:)
     PetscReal, pointer :: kinmnrlstoich(:,:)
     PetscReal, pointer :: kinmnrl_rate_limiter(:)
     PetscReal, pointer :: kinmnrl_surf_area_vol_frac_pwr(:)
     PetscReal, pointer :: kinmnrl_surf_area_porosity_pwr(:)
+    PetscReal, pointer :: kinmnrl_armor_crit_vol_frac(:)
+    PetscReal, pointer :: kinmnrl_armor_pwr(:)
     PetscInt, pointer :: kinmnrl_irreversible(:)
    
   end type mineral_type
   nullify(mineral%kinmnrl_surf_area_vol_frac_pwr)
   nullify(mineral%kinmnrl_surf_area_porosity_pwr)
 
+  nullify(mineral%kinmnrl_armor_min_names)
+  nullify(mineral%kinmnrl_armor_crit_vol_frac)
+  nullify(mineral%kinmnrl_armor_pwr)
+
   MineralCreate => mineral
   
 end function MineralCreate
   tstrxn%rate_limiter = 0.d0
   tstrxn%irreversible = 0
   tstrxn%activation_energy = 0.d0
+  tstrxn%armor_min_name = ''
+  tstrxn%armor_pwr = 1.d0
+  tstrxn%armor_crit_vol_frac = 0.d0
   tstrxn%rate = 0.d0
   nullify(tstrxn%prefactor)
   nullify(tstrxn%next)

src/pflotran/reaction.F90

           call InputReadWord(input,option,name,PETSC_TRUE)
           call InputErrorMsg(input,option,name,'CHEMISTRY,MINERAL_KINETICS')
           temp_int = temp_int + 1
+
           do
             call InputReadFlotranString(input,option)
             call InputReadStringErrorMsg(input,option,card)
                                     'CHEMISTRY,MINERAL_KINETICS')
             call StringToUpper(word)
             select case(word)
+
+              case('ARMORING')
+!             read amoring mineral and parameters for surface area armoring
+                do
+                  call InputReadFlotranString(input,option)
+                  call InputReadStringErrorMsg(input,option,card)
+                  if (InputCheckExit(input,option)) exit
+                  call InputReadWord(input,option,word,PETSC_TRUE)
+                  call InputErrorMsg(input,option,'keyword', &
+                                      'CHEMISTRY,MINERAL_KINETICS,ARMORING')
+
+                  print *,'Armor-1: ',word,temp_int
+
+                  call InputSkipToEnd(input,option,word)
+
+!                 call StringToUpper(word)
+!                 select case(word)
+!                   case('ARMOR_MINERAL')
+!                     call InputSkipToEnd(input,option,word)
+!                 case('ARMOR_PWR')
+!                     call InputSkipToEnd(input,option,word)
+!                 case('ARMOR_CRIT_VOL_FRAC')
+!                     call InputSkipToEnd(input,option,word)
+!                 end select
+                enddo
+
               case('PREFACTOR')
                 do 
                   call InputReadFlotranString(input,option)
           enddo
         enddo
         reaction%mineral%nkinmnrl = reaction%mineral%nkinmnrl + temp_int
+
       case('SOLID_SOLUTIONS') ! solid solutions read on second round
 #ifdef SOLID_SOLUTION
         do
         option%io_buffer = 'To use solid solutions, must compile with -DSOLID_SOLUTION'
         call printErrMsg(option)
 #endif
+
       case('COLLOIDS')
         nullify(prev_colloid)
         do