Wiki

Clone wiki

pflotran / Depreciated / Documentation / CodeDevelopment / NewProcessModel

Steps For Integrating a New Process Model within PFLOTRAN

  1. Create a new process model (pm_XXX.F90) by mimicking another process model.
  1. Create a module pm_XXX_class.
  2. Create a pm_xxx_type that extends pm_XXX_base (or any other child class).
  3. Pick and choose which routines need to be extended.
  1. Add the new process model to the PFLOTRAN factory.
  1. Add a new case statement within the factory_pflotran.F90:PFLOTRANReadSimulation():PROCESS_MODELS case statement.
  2. Add a call to the new process model read routine located in the appropriate sub-factory (e.g. SubsurfaceReadXXXPM() in factory_subsurface.F90).
  1. Add a read routine for the new process model in factory_subsurface.F90. Look at SubsurfaceReadFlowPM() for an example.
  2. Within SubsurfaceInitializePostPetsc(), add the new process model (best to mimic an existing process model).
  1. Create a pointer to the new process model (pm_XXX).
  2. Assign the pointer in the loop over process models block.
cur_pm => simulation%process_model_list
do
  if (.not.associated(cur_pm)) exit
  select type(cur_pm)
    ...
    class is (pm_XXX_type)
      pm_XXX => cur_pm
    ...
  end select
  ...
enddo
  1. Add a new conditional block for reading the new process model parameters from the input file. This block should come after InitSubsurfaceReadInput() and before InputDestroy()
if (associated(pm_XXX)) then
  string = 'XXX'
  call InputFindStringInFile(realization%input,option,string)
  call InputFindStringErrorMsg(realization%input,option,string)
  call pm_XXX%Read(realization%input)
endif
  1. Add a new conditional block for setting up the linkage between process models. This can be tricky and a comprehensive understanding of the PFLOTRAN process model hierarchy will be useful.
if (associated(pm_XXX)) then
  pmc_XXX => PMCXXXCreate()
  pmc_XXX%option => option
  pmc_XXX%pms => pmc_XXX
  pmc_XXX%pm_ptr%ptr => pmc_XXX
  pmc_XXX%realization => realization
  ! set up logging stage
  string = 'XXX'
  call LoggingCreateStage(string,pmc_XXX%stage)
  ...
  nullify(pmc_XXX)
endif

Updated