New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
miscellaneous.tex in NEMO/branches/2019/dev_ASINTER-01-05_merged/doc/latex/TOP/subfiles – NEMO

source: NEMO/branches/2019/dev_ASINTER-01-05_merged/doc/latex/TOP/subfiles/miscellaneous.tex @ 12063

Last change on this file since 12063 was 12063, checked in by gsamson, 4 years ago

dev_ASINTER-01-05_merged: update branch with dev_r11085_ASINTER-05_Brodeau_Advanced_Bulk@r12061 and trunk@r12055 + bugfix for agrif compatibility in sbcblk: sette tests with ref configs ok except ABL restartability (under investigation) (tickets #2159 and #2131)

File size: 4.2 KB
Line 
1\documentclass[../main/TOP_manual]{subfiles}
2
3\begin{document}
4
5\chapter{Miscellaneous}
6
7\section{TOP synthetic Workflow}
8
9\subsection{Model initialization}
10
11\subsection{Time marching procedure}
12
13\section{Coupling an external BGC model using NEMO framework}
14
15The coupling with an external BGC model through the NEMO compilation framework can be achieved in different ways according to the degree of coding complexity of the Biogeochemical model, like e.g., the whole code is made only by one file or it has multiple modules and interfaces spread across several subfolders.\\ \\
16Beside the 6 core files of MY\_TRC module, see (see \label{Mytrc}, let's assume an external BGC model named \textit{"MYBGC"} and constituted by a rather essential coding structure, likely few Fortran files. The new coupled configuration name is NEMO\_MYBGC. \\ \\
17The best solution is to have all files (the modified MY\_TRC routines and the BGC model ones) placed in a unique folder with root \path{<MYBGCPATH>} and to use the \textit{makenemo} external readdressing of MY\_SRC folder. \\ \\
18The coupled configuration listed in \textbf{cfg.txt}  will look like
19
20\begin{minted}{bash}
21   NEMO_MYBGC OPA_SRC TOP_SRC
22\end{minted}
23and the related cpp\_MYBGC.fcm content will be
24%
25\begin{minted}{bash}
26    bld::tool::fppkeys   key_iomput key_mpp_mpi key_top
27\end{minted}
28
29the compilation with \textit{makenemo} will be executed through the following syntax
30
31\begin{minted}{bash}
32   makenemo -n NEMO_MYBGC -m <arch_my_machine> -j 8 -e <MYBGCPATH>
33\end{minted}
34%The 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.
35%
36%
37%The compilation of more articulated BGC model code & infrastructure, like in the case of BFM (?BFM-NEMO coupling manual), requires some additional features.
38%
39%As before, let?s assume a coupled configuration name NEMO_MYBGC, but in this case MYBGC model root becomes <MYBGCPATH> that contains 4 different subfolders for biogeochemistry, named initialization, pelagic, and benthic, and a separate one named nemo_coupling including the modified MY_SRC routines. The latter folder containing the modified NEMO coupling interface will be still linked using the makenemo ?-e? option.
40%
41%In order 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 to include the specific paths of MYBGC folders, as in the following example
42%
43\begin{minted}{bash}
44   bld::tool::fppkeys   key_iomput key_mpp_mpi key_top
45
46   src::MYBGC::initialization         <MYBGCPATH>/initialization
47   src::MYBGC::pelagic                <MYBGCPATH>/pelagic
48   src::MYBGC::benthic                <MYBGCPATH>/benthic
49
50   bld::pp::MYBGC      1
51   bld::tool::fppflags::MYBGC   %FPPFLAGS
52   bld::tool::fppkeys   %bld::tool::fppkeys MYBGC_MACROS
53\end{minted}
54
55%where MYBGC_MACROS is the space delimited list of macros used in MYBGC model for selecting/excluding specific parts of the code. The 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>.
56%
57%The compilation will be performed similarly to in the previous case with the following
58%
59%makenemo -n NEMO_MYBGC -m <arch_my_machine> -j 8 -e <MYBGCPATH>/nemo_coupling
60%Note 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
61%
62%bld::tool::fppkeys  key_zdftke key_dynspg_ts key_iomput key_mpp_mpi key_top
63%inc <MYBGCPATH>/MYBGC.fcm
64%This will enable a more portable compilation structure for all MYBGC related configurations.
65%
66%Important: the coupling interface contained in nemo_coupling cannot be added using the FCM syntax, as the same files already exists in NEMO and they are overridden only with the readdressing of MY_SRC contents to avoid compilation conflicts due to duplicate routines.
67%
68%All modifications illustrated above, can be easily implemented using shell or python scripting to edit the NEMO configuration cpp.fcm file and to create the BGC model specific FCM compilation file with code paths.
69
70\end{document}
Note: See TracBrowser for help on using the repository browser.