Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create sites #2

Open
wants to merge 13 commits into
base: noresm_site_platform
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Externals.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ required = True
[cime]
local_path = cime
protocol = git
repo_url = https://github.com/ESMCI/cime
tag = branch_tags/cime5.8.23_a01
repo_url = https://github.com/NordicESMhub/cime.git
tag = release-emerald2.0.0
externals = ../Externals_cime.cfg
required = True

Expand Down
148 changes: 148 additions & 0 deletions README_fates_emerald_api
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
$CTSMROOT/README_fates_emerald_api 22/04/2020

Version 1.0, 22/04/2020 :
Developed based on:
CLM5.0: release-clm5.0.32
FATES: sci.1.34.0_api.9.0.0
CIME: cime5.6.33
Basic setup for runing CLM-FATES on 12 SeedClim sites, using
(1) GSWP3v1 (0.5 degree) atm forcing,
(2) Default surface data file
(3) Default FATES parameterfile (12 pfts)
(4) No initial file ("initial cold start from bare ground")
(5) Only simulation for present-day (2000) in equilibrium state are available and tested

Version 1.1, ??/??/????:
Improved setup for runing CLM-FATES on 12 SeedClim sites, using
(1) COSMO-Rea 6km, ERALAND 9km, atm forcing ?
(2) Modify surface data file to better represent the sites ?
(3) Modify FATES parameterfile to better represent the sites ?
(4) Initial file available for all the sites to run FATES and CLM50BGC ?

Version 1.2, ??/??/????:
Improved setup for runing CLM-FATES on 12 SeedClim sites
(1) Set up simulations with prescribed standing structure
(2) Set up and test transient simulations from pre-industrial (1850) to present (2020)



=============================================================================================
QUICKSTART on SAGA:
=============================================================================================
#### You need to have access to SAGA and the NorESM shared folder on SAGA: /cluster/shared/noresm/inputdata/

#### Clone git repository
git clone https://github.com/NordicESMhub/ctsm.git

#### For developer, please checkout branch "fates_emerald_api"
cd ~/ctsm
git checkout fates_emerald_api # The branch will have the same name as the branch name.
or:
git checkout fates_emerald_api -b new_branch_name # if you want to create a new branch name.
#### For user, please checkout "release tag" of the platform, e.g., release-emerald-platform1.0.0.
cd ~/ctsm
git checkout release-emerald-platform1.0.0 # The branch will have the same name as the tag name.
or
git checkout release-emerald-platform1.0.0 -b new_branch_name # if you want to create a new branch name.
#### More details on the workflow for developing the platform are available at ??????


#### Download other external codes
./manage_externals/checkout_externals

#### Create a case:
#--case: which directory your case will be create
#--compset: which model component will be used, only DATM%1PTGSWP3 is available at the moment
#--res: currently available resolution are as following. More details about each sites can be found in: ?????
SeedClim Sites: 1x1_ALP1,61.0243N,8.12343E
1x1_ALP2,60.8231N,7.27596E
1x1_ALP3,60.8328N,7.17561E
1x1_ALP4,60.9335N,6.41504E
1x1_SUB1,60.8203N,8.70466E
1x1_SUB2,60.8760N,7.17666E
1x1_SUB3,61.0866N,6.63028E
1x1_SUB4,60.5445N,6.51468E
1x1_BOR1,61.0355N,9.07876E
1x1_BOR2,60.8803N,7.16982E
1x1_BOR3,60.6652N,6.33738E
1x1_BOR4,60.6901N,5.96487E
LandPress Sites:1x1_LYG,60.70084N,5.092566E
1x1_BUO,65.83677N,12.224506E
1x1_HAV,64.779N,11.2193E
1x1_SKO,65.79602N,12.219299E
Three-D Sites: 1x1_VIKE,60.88019N,7.16990E
1x1_JOAS,60.86183N,7.16800E
1x1_LIAH,60.85994N,7.19504E
Finnmark Site: 1x1_FINN,69.341088N,25.293524E

Other sites will be available:
Finse (FNS) : 60.5938694N, 7.5272352E (contact Yeliz, LATICE project)
Bayelva (BYV) : 78.92094N, 11.83334E (contact Yeliz, LATICE project)
Iskoras (ISK) : 69.3405665N, 25.2956747E (contact Yeliz, LATICE project)
Hedmark/Trysil : the mire site with EC-flux measurements run by Norbert (Lena, Norbert)
Svanhovd: has also an extensive record of environmental data (Stefanie, DoublePunch project)
Adventdalen (ADVN) : 78.18333N, 15.91667E (Dev, Frans-Jan)
Hurdal (HUR): ??? (Hanna)


#--machine: where to run the model, saga is the only option at the moment
#--project: your project number on saga

cd ~/ctsm/cime/scripts
./create_newcase --case ../../../ctsm_cases/YOUR_CASE_NAME --compset 2000_DATM%1PTGSWP3_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV --res 1x1_ALP1 --machine saga --run-unsupported --project nn2806k


#### Copy inputdata for the site to your working directory, e.g.:

cp /cluster/shared/noresm/inputdata_fates_platform/inputdata_version1.0.0_ALP1.tar /cluster/work/users/$USER/
cd /cluster/work/users/$USER/
tar xvf inputdata_version1.0.0_ALP1.tar

#### Run a case

cd ~/ctsm_cases/YOUR_CASE_NAME
./case.setup # create the $CASE.run file
./case.build # build model and create namelists
./case.submit # submit script
# default setting only allow you to run 5 days test run.

#### To run a longer simulation

# Following parameters can be adapted for longer simulation

./xmlchange --file env_run.xml --id RUN_STARTDATE --val 0001-01-01 # set up the starting date of your simulation
./xmlchange --file env_run.xml --id STOP_OPTION --val nyears # set the simulation periods to "years"
./xmlchange --file env_run.xml --id STOP_N --val 5 # set the length of simulation, i.e, how many years
./xmlchange --file env_run.xml --id CONTINUE_RUN --val TRUE # if you want to continue your simulation from restart file, set it to TRUE
./xmlchange --file env_run.xml --id RESUBMIT --val 10 # set up how many times you want to resubmit your simulation.
# e.g, STOP_N=5, RESUBMIT=10, you will have simulation for 5+5*10=55
./xmlchange --file env_run.xml --id DATM_CLMNCEP_YR_START --val 1901 # set up the start year of the atmospheric forcing
./xmlchange --file env_run.xml --id DATM_CLMNCEP_YR_END --val 1950 # set up the end year of the atmospheric forcing
./xmlchange --file env_workflow.xml --id JOB_WALLCLOCK_TIME --val 01:00:00 # set up longer time for runing the simulation

./case.submit

#### Checking the status of your simulation

squeue -u YOUR_SAGA_ACCOUNT

#### Checking the results of your simulation

cd /cluster/work/users/YOUR_SAGA_ACCOUNT/ctsm/YOUR_CASE_NAME/run # when model is running, model results and restart file are kept here
cd /cluster/work/users/YOUR_SAGA_ACCOUNT/archive/YOUR_CASE_NAME # when model is finished, model results and restart file are kept here

=============================================================================================
For more detail on the platform and its usage, please refere to "README_fates_emerald_api_expert_only"
=============================================================================================

=============================================================================================
QUICKSTART on GALAXY:
=============================================================================================
Tutorials can be found at: https://github.com/NordicESMhub/galaxy-training-material/blob/fates/topics/climate/tutorials/fates/tutorial.md

Available exerpiments and results using FATES_emerald_platform can be found: https://docs.google.com/spreadsheets/d/1yHFbRDTyYBv61klcgdJpIWNc5rN-FzBmMF50AgiPeWc/edit?usp=sharing





74 changes: 74 additions & 0 deletions README_fates_emerald_api_expert_only
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
$CTSMROOT/README_fates_emerald_api_expert_only 03/06/2020

#################################################################################
# This document explains how to update the model codes and
# how to create atmospheric forcing and inputdata for new sites
# (No technical support will be promised, use at your own risk!)
# See also Yeliz's notes: https://ctsm-docs.readthedocs.io/en/latest/ for additional details
#################################################################################

######## Two important things to watch out first!!!
######## Two important things to watch out first!!!
######## Two important things to watch out first!!!
(1) Module environment on your supercomputer: DON'T load any module beforehand, except "StdEvn"!
(2) Git version control:
CLM-FATES have very complex and sperate repository system:
-> ctsm: always create your own branch, do not touch master!
-> cime: remember to create your own branch in cime folder also, to record all the changes you make.
-> fates: remember to create your own branch in fates folder also, to record all the changes you make.
If you do not create your own branch for "cime" and "fates", when you run "./manage_externals/checkout_externals", your previous "cime" and "fates" will be overwritten.


######## Download ctsm and update ctsm-fates (Only important steps are illustrated here!!!)
**** If you are already using fates_emerald_api, skip this! ****
e.g.:
git remote add ctsm_ncar https://github.com/ESCOMP/CTSM.git # set a remote name for NCAR CTSM git repository
git fetch ctsm_ncar # get the most recent updates of CTSM
git merge ctsm_ncar/master # update your current branch with the newest CTSM version
git merge ctsm_ncar/fates_next_api # update your current branch with the newest CLM-FATES interface

##To update fates, you need to go to fates folder
e.g.:
git remote add NGEET_fates https://github.com/NGEET/fates.git
git fetch NGEET_fates # get the most recent updates of FATES
git merge NGEET_fates.git/master # update your current branch with the newest FATES

######## Adapt ctsm/cime to specific machine (e.g., SAGA and FRAM)
**** If you are already using fates_emerald_api, skip this! ****
Following file need to be modified
..../cime/config/cesm/machines/config_batch.xml
..../cime/config/cesm/machines/config_compilers.xml
..../cime/config/cesm/machines/config_machines.xml

See example here, you need look for the setup
https://github.com/NordicESMhub/cime/blob/cime5.6.10_noresm2_1_rel_06/config/cesm/machines/config_compilers.xml
https://github.com/NordicESMhub/cime/blob/cime5.6.10_noresm2_1_rel_06/config/cesm/machines/config_machines.xml
https://github.com/NordicESMhub/cime/blob/cime5.6.10_noresm2_1_rel_06/config/cesm/machines/config_batch.xml


**** If you want to set up new sites, please follow the following steps ****
######## Make script grids (see "prepare_inputdata.sh" in ~/ctsm/tools/emerald_sites_tools)
######## Make domain file (see "prepare_inputdata.sh" in ~/ctsm/tools/emerald_sites_tools)
######## Make mapping file (see "prepare_inputdata.sh" in ~/ctsm/tools/emerald_sites_tools)
######## Make surface data file (see "prepare_inputdata.sh" in ~/ctsm/tools/emerald_sites_tools)
######## Make and modify FATES parameter file:
## Use existing tools:
./src/fates/tools/FatesPFTIndexSwapper.py # Select PFTs interested.
./src/fates/tools/modify_fates_paramfile.py # Modify PFT parameters
## To use these tools, netcdf and python modules need to be loaded.
module load netCDF-Fortran/4.4.4-intel-2018b
module load Python/3.6.6-intel-2018b
./FatesPFTIndexSwapper.py --pft-indices=2,6,9,10 --fin=****.nc --fout=****.nc
## The default FATES parameter file is in ./src/fates/parameter_files
## To create a netcdf parameter file: ncgen -o ****.nc fates_params_default.cdl
######## Make atmospheric forcing for new sites (see "prepare_atm_forcing_****.ncl" in ./tools)

######## Set each sites as a unique grid type. The following file need to be modified:
~/ctsm/cime/config/cesm/config_grids.xml
~/ctsm/cime/src/components/data_comps/datm/cime_config/namelist_definition_datm.xml
~/ctsm/bld/namelist_files/namelist_defaults_clm4_5.xml

######## Set new atmospheric forcing for the sites
~/ctsm/cime/src/components/data_comps/datm/cime_config/config_component.xml (for different climate forcing)
~/ctsm/cime_config/config_component.xml (for different climate forcing)

14 changes: 7 additions & 7 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2341,9 +2341,9 @@ sub setup_logic_initial_conditions {
}
}
} else {
if ( $nl_flags->{'clm_start_type'} =~ /startup/ ) {
$log->fatal_error("clm_start_type is startup so an initial conditions ($var) file is required, but can't find one without $useinitvar being set to true");
}
# if ( $nl_flags->{'clm_start_type'} =~ /startup/ ) {
# $log->fatal_error("clm_start_type is startup so an initial conditions ($var) file is required, but can't find one without $useinitvar being set to true");
# }
$try = $done;
}
} else {
Expand Down Expand Up @@ -3237,7 +3237,7 @@ sub setup_logic_popd_streams {
'sim_year_range'=>$nl_flags->{'sim_year_range'}, 'cnfireson'=>$nl_flags->{'cnfireson'});
}
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_popdens', 'phys'=>$nl_flags->{'phys'},
'cnfireson'=>$nl_flags->{'cnfireson'}, 'hgrid'=>"0.5x0.5", 'ssp_rcp'=>$nl_flags->{'ssp_rcp'} );
'cnfireson'=>$nl_flags->{'cnfireson'}, 'hgrid'=>$nl_flags->{'res'}, 'ssp_rcp'=>$nl_flags->{'ssp_rcp'} );
} else {
# If bgc is NOT CN/CNDV or fire_method==nofire then make sure none of the popdens settings are set
if ( defined($nl->get_value('stream_year_first_popdens')) ||
Expand Down Expand Up @@ -3273,8 +3273,8 @@ sub setup_logic_urbantv_streams {
'sim_year_range'=>$nl_flags->{'sim_year_range'});
}
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_urbantv', 'phys'=>$nl_flags->{'phys'},
'hgrid'=>"0.9x1.25" );
}
'hgrid'=>$nl_flags->{'res'} );
}

#-------------------------------------------------------------------------------

Expand All @@ -3299,7 +3299,7 @@ sub setup_logic_lightning_streams {
'sim_year_range'=>$nl_flags->{'sim_year_range'});
}
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_lightng', 'use_cn'=>$nl_flags->{'use_cn'},
'hgrid'=>$nl_flags->{'light_res'} );
'hgrid'=>$nl_flags->{'res'} );
} else {
# If bgc is NOT CN/CNDV then make sure none of the Lightng settings are set
if ( defined($nl->get_value('stream_year_first_lightng')) ||
Expand Down
Loading