Changes between Version 16 and Version 17 of Working Groups/TOP/TOP-User Quick Guide


Ignore:
Timestamp:
2018-01-17T12:15:28+01:00 (3 years ago)
Author:
lovato
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Working Groups/TOP/TOP-User Quick Guide

    v16 v17  
    211211|| tyrc14_beg || starting year of experiment - Bomb || 
    212212 
    213  
     213[[BR]] 
    214214 
    215215== Generalized coupling interface for external BGC models == 
     216 
    216217The generalized interface is pivoted on MY_TRC module that contains template files to build the coupling between NEMO and any external BGC model. 
    217218 
    218 The call to MY_TRC is activated by setting ln_my_trc = .true. (in namtrc) 
     219The call to MY_TRC is activated by setting {{{ ln_my_trc = .true. }}} (in namtrc) 
    219220 
    220221The following 6 fortran files are available in MY_TRC with the specific purposes here described. 
    221222 
    222 par_my_trc.F90 
     223[[BR]] 
     224 
     225'''par_my_trc.F90''' 
    223226 
    224227This module allows to define additional arrays and public variables to be used within the MY_TRC interface 
    225228 
    226 trcini_my_trc.F90 
     229'''trcini_my_trc.F90''' 
    227230 
    228231Here are initialized user defined namelists and the call to the external BGC model initialization procedures to populate general tracer array (trn and trb). Here are also likely to be defined suport arrays related to system metrics that could be needed by the BGC model. 
    229232 
    230 trcnam_my_trc.F90 
    231  
    232 This routine is called at the beginning of trcini_my_trc and should contain the initialization of additional namelists for the BGC model or user-defined code.  
    233  
    234 trcsms_my_trc.F90 
    235  
    236 The routine performs the call to Boundary Conditions and its main purpose is to contain the Source-Minus-Sinks terms due to the biogeochemical processes of the external model. Be aware that lateral boundary conditions are applied in trcnxt routine. IMPORTANT: the routines to compute the light penetration along the water column and the tracer vertical sinking should be defined/called in here, as generalized modules are still missing in the code.  
    237  
    238 trcice_my_trc.F90 
     233'''trcnam_my_trc.F90''' 
     234 
     235This routine is called at the beginning of trcini_my_trc and should contain the initialization of additional namelists for the BGC model or user-defined code. 
     236 
     237'''trcsms_my_trc.F90''' 
     238 
     239The routine performs the call to Boundary Conditions and its main purpose is to contain the Source-Minus-Sinks terms due to the biogeochemical processes of the external model. Be aware that lateral boundary conditions are applied in trcnxt routine. IMPORTANT: the routines to compute the light penetration along the water column and the tracer vertical sinking should be defined/called in here, as generalized modules are still missing in the code. 
     240 
     241'''trcice_my_trc.F90''' 
    239242 
    240243Here it is possible to prescribe the tracers concentrations in the seaice that will be used as boundary conditions when ice melting occurs (nn_ice_tr =1 in namtrc_ice). See e.g. the correspondent PISCES subroutine. 
    241244 
    242 trcwri_my_trc.F90 
     245'''trcwri_my_trc.F90''' 
    243246 
    244247This routine performs the output of the model tracers (only those defined in namtrc) using IOM module (see Manual Chapter “Output and Diagnostics”). It is possible to place here the output of additional variables produced by the model, if not done elsewhere in the code, using the call to iom_put. 
    245248 
     249[[BR]] 
     250 
    246251== Coupling with an external BGC model == 
     252 
    247253The coupling with an external BGC model through the NEMO compilation framework can be achieved in different ways according to the degree of coding complexity (e.g., code is only in one file or it has multiple modules and interfaces) of the BGC model itself. 
    248254 
    249 Beside the 6 core files of MY_TRC module, let’s assume an external BGC model named “MYBGC” made of a rather essential coding structure, likely few Fortran files. 
    250  
    251 The best solution is to have a single folder containing the modified MY_TRC routines and the BGC model ones and use the makenemo external addressing of MY_SRC folder. 
    252  
    253 The configuration listed in cfg.txt will look like 
    254  
     255[[BR]] 
     256 
     257Beside the 6 core files of MY_TRC module, let’s assume an external BGC model named “MYBGC” and constituted by a rather essential coding structure, likely few Fortran files. The new coupled configuration name is NEMO_MYBGC. 
     258 
     259The best solution is to have all files (the modified MY_TRC routines and the BGC model ones) place in a single folder and use the makenemo external addressing of MY_SRC folder. 
     260 
     261The coupled configuration listed in '''cfg.txt''' will look like 
     262{{{ 
    255263NEMO_MYBGC OPA_SRC TOP_SRC 
    256  
    257 and the related cpp_MYBGC.fcm content will be  
    258  
    259 bld::tool::fppkeys  key_zdftke key_dynspg_ts key_iomput key_mpp_mpi key_top 
    260  
    261 For compilation it will be then used the following syntax 
    262  
     264}}} 
     265 
     266and the related '''cpp_MYBGC.fcm''' content will be 
     267{{{ 
     268bld::tool::fppkeys  key_zdftke key_dynspg_ts key_iomput key_mpp_mpi key_top 
     269}}} 
     270 
     271the compilation qith makenemo will be executed the following syntax 
     272{{{ 
    263273makenemo -n NEMO_MYBGC -m <arch_my_machine> -j 8 -e <MYBGCPATH> 
     274}}} 
    264275 
    265276The makenemo feature “-e” was introduced to readdress at compilation time the standard MY_SRC folder (usually found in NEMO configurations) with a user defined external one. 
    266277 
     278[[BR]] 
     279 
    267280In the case of more complex and articulated BGC model code infrastructure, like in the case of BFM (!http://www.bfm-community.eu/publications/bfmnemomanual_r1.0_201508.pdf), the compilation requires some additional features. 
    268281 
    269 As before, let’s assume that we have a coupled configuration name NEMO_MYBGC, but in this case the BGC model repository has 3 different subfolders for biogeochemistry, named initialization, pelagic, and benthic, and a separate one named nemo_coupling that contains the modified MY_SRC routines. 
    270  
     282As before, let’s assume a coupled configuration name NEMO_MYBGC, but in this case MYBGC model repository has 3 different subfolders for biogeochemistry, named initialization, pelagic, and benthic, and a separate one named nemo_coupling that contains the modified MY_SRC routines. 
    271283The latter folder containing the modified NEMO coupling interface will be still linked using the makenemo “-e” option. 
    272284 
    273 To include the BGC model subfolders in the compilation of NEMO code it will be necessary to extend the configuration cpp_NEMO_MYBGC.fcm file (see previous case), as in the following example  
    274  
    275 bld::tool::fppkeys  key_zdftke key_dynspg_ts key_iomput key_mpp_mpi key_top 
    276  
    277 src::MYBGC::initialization           <MYBGCPATH>/initialization 
    278  
    279 src::MYBGC::pelagic         <MYBGCPATH>/pelagic 
    280  
    281 src::MYBGC::benthic             <MYBGCPATH>/benthic 
    282  
    283 bld::pp::MYBGC      1 
    284  
     285To include the BGC model subfolders in the compilation of NEMO code it will be necessary to extend the configuration cpp_NEMO_MYBGC.fcm file to include the specific paths of MYBGC folders, as in the following example 
     286{{{ 
     287bld::tool::fppkeys  key_zdftke key_dynspg_ts key_iomput key_mpp_mpi key_top 
     288src::MYBGC::initialization           <MYBGCPATH>/initialization 
     289src::MYBGC::pelagic         <MYBGCPATH>/pelagic 
     290src::MYBGC::benthic             <MYBGCPATH>/benthic 
     291 
     292bld::pp::MYBGC      1 
    285293bld::tool::fppflags::MYBGC %FPPFLAGS 
    286  
    287 bld::tool::fppkeys  %bld::tool::fppkeys MYBGC_MACROS 
     294bld::tool::fppkeys  %bld::tool::fppkeys MYBGC_MACROS 
     295}}} 
    288296 
    289297where MYBGC_MACROS is the space delimited list of macros used in MYBGC model for selecting/excluding specific parts of the code. 
    290  
    291298The BGC model code will be preprocessed in the configuration BLD folder as for NEMO, but with an independent path, like NEMO_MYBGC/BLD/MYBGC/<subforlders>. 
    292299 
    293 The compilation will be performed as in the previous case with the following  
    294  
     300The compilation will be performed as in the previous case with the following 
     301{{{ 
    295302makenemo -n NEMO_MYBGC -m <arch_my_machine> -j 8 -e <MYBGCPATH> 
    296  
    297 Note that, the additional lines of previous example, can be written into a separate file, e.g. named MYBGC.fcm, and then simply included in the cpp_NEMO_MYBGC.fcm as follow 
    298  
    299 bld::tool::fppkeys  key_zdftke key_dynspg_ts key_iomput key_mpp_mpi key_top key_my_trc 
    300  
     303}}} 
     304 
     305 
     306Note that, the additional lines specific for the BGC model source and build paths, can be written into a separate file, e.g. named MYBGC.fcm, and then simply included in the cpp_NEMO_MYBGC.fcm as follow 
     307{{{ 
     308bld::tool::fppkeys  key_zdftke key_dynspg_ts key_iomput key_mpp_mpi key_top key_my_trc 
    301309inc <MYBGCPATH>/MYBGC.fcm 
     310}}} 
    302311 
    303312This will enable a more portable compilation structure for all MYBGC related configurations.