Skip to content

Compiling and Run ELM PFLOTRAN

Fengming Yuan edited this page Aug 6, 2019 · 5 revisions

Building ELM with PFLOTRAN library

(UPDATED: @2019-08-06 Now ELM-PFLOTRAN coupling can be setup using specific COMPSETs such as CLM45%PFCN*)

(1) Building PFLOTRAN library

See PFLOTRAN-ELM interface

(2) Creating an ELM new case, with ELM-PFLOTRAN coupled.

For general ELM setup

See point ELM case example

For pflotran-coupled ELM setup (New@2019-08-06)

./create_newcase --case $HOME/project_acme/cases/testalmpf --mach mymac --compiler gnu --mpilib mpich --compset  I1850PFCNRDCTCBC --res CLM_USRDAT --srcroot $HOME/mygithub/ACME

NOTE: Currently, support 12 compsets:

I1850PFCNRDCTC
I20TRPFCNRDCTC
ICB1850PFCNRDCTC
ICB20TRPFCNRDCTC
I1850GSWPFCNRDCTC
I20TRGSWPFCNRDCTC
I1850PFCNRDCTCBC
I20TRPFCNRDCTCBC
ICB1850PFCNRDCTCBC
ICB20TRPFCNRDCTCBC
I1850GSWPFCNRDCTCBC
I20TRGSWPFCNRDCTCBC

(3) Modifying configuration for coupling with PFLOTRAN

Three E3SM configuration files to be modified as following under CASE directory, e.g. the case built above

cd $HOME/project_acme/cases/testalmpf

I. env_build.xml (OPTIONAL - to change default vertcal-only coupled mode, to 3-D fully coupled)

Edit this file (any editor, e.g. vi) for the following xml tag '-cppdefs', aka removing '-DCOLUMN_MODE'.

vi env_build.xml

  <group id="build_component_clm">
    <entry id="CLM_CONFIG_OPTS" value="-phys clm4_5 -cppdefs '-DMODAL_AER -DCLM_PFLOTRAN -DCOLUMN_MODE'">
      <type>char</type>

II. env_mach_specific.xml (to switch on/off ELM building with PFLOTRAN library)

Usually, the PETSc library path and CLM_PFLOTRAN source directory are pre-defined in machine file. If not, they can be added into this env_mach_specific.xml, as following (of course both ENV variables must be defined in shell or .bashrc):

  <environment_variables>
    <env name="PETSC_PATH">$ENV{PETSC_DIR}</env>
    <env name="CLM_PFLOTRAN_SOURCE_DIR">/Users/$USER/mygitlab/pflotran-interface/src/pflotran-elm-interface</env>
    <env name="PFLOTRAN_INC"> -I$ENV{CLM_PFLOTRAN_SOURCE_DIR} -I$ENV{PETSC_DIR}/include</env>
    <env name="PFLOTRAN_LIB"> -L$ENV{CLM_PFLOTRAN_SOURCE_DIR} -lpflotran -L$ENV{PETSC_DIR}/lib -lpetsc -lmetis -lparmetis</env>
  </environment_variables>

IN CASE that you don't want to include PETSc and/or PFLOTRAN libraries in e3sm.exe, then comment out as following:

<!--
  <environment_variables>
    <env name="PETSC_PATH">$ENV{PETSC_DIR}</env>
    <env name="CLM_PFLOTRAN_SOURCE_DIR">/Users/$USER/mygitlab/pflotran-interface/src/pflotran-elm-interface</env>
    <env name="PFLOTRAN_INC"> -I$ENV{CLM_PFLOTRAN_SOURCE_DIR} -I$ENV{PETSC_DIR}/include</env>
    <env name="PFLOTRAN_LIB"> -L$ENV{CLM_PFLOTRAN_SOURCE_DIR} -lpflotran -L$ENV{PETSC_DIR}/lib -lpetsc -lmetis -lparmetis</env>
  </environment_variables>
-->

III. env_run.xml (to switch on run-time ELM-PFLOTRAN coupling)

IF cloning this folked (and specific-modified) [E3SM](https://github.com/fmyuan/E3SM.git, branch 'elm-dev'), you may modify env_run.xml to switch run-time ELM-PFLOTRAN interface as following,

./xmlchange --id CLM_INTERFACE_MODE --val pflotran

OTHERWISE, same codes and e3sm.exe can be run for non-PFLOTRAN coupled case.

(4) (optional) PFLOTRAN input decks

(5) Submit ELM as usual

Clone this wiki locally