Skip to content

Commit e630aab

Browse files
committed
-
1 parent 25eb6bf commit e630aab

1 file changed

Lines changed: 118 additions & 12 deletions

File tree

muffin.tex

Lines changed: 118 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7794,9 +7794,9 @@ \section{Miscellaneous data processing}
77947794

77957795
\section{Model ensembles}
77967796

7797-
The \textbf{muffindata} \textbf{MATLAB} file: \textsf{\footnotesize fun\_make\_ensemble\_2d.m} provides a simple/convenient way of generating ensembles of model experiments. By default, the function is designed for generating 2D ensembels of a first varying parameter vs. a second varying parameter. However, by specifying only a single value of the 2nd (or first) parameter, you'll obtain a 1D ensemble of just a single varuing parameter.
7797+
The \textbf{muffindata} \textbf{MATLAB} file: \textsf{\footnotesize fun\_make\_ensemble\_2d.m} provides a simple/convenient way of generating ensembles of model experiments. By default, the function is designed for generating 2D ensembles of a first varying parameter vs. a second varying parameter. However, by specifying only a single value of the 2nd (or first) parameter, you'll obtain a 1D ensemble of just a single parameter varying.
77987798

7799-
Information about how to configure and generate an ensemble is provided as MATLAB help on this function:
7799+
Information about how to configure and generate an ensemble is provided as \textbf{MATLAB} help on this function:
78007800
\vspace{-2mm}
78017801
\begin{verbatim}
78027802
>> help fun_make_ensemble_2d
@@ -7805,29 +7805,74 @@ \section{Model ensembles}
78057805

78067806
The function \textsf{\footnotesize fun\_make\_ensemble\_2d.m} requires 2 parameters (\textit{strings}) to be passed in the argument list, i.e.:
78077807
\begin{verbatim}
7808-
>> plot_timeseries_biogem(PAR1,PAR2)
7808+
>> fun_make_ensemble_2d.m(PAR1,PAR2)
78097809
\end{verbatim}
78107810

78117811
These are, in order:
78127812

7813-
\vspace{1mm}
78147813
\begin{enumerate}
7815-
\item \texttt{STR\_TEMPLATE} -- \textit{string} \(\rightarrow\) is the name of the template user-config file (within the \textbf{muffindata} directory) used to generate the ensemble. An example template-file (\texttt{01\_user\_config\_ensemble\_template}) is included in \textbf{muffindata}.
7816-
\item \texttt{STR\_PARAMS} -- \textit{string} \(\rightarrow\) is the name of the parameter configuration file (omitting the '.dat' extension). The format of this file is provided in the MATLAB help for this function. An example parameter-file (\texttt{01\_user\_config\_params.dat}) is included in \textbf{muffindata}.
7814+
\vspace{1mm}
7815+
\item \texttt{STR\_TEMPLATE} -- \textit{string} \(\rightarrow\) is the name of the template \textit{user-config} file (within the \textbf{muffindata} directory) used to generate the ensemble.
7816+
\\Note that the \textit{user-config} may already contain a value for the varying parameter(s) -- the automatically-generated parameter values will be appended at the very end of the file, hence over-writing any previous values.
7817+
\vspace{1mm}
7818+
\item \texttt{STR\_PARAMS} -- \textit{string} \(\rightarrow\) is the name of the parameter configuration file (omitting the '\textsf{\footnotesize .dat}' extension). The format of this file is plain text and takes a '\textsf{\footnotesize .dat}' extension. Example contents for this file are provided in the \textbf{MATLAB} help for this function.
78177819
\end{enumerate}
78187820
\vspace{2mm}
78197821

7820-
A simple example usage with the files provided would be:
7822+
An example example usage would be:
78217823
\begin{verbatim}
7822-
>> plot_timeseries_biogem('01_user_config_ensemble_template','01_user_config_params')
7824+
>> fun_make_ensemble_2d.m('user_config_template','ensemble_params')
78237825
\end{verbatim}
7824-
which creates a $2\times3$ ensemble (i.e. 6 new user-config files), by modifying the paramater \textit{bg\_ocn\_init\_8} with the vector [0.5 2.0] (i.e. multiplying the default paramater value 2.159E-06 with 0.5 and then with 2.0) and the parameter \textit{bg\_par\_atm\_force\_scale\_val\_3} with the vector [2.0 3.0 10.0]. Other examples are provided in the MATLAB help for this function.
7826+
which creates an ensemble based on the \textit{user-config} file: \textsf{\footnotesize user\_config\_template} (example file name) and with varying parameter values specified in the file: \textsf{\footnotesize ensemble\_params.dat} (example file name).
7827+
7828+
The \textit{user-config} (and hence experiment names) that are automatically generated end in \textsf{\footnotesize .xy}, where \textsf{\footnotesize x} represents the \(x+1th\) parameter value on the first axis, and \textsf{\footnotesize y} represents the \(y+1th\) parameter value on the second axis (the \textsf{\footnotesize .xy} notation starts counting at \textsf{\footnotesize .00}). For instance, \textsf{\footnotesize .00} would be an experiment taking the first parameter values specified in \textsf{\footnotesize ensemble\_params.dat} for both axes. \textsf{\footnotesize .10} would have the 2nd lister parameter value on the 1st axis, and the 1st lister on the 2nd axis. \textsf{\footnotesize .27} would have the 3rd parameter value on the 1st axis, and 8th listed parameter value on the 2nd axis. etc etc etc
7829+
7830+
Also in \textbf{muffindata} you can find a BASH shell script for submitting the entire ensemble\footnote{Having first transferred all the \textit{user-config} files to the cluster to an appropriate \textsf{\footnotesize genie-userconfigs} folder} at the command line (within \textsf{\footnotesize genie-main}) -- \textsf{\footnotesize sub\_ens.muffin.sh}. NOTE: you have to specify the experiment parameters of your ensemble (e.g. \textit{base-config} and \textit{user-config} filenames, run duration, etc.) in the BASH file and you should be sure to have compiled the model (by running a brief experiment) with the required \textit{base-config} prior to using \textsf{\footnotesize sub\_ens.muffin.sh}.
7831+
7832+
The lines requiring editing in \textsf{\footnotesize sub\_ens.muffin.sh} are clearly marked and these instructions are not repeated here.
7833+
7834+
\newpage
7835+
7836+
Note that you may need to re-assigned an 'executable' permission after editing and saving \textsf{\footnotesize sub\_ens.muffin.sh}. To do this, from \textsf{\footnotesize genie-main}:
7837+
\begin{verbatim}
7838+
>> chmod a+x sub_ens.muffin.sh
7839+
\end{verbatim}
7840+
7841+
\vspace{-2mm}
7842+
\noindent\rule{4cm}{0.5pt}
7843+
\vspace{2mm}
7844+
7845+
\noindent What do you then 'do' with a whole bunch of experiments with names ending in \textsf{\footnotesize .xy} ... ???
7846+
7847+
You could of course, pick out individual ensemble member to plot and analyse, referring to the \textsf{\footnotesize ensemble\_params.dat} file where you specified the sequence of parameter values on both axes in order to identify the ensemble member you want. And/or ...
78257848

7849+
The \textbf{muffindata} \textbf{MATLAB} file: \textsf{\footnotesize fun\_process\_ensemble\_2d.m} provides a simple/convenient way of processing and visualizing ensembles of model experiments.
78267850

7827-
Also in \textbf{muffindata} you can find a BASH script for submitting the entire ensemble\footnote{Having first transferred all the \textit{user-config} files to the cluster to an appropriate genie-userconfigs folder} at the command line (within \textsf{\footnotesize genie-main}) -- \textsf{\footnotesize sub\_ens.muffin.sh}. NOTE: you have to specify the experiment parameters of your ensemble (e.g. base-config and user-config filenames, run duration etc.) in the BASH file and you should be sure to have compiled the model with the required \textit{base-config} prior to using \textsf{\footnotesize sub\_ens.muffin.sh}. An example BASH script (\textit{sub\_ens.muffin\_LAB\_4.sh}) for the $2\times3$ ensemble created above is included in \textbf{muffindata}. This ensemble can be submitted by typing:
7828-
\\\texttt{\$ ./sub\_ens.muffin\_LAB\_4.sh}\\
7829-
within \textsf{\footnotesize genie-main}.
7851+
Information about how to configure and generate an ensemble is provided as \textbf{MATLAB} help on this function:
7852+
\vspace{-2mm}
7853+
\begin{verbatim}
7854+
>> help fun_process_ensemble_2d
7855+
\end{verbatim}
7856+
\vspace{-2mm}
7857+
7858+
The function \textsf{\footnotesize fun\_make\_ensemble\_2d.m} requires 3 parameters to be passed in the argument list, i.e.:
7859+
\begin{verbatim}
7860+
>> fun_process_ensemble_2d.m(PAR1,PAR2,PAR3)
7861+
\end{verbatim}
7862+
7863+
These are, in order:
7864+
7865+
\begin{enumerate}
7866+
\vspace{1mm}
7867+
\item \texttt{PAR1} -- \textit{string} \(\rightarrow\) is simply the ensemble name, but omitting the \textsf{\footnotesize .xy} numerical code of individual ensemble members).
7868+
\vspace{1mm}
7869+
\item \texttt{PAR2} -- \textit{number} \(\rightarrow\) is the year of model data to extract. e.g. \texttt{9999.5} for the last year of a 10,000 year long run.
7870+
\vspace{1mm}
7871+
\item \texttt{PAR3} -- \textit{string} \(\rightarrow\) is a name to assign to the output files (e.g. giving you a potentially more meaningful set of filenames than simply re-using \texttt{PAR1}.
7872+
\end{enumerate}
7873+
\vspace{2mm}
78307874

7875+
\noindent Within the code of \textsf{\footnotesize fun\_process\_ensemble\_2d.m} are instructions/directions as to how to extract specific variables. More advanced usage can statistically compare to data and calculate the goodness of fit of al the ensembles members, and even automatically identify and further process the 'best' (depending on the specific criteria for 'best').
78317876

78327877
%----------------------------------------------------------------------------------------
78337878
% CHAPTER X
@@ -13520,6 +13565,67 @@ \subsubsection{Adding (and testing) a basic tracer biogeochemical cycle}
1352013565
\end{verbatim}\vspace{-1mm}\normalsize
1352113566
(ca. L2961), e.g. following the examples of Fe scavenging and H2S reaction with organic matter (treated as a form of 'scavenging' for simplicity of code structure), plus a corresponding subroutine added in which is the scavenged particulate tracer concentration is calculated and the removal of the corresponding dissolved tracers set.
1352213567

13568+
%------------------------------------------------
13569+
13570+
\newpage
13571+
13572+
%------------------------------------------------
13573+
%
13574+
\section{Other Modifications!}
13575+
13576+
%------------------------------------------------
13577+
%
13578+
\subsection*{Add a new functional type to ECOGEM}\label{functionaltype}
13579+
13580+
13581+
\begin{enumerate}[noitemsep]
13582+
13583+
\vspace{1mm}
13584+
\item First, define the new PFT in:
13585+
\\\textsf{\footnotesize \(\sim\)/cgenie.muffin/genie-ecogem/src/fortran/ecogem\_data.f90}
13586+
13587+
In the subroutine \textsf{\footnotesize sub\_init\_plankton}, add a set of definitions for a new PFT consistent with the formatting -- the PFT has a name and various true/false statements as to what it does, e.g.
13588+
\small\begin{verbatim}
13589+
if (pft(jp).eq.'new_PFT') then
13590+
NO3up(jp) = 0.0
13591+
Nfix(jp) = 0.0
13592+
calcify(jp) = 0.0
13593+
silicify(jp) = 0.0
13594+
autotrophy(jp) = 1.0
13595+
heterotrophy(jp)= 0.0
13596+
palatability(jp)= 1.0
13597+
\end{verbatim}\normalsize
13598+
13599+
\vspace{1mm}
13600+
\item Define parameters relevant to the PFT such as size-scaling parameters
13601+
(\texttt{a},\texttt{b},\texttt{c}) for \texttt{vmax}. (See existing manual section for adding parameters.)
13602+
13603+
\vspace{1mm}
13604+
\item Use the new parameters to update the PFT parameter definitions in
13605+
\textsf{\footnotesize \(\sim\)/cgenie.muffin/genie-ecogem/src/fortran/ecogem\_data.f90}, using the PFT name defined in step 1:
13606+
13607+
\small\begin{verbatim}
13608+
! generic maximum photosynthetic rate
13609+
vmax(iDIC,:) = (vmaxDIC\_a + log10(volume(:))) / (vmaxDIC\_b + vmaxDIC\_c
13610+
* log10(volume(:)) + log10(volume(:))**2) * autotrophy(:)
13611+
13612+
! modify rates for new functional types
13613+
vmax(iDIC,:) = merge(vmaxDIC\_a\_pft\_newPFT * volume(:) **
13614+
vmaxDIC\_b\_pft\_newPFT,vmax(iDIC,:),pft.eq.'new\_PFT')
13615+
\end{verbatim}\normalsize
13616+
13617+
\vspace{1mm}
13618+
\item Set up a plankton definition file in
13619+
\textsf{\footnotesize \(\sim\)cgenie.muffin/genie-ecogem/data/input/new\_PFT\_setup.eco} that includes the name of the new PFT defined in step 1 and the cell size.
13620+
13621+
\end{enumerate}
13622+
13623+
\vspace{2mm}
13624+
\noindent Note that to date, only the growth rate parameters (\texttt{Vmax} for DIC) have been changed, and this approach has worked. No changes in other parameters,
13625+
specifically for PFTs such as quotas or other nutrient uptake, have been tested but I guess
13626+
it would be similar. Overall, this is a little bit clumsy in that it requires new at
13627+
least 2-3 new parameter definitions for each PFT.
13628+
1352313629
%----------------------------------------------------------------------------------------
1352413630
% CHAPTER -- EXAMPLES
1352513631
%----------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)