Wiki
Clone wikipflotran / Depreciated / Documentation / CodeDevelopment / NewProcessModel
Steps For Integrating a New Process Model within PFLOTRAN
- Create a new process model (pm_XXX.F90) by mimicking another process model.
- Create a module pm_XXX_class.
- Create a pm_xxx_type that extends pm_XXX_base (or any other child class).
- Pick and choose which routines need to be extended.
- Add the new process model to the PFLOTRAN factory.
- Add a new case statement within the factory_pflotran.F90:PFLOTRANReadSimulation():PROCESS_MODELS case statement.
- Add a call to the new process model read routine located in the appropriate sub-factory (e.g. SubsurfaceReadXXXPM() in factory_subsurface.F90).
- Add a read routine for the new process model in factory_subsurface.F90. Look at SubsurfaceReadFlowPM() for an example.
- Within SubsurfaceInitializePostPetsc(), add the new process model (best to mimic an existing process model).
- Create a pointer to the new process model (pm_XXX).
- 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
- 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
- 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