Step-by-step guide (in this example we want to add an interface for the WRF model)
1) Check out the OOPS mom5cice5 branch as template:
Clone the OOPS repository
|
2) Define the path to the OOPS directory for convenience:
sh/bash/ksh
|
csh/tcsh
|
cd into the OOPS directory
|
checkout and track
|
2) Create a developer branch for that model:
Use git flow if available
|
Otherwise, create local branch
|
3) Compile OOPS and run the basic tests:
Execute the script
|
Go to oops sub-directory and run tests
|
Note: some test might fail for the QG model
4) Preparing the directory for the specific model:
If the model is coded in some flavor of fortran (90 or more recent), the addition of a new model interface begins by duplicating the existing ModelX directory under OOPS/oops/ and renaming rename the "X" files with the appropriate tag that reflect the new model. In this example, the new model is wrf:
Use the ModelX as a template:
cd $OOPS/oops
cp -r ModelX wrf
Rename the files (xxxx_*) with the appropriate new model tag (wrf_*)
cd wrf/model
mv -f xxxx_constants.f90 wrf_constants.f90
mv -f xxxx_fields.F90 wrf_fields.F90
mv -f xxxx_fields_interface.F90 wrf_fields_interface.F90
mv -f xxxx_geom_mod.F90 wrf_geom_mod.F90
mv -f xxxx_invent_state.f90 wrf_invent_state.f90
mv -f xxxx_vars_mod.F90 wrf_vars_mod.F90
Update the files content with the changes using script oops/ModelX/template2model.py. In the following example, all call to xxxx_ will be replaced by wrf_ and all calls to XXXX_ will be replaced by WRF:
cd $OOPS/oops/wrf
../ModelX/template2model.py wrf WRF
cd $OOPS/oops/wrf/model
../../ModelX/template2model.py wrf WRF
cd $OOPS/oops/wrf/executables
../../ModelX/template2model.py wrf WRF
5) Check the compilation after the changes:
In $OOPS/oops/CMakeLists.txt, add the following line:
add_subdirectory( wrf )
Recompile:
cd $OOPS
./build_oops_cheyenne.csh
6) Test the changes:
cd $OOPS/build/oops/
ctest
Running single test:
cd $OOPS/build/oops/wrf/test
./test_wrf_geometry -- ./testinput/test.json
7) Optional: Remove the files specific to the physics of ModelX:
rm -f calc_pv.f90 pv_operator.f90 laplacian_2d.f90 random_*
Edit the file $OOPS/wrf/model/CMakeLists.txt and delete the corresponding entries:
8) Commit and push the changes