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.
Changeset 7341 – NEMO

Changeset 7341


Ignore:
Timestamp:
2016-11-25T16:49:05+01:00 (7 years ago)
Author:
acc
Message:

Ticket #1802. Merged in trunk changes from 6393:6998 and resolved single conflicit in cfg.txt

Location:
branches/2016/dev_NOC_2016
Files:
13 deleted
123 edited
9 copied

Legend:

Unmodified
Added
Removed
  • branches/2016/dev_NOC_2016/DOC/NEMO_book.tex

    r6289 r7341  
    44% (C) Xavier Perseguers 2002 - xavier.perseguers@epfl.ch 
    55 
    6 \documentclass[a4paper,11pt]{book} 
    7 %\documentclass[a4paper,11pt,makeidx]{book} <== may need this to generate index 
     6% ================================================================ 
     7% PREAMBLE 
     8% ================================================================ 
    89 
    9 %  makeindex NEMO_book     <== to regenerate the index 
    10 %  bibtex         NEMO_book   <== to generate  the bibliography 
     10\include{TexFiles/Preamble} 
    1111 
    1212% ================================================================ 
    13 % HEADERS DEFINITION 
     13% TOP MATTER 
    1414% ================================================================ 
    1515 
    16 \usepackage[french]{babel} 
    17 %\usepackage{color} 
    18 \usepackage{xcolor} 
    19 %\usepackage{graphics}           % allows insertion of pictures 
    20 \usepackage{graphicx}            % allows insertion of pictures 
    21 \usepackage[capbesideposition={top,center}]{floatrow} % allows captions 
    22 \floatsetup[table]{style=plaintop}                                   % beside pictures 
    23 \usepackage[margin=10pt,font={small},labelsep=colon,labelfont={bf}]{caption} % Gives small font for captions 
    24 \usepackage{enumitem}                          % allows non-bold description items 
    25 \usepackage{longtable}                         % allows multipage tables 
    26 %\usepackage{colortbl}                           % gives coloured panels behind table columns 
    27  
    28 %hyperref 
    29 \usepackage[               % 
    30   pdftitle={NEMO ocean engine},  % 
    31   pdfauthor={Gurvan Madec},      % pdfsubject={The preprint document class 
    32                                        % elsart},% pdfkeywords={diapycnal diffusion,numerical mixing,z-level models},% 
    33   pdfstartview=FitH,          % 
    34   bookmarks=true,          % 
    35   bookmarksopen=true,         % 
    36   breaklinks=true,            % 
    37   colorlinks=true,            % 
    38   linkcolor=blue,anchorcolor=blue,  % 
    39   citecolor=blue,filecolor=blue,    % 
    40  menucolor=blue,                    % 
    41   urlcolor=blue]{hyperref} 
    42 %  usage of exteranl hyperlink :  \href{mailto:my_address@wikibooks.org}{my\_address@wikibooks.org} 
    43 %                                                 \url{http://www.wikibooks.org} 
    44 %                                     or         \href{http://www.wikibooks.org}{wikibooks home} 
    45  
    46  
    47  
    48 %%%% page styles etc................ 
    49 \usepackage{fancyhdr} 
    50 \pagestyle{fancy} 
    51 % with this we ensure that the chapter and section 
    52 % headings are in lowercase. 
    53 \renewcommand{\chaptermark}[1]{\markboth{#1}{}} 
    54 \renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}} 
    55 \fancyhf{}             % delete current setting for header and footer 
    56 \fancyhead[LE,RO]{\bfseries\thepage} 
    57 \fancyhead[LO]{\bfseries\hspace{-0em}\rightmark} 
    58 \fancyhead[RE]{\bfseries\leftmark} 
    59 \renewcommand{\headrulewidth}{0.5pt} 
    60 \renewcommand{\footrulewidth}{0pt} 
    61 \addtolength{\headheight}{2.6pt}   % make space for the rule 
    62 %\addtolength{\headheight}{1.6pt}   % make space for the rule 
    63 \fancypagestyle{plain}{ 
    64   \fancyhead{}         % get rid of headers on plain pages 
    65   \renewcommand{\headrulewidth}{0pt}  % and the line 
    66 } 
    67  
    68  
    69 %%%%  Section number in Margin....... 
    70 % typeset the number of each section in the left margin, with the start of each instance of 
    71 % sectional heading text aligned with the left hand edge of  the body text. 
    72 \makeatletter 
    73 \def\@seccntformat#1{\protect\makebox[0pt][r]{\csname the#1\endcsname\quad}} 
    74 \makeatother 
    75  
    76 % Leave blank pages completely empty, w/o header 
    77 \makeatletter 
    78 \def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else 
    79   \hbox{} 
    80   \vspace*{\fill} 
    81   \vspace{\fill} 
    82   \thispagestyle{empty} 
    83   \newpage 
    84   \if@twocolumn\hbox{}\newpage\fi\fi\fi} 
    85 \makeatother 
    86  
    87 %%%% define the chapter  style ................ 
    88 \usepackage{minitoc}          %In French : \usepackage[french]{minitoc} 
    89 %\usepackage{mtcoff}          % invalidate the use of minitocs 
    90 \usepackage{fancybox} 
    91  
    92 \makeatletter 
    93 \def\LigneVerticale{\vrule height 5cm depth 2cm\hspace{0.1cm}\relax} 
    94 \def\LignesVerticales{% 
    95   \let\LV\LigneVerticale\LV\LV\LV\LV\LV\LV\LV\LV\LV\LV} 
    96 \def\GrosCarreAvecUnChiffre#1{% 
    97   \rlap{\vrule height 0.8cm width 1cm depth 0.2cm}% 
    98  \rlap{\hbox to 1cm{\hss\mbox{\color{white} #1}\hss}}% 
    99   \vrule height 0pt width 1cm depth 0pt} 
    100 \def\GrosCarreAvecTroisChiffre#1{% 
    101   \rlap{\vrule height 0.8cm width 1.6cm depth 0.2cm}% 
    102  \rlap{\hbox to 1.5cm{\hss\mbox{\color{white} #1}\hss}}% 
    103   \vrule height 0pt width 1cm depth 0pt} 
    104  
    105 \def\@makechapterhead#1{\hbox{% 
    106    \huge 
    107     \LignesVerticales 
    108     \hspace{-0.5cm}% 
    109     \GrosCarreAvecUnChiffre{\thechapter} 
    110     \hspace{0.2cm}\hbox{#1}% 
    111 %    \GrosCarreAvecTroisChiffre{\thechapter} 
    112 %    \hspace{1cm}\hbox{#1}% 
    113 %}\par\vskip 2cm} 
    114 }\par\vskip 1cm} 
    115 \def\@makeschapterhead#1{\hbox{% 
    116    \huge 
    117     \LignesVerticales 
    118     %\hspace{0.5cm}% 
    119     \hbox{#1}% 
    120 }\par\vskip 2cm} 
    121 \makeatother 
    122  
    123 %\def\thechapter{\Roman{chapter}}      % chapter number to be Roman 
    124  
    125  
    126 %%%%           Mathematics............... 
    127 %\documentclass{amsart} 
    128 \usepackage{xspace}                              % helpd ensure correct spacing after macros 
    129 \usepackage{latexsym} 
    130 \usepackage{amssymb} 
    131 \usepackage{amsmath} 
    132 \allowdisplaybreaks[1]           % allow page breaks in the middle of equations 
    133 \usepackage{./TexFiles/math_abbrev}    % use maths shortcuts 
    134  
    135 \DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it} 
    136  
    137 \usepackage{times}                % use times font for text 
    138 %\usepackage{mathtime}                          % font for illustrator to work (belleek fonts ) 
    139 %\usepackage[latin1]{inputenc}                % allows some unicode removed (agn) 
    140  
    141  
    142 %%% essai commande 
    143 \newcommand{\nl} [1] {\texttt{\small {\textcolor{blue}{#1}} } } 
    144 \newcommand{\nlv} [1] {\texttt{\footnotesize#1}\xspace} 
    145 \newcommand{\smnlv} [1] {\texttt{\scriptsize#1}\xspace} 
    146  
    147 %%%% namelist & code display................................ 
    148 \usepackage{alltt}      %%  alltt for namelist 
    149 \usepackage{verbatim}   %%  alltt for namelist 
    150 % namelists 
    151 \newcommand{\namdisplay} [1] { 
    152 \begin{alltt} 
    153 {\tiny \verbatiminput{./TexFiles/Namelist/#1}} 
    154 \end{alltt} 
    155   \vspace{-10pt} 
    156 } 
    157 % namelist_tools 
    158 \newcommand{\namtools} [1] { 
    159 \begin{alltt} 
    160 {\tiny \verbatiminput{./TexFiles/Namelist_tools/#1}} 
    161 \end{alltt} 
    162   \vspace{-10pt} 
    163 } 
    164 % code display 
    165 %\newcommand{\codedisplay} [1] { \begin{alltt} {\tiny  {\begin{verbatim} {#1}} \end{verbatim} }  \end{alltt}   } 
    166  
    167  
    168  
    169 %%%% commands for working with text................................ 
    170 % command to "comment out" portions of text ({} argument) or not ({#1} argument) 
    171 \newcommand{\amtcomment}[1]{}    % command to "commented out" portions of text or not (#1 in argument) 
    172 \newcommand{\sgacomment}[1]{}    % command to "commented out" portions of 
    173 \newcommand{\gmcomment}[1]{}     % command to "commented out" portions of 
    174 %                                               % text that span line breaks 
    175 %Red (NR) or Yellow(WARN) 
    176 %\newcommand{\NR} {\colorbox{red}{#1}} 
    177 %\newcommand{\WARN} {{ \colorbox{yellow}{#1}} } 
    178  
    179  
    180  
    181 %%% index commands...................... 
    182 \usepackage{makeidx} 
    183 %\usepackage{showidx}            % show the index entry 
    184  
    185 \newcommand{\mdl} [1] {\textit{#1.F90}\index{Modules!#1}}         %module (mdl) 
    186 \newcommand{\rou} [1] {\textit{#1}\index{Routines!#1}}            %module (routine) 
    187 \newcommand{\hf} [1] {\textit{#1.h90}\index{h90 file!#1}}            %module (h90 files) 
    188 \newcommand{\ngn} [1] {\textit{#1}\index{Namelist Group Name!#1}}    %namelist name (nampar) 
    189 \newcommand{\np} [1] {\textit{#1}\index{Namelist variables!#1}}             %namelist variable 
    190 \newcommand{\jp} [1] {\textit{#1}\index{Model parameters!#1}}        %model parameter (jp) 
    191 \newcommand{\pp} [1] {\textit{#1}\index{Model parameters!#1}}        %namelist parameter (pp) 
    192 \newcommand{\ifile} [1] {\textit{#1.nc}\index{Input NetCDF files!#1.nc}}   %input NetCDF files (.nc) 
    193 \newcommand{\key} [1] {\textbf{key\_#1}\index{CPP keys!key\_#1}}  %key_cpp (key) 
    194 \newcommand{\NEMO} {\textit{NEMO}\xspace}                %NEMO (nemo) 
    195  
    196 %%%%   Bibliography   ............. 
    197 \usepackage[nottoc, notlof, notlot]{tocbibind} 
    198 \usepackage[square, comma]{natbib} 
    199 \bibpunct{[}{]}{,}{a}{}{;}                           %suppress "," after "et al." 
    200 \providecommand{\bibfont}{\small} 
    201  
     16\include{TexFiles/Top_Matter} 
    20217 
    20318% ================================================================ 
    204 % FRONT PAGE 
    205 % ================================================================ 
    206  
    207 %\usepackage{pstricks} 
    208 \title{ 
    209 %\psset{unit=1.1in,linewidth=4pt}   %parameters of the units for pstricks 
    210 % \rput(0,2){ \includegraphics[width=1.1\textwidth]{./TexFiles/Figures/logo_ALL.pdf}             } \\ 
    211 % \vspace{0.1cm} 
    212 \vspace{-6.0cm} 
    213 \includegraphics[width=1.1\textwidth]{./TexFiles/Figures/logo_ALL.pdf}\\ 
    214 \vspace{5.1cm} 
    215 \includegraphics[width=0.9\textwidth]{./TexFiles/Figures/NEMO_logo_Black.pdf} \\ 
    216 \vspace{1.4cm} 
    217 \rule{345pt}{1.5pt} \\ 
    218 \vspace{0.45cm} 
    219 {\Huge NEMO ocean engine} 
    220 \rule{345pt}{1.5pt} \\ 
    221  } 
    222 %{ -- Draft --}   } 
    223 %\date{\today} 
    224 \date{ 
    225 January 2016  \\ 
    226 {\small  -- draft of version 4.0 --} \\ 
    227 ~  \\ 
    228 \textit{\small Note du P\^ole de mod\'{e}lisation de l'Institut Pierre-Simon Laplace No 27 }\\ 
    229 \vspace{0.45cm} 
    230 { ISSN No 1288-1619.} 
    231 } 
    232  
    233  
    234 \author{ 
    235 \Large Gurvan Madec, and the NEMO team  \\ 
    236  \texttt{\small gurvan.madec@locean-ipsl.umpc.fr} \\ 
    237  \texttt{\small nemo\_st@locean-ipsl.umpc.fr} \\ 
    238 %{\small Laboratoire d'Oc\'{e}anographie  et du Climat: Exp\'{e}rimentation et Approches Num\'{e}riques } 
    239 } 
    240  
    241 \dominitoc 
    242 \makeindex        %type this first :     makeindex -s NEMO.ist NEMO_book.idx 
    243  
    244 % ================================================================ 
    245 %      Include ONLY order 
    246 % ================================================================ 
    247  
    248 %\includeonly{./TexFiles/Chapters/Chap_MISC} 
    249 %\includeonly{./TexFiles/Chapters/Chap_ZDF} 
    250 %\includeonly{./TexFiles/Chapters/Chap_STP,./TexFiles/Chapters/Chap_SBC,./TexFiles/Chapters/Chap_TRA} 
    251 %\includeonly{./TexFiles/Chapters/Chap_LBC,./TexFiles/Chapters/Chap_MISC} 
    252 %\includeonly{./TexFiles/Chapters/Chap_Model_Basics} 
    253 %\includeonly{./TexFiles/Chapters/Annex_A,./TexFiles/Chapters/Annex_B,./TexFiles/Chapters/Annex_C,./TexFiles/Chapters/Annex_D} 
    254  
    255 % ================================================================ 
     19% DOCUMENT 
    25620% ================================================================ 
    25721 
     
    27236% ================================================================ 
    27337 
    274 \include{./TexFiles/Chapters/Abstracts_Foreword} 
     38\subfile{TexFiles/Chapters/Abstracts_Foreword} 
    27539 
    27640% ================================================================ 
     
    27842% ================================================================ 
    27943 
    280 \include{./TexFiles/Chapters/Introduction} 
     44\subfile{TexFiles/Chapters/Introduction} 
    28145 
    28246% ================================================================ 
     
    28448% ================================================================ 
    28549 
    286 \include{./TexFiles/Chapters/Chap_Model_Basics} 
     50\subfile{TexFiles/Chapters/Chap_Model_Basics} 
    28751 
    288 \include{./TexFiles/Chapters/Chap_STP}       % Time discretisation (time stepping strategy) 
     52\subfile{TexFiles/Chapters/Chap_STP}         % Time discretisation (time stepping strategy) 
    28953 
    290 \include{./TexFiles/Chapters/Chap_DOM}       % Space discretisation 
     54\subfile{TexFiles/Chapters/Chap_DOM}         % Space discretisation 
    29155 
    292 \include{./TexFiles/Chapters/Chap_TRA}       % Tracer advection/diffusion equation 
     56\subfile{TexFiles/Chapters/Chap_TRA}         % Tracer advection/diffusion equation 
    29357 
    294 \include{./TexFiles/Chapters/Chap_DYN}       % Dynamics : momentum equation 
     58\subfile{TexFiles/Chapters/Chap_DYN}         % Dynamics : momentum equation 
    29559 
    296 \include{./TexFiles/Chapters/Chap_SBC}       % Surface Boundary Conditions 
     60\subfile{TexFiles/Chapters/Chap_SBC}         % Surface Boundary Conditions 
    29761 
    298 \include{./TexFiles/Chapters/Chap_LBC}       % Lateral Boundary Conditions 
     62\subfile{TexFiles/Chapters/Chap_LBC}         % Lateral Boundary Conditions 
    29963 
    300 \include{./TexFiles/Chapters/Chap_LDF}       % Lateral diffusion 
     64\subfile{TexFiles/Chapters/Chap_LDF}         % Lateral diffusion 
    30165 
    302 \include{./TexFiles/Chapters/Chap_ZDF}       % Vertical diffusion 
     66\subfile{TexFiles/Chapters/Chap_ZDF}         % Vertical diffusion 
    30367 
    304 \include{./TexFiles/Chapters/Chap_DIA}       % Outputs and Diagnostics 
     68\subfile{TexFiles/Chapters/Chap_DIA}         % Outputs and Diagnostics 
    30569 
    306 \include{./TexFiles/Chapters/Chap_OBS}          % Observation operator 
     70\subfile{TexFiles/Chapters/Chap_OBS}                    % Observation operator 
    30771 
    308 \include{./TexFiles/Chapters/Chap_ASM}          % Assimilation increments 
     72\subfile{TexFiles/Chapters/Chap_ASM}                    % Assimilation increments 
    30973 
    310 \include{./TexFiles/Chapters/Chap_STO}          % Stochastic param. 
     74\subfile{TexFiles/Chapters/Chap_STO}                    % Stochastic param. 
    31175 
    312 \include{./TexFiles/Chapters/Chap_DIU}          % Diurnal SST models. 
     76\subfile{TexFiles/Chapters/Chap_MISC}        % Miscellaneous topics 
    31377 
    314 \include{./TexFiles/Chapters/Chap_MISC}         % Miscellaneous topics 
    315  
    316 \include{./TexFiles/Chapters/Chap_CFG}       % Predefined configurations 
     78\subfile{TexFiles/Chapters/Chap_CFG}         % Predefined configurations 
    31779 
    31880% ================================================================ 
     
    32284\appendix 
    32385 
    324 %\include{./TexFiles/Chapters/Chap_Conservation} 
    325 \include{./TexFiles/Chapters/Annex_A}        % generalised vertical coordinate 
    326 \include{./TexFiles/Chapters/Annex_B}        % diffusive operator 
    327 \include{./TexFiles/Chapters/Annex_C}        % Discrete invariants of the eqs. 
    328 \include{./TexFiles/Chapters/Annex_ISO}                     % Isoneutral diffusion using triads 
    329 \include{./TexFiles/Chapters/Annex_D}        % Coding rules 
    330 %\include{./TexFiles/Chapters/Annex_E}                   % Notes on some on going staff (no included in the DOC) 
    331 %\include{./TexFiles/Chapters/Annex_Fox-Kemper}   % Notes on Fox-Kemper (no included in the DOC) 
    332 %\include{./TexFiles/Chapters/Annex_EVP}           % Notes on EVP (no included in the DOC) 
     86%\subfile{TexFiles/Chapters/Chap_Conservation} 
     87\subfile{TexFiles/Chapters/Annex_A}       % generalised vertical coordinate 
     88\subfile{TexFiles/Chapters/Annex_B}       % diffusive operator 
     89\subfile{TexFiles/Chapters/Annex_C}       % Discrete invariants of the eqs. 
     90\subfile{TexFiles/Chapters/Annex_ISO}                    % Isoneutral diffusion using triads 
     91\subfile{TexFiles/Chapters/Annex_D}       % Coding rules 
     92%\subfile{TexFiles/Chapters/Annex_E}                     % Notes on some on going staff (no included in the DOC) 
     93%\subfile{TexFiles/Chapters/Annex_Fox-Kemper}   % Notes on Fox-Kemper (no included in the DOC) 
     94%\subfile{TexFiles/Chapters/Annex_EVP}          % Notes on EVP (no included in the DOC) 
    33395 
    33496% ================================================================ 
     
    344106 
    345107%%\bibliographystyle{plainat} 
    346 \bibliographystyle{./TexFiles/ametsoc}    % AMS biblio style (JPO) 
    347 \bibliography{./TexFiles/Biblio/Biblio} 
     108\bibliographystyle{TexFiles/Styles/ametsoc}     % AMS biblio style (JPO) 
     109\bibliography{TexFiles/Bibliography/Biblio} 
    348110 
    349111% ================================================================ 
  • branches/2016/dev_NOC_2016/DOC/NEMO_coding.conv.tex

    r2738 r7341  
    77\usepackage{framed}  
    88\usepackage{makeidx}  
    9  
     9\graphicspath{{Figures/}} 
    1010 
    1111%%%%%%% 
     
    3131 
    3232\title{  
    33 \includegraphics[width=0.3\textwidth]{./TexFiles/Figures/NEMO_logo_Black.pdf} \\ 
     33\includegraphics[width=0.3\textwidth]{NEMO_logo_Black} \\ 
    3434\vspace{1.0cm} 
    3535\rule{345pt}{1.5pt} \\ 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Abstracts_Foreword.tex

    r6289 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13 
    24% ================================================================ 
     
    2426 
    2527% ================================================================ 
    26  \vspace{0.5cm} 
     28% \vspace{0.5cm} 
    2729 
    28 Le moteur oc\'{e}anique de NEMO (Nucleus for European Modelling of the Ocean) est un  
    29 mod\`{e}le aux \'{e}quations primitives de la circulation oc\'{e}anique r\'{e}gionale et globale.  
    30 Il se veut un outil flexible pour \'{e}tudier sur un vaste spectre spatiotemporel l'oc\'{e}an et ses  
    31 interactions avec les autres composantes du syst\`{e}me climatique terrestre.  
    32 Les variables pronostiques sont le champ tridimensionnel de vitesse, une hauteur de la mer  
    33 lin\'{e}aire, la Temp\'{e}erature Conservative et la Salinit\'{e} Absolue.  
    34 La distribution des variables se fait sur une grille C d'Arakawa tridimensionnelle utilisant une  
    35 coordonn\'{e}e verticale $z$ \`{a} niveaux entiers ou partiels, ou une coordonn\'{e}e s, ou encore  
    36 une combinaison des deux. Diff\'{e}rents choix sont propos\'{e}s pour d\'{e}crire la physique  
    37 oc\'{e}anique, incluant notamment des physiques verticales TKE et GLS. A travers l'infrastructure  
    38 NEMO, l'oc\'{e}an est interfac\'{e} avec des mod\`{e}les de glace de mer (LIM ou CICE),  
    39 de biog\'{e}ochimie marine et de traceurs passifs, et, via le coupleur OASIS, \`{a} plusieurs  
    40 mod\`{e}les de circulation g\'{e}n\'{e}rale atmosph\'{e}rique.  
    41 Il supporte \'{e}galement l'embo\^{i}tement interactif de maillages via le logiciel AGRIF. 
     30%Le moteur oc\'{e}anique de NEMO (Nucleus for European Modelling of the Ocean) est un  
     31%mod\`{e}le aux \'{e}quations primitives de la circulation oc\'{e}anique r\'{e}gionale et globale.  
     32%Il se veut un outil flexible pour \'{e}tudier sur un vaste spectre spatiotemporel l'oc\'{e}an et ses  
     33%interactions avec les autres composantes du syst\`{e}me climatique terrestre.  
     34%Les variables pronostiques sont le champ tridimensionnel de vitesse, une hauteur de la mer  
     35%lin\'{e}aire, la Temp\'{e}rature Conservative et la Salinit\'{e} Absolue.  
     36%La distribution des variables se fait sur une grille C d'Arakawa tridimensionnelle utilisant une  
     37%coordonn\'{e}e verticale $z$ \`{a} niveaux entiers ou partiels, ou une coordonn\'{e}e s, ou encore  
     38%une combinaison des deux. Diff\'{e}rents choix sont propos\'{e}s pour d\'{e}crire la physique  
     39%oc\'{e}anique, incluant notamment des physiques verticales TKE et GLS. A travers l'infrastructure  
     40%NEMO, l'oc\'{e}an est interfac\'{e} avec des mod\`{e}les de glace de mer (LIM ou CICE),  
     41%de biog\'{e}ochimie marine et de traceurs passifs, et, via le coupleur OASIS, \`{a} plusieurs  
     42%mod\`{e}les de circulation g\'{e}n\'{e}rale atmosph\'{e}rique.  
     43%Il supporte \'{e}galement l'embo\^{i}tement interactif de maillages via le logiciel AGRIF. 
    4244}  
    4345 
     
    6971 \vspace{0.5cm} 
    7072 
     73\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Annex_A.tex

    r3294 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13 
    24% ================================================================ 
     
    532534expression of the 3D divergence in the $s-$coordinates established above.  
    533535 
     536\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Annex_B.tex

    r3294 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter Ñ Appendix B : Diffusive Operators 
     
    364366\eqref{Apdx_B_Lap_U} is used in both $z$- and $s$-coordinate systems, that is 
    365367a Laplacian diffusion is applied on momentum along the coordinate directions. 
     368\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Annex_C.tex

    r6289 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter Ñ Appendix C : Discrete Invariants of the Equations 
     
    15311533%%%%  end of appendix in gm comment 
    15321534%} 
     1535\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Annex_D.tex

    r6289 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Appendix D Ñ Coding Rules 
     
    202204 
    203205To be done.... 
     206\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Annex_E.tex

    r3294 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Appendix E : Note on some algorithms 
     
    299301\begin{figure}[!ht] \label{Fig_ISO_triad} 
    300302\begin{center} 
    301 \includegraphics[width=0.70\textwidth]{./TexFiles/Figures/Fig_ISO_triad.pdf} 
     303\includegraphics[width=0.70\textwidth]{Fig_ISO_triad} 
    302304\caption{  \label{Fig_ISO_triad}    
    303305Triads used in the Griffies's like iso-neutral diffision scheme for  
     
    806808tracer is preserved by the discretisation of the skew fluxes. 
    807809 
     810\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Annex_ISO.tex

    r6289 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Iso-neutral diffusion : 
     
    190192% >>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    191193\begin{figure}[tb] \begin{center} 
    192     \includegraphics[width=1.05\textwidth]{./TexFiles/Figures/Fig_GRIFF_triad_fluxes} 
     194    \includegraphics[width=1.05\textwidth]{Fig_GRIFF_triad_fluxes} 
    193195    \caption{ \label{fig:triad:ISO_triad} 
    194196      (a) Arrangement of triads $S_i$ and tracer gradients to 
     
    254256% >>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    255257\begin{figure}[tb] \begin{center} 
    256     \includegraphics[width=0.80\textwidth]{./TexFiles/Figures/Fig_GRIFF_qcells} 
     258    \includegraphics[width=0.80\textwidth]{Fig_GRIFF_qcells} 
    257259    \caption{   \label{fig:triad:qcells} 
    258260    Triad notation for quarter cells. $T$-cells are inside 
     
    658660% >>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    659661\begin{figure}[h] \begin{center} 
    660     \includegraphics[width=0.60\textwidth]{./TexFiles/Figures/Fig_GRIFF_bdry_triads} 
     662    \includegraphics[width=0.60\textwidth]{Fig_GRIFF_bdry_triads} 
    661663    \caption{  \label{fig:triad:bdry_triads} 
    662664      (a) Uppermost model layer $k=1$ with $i,1$ and $i+1,1$ tracer 
     
    831833    different $i_p,k_p$, denoted by different colours, (e.g. the green 
    832834    triad $i_p=1/2,k_p=-1/2$) are tapered to the appropriate basal triad.}} 
    833   {\includegraphics[width=0.60\textwidth]{./TexFiles/Figures/Fig_GRIFF_MLB_triads}} 
     835  {\includegraphics[width=0.60\textwidth]{Fig_GRIFF_MLB_triads}} 
    834836\end{figure} 
    835837% >>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    11751177\end{split} 
    11761178\end{equation} 
     1179\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_ASM.tex

    r4147 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter Assimilation increments (ASM) 
     
    172174\end{verbatim} 
    173175\end{alltt} 
     176\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_CFG.tex

    r4147 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter � Configurations 
     
    8890%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    8991\begin{figure}[!t]   \begin{center} 
    90 \includegraphics[width=0.98\textwidth]{./TexFiles/Figures/Fig_ORCA_NH_mesh.pdf} 
     92\includegraphics[width=0.98\textwidth]{Fig_ORCA_NH_mesh} 
    9193\caption{  \label{Fig_MISC_ORCA_msh}      
    92 ORCA mesh conception. The departure from an isotropic Mercator grid start poleward of 20\deg N. 
     94ORCA mesh conception. The departure from an isotropic Mercator grid start poleward of 20\degN. 
    9395The two "north pole" are the foci of a series of embedded ellipses (blue curves)  
    9496which are determined analytically and form the i-lines of the ORCA mesh (pseudo latitudes).  
     
    115117%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    116118\begin{figure}[!tbp]  \begin{center} 
    117 \includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_ORCA_NH_msh05_e1_e2.pdf} 
    118 \includegraphics[width=0.80\textwidth]{./TexFiles/Figures/Fig_ORCA_aniso.pdf} 
     119\includegraphics[width=1.0\textwidth]{Fig_ORCA_NH_msh05_e1_e2} 
     120\includegraphics[width=0.80\textwidth]{Fig_ORCA_aniso} 
    119121\caption {  \label{Fig_MISC_ORCA_e1e2} 
    120122\textit{Top}: Horizontal scale factors ($e_1$, $e_2$) and  
    121123\textit{Bottom}: ratio of anisotropy ($e_1 / e_2$) 
    122 for ORCA 0.5\deg ~mesh. South of 20\deg N a Mercator grid is used ($e_1 = e_2$)  
    123 so that the anisotropy ratio is 1. Poleward of 20\deg N, the two "north pole"  
     124for ORCA 0.5\deg ~mesh. South of 20\degN a Mercator grid is used ($e_1 = e_2$)  
     125so that the anisotropy ratio is 1. Poleward of 20\degN, the two "north pole"  
    124126introduce a weak anisotropy over the ocean areas ($< 1.2$) except in vicinity of Victoria Island  
    125127(Canadian Arctic Archipelago). } 
     
    129131 
    130132The method is applied to Mercator grid ($i.e.$ same zonal and meridional grid spacing) poleward  
    131 of $20\deg$N, so that the Equator is a mesh line, which provides a better numerical solution  
     133of 20\degN, so that the Equator is a mesh line, which provides a better numerical solution  
    132134for equatorial dynamics. The choice of the series of embedded ellipses (position of the foci and  
    133135variation of the ellipses) is a compromise between maintaining  the ratio of mesh anisotropy  
     
    178180The ORCA\_R2 configuration has the following specificity : starting from a 2\deg~ORCA mesh,  
    179181local mesh refinements were applied to the Mediterranean, Red, Black and Caspian Seas,  
    180 so that the resolution is $1\deg \time 1\deg$ there. A local transformation were also applied  
     182so that the resolution is 1\deg \time 1\deg there. A local transformation were also applied  
    181183with in the Tropics in order to refine the meridional resolution up to 0.5\deg at the Equator. 
    182184 
     
    227229 
    228230The domain geometry is a closed rectangular basin on the $\beta$-plane centred  
    229 at $\sim 30\deg$N and rotated by 45\deg, 3180~km long, 2120~km wide  
     231at $\sim$ 30\degN and rotated by 45\deg, 3180~km long, 2120~km wide  
    230232and 4~km deep (Fig.~\ref{Fig_MISC_strait_hand}).  
    231233The domain is bounded by vertical walls and by a flat bottom. The configuration is  
     
    234236The applied forcings vary seasonally in a sinusoidal manner between winter  
    235237and summer extrema \citep{Levy_al_OM10}.  
    236 The wind stress is zonal and its curl changes sign at 22\deg N and 36\deg N.  
     238The wind stress is zonal and its curl changes sign at 22\degN and 36\degN.  
    237239It forces a subpolar gyre in the north, a subtropical gyre in the wider part of the domain  
    238240and a small recirculation gyre in the southern corner.  
     
    261263%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    262264\begin{figure}[!t]   \begin{center} 
    263 \includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_GYRE.pdf} 
     265\includegraphics[width=1.0\textwidth]{Fig_GYRE} 
    264266\caption{  \label{Fig_GYRE}    
    265267Snapshot of relative vorticity at the surface of the model domain  
     
    311313temperature data. 
    312314 
     315\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_Conservation.tex

    r3294 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13 
    24% ================================================================ 
     
    333335not been implemented. 
    334336 
     337\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_DIA.tex

    r6289 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter I/O & Diagnostics 
     
    14091411 
    14101412% ------------------------------------------------------------------------------------------------------------- 
    1411 %       25 hour mean and hourly Surface, Mid and Bed  
    1412 % ------------------------------------------------------------------------------------------------------------- 
    1413 \section{25 hour mean output for tidal models } 
    1414  
    1415 A module is available to compute a crudely detided M2 signal by obtaining a 25 hour mean. 
    1416 The 25 hour mean is available for daily runs by summing up the 25 hourly instantananeous hourly values from 
    1417 midnight at the start of the day to midight at the day end. 
    1418 This diagnostic is actived with the logical  $ln\_dia25h$ 
    1419  
    1420 %------------------------------------------nam_dia25h------------------------------------------------------ 
    1421 \namdisplay{nam_dia25h} 
    1422 %---------------------------------------------------------------------------------------------------------- 
    1423  
    1424 \section{Top Middle and Bed hourly output } 
    1425  
    1426 A module is available to output the surface (top), mid water and bed diagnostics of a set of standard variables.  
    1427 This can be a useful diagnostic when hourly or sub-hourly output is required in high resolution tidal outputs. 
    1428 The tidal signal is retained but the overall data usage is cut to just three vertical levels. Also the bottom level  
    1429 is calculated for each cell. 
    1430 This diagnostic is actived with the logical  $ln\_diatmb$ 
    1431  
    1432 %------------------------------------------nam_diatmb----------------------------------------------------- 
    1433 \namdisplay{nam_diatmb} 
    1434 %---------------------------------------------------------------------------------------------------------- 
    1435  
    1436 % ------------------------------------------------------------------------------------------------------------- 
    14371413%       Sections transports 
    14381414% ------------------------------------------------------------------------------------------------------------- 
     
    14401416\label{DIA_diag_dct} 
    14411417 
     1418%------------------------------------------namdct---------------------------------------------------- 
     1419\namdisplay{namdct} 
     1420%------------------------------------------------------------------------------------------------------------- 
     1421 
    14421422A module is available to compute the transport of volume, heat and salt through sections.  
    14431423This diagnostic is actived with \key{diadct}. 
     
    14591439and the time scales over which they are averaged, as well as the level of output for debugging: 
    14601440 
    1461 %------------------------------------------namdct---------------------------------------------------- 
    1462 \namdisplay{namdct} 
    1463 %------------------------------------------------------------------------------------------------------------- 
    1464  
    14651441\np{nn\_dct}: frequency of instantaneous transports computing 
    14661442 
     
    14691445\np{nn\_debug}: debugging of the section 
    14701446 
    1471 \subsubsection{ To create a binary file containing the pathway of each section } 
    1472  
    1473 In \texttt{NEMOGCM/TOOLS/SECTIONS\_DIADCT/run}, the file \texttt{ {list\_sections.ascii\_global}} 
     1447\subsubsection{ Creating a binary file containing the pathway of each section } 
     1448 
     1449In \texttt{NEMOGCM/TOOLS/SECTIONS\_DIADCT/run}, the file \textit{ {list\_sections.ascii\_global}} 
    14741450contains a list of all the sections that are to be computed (this list of sections is based on MERSEA project metrics). 
    14751451 
     
    15831559\texttt{=/0, =/ 1000.}   &  diagonal   & eastward  & westward  & postive: eastward  \\ \hline                 
    15841560\end{tabular} 
    1585  
    1586  
    1587  
    1588 % ------------------------------------------------------------------------------------------------------------- 
    1589 %       Other Diagnostics 
    1590 % ------------------------------------------------------------------------------------------------------------- 
    1591 \section{Other Diagnostics (\key{diahth}, \key{diaar5})} 
    1592 \label{DIA_diag_others} 
    1593  
    1594  
    1595 Aside from the standard model variables, other diagnostics can be computed  
    1596 on-line. The available ready-to-add diagnostics routines can be found in directory DIA.  
    1597 Among the available diagnostics the following ones are obtained when defining  
    1598 the \key{diahth} CPP key:  
    1599  
    1600 - the mixed layer depth (based on a density criterion \citep{de_Boyer_Montegut_al_JGR04}) (\mdl{diahth}) 
    1601  
    1602 - the turbocline depth (based on a turbulent mixing coefficient criterion) (\mdl{diahth}) 
    1603  
    1604 - the depth of the 20\deg C isotherm (\mdl{diahth}) 
    1605  
    1606 - the depth of the thermocline (maximum of the vertical temperature gradient) (\mdl{diahth}) 
    1607  
    1608 The poleward heat and salt transports, their advective and diffusive component, and  
    1609 the meriodional stream function can be computed on-line in \mdl{diaptr}  
    1610 \np{ln\_diaptr} to true (see the \textit{\ngn{namptr} } namelist below).   
    1611 When \np{ln\_subbas}~=~true, transports and stream function are computed  
    1612 for the Atlantic, Indian, Pacific and Indo-Pacific Oceans (defined north of 30\deg S)  
    1613 as well as for the World Ocean. The sub-basin decomposition requires an input file  
    1614 (\ifile{subbasins}) which contains three 2D mask arrays, the Indo-Pacific mask  
    1615 been deduced from the sum of the Indian and Pacific mask (Fig~\ref{Fig_mask_subasins}).  
    1616  
    1617 %------------------------------------------namptr---------------------------------------------------- 
    1618 \namdisplay{namptr}  
    1619 %------------------------------------------------------------------------------------------------------------- 
    1620 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    1621 \begin{figure}[!t]     \begin{center} 
    1622 \includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_mask_subasins.pdf} 
    1623 \caption{   \label{Fig_mask_subasins} 
    1624 Decomposition of the World Ocean (here ORCA2) into sub-basin used in to compute 
    1625 the heat and salt transports as well as the meridional stream-function: Atlantic basin (red),  
    1626 Pacific basin (green), Indian basin (bleue), Indo-Pacific basin (bleue+green).  
    1627 Note that semi-enclosed seas (Red, Med and Baltic seas) as well as Hudson Bay  
    1628 are removed from the sub-basins. Note also that the Arctic Ocean has been split  
    1629 into Atlantic and Pacific basins along the North fold line.  } 
    1630 \end{center}   \end{figure}   
    1631 %>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    1632  
    1633 In addition, a series of diagnostics has been added in the \mdl{diaar5}.  
    1634 They corresponds to outputs that are required for AR5 simulations  
    1635 (see Section \ref{DIA_steric} below for one of them).  
    1636 Activating those outputs requires to define the \key{diaar5} CPP key. 
    1637 \\ 
    1638 \\ 
    1639  
    1640 \section{Courant numbers} 
    1641 Courant numbers provide a theoretical indication of the model's numerical stability. The advective Courant numbers can be calculated according to 
    1642 \begin{equation} 
    1643 \label{eq:CFL} 
    1644 C_u = |u|\frac{\rdt}{e_{1u}}, \quad C_v = |v|\frac{\rdt}{e_{2v}}, \quad C_w = |w|\frac{\rdt}{e_{3w}} 
    1645 \end{equation} 
    1646 in the zonal, meridional and vertical directions respectively. The vertical component is included although it is not strictly valid as the vertical velocity is calculated from the continuity equation rather than as a prognostic variable. Physically this represents the rate at which information is propogated across a grid cell. Values greater than 1 indicate that information is propagated across more than one grid cell in a single time step. 
    1647  
    1648 The variables can be activated by setting the \np{nn\_diacfl} namelist parameter to 1 in the \ngn{namctl} namelist. The diagnostics will be written out to an ascii file named cfl\_diagnostics.ascii. In this file the maximum value of $C_u$, $C_v$, and $C_w$ are printed at each timestep along with the coordinates of where the maximum value occurs. At the end of the model run the maximum value of $C_u$, $C_v$, and $C_w$ for the whole model run is printed along with the coordinates of each. The maximum values from the run are also copied to the ocean.output file.  
    16491561 
    16501562 
     
    18021714the \key{diaar5} defined to be called. 
    18031715 
     1716 
     1717 
     1718% ------------------------------------------------------------------------------------------------------------- 
     1719%       Other Diagnostics 
     1720% ------------------------------------------------------------------------------------------------------------- 
     1721\section{Other Diagnostics (\key{diahth}, \key{diaar5})} 
     1722\label{DIA_diag_others} 
     1723 
     1724 
     1725Aside from the standard model variables, other diagnostics can be computed on-line.  
     1726The available ready-to-add diagnostics modules can be found in directory DIA.  
     1727 
     1728\subsection{Depth of various quantities (\mdl{diahth})} 
     1729 
     1730Among the available diagnostics the following ones are obtained when defining  
     1731the \key{diahth} CPP key:  
     1732 
     1733- the mixed layer depth (based on a density criterion \citep{de_Boyer_Montegut_al_JGR04}) (\mdl{diahth}) 
     1734 
     1735- the turbocline depth (based on a turbulent mixing coefficient criterion) (\mdl{diahth}) 
     1736 
     1737- the depth of the 20\deg C isotherm (\mdl{diahth}) 
     1738 
     1739- the depth of the thermocline (maximum of the vertical temperature gradient) (\mdl{diahth}) 
     1740 
     1741% ----------------------------------------------------------- 
     1742%     Poleward heat and salt transports 
     1743% ----------------------------------------------------------- 
     1744 
     1745\subsection{Poleward heat and salt transports (\mdl{diaptr})} 
     1746 
     1747%------------------------------------------namptr----------------------------------------- 
     1748\namdisplay{namptr}  
     1749%----------------------------------------------------------------------------------------- 
     1750 
     1751The poleward heat and salt transports, their advective and diffusive component, and  
     1752the meriodional stream function can be computed on-line in \mdl{diaptr}  
     1753\np{ln\_diaptr} to true (see the \textit{\ngn{namptr} } namelist below).   
     1754When \np{ln\_subbas}~=~true, transports and stream function are computed  
     1755for the Atlantic, Indian, Pacific and Indo-Pacific Oceans (defined north of 30\deg S)  
     1756as well as for the World Ocean. The sub-basin decomposition requires an input file  
     1757(\ifile{subbasins}) which contains three 2D mask arrays, the Indo-Pacific mask  
     1758been deduced from the sum of the Indian and Pacific mask (Fig~\ref{Fig_mask_subasins}).  
     1759 
     1760%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     1761\begin{figure}[!t]     \begin{center} 
     1762\includegraphics[width=1.0\textwidth]{Fig_mask_subasins} 
     1763\caption{   \label{Fig_mask_subasins} 
     1764Decomposition of the World Ocean (here ORCA2) into sub-basin used in to compute 
     1765the heat and salt transports as well as the meridional stream-function: Atlantic basin (red),  
     1766Pacific basin (green), Indian basin (bleue), Indo-Pacific basin (bleue+green).  
     1767Note that semi-enclosed seas (Red, Med and Baltic seas) as well as Hudson Bay  
     1768are removed from the sub-basins. Note also that the Arctic Ocean has been split  
     1769into Atlantic and Pacific basins along the North fold line.  } 
     1770\end{center}   \end{figure}   
     1771%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     1772 
     1773 
     1774% ----------------------------------------------------------- 
     1775%       CMIP specific diagnostics  
     1776% ----------------------------------------------------------- 
     1777\subsection{CMIP specific diagnostics (\mdl{diaar5})} 
     1778 
     1779A series of diagnostics has been added in the \mdl{diaar5}.  
     1780They corresponds to outputs that are required for AR5 simulations (CMIP5) 
     1781(see also Section \ref{DIA_steric} for one of them).  
     1782Activating those outputs requires to define the \key{diaar5} CPP key. 
     1783 
     1784 
     1785% ----------------------------------------------------------- 
     1786%       25 hour mean and hourly Surface, Mid and Bed  
     1787% ----------------------------------------------------------- 
     1788\subsection{25 hour mean output for tidal models } 
     1789 
     1790%------------------------------------------nam_dia25h------------------------------------- 
     1791\namdisplay{nam_dia25h} 
     1792%----------------------------------------------------------------------------------------- 
     1793 
     1794A module is available to compute a crudely detided M2 signal by obtaining a 25 hour mean. 
     1795The 25 hour mean is available for daily runs by summing up the 25 hourly instantananeous hourly values from 
     1796midnight at the start of the day to midight at the day end. 
     1797This diagnostic is actived with the logical  $ln\_dia25h$ 
     1798 
     1799 
     1800% ----------------------------------------------------------- 
     1801%     Top Middle and Bed hourly output 
     1802% ----------------------------------------------------------- 
     1803\subsection{Top Middle and Bed hourly output } 
     1804 
     1805%------------------------------------------nam_diatmb----------------------------------------------------- 
     1806\namdisplay{nam_diatmb} 
     1807%---------------------------------------------------------------------------------------------------------- 
     1808 
     1809A module is available to output the surface (top), mid water and bed diagnostics of a set of standard variables.  
     1810This can be a useful diagnostic when hourly or sub-hourly output is required in high resolution tidal outputs. 
     1811The tidal signal is retained but the overall data usage is cut to just three vertical levels. Also the bottom level  
     1812is calculated for each cell. 
     1813This diagnostic is actived with the logical  $ln\_diatmb$ 
     1814 
     1815 
     1816 
     1817% ----------------------------------------------------------- 
     1818%     Courant numbers 
     1819% ----------------------------------------------------------- 
     1820\subsection{Courant numbers} 
     1821Courant numbers provide a theoretical indication of the model's numerical stability. The advective Courant numbers can be calculated according to 
     1822\begin{equation} 
     1823\label{eq:CFL} 
     1824C_u = |u|\frac{\rdt}{e_{1u}}, \quad C_v = |v|\frac{\rdt}{e_{2v}}, \quad C_w = |w|\frac{\rdt}{e_{3w}} 
     1825\end{equation} 
     1826in the zonal, meridional and vertical directions respectively. The vertical component is included although it is not strictly valid as the vertical velocity is calculated from the continuity equation rather than as a prognostic variable. Physically this represents the rate at which information is propogated across a grid cell. Values greater than 1 indicate that information is propagated across more than one grid cell in a single time step. 
     1827 
     1828The variables can be activated by setting the \np{nn\_diacfl} namelist parameter to 1 in the \ngn{namctl} namelist. The diagnostics will be written out to an ascii file named cfl\_diagnostics.ascii. In this file the maximum value of $C_u$, $C_v$, and $C_w$ are printed at each timestep along with the coordinates of where the maximum value occurs. At the end of the model run the maximum value of $C_u$, $C_v$, and $C_w$ for the whole model run is printed along with the coordinates of each. The maximum values from the run are also copied to the ocean.output file.  
     1829 
     1830 
    18041831% ================================================================ 
    18051832 
     
    18151842 
    18161843 
     1844\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_DIU.tex

    r6289 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Diurnal SST models (DIU) 
     
    162164\end{equation} 
    163165 
    164  
     166\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_DOM.tex

    r6320 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter 2 ——— Space and Time Domain (DOM) 
     
    4042%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    4143\begin{figure}[!tb]    \begin{center} 
    42 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_cell.pdf} 
     44\includegraphics[width=0.90\textwidth]{Fig_cell} 
    4345\caption{ \label{Fig_cell}     
    4446Arrangement of variables. $t$ indicates scalar points where temperature,  
     
    201203%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    202204\begin{figure}[!tb]  \begin{center} 
    203 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_index_hor.pdf} 
     205\includegraphics[width=0.90\textwidth]{Fig_index_hor} 
    204206\caption{   \label{Fig_index_hor}     
    205207Horizontal integer indexing used in the \textsc{Fortran} code. The dashed area indicates  
     
    251253%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    252254\begin{figure}[!pt]    \begin{center} 
    253 \includegraphics[width=.90\textwidth]{./TexFiles/Figures/Fig_index_vert.pdf} 
     255\includegraphics[width=.90\textwidth]{Fig_index_vert} 
    254256\caption{ \label{Fig_index_vert}      
    255257Vertical integer indexing used in the \textsc{Fortran } code. Note that  
     
    349351%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    350352\begin{figure}[!t]     \begin{center} 
    351 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_zgr_e3.pdf} 
     353\includegraphics[width=0.90\textwidth]{Fig_zgr_e3} 
    352354\caption{ \label{Fig_zgr_e3}     
    353355Comparison of (a) traditional definitions of grid-point position and grid-size in the vertical,  
     
    458460%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    459461\begin{figure}[!tb]    \begin{center} 
    460 \includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_z_zps_s_sps.pdf} 
     462\includegraphics[width=1.0\textwidth]{Fig_z_zps_s_sps} 
    461463\caption{  \label{Fig_z_zps_s_sps}    
    462464The ocean bottom as seen by the model:  
     
    486488The last choice in terms of vertical coordinate concerns the presence (or not) in the model domain  
    487489of ocean cavities beneath ice shelves. Setting \np{ln\_isfcav} to true allows to manage ocean cavities,  
    488 otherwise they are filled in. 
     490otherwise they are filled in. This option is currently only available in $z$- or $zps$-coordinate, 
     491and partial step are also applied at the ocean/ice shelf interface.  
    489492 
    490493Contrary to the horizontal grid, the vertical grid is computed in the code and no  
     
    567570%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    568571\begin{figure}[!tb]    \begin{center} 
    569 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_zgr.pdf} 
     572\includegraphics[width=0.90\textwidth]{Fig_zgr} 
    570573\caption{ \label{Fig_zgr}     
    571574Default vertical mesh for ORCA2: 30 ocean levels (L30). Vertical level functions for  
     
    772775\end{equation} 
    773776 
    774 where $s_{min}$ is the depth at which the s-coordinate stretching starts and  
    775 allows a z-coordinate to placed on top of the stretched coordinate,  
    776 and z is the depth (negative down from the asea surface). 
     777where $s_{min}$ is the depth at which the $s$-coordinate stretching starts and  
     778allows a $z$-coordinate to placed on top of the stretched coordinate,  
     779and $z$ is the depth (negative down from the asea surface). 
    777780 
    778781\begin{equation} 
     
    800803%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    801804\begin{figure}[!ht]    \begin{center} 
    802 \includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_sco_function.pdf} 
     805\includegraphics[width=1.0\textwidth]{Fig_sco_function} 
    803806\caption{  \label{Fig_sco_function}    
    804807Examples of the stretching function applied to a seamount; from left to right:  
     
    846849%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    847850\begin{figure}[!ht] 
    848    \includegraphics[width=1.0\textwidth]{./TexFiles/Figures/FIG_DOM_compare_coordinates_surface.pdf} 
     851   \includegraphics[width=1.0\textwidth]{FIG_DOM_compare_coordinates_surface} 
    849852        \caption{A comparison of the \citet{Song_Haidvogel_JCP94} $S$-coordinate (solid lines), a 50 level $Z$-coordinate (contoured surfaces) and the \citet{Siddorn_Furner_OM12} $S$-coordinate (dashed lines) in the surface 100m for a idealised bathymetry that goes from 50m to 5500m depth. For clarity every third coordinate surface is shown.} 
    850853    \label{fig_compare_coordinates_surface} 
     
    886889that do not communicate with another ocean point at the same level are eliminated. 
    887890 
    888 In case of ice shelf cavities, as for the representation of bathymetry, a 2D integer array, misfdep, is created.  
    889 misfdep defines the level of the first wet $t$-point (ie below the ice-shelf/ocean interface). All the cells between $k=1$ and $misfdep(i,j)-1$ are masked.  
    890 By default, $misfdep(:,:)=1$ and no cells are masked. 
    891 Modifications of the model bathymetry and ice shelf draft into  
     891As for the representation of bathymetry, a 2D integer array, misfdep, is created.  
     892misfdep defines the level of the first wet $t$-point. All the cells between $k=1$ and $misfdep(i,j)-1$ are masked.  
     893By default, misfdep(:,:)=1 and no cells are masked. 
     894 
     895In case of ice shelf cavities, modifications of the model bathymetry and ice shelf draft into  
    892896the cavities are performed in the \textit{zgr\_isf} routine. The compatibility between ice shelf draft and bathymetry is checked.  
    893897All the locations where the isf cavity is thinnest than \np{rn\_isfhmin} meters are grounded ($i.e.$ masked).  
     
    903907vmask(i,j,k) &=         \; tmask(i,j,k) \ * \ tmask(i,j+1,k)   \\ 
    904908fmask(i,j,k) &=         \; tmask(i,j,k) \ * \ tmask(i+1,j,k)   \\ 
    905                    & \ \ \, * tmask(i,j,k) \ * \ tmask(i+1,j,k) \\ 
     909             &    \ \ \, * tmask(i,j,k) \ * \ tmask(i+1,j,k) \\ 
    906910wmask(i,j,k) &=         \; tmask(i,j,k) \ * \ tmask(i,j,k-1) \text{ with } wmask(i,j,1) = tmask(i,j,1)  
    907911\end{align*} 
    908912 
    909 Note, wmask is now defined. It allows, in case of ice shelves,  
    910 to deal with the top boundary (ice shelf/ocean interface) exactly in the same way as for the bottom boundary.  
     913Note that, without ice shelves cavities, masks at $t-$ and $w-$points are identical with  
     914the numerical indexing used (\S~\ref{DOM_Num_Index}). Nevertheless, $wmask$ are required  
     915with oceean cavities to deal with the top boundary (ice shelf/ocean interface)  
     916exactly in the same way as for the bottom boundary.  
    911917 
    912918The specification of closed lateral boundaries requires that at least the first and last  
     
    916922(and so too the mask arrays) (see \S~\ref{LBC_jperio}). 
    917923 
    918 %%% 
    919 \gmcomment{   \colorbox{yellow}{Add one word on tricky trick !} mbathy in further modified in zdfbfr{\ldots}.  } 
    920 %%% 
    921924 
    922925% ================================================================ 
     
    942945(typical of the tropical ocean), see \rou{istate\_t\_s} subroutine called from \mdl{istate} module. 
    943946\end{description} 
     947\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_DYN.tex

    r6320 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter ——— Ocean Dynamics (DYN) 
     
    294296%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    295297\begin{figure}[!ht]    \begin{center} 
    296 \includegraphics[width=0.70\textwidth]{./TexFiles/Figures/Fig_DYN_een_triad.pdf} 
     298\includegraphics[width=0.70\textwidth]{Fig_DYN_een_triad} 
    297299\caption{ \label{Fig_DYN_een_triad}   
    298300Triads used in the energy and enstrophy conserving scheme (een) for  
     
    663665$\bullet$ The main hypothesis to compute the ice shelf load is that the ice shelf is in an isostatic equilibrium. 
    664666 The top pressure is computed integrating from surface to the base of the ice shelf a reference density profile  
    665 (prescribed as density of a water at 34.4 PSU and -1.9$\degres C$) and corresponds to the water replaced by the ice shelf.  
     667(prescribed as density of a water at 34.4 PSU and -1.9\degC) and corresponds to the water replaced by the ice shelf.  
    666668This top pressure is constant over time. A detailed description of this method is described in \citet{Losch2008}.\\ 
    667669 
     
    827829%>   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   > 
    828830\begin{figure}[!t]    \begin{center} 
    829 \includegraphics[width=0.7\textwidth]{./TexFiles/Figures/Fig_DYN_dynspg_ts.pdf} 
     831\includegraphics[width=0.7\textwidth]{Fig_DYN_dynspg_ts} 
    830832\caption{  \label{Fig_DYN_dynspg_ts} 
    831833Schematic of the split-explicit time stepping scheme for the external  
     
    12631265 
    12641266% ================================================================ 
     1267\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_LBC.tex

    r6289 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter — Lateral Boundary Condition (LBC)  
     
    5355%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    5456\begin{figure}[!t]     \begin{center} 
    55 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_LBC_uv.pdf} 
     57\includegraphics[width=0.90\textwidth]{Fig_LBC_uv} 
    5658\caption{  \label{Fig_LBC_uv} 
    5759Lateral boundary (thick line) at T-level. The velocity normal to the boundary is set to zero.} 
     
    7678%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    7779\begin{figure}[!p] \begin{center} 
    78 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_LBC_shlat.pdf} 
     80\includegraphics[width=0.90\textwidth]{Fig_LBC_shlat} 
    7981\caption{     \label{Fig_LBC_shlat}  
    8082lateral boundary condition (a) free-slip ($rn\_shlat=0$) ; (b) no-slip ($rn\_shlat=2$)  
     
    177179%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    178180\begin{figure}[!t]     \begin{center} 
    179 \includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_LBC_jperio.pdf} 
     181\includegraphics[width=1.0\textwidth]{Fig_LBC_jperio} 
    180182\caption{    \label{Fig_LBC_jperio} 
    181183setting of (a) east-west cyclic  (b) symmetric across the equator boundary conditions.} 
     
    196198%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    197199\begin{figure}[!t]    \begin{center} 
    198 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_North_Fold_T.pdf} 
     200\includegraphics[width=0.90\textwidth]{Fig_North_Fold_T} 
    199201\caption{    \label{Fig_North_Fold_T}  
    200202North fold boundary with a $T$-point pivot and cyclic east-west boundary condition  
     
    259261%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    260262\begin{figure}[!t]    \begin{center} 
    261 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_mpp.pdf} 
     263\includegraphics[width=0.90\textwidth]{Fig_mpp} 
    262264\caption{   \label{Fig_mpp}  
    263265Positioning of a sub-domain when massively parallel processing is used. } 
     
    333335%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    334336\begin{figure}[!ht]     \begin{center} 
    335 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_mppini2.pdf} 
     337\includegraphics[width=0.90\textwidth]{Fig_mppini2} 
    336338\caption {    \label{Fig_mppini2} 
    337339Example of Atlantic domain defined for the CLIPPER projet. Initial grid is  
     
    564566%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    565567\begin{figure}[!t]      \begin{center} 
    566 \includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_LBC_bdy_geom.pdf} 
     568\includegraphics[width=1.0\textwidth]{Fig_LBC_bdy_geom} 
    567569\caption {      \label{Fig_LBC_bdy_geom} 
    568570Example of geometry of unstructured open boundary} 
     
    605607%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    606608\begin{figure}[!t]     \begin{center} 
    607 \includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_LBC_nc_header.pdf} 
     609\includegraphics[width=1.0\textwidth]{Fig_LBC_nc_header} 
    608610\caption {     \label{Fig_LBC_nc_header}  
    609611Example of the header for a coordinates.bdy.nc file} 
     
    642644 
    643645 
     646\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_LDF.tex

    r6289 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13 
    24% ================================================================ 
     
    228230%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    229231\begin{figure}[!ht]      \begin{center} 
    230 \includegraphics[width=0.70\textwidth]{./TexFiles/Figures/Fig_LDF_ZDF1.pdf} 
     232\includegraphics[width=0.70\textwidth]{Fig_LDF_ZDF1} 
    231233\caption {    \label{Fig_LDF_ZDF1} 
    232234averaging procedure for isopycnal slope computation.} 
     
    256258%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    257259\begin{figure}[!ht]     \begin{center} 
    258 \includegraphics[width=0.70\textwidth]{./TexFiles/Figures/Fig_eiv_slp.pdf} 
     260\includegraphics[width=0.70\textwidth]{Fig_eiv_slp} 
    259261\caption {     \label{Fig_eiv_slp} 
    260262Vertical profile of the slope used for lateral mixing in the mixed layer :  
     
    298300diffusion along model level surfaces, i.e. using the shear computed along  
    299301the model levels and with no additional friction at the ocean bottom (see  
    300 {\S\ref{LBC_coast}). 
     302\S\ref{LBC_coast}). 
    301303 
    302304 
     
    425427values are $0$). However, the technique used to compute the isopycnal  
    426428slopes is intended to get rid of such a background diffusion, since it introduces  
    427 spurious diapycnal diffusion (see {\S\ref{LDF_slp}). 
     429spurious diapycnal diffusion (see \S\ref{LDF_slp}). 
    428430 
    429431(4) when an eddy induced advection term is used (\key{traldf\_eiv}), $A^{eiv}$,  
     
    499501 
    500502 
    501  
     503\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_MISC.tex

    r6289 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter ——— Miscellaneous Topics 
     
    6062%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    6163\begin{figure}[!tbp]     \begin{center} 
    62 \includegraphics[width=0.80\textwidth]{./TexFiles/Figures/Fig_Gibraltar.pdf} 
    63 \includegraphics[width=0.80\textwidth]{./TexFiles/Figures/Fig_Gibraltar2.pdf} 
     64\includegraphics[width=0.80\textwidth]{Fig_Gibraltar} 
     65\includegraphics[width=0.80\textwidth]{Fig_Gibraltar2} 
    6466\caption{   \label{Fig_MISC_strait_hand}  
    65 Example of the Gibraltar strait defined in a $1\deg \times 1\deg$ mesh.  
     67Example of the Gibraltar strait defined in a $1^{\circ} \times 1^{\circ}$ mesh.  
    6668\textit{Top}: using partially open cells. The meridional scale factor at $v$-point  
    6769is reduced on both sides of the strait to account for the real width of the strait  
     
    181183%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    182184\begin{figure}[!ht]    \begin{center} 
    183 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_LBC_zoom.pdf} 
     185\includegraphics[width=0.90\textwidth]{Fig_LBC_zoom} 
    184186\caption{   \label{Fig_LBC_zoom} 
    185187Position of a model domain compared to the data input domain when the zoom functionality is used.} 
     
    317319 
    318320% ================================================================ 
    319  
    320  
    321  
    322  
    323  
     321\end{document} 
     322 
     323 
     324 
     325 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_Model_Basics.tex

    r6289 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter 1 Ñ Model Basics 
     
    114116%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    115117\begin{figure}[!ht]   \begin{center} 
    116 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_I_ocean_bc.pdf} 
     118\includegraphics[width=0.90\textwidth]{Fig_I_ocean_bc} 
    117119\caption{    \label{Fig_ocean_bc}  
    118120The ocean is bounded by two surfaces, $z=-H(i,j)$ and $z=\eta(i,j,t)$, where $H$  
     
    312314%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    313315\begin{figure}[!tb]   \begin{center} 
    314 \includegraphics[width=0.60\textwidth]{./TexFiles/Figures/Fig_I_earth_referential.pdf} 
     316\includegraphics[width=0.60\textwidth]{Fig_I_earth_referential} 
    315317\caption{   \label{Fig_referential}  
    316318the geographical coordinate system $(\lambda,\varphi,z)$ and the curvilinear  
     
    807809%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    808810\begin{figure}[!b]    \begin{center} 
    809 \includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_z_zstar.pdf} 
     811\includegraphics[width=1.0\textwidth]{Fig_z_zstar} 
    810812\caption{   \label{Fig_z_zstar}  
    811813(a) $z$-coordinate in linear free-surface case ;  
     
    12471249not available in the iso-neutral case. 
    12481250 
     1251\end{document} 
     1252 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_Model_Basics_zstar.tex

    r6140 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter 1 ——— Model Basics 
     
    121123%>   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   >   > 
    122124\begin{figure}[!t]   \begin{center} 
    123 \includegraphics[width=0.90\textwidth]{./Figures/Fig_DYN_dynspg_ts.pdf} 
     125\includegraphics[width=0.90\textwidth]{Fig_DYN_dynspg_ts} 
    124126\caption{    \label{Fig_DYN_dynspg_ts} 
    125127Schematic of the split-explicit time stepping scheme for the barotropic and baroclinic modes,  
     
    256258 
    257259 
     260\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_OBS.tex

    r6140 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter observation operator (OBS) 
     
    744746%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    745747\begin{figure}      \begin{center} 
    746 \includegraphics[width=10cm,height=12cm,angle=-90.]{./TexFiles/Figures/Fig_ASM_obsdist_local} 
     748\includegraphics[width=10cm,height=12cm,angle=-90.]{Fig_ASM_obsdist_local} 
    747749\caption{      \label{fig:obslocal} 
    748750Example of the distribution of observations with the geographical distribution of observational data.}  
     
    771773%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    772774\begin{figure}     \begin{center} 
    773 \includegraphics[width=10cm,height=12cm,angle=-90.]{./TexFiles/Figures/Fig_ASM_obsdist_global} 
     775\includegraphics[width=10cm,height=12cm,angle=-90.]{Fig_ASM_obsdist_global} 
    774776\caption{      \label{fig:obsglobal} 
    775777Example of the distribution of observations with the round-robin distribution of observational data.} 
     
    13881390%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    13891391\begin{figure}     \begin{center} 
    1390 %\includegraphics[width=10cm,height=12cm,angle=-90.]{./TexFiles/Figures/Fig_OBS_dataplot_main} 
    1391 \includegraphics[width=9cm,angle=-90.]{./TexFiles/Figures/Fig_OBS_dataplot_main} 
     1392%\includegraphics[width=10cm,height=12cm,angle=-90.]{Fig_OBS_dataplot_main} 
     1393\includegraphics[width=9cm,angle=-90.]{Fig_OBS_dataplot_main} 
    13921394\caption{      \label{fig:obsdataplotmain} 
    13931395Main window of dataplot.} 
     
    14001402%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    14011403\begin{figure}     \begin{center} 
    1402 %\includegraphics[width=10cm,height=12cm,angle=-90.]{./TexFiles/Figures/Fig_OBS_dataplot_prof} 
    1403 \includegraphics[width=7cm,angle=-90.]{./TexFiles/Figures/Fig_OBS_dataplot_prof} 
     1404%\includegraphics[width=10cm,height=12cm,angle=-90.]{Fig_OBS_dataplot_prof} 
     1405\includegraphics[width=7cm,angle=-90.]{Fig_OBS_dataplot_prof} 
    14041406\caption{      \label{fig:obsdataplotprofile} 
    14051407Profile plot from dataplot produced by right clicking on a point in the main window.} 
     
    14101412 
    14111413 
     1414\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_SBC.tex

    r6320 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter —— Surface Boundary Condition (SBC, ISF, ICB)  
     
    128130The ocean model provides, at each time step, to the surface module (\mdl{sbcmod})  
    129131the surface currents, temperature and salinity.   
    130 These variables are averaged over \np{nf\_sbc} time-step (\ref{Tab_ssm}),  
     132These variables are averaged over \np{nn\_fsbc} time-step (\ref{Tab_ssm}),  
    131133and it is these averaged fields which are used to computes the surface fluxes  
    132 at a frequency of \np{nf\_sbc} time-step. 
     134at a frequency of \np{nn\_fsbc} time-step. 
    133135 
    134136 
     
    144146\caption{  \label{Tab_ssm}    
    145147Ocean variables provided by the ocean to the surface module (SBC).  
    146 The variable are averaged over nf{\_}sbc time step, $i.e.$ the frequency of  
    147 computation of surface fluxes.} 
     148The variable are averaged over nn{\_}fsbc time step,  
     149$i.e.$ the frequency of computation of surface fluxes.} 
    148150\end{center}   \end{table} 
    149151%-------------------------------------------------------------------------------------------------------------- 
     
    592594or larger than the one of the input atmospheric fields. 
    593595 
     596The \np{sn\_wndi}, \np{sn\_wndj}, \np{sn\_qsr}, \np{sn\_qlw}, \np{sn\_tair}, \np{sn\_humi}, 
     597\np{sn\_prec}, \np{sn\_snow}, \np{sn\_tdif} parameters describe the fields  
     598and the way they have to be used (spatial and temporal interpolations).  
     599 
     600\np{cn\_dir} is the directory of location of bulk files 
     601\np{ln\_taudif} is the flag to specify if we use Hight Frequency (HF) tau information (.true.) or not (.false.) 
     602\np{rn\_zqt}: is the height of humidity and temperature measurements (m) 
     603\np{rn\_zu}: is the height of wind measurements (m) 
     604 
     605Three multiplicative factors are availables :  
     606\np{rn\_pfac} and \np{rn\_efac} allows to adjust (if necessary) the global freshwater budget  
     607by increasing/reducing the precipitations (total and snow) and or evaporation, respectively. 
     608The third one,\np{rn\_vfac}, control to which extend the ice/ocean velocities are taken into account  
     609in the calculation of surface wind stress. Its range should be between zero and one,  
     610and it is recommended to set it to 0. 
     611 
    594612% ------------------------------------------------------------------------------------------------------------- 
    595613%        CLIO Bulk formulea 
     
    926944\begin{description} 
    927945\item[\np{nn\_isf}~=~1] 
    928 The ice shelf cavity is represented (\np{ln\_isfcav}~=~true needed). The fwf and heat flux are computed. Two different bulk formula are available: 
     946The ice shelf cavity is represented (\np{ln\_isfcav}~=~true needed). The fwf and heat flux are computed.  
     947Two different bulk formula are available: 
    929948   \begin{description} 
    930949   \item[\np{nn\_isfblk}~=~1] 
     
    9881007This parameter is only used if \np{nn\_isf}~=~1 or \np{nn\_isf}~=~4 
    9891008 
    990 If \np{rn\_hisf\_tbl} = 0.0, the fluxes are put in the top level whatever is its tickness.  
    991  
    992 If \np{rn\_hisf\_tbl} $>$ 0.0, the fluxes are spread over the first \np{rn\_hisf\_tbl} m (ie over one or several cells).\\ 
     1009If \np{rn\_hisf\_tbl} = 0., the fluxes are put in the top level whatever is its tickness.  
     1010 
     1011If \np{rn\_hisf\_tbl} $>$ 0., the fluxes are spread over the first \np{rn\_hisf\_tbl} m (ie over one or several cells).\\ 
    9931012 
    9941013The ice shelf melt is implemented as a volume flux with in the same way as for the runoff. 
     
    11161135%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    11171136\begin{figure}[!t]    \begin{center} 
    1118 \includegraphics[width=0.8\textwidth]{./TexFiles/Figures/Fig_SBC_diurnal.pdf} 
     1137\includegraphics[width=0.8\textwidth]{Fig_SBC_diurnal} 
    11191138\caption{ \label{Fig_SBC_diurnal}     
    11201139Example of recontruction of the diurnal cycle variation of short wave flux   
     
    11491168%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    11501169\begin{figure}[!t]  \begin{center} 
    1151 \includegraphics[width=0.7\textwidth]{./TexFiles/Figures/Fig_SBC_dcy.pdf} 
     1170\includegraphics[width=0.7\textwidth]{Fig_SBC_dcy} 
    11521171\caption{ \label{Fig_SBC_dcy}    
    11531172Example of recontruction of the diurnal cycle variation of short wave flux   
     
    13441363 
    13451364 
     1365\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_STO.tex

    r6289 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter stochastic parametrization of EOS (STO) 
     
    57\label{STO} 
    68 
     9Authors: P.-A. Bouttier 
     10 
    711\minitoc 
    812 
     13\newpage 
    914 
    10 \newpage 
    11 $\ $\newline    % force a new line 
     15 
     16The stochastic parametrization module aims to explicitly simulate uncertainties in the model.  
     17More particularly, \cite{Brankart_OM2013} has shown that,  
     18because of the nonlinearity of the seawater equation of state, unresolved scales represent  
     19a major source of uncertainties in the computation of the large scale horizontal density gradient  
     20(from T/S large scale fields), and that the impact of these uncertainties can be simulated  
     21by random processes representing unresolved T/S fluctuations. 
     22 
     23The stochastic formulation of the equation of state can be written as: 
     24\begin{equation} 
     25 \label{eq:eos_sto} 
     26  \rho = \frac{1}{2} \sum_{i=1}^m\{ \rho[T+\Delta T_i,S+\Delta S_i,p_o(z)] + \rho[T-\Delta T_i,S-\Delta S_i,p_o(z)] \} 
     27\end{equation} 
     28where $p_o(z)$ is the reference pressure depending on the depth and,  
     29$\Delta T_i$ and $\Delta S_i$ are a set of T/S perturbations defined as the scalar product  
     30of the respective local T/S gradients with random walks $\mathbf{\xi}$: 
     31\begin{equation} 
     32 \label{eq:sto_pert} 
     33 \Delta T_i = \mathbf{\xi}_i \cdot \nabla T \qquad \hbox{and} \qquad \Delta S_i = \mathbf{\xi}_i \cdot \nabla S 
     34\end{equation} 
     35$\mathbf{\xi}_i$ are produced by a first-order autoregressive processes (AR-1) with  
     36a parametrized decorrelation time scale, and horizontal and vertical standard deviations $\sigma_s$.  
     37$\mathbf{\xi}$ are uncorrelated over the horizontal and fully correlated along the vertical. 
     38 
     39 
     40\section{Stochastic processes} 
     41\label{STO_the_details} 
     42 
     43The starting point of our implementation of stochastic parameterizations 
     44in NEMO is to observe that many existing parameterizations are based 
     45on autoregressive processes, which are used as a basic source of randomness 
     46to transform a deterministic model into a probabilistic model. 
     47A generic approach is thus to add one single new module in NEMO, 
     48generating processes with appropriate statistics 
     49to simulate each kind of uncertainty in the model 
     50(see \cite{Brankart_al_GMD2015} for more details). 
     51 
     52In practice, at every model grid point, independent Gaussian autoregressive 
     53processes~$\xi^{(i)},\,i=1,\ldots,m$ are first generated 
     54using the same basic equation: 
     55 
     56\begin{equation} 
     57\label{eq:autoreg} 
     58\xi^{(i)}_{k+1} = a^{(i)} \xi^{(i)}_k + b^{(i)} w^{(i)} + c^{(i)} 
     59\end{equation} 
     60 
     61\noindent 
     62where $k$ is the index of the model timestep; and 
     63$a^{(i)}$, $b^{(i)}$, $c^{(i)}$ are parameters defining 
     64the mean ($\mu^{(i)}$) standard deviation ($\sigma^{(i)}$) 
     65and correlation timescale ($\tau^{(i)}$) of each process: 
     66 
     67\begin{itemize} 
     68\item for order~1 processes, $w^{(i)}$ is a Gaussian white noise, 
     69with zero mean and standard deviation equal to~1, and the parameters 
     70$a^{(i)}$, $b^{(i)}$, $c^{(i)}$ are given by: 
     71 
     72\begin{equation} 
     73\label{eq:ord1} 
     74\left\{ 
     75\begin{array}{l} 
     76a^{(i)} = \varphi \\ 
     77b^{(i)} = \sigma^{(i)} \sqrt{ 1 - \varphi^2 }  
     78 \qquad\qquad\mbox{with}\qquad\qquad 
     79\varphi = \exp \left( - 1 / \tau^{(i)} \right) \\ 
     80c^{(i)} = \mu^{(i)} \left( 1 - \varphi \right) \\ 
     81\end{array} 
     82\right. 
     83\end{equation} 
     84 
     85\item for order~$n>1$ processes, $w^{(i)}$ is an order~$n-1$ autoregressive process, 
     86with zero mean, standard deviation equal to~$\sigma^{(i)}$; correlation timescale 
     87equal to~$\tau^{(i)}$; and the parameters $a^{(i)}$, $b^{(i)}$, $c^{(i)}$ are given by: 
     88 
     89\begin{equation} 
     90\label{eq:ord2} 
     91\left\{ 
     92\begin{array}{l} 
     93a^{(i)} = \varphi \\ 
     94b^{(i)} = \frac{n-1}{2(4n-3)} \sqrt{ 1 - \varphi^2 }  
     95 \qquad\qquad\mbox{with}\qquad\qquad 
     96\varphi = \exp \left( - 1 / \tau^{(i)} \right) \\ 
     97c^{(i)} = \mu^{(i)} \left( 1 - \varphi \right) \\ 
     98\end{array} 
     99\right. 
     100\end{equation} 
     101 
     102\end{itemize} 
     103 
     104\noindent 
     105In this way, higher order processes can be easily generated recursively using  
     106the same piece of code implementing Eq.~(\ref{eq:autoreg}),  
     107and using succesively processes from order $0$ to~$n-1$ as~$w^{(i)}$. 
     108The parameters in Eq.~(\ref{eq:ord2}) are computed so that this recursive application 
     109of Eq.~(\ref{eq:autoreg}) leads to processes with the required standard deviation 
     110and correlation timescale, with the additional condition that 
     111the $n-1$ first derivatives of the autocorrelation function 
     112are equal to zero at~$t=0$, so that the resulting processes 
     113become smoother and smoother as $n$ is increased. 
     114 
     115Overall, this method provides quite a simple and generic way of generating  
     116a wide class of stochastic processes.  
     117However, this also means that new model parameters are needed to specify each of  
     118these stochastic processes. As in any parameterization of lacking physics,  
     119a very important issues then to tune these new parameters using either first principles,  
     120model simulations, or real-world observations. 
     121 
     122\section{Implementation details} 
     123\label{STO_thech_details} 
     124 
    12125%---------------------------------------namsbc-------------------------------------------------- 
    13126\namdisplay{namsto} 
    14127%-------------------------------------------------------------------------------------------------------------- 
    15 $\ $\newline    % force a new ligne 
     128 
     129The computer code implementing stochastic parametrisations can be found in the STO directory. 
     130It involves three modules :  
     131\begin{description} 
     132\item[\mdl{stopar}] : define the Stochastic parameters and their time evolution. 
     133\item[\mdl{storng}] : a random number generator based on (and includes) the 64-bit KISS  
     134                      (Keep It Simple Stupid) random number generator distributed by George Marsaglia  
     135                      (see \href{https://groups.google.com/forum/#!searchin/comp.lang.fortran/64-bit$20KISS$20RNGs}{here}) 
     136\item[\mdl{stopts}] : stochastic parametrisation associated with the non-linearity of the equation of seawater,  
     137 implementing Eq~\ref{eq:sto_pert} and specific piece of code in the equation of state implementing Eq~\ref{eq:eos_sto}. 
     138\end{description} 
     139 
     140The \mdl{stopar} module has 3 public routines to be called by the model (in our case, NEMO): 
     141 
     142The first routine (\rou{sto\_par}) is a direct implementation of Eq.~(\ref{eq:autoreg}), 
     143applied at each model grid point (in 2D or 3D),  
     144and called at each model time step ($k$) to update 
     145every autoregressive process ($i=1,\ldots,m$). 
     146This routine also includes a filtering operator, applied to $w^{(i)}$, 
     147to introduce a spatial correlation between the stochastic processes. 
     148 
     149The second routine (\rou{sto\_par\_init}) is an initialization routine mainly dedicated 
     150to the computation of parameters $a^{(i)}, b^{(i)}, c^{(i)}$ 
     151for each autoregressive process, as a function of the statistical properties 
     152required by the model user (mean, standard deviation, time correlation, 
     153order of the process,\ldots).  
     154 
     155Parameters for the processes can be specified through the following \ngn{namsto} namelist parameters: 
     156\begin{description} 
     157   \item[\np{nn\_sto\_eos}]   : number of independent random walks  
     158   \item[\np{rn\_eos\_stdxy}] : random walk horz. standard deviation (in grid points) 
     159   \item[\np{rn\_eos\_stdz}]  : random walk vert. standard deviation (in grid points) 
     160   \item[\np{rn\_eos\_tcor}]  : random walk time correlation (in timesteps) 
     161   \item[\np{nn\_eos\_ord}]   : order of autoregressive processes 
     162   \item[\np{nn\_eos\_flt}]   : passes of Laplacian filter 
     163   \item[\np{rn\_eos\_lim}]   : limitation factor (default = 3.0) 
     164\end{description} 
     165This routine also includes the initialization (seeding) of the random number generator. 
     166 
     167The third routine (\rou{sto\_rst\_write}) writes a restart file (which suffix name is  
     168given by \np{cn\_storst\_out} namelist parameter) containing the current value of  
     169all autoregressive processes to allow restarting a simulation from where it has been interrupted. 
     170This file also contains the current state of the random number generator. 
     171When \np{ln\_rststo} is set to \textit{true}), the restart file (which suffix name is  
     172given by \np{cn\_storst\_in} namelist parameter) is read by the initialization routine  
     173(\rou{sto\_par\_init}). The simulation will continue exactly as if it was not interrupted 
     174only  when \np{ln\_rstseed} is set to \textit{true}, $i.e.$ when the state of  
     175the random number generator is read in the restart file. 
    16176 
    17177 
    18 See \cite{Brankart_OM2013} and \cite{Brankart_al_GMD2015} papers for a description of the parameterization. 
     178\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_STP.tex

    r6140 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13 
    24% ================================================================ 
     
    204206%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    205207\begin{figure}[!t]     \begin{center} 
    206 \includegraphics[width=0.7\textwidth]{./TexFiles/Figures/Fig_TimeStepping_flowchart.pdf} 
     208\includegraphics[width=0.7\textwidth]{Fig_TimeStepping_flowchart} 
    207209\caption{   \label{Fig_TimeStep_flowchart} 
    208210Sketch of the leapfrog time stepping sequence in \NEMO from \citet{Leclair_Madec_OM09}.  
     
    266268%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    267269\begin{figure}[!t]     \begin{center} 
    268 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_MLF_forcing.pdf} 
     270\includegraphics[width=0.90\textwidth]{Fig_MLF_forcing} 
    269271\caption{   \label{Fig_MLF_forcing} 
    270272Illustration of forcing integration methods.  
     
    402404} 
    403405%% 
     406\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_TRA.tex

    r6320 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter 1 ——— Ocean Tracers (TRA) 
     
    9092%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    9193\begin{figure}[!t]    \begin{center} 
    92 \includegraphics[width=0.9\textwidth]{./TexFiles/Figures/Fig_adv_scheme.pdf} 
     94\includegraphics[width=0.9\textwidth]{Fig_adv_scheme} 
    9395\caption{   \label{Fig_adv_scheme}  
    9496Schematic representation of some ways used to evaluate the tracer value  
     
    734736(see \S\ref{SBC_rnf} for further detail of how it acts on temperature and salinity tendencies) 
    735737 
    736 $\bullet$ \textit{fwfisf}, the mass flux associated with ice shelf melt, (see \S\ref{SBC_isf} for further details  
    737 on how the ice shelf melt is computed and applied). 
     738$\bullet$ \textit{fwfisf}, the mass flux associated with ice shelf melt,  
     739(see \S\ref{SBC_isf} for further details on how the ice shelf melt is computed and applied). 
    738740 
    739741The surface boundary condition on temperature and salinity is applied as follows: 
     
    840842($i.e.$ the inverses of the extinction length scales) are tabulated over 61 nonuniform  
    841843chlorophyll classes ranging from 0.01 to 10 g.Chl/L (see the routine \rou{trc\_oce\_rgb}  
    842 in \mdl{trc\_oce} module). Three types of chlorophyll can be chosen in the RGB formulation: 
    843 (1) a constant 0.05 g.Chl/L value everywhere (\np{nn\_chdta}=0) ; (2) an observed  
    844 time varying chlorophyll (\np{nn\_chdta}=1) ; (3) simulated time varying chlorophyll 
    845 by TOP biogeochemical model (\np{ln\_qsr\_bio}=true). In the latter case, the RGB  
    846 formulation is used to calculate both the phytoplankton light limitation in PISCES  
    847 or LOBSTER and the oceanic heating rate.  
    848  
     844in \mdl{trc\_oce} module). Four types of chlorophyll can be chosen in the RGB formulation: 
     845\begin{description}  
     846\item[\np{nn\_chdta}=0]  
     847a constant 0.05 g.Chl/L value everywhere ;  
     848\item[\np{nn\_chdta}=1]   
     849an observed time varying chlorophyll deduced from satellite surface ocean color measurement  
     850spread uniformly in the vertical direction ;  
     851\item[\np{nn\_chdta}=2]   
     852same as previous case except that a vertical profile of chlorophyl is used.  
     853Following \cite{Morel_Berthon_LO89}, the profile is computed from the local surface chlorophyll value ; 
     854\item[\np{ln\_qsr\_bio}=true]   
     855simulated time varying chlorophyll by TOP biogeochemical model.  
     856In this case, the RGB formulation is used to calculate both the phytoplankton  
     857light limitation in PISCES or LOBSTER and the oceanic heating rate.  
     858\end{description}  
    849859The trend in \eqref{Eq_tra_qsr} associated with the penetration of the solar radiation  
    850860is added to the temperature trend, and the surface heat flux is modified in routine \mdl{traqsr}.  
     
    861871%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    862872\begin{figure}[!t]     \begin{center} 
    863 \includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_TRA_Irradiance.pdf} 
     873\includegraphics[width=1.0\textwidth]{Fig_TRA_Irradiance} 
    864874\caption{    \label{Fig_traqsr_irradiance} 
    865875Penetration profile of the downward solar irradiance calculated by four models.  
     
    882892%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    883893\begin{figure}[!t]     \begin{center} 
    884 \includegraphics[width=1.0\textwidth]{./TexFiles/Figures/Fig_TRA_geoth.pdf} 
     894\includegraphics[width=1.0\textwidth]{Fig_TRA_geoth} 
    885895\caption{   \label{Fig_geothermal} 
    886896Geothermal Heat flux (in $mW.m^{-2}$) used by \cite{Emile-Geay_Madec_OS09}. 
     
    9921002%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    9931003\begin{figure}[!t]   \begin{center} 
    994 \includegraphics[width=0.7\textwidth]{./TexFiles/Figures/Fig_BBL_adv.pdf} 
     1004\includegraphics[width=0.7\textwidth]{Fig_BBL_adv} 
    9951005\caption{   \label{Fig_bbl}   
    9961006Advective/diffusive Bottom Boundary Layer. The BBL parameterisation is  
     
    11501160The restoration coefficient can be set to zero in equatorial regions by specifying a positive value of \np{nn\_hdmp}.  
    11511161Equatorward of this latitude the restoration coefficient will be zero with a smooth transition to  
    1152 the full values of a 10$^{\circ}$ latitud band.  
     1162the full values of a 10\deg latitud band.  
    11531163This is often used because of the short adjustment time scale in the equatorial region  
    11541164\citep{Reverdin1991, Fujio1991, Marti_PhD92}. The time scale associated with the damping depends on the depth as a  
     
    12501260rational function approximation for hydrographic data analysis  \citep{TEOS10}.  
    12511261A key point is that conservative state variables are used:  
    1252 Absolute Salinity (unit: g/kg, notation: $S_A$) and Conservative Temperature (unit: $\degres C$, notation: $\Theta$). 
     1262Absolute Salinity (unit: g/kg, notation: $S_A$) and Conservative Temperature (unit: \degC, notation: $\Theta$). 
    12531263The pressure in decibars is approximated by the depth in meters.  
    12541264With TEOS10, the specific heat capacity of sea water, $C_p$, is a constant. It is set to  
    1255 $C_p=3991.86795711963~J\,Kg^{-1}\,\degres K^{-1}$, according to \citet{TEOS10}. 
     1265$C_p=3991.86795711963~J\,Kg^{-1}\,^{\circ}K^{-1}$, according to \citet{TEOS10}. 
    12561266 
    12571267Choosing polyTEOS10-bsq implies that the state variables used by the model are  
     
    12661276to accurately fit EOS80 (Roquet, personal comm.). The state variables used in both the EOS80  
    12671277and the ocean model are:  
    1268 the Practical Salinity ((unit: psu, notation: $S_p$)) and Potential Temperature (unit: $\degres C$, notation: $\theta$). 
     1278the Practical Salinity ((unit: psu, notation: $S_p$)) and Potential Temperature (unit: $^{\circ}C$, notation: $\theta$). 
    12691279The pressure in decibars is approximated by the depth in meters.   
    12701280With thsi EOS, the specific heat capacity of sea water, $C_p$, is a function of temperature,  
     
    13851395                   I've changed "derivative" to "difference" and "mean" to "average"} 
    13861396 
    1387 With partial cells (\np{ln\_zps}=true) at bottom and top (\np{ln\_isfcav}=true), in general, tracers in horizontally  
    1388 adjacent cells live at different depths. Horizontal gradients of tracers are needed  
    1389 for horizontal diffusion (\mdl{traldf} module) and for the hydrostatic pressure  
    1390 gradient (\mdl{dynhpg} module) to be active. The partial cell properties  
    1391 at the top (\np{ln\_isfcav}=true) are computed in the same way as for the bottom. So, only the bottom interpolation is shown. 
    1392 \gmcomment{STEVEN from gm : question: not sure of  what -to be active- means} 
     1397With partial cells (\np{ln\_zps}=true) at bottom and top (\np{ln\_isfcav}=true), in general,  
     1398tracers in horizontally adjacent cells live at different depths.  
     1399Horizontal gradients of tracers are needed for horizontal diffusion (\mdl{traldf} module)  
     1400and the hydrostatic pressure gradient calculations (\mdl{dynhpg} module).  
     1401The partial cell properties at the top (\np{ln\_isfcav}=true) are computed in the same way as for the bottom.  
     1402So, only the bottom interpolation is explained below. 
    13931403 
    13941404Before taking horizontal gradients between the tracers next to the bottom, a linear  
     
    14001410%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    14011411\begin{figure}[!p]    \begin{center} 
    1402 \includegraphics[width=0.9\textwidth]{./TexFiles/Figures/Partial_step_scheme.pdf} 
     1412\includegraphics[width=0.9\textwidth]{Partial_step_scheme} 
    14031413\caption{   \label{Fig_Partial_step_scheme}  
    14041414Discretisation of the horizontal difference and average of tracers in the $z$-partial  
     
    14671477\gmcomment{gm :   this last remark has to be done} 
    14681478%%% 
     1479\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Chap_ZDF.tex

    r6320 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13% ================================================================ 
    24% Chapter  Vertical Ocean Physics (ZDF) 
     
    234236%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    235237\begin{figure}[!t] \begin{center} 
    236 \includegraphics[width=1.00\textwidth]{./TexFiles/Figures/Fig_mixing_length.pdf} 
     238\includegraphics[width=1.00\textwidth]{Fig_mixing_length} 
    237239\caption{ \label{Fig_mixing_length}  
    238240Illustration of the mixing length computation. } 
     
    262264\end{equation} 
    263265 
    264 At the ocean surface, a non zero length scale is set through the  \np{rn\_lmin0} namelist  
     266At the ocean surface, a non zero length scale is set through the  \np{rn\_mxl0} namelist  
    265267parameter. Usually the surface scale is given by $l_o = \kappa \,z_o$  
    266268where $\kappa = 0.4$ is von Karman's constant and $z_o$ the roughness  
    267269parameter of the surface. Assuming $z_o=0.1$~m \citep{Craig_Banner_JPO94}  
    268 leads to a 0.04~m, the default value of \np{rn\_lsurf}. In the ocean interior  
     270leads to a 0.04~m, the default value of \np{rn\_mxl0}. In the ocean interior  
    269271a minimum length scale is set to recover the molecular viscosity when $\bar{e}$  
    270272reach its minimum value ($1.10^{-6}= C_k\, l_{min} \,\sqrt{\bar{e}_{min}}$ ). 
     
    295297As the surface boundary condition on TKE is prescribed through $\bar{e}_o = e_{bb} |\tau| / \rho_o$,  
    296298with $e_{bb}$ the \np{rn\_ebb} namelist parameter, setting \np{rn\_ebb}~=~67.83 corresponds  
    297 to $\alpha_{CB} = 100$. further setting  \np{ln\_lsurf} to true applies \eqref{ZDF_Lsbc}  
    298 as surface boundary condition on length scale, with $\beta$ hard coded to the Stacet's value. 
     299to $\alpha_{CB} = 100$. Further setting  \np{ln\_mxl0} to true applies \eqref{ZDF_Lsbc}  
     300as surface boundary condition on length scale, with $\beta$ hard coded to the Stacey's value. 
    299301Note that a minimal threshold of \np{rn\_emin0}$=10^{-4}~m^2.s^{-2}$ (namelist parameters)  
    300302is applied on surface $\bar{e}$ value. 
     
    408410%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    409411\begin{figure}[!t]   \begin{center} 
    410 \includegraphics[width=1.00\textwidth]{./TexFiles/Figures/Fig_ZDF_TKE_time_scheme.pdf} 
     412\includegraphics[width=1.00\textwidth]{Fig_ZDF_TKE_time_scheme} 
    411413\caption{ \label{Fig_TKE_time_scheme}  
    412414Illustration of the TKE time integration and its links to the momentum and tracer time integration. } 
     
    587589value near physical boundaries (logarithmic boundary layer law). $C_{\mu}$ and $C_{\mu'}$  
    588590are calculated from stability function proposed by \citet{Galperin_al_JAS88}, or by \citet{Kantha_Clayson_1994}  
    589 or one of the two functions suggested by \citet{Canuto_2001}  (\np{nn\_stab\_func} = 0, 1, 2 or 3, resp.}).  
     591or one of the two functions suggested by \citet{Canuto_2001}  (\np{nn\_stab\_func} = 0, 1, 2 or 3, resp.).  
    590592The value of $C_{0\mu}$ depends of the choice of the stability function. 
    591593 
     
    643645%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    644646\begin{figure}[!htb]    \begin{center} 
    645 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_npc.pdf} 
     647\includegraphics[width=0.90\textwidth]{Fig_npc} 
    646648\caption{  \label{Fig_npc}  
    647649Example of an unstable density profile treated by the non penetrative  
     
    799801%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    800802\begin{figure}[!t]   \begin{center} 
    801 \includegraphics[width=0.99\textwidth]{./TexFiles/Figures/Fig_zdfddm.pdf} 
     803\includegraphics[width=0.99\textwidth]{Fig_zdfddm} 
    802804\caption{  \label{Fig_zdfddm} 
    803805From \citet{Merryfield1999} : (a) Diapycnal diffusivities $A_f^{vT}$  
     
    852854The bottom friction represents the friction generated by the bathymetry.  
    853855The top friction represents the friction generated by the ice shelf/ocean interface.  
    854 As the friction processes at the top and bottom are represented similarly, only the bottom friction is described in detail below.\\ 
     856As the friction processes at the top and bottom are treated in similar way,  
     857only the bottom friction is described in detail below. 
    855858 
    856859 
     
    926929$H = 4000$~m, the resulting friction coefficient is $r = 4\;10^{-4}$~m\;s$^{-1}$.  
    927930This is the default value used in \NEMO. It corresponds to a decay time scale  
    928 of 115~days. It can be changed by specifying \np{rn\_bfric1} (namelist parameter). 
     931of 115~days. It can be changed by specifying \np{rn\_bfri1} (namelist parameter). 
    929932 
    930933For the linear friction case the coefficients defined in the general  
     
    936939\end{split} 
    937940\end{equation} 
    938 When \np{nn\_botfr}=1, the value of $r$ used is \np{rn\_bfric1}.  
     941When \np{nn\_botfr}=1, the value of $r$ used is \np{rn\_bfri1}.  
    939942Setting \np{nn\_botfr}=0 is equivalent to setting $r=0$ and leads to a free-slip  
    940943bottom boundary condition. These values are assigned in \mdl{zdfbfr}.  
     
    943946in the \ifile{bfr\_coef} input NetCDF file. The mask values should vary from 0 to 1.  
    944947Locations with a non-zero mask value will have the friction coefficient increased  
    945 by $mask\_value$*\np{rn\_bfrien}*\np{rn\_bfric1}. 
     948by $mask\_value$*\np{rn\_bfrien}*\np{rn\_bfri1}. 
    946949 
    947950% ------------------------------------------------------------------------------------------------------------- 
     
    963966$e_b = 2.5\;10^{-3}$m$^2$\;s$^{-2}$, while the FRAM experiment \citep{Killworth1992}  
    964967uses $C_D = 1.4\;10^{-3}$ and $e_b =2.5\;\;10^{-3}$m$^2$\;s$^{-2}$.  
    965 The CME choices have been set as default values (\np{rn\_bfric2} and \np{rn\_bfeb2}  
     968The CME choices have been set as default values (\np{rn\_bfri2} and \np{rn\_bfeb2}  
    966969namelist parameters). 
    967970 
     
    978981\end{equation} 
    979982 
    980 The coefficients that control the strength of the non-linear bottom friction are  
    981 initialised as namelist parameters: $C_D$= \np{rn\_bfri2}, and $e_b$ =\np{rn\_bfeb2}.  
    982 Note for applications which treat tides explicitly a low or even zero value of  
    983 \np{rn\_bfeb2} is recommended. From v3.2 onwards a local enhancement of $C_D$  
    984 is possible via an externally defined 2D mask array (\np{ln\_bfr2d}=true).  
    985 See previous section for details. 
     983The coefficients that control the strength of the non-linear bottom friction are 
     984initialised as namelist parameters: $C_D$= \np{rn\_bfri2}, and $e_b$ =\np{rn\_bfeb2}. 
     985Note for applications which treat tides explicitly a low or even zero value of 
     986\np{rn\_bfeb2} is recommended. From v3.2 onwards a local enhancement of $C_D$ is possible 
     987via an externally defined 2D mask array (\np{ln\_bfr2d}=true).  This works in the same way 
     988as for the linear bottom friction case with non-zero masked locations increased by 
     989$mask\_value$*\np{rn\_bfrien}*\np{rn\_bfri2}. 
     990 
     991% ------------------------------------------------------------------------------------------------------------- 
     992%       Bottom Friction Log-layer 
     993% ------------------------------------------------------------------------------------------------------------- 
     994\subsection{Log-layer Bottom Friction enhancement (\np{nn\_botfr} = 2, \np{ln\_loglayer} = .true.)} 
     995\label{ZDF_bfr_loglayer} 
     996 
     997In the non-linear bottom friction case, the drag coefficient, $C_D$, can be optionally 
     998enhanced using a "law of the wall" scaling. If  \np{ln\_loglayer} = .true., $C_D$ is no 
     999longer constant but is related to the thickness of the last wet layer in each column by: 
     1000 
     1001\begin{equation} 
     1002C_D = \left ( {\kappa \over {\rm log}\left ( 0.5e_{3t}/rn\_bfrz0 \right ) } \right )^2 
     1003\end{equation} 
     1004 
     1005\noindent where $\kappa$ is the von-Karman constant and \np{rn\_bfrz0} is a roughness 
     1006length provided via the namelist. 
     1007 
     1008For stability, the drag coefficient is bounded such that it is kept greater or equal to 
     1009the base \np{rn\_bfri2} value and it is not allowed to exceed the value of an additional 
     1010namelist parameter: \np{rn\_bfri2\_max}, i.e.: 
     1011 
     1012\begin{equation} 
     1013rn\_bfri2 \leq C_D \leq rn\_bfri2\_max 
     1014\end{equation} 
     1015 
     1016\noindent Note also that a log-layer enhancement can also be applied to the top boundary 
     1017friction if under ice-shelf cavities are in use (\np{ln\_isfcav}=.true.).  In this case, the 
     1018relevant namelist parameters are \np{rn\_tfrz0}, \np{rn\_tfri2} 
     1019and \np{rn\_tfri2\_max}. 
    9861020 
    9871021% ------------------------------------------------------------------------------------------------------------- 
     
    10971131baroclinic and barotropic components which is appropriate when using either the 
    10981132explicit or filtered surface pressure gradient algorithms (\key{dynspg\_exp} or  
    1099 {\key{dynspg\_flt}). Extra attention is required, however, when using  
     1133\key{dynspg\_flt}). Extra attention is required, however, when using  
    11001134split-explicit time stepping (\key{dynspg\_ts}). In this case the free surface  
    11011135equation is solved with a small time step \np{rn\_rdt}/\np{nn\_baro}, while the three  
     
    12121246%>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    12131247\begin{figure}[!t]   \begin{center} 
    1214 \includegraphics[width=0.90\textwidth]{./TexFiles/Figures/Fig_ZDF_M2_K1_tmx.pdf} 
     1248\includegraphics[width=0.90\textwidth]{Fig_ZDF_M2_K1_tmx} 
    12151249\caption{  \label{Fig_ZDF_M2_K1_tmx}  
    12161250(a) M2 and (b) K1 internal wave drag energy from \citet{Carrere_Lyard_GRL03} ($W/m^2$). } 
     
    12671301 
    12681302% ================================================================ 
     1303% Internal wave-driven mixing 
     1304% ================================================================ 
     1305\section{Internal wave-driven mixing (\key{zdftmx\_new})} 
     1306\label{ZDF_tmx_new} 
     1307 
     1308%--------------------------------------------namzdf_tmx_new------------------------------------------ 
     1309\namdisplay{namzdf_tmx_new} 
     1310%-------------------------------------------------------------------------------------------------------------- 
     1311 
     1312The parameterization of mixing induced by breaking internal waves is a generalization  
     1313of the approach originally proposed by \citet{St_Laurent_al_GRL02}.  
     1314A three-dimensional field of internal wave energy dissipation $\epsilon(x,y,z)$ is first constructed,  
     1315and the resulting diffusivity is obtained as  
     1316\begin{equation} \label{Eq_Kwave} 
     1317A^{vT}_{wave} =  R_f \,\frac{ \epsilon }{ \rho \, N^2 } 
     1318\end{equation} 
     1319where $R_f$ is the mixing efficiency and $\epsilon$ is a specified three dimensional distribution  
     1320of the energy available for mixing. If the \np{ln\_mevar} namelist parameter is set to false,  
     1321the mixing efficiency is taken as constant and equal to 1/6 \citep{Osborn_JPO80}.  
     1322In the opposite (recommended) case, $R_f$ is instead a function of the turbulence intensity parameter  
     1323$Re_b = \frac{ \epsilon}{\nu \, N^2}$, with $\nu$ the molecular viscosity of seawater,  
     1324following the model of \cite{Bouffard_Boegman_DAO2013}  
     1325and the implementation of \cite{de_lavergne_JPO2016_efficiency}. 
     1326Note that $A^{vT}_{wave}$ is bounded by $10^{-2}\,m^2/s$, a limit that is often reached when the mixing efficiency is constant. 
     1327 
     1328In addition to the mixing efficiency, the ratio of salt to heat diffusivities can chosen to vary  
     1329as a function of $Re_b$ by setting the \np{ln\_tsdiff} parameter to true, a recommended choice).  
     1330This parameterization of differential mixing, due to \cite{Jackson_Rehmann_JPO2014},  
     1331is implemented as in \cite{de_lavergne_JPO2016_efficiency}. 
     1332 
     1333The three-dimensional distribution of the energy available for mixing, $\epsilon(i,j,k)$, is constructed  
     1334from three static maps of column-integrated internal wave energy dissipation, $E_{cri}(i,j)$,  
     1335$E_{pyc}(i,j)$, and $E_{bot}(i,j)$, combined to three corresponding vertical structures  
     1336(de Lavergne et al., in prep): 
     1337\begin{align*} 
     1338F_{cri}(i,j,k) &\propto e^{-h_{ab} / h_{cri} }\\ 
     1339F_{pyc}(i,j,k) &\propto N^{n\_p}\\ 
     1340F_{bot}(i,j,k) &\propto N^2 \, e^{- h_{wkb} / h_{bot} } 
     1341\end{align*}  
     1342In the above formula, $h_{ab}$ denotes the height above bottom,  
     1343$h_{wkb}$ denotes the WKB-stretched height above bottom, defined by 
     1344\begin{equation*} 
     1345h_{wkb} = H \, \frac{ \int_{-H}^{z} N \, dz' } { \int_{-H}^{\eta} N \, dz'  } \; , 
     1346\end{equation*} 
     1347The $n_p$ parameter (given by \np{nn\_zpyc} in \ngn{namzdf\_tmx\_new} namelist)  controls the stratification-dependence of the pycnocline-intensified dissipation.  
     1348It can take values of 1 (recommended) or 2. 
     1349Finally, the vertical structures $F_{cri}$ and $F_{bot}$ require the specification of  
     1350the decay scales $h_{cri}(i,j)$ and $h_{bot}(i,j)$, which are defined by two additional input maps.  
     1351$h_{cri}$ is related to the large-scale topography of the ocean (etopo2)  
     1352and $h_{bot}$ is a function of the energy flux $E_{bot}$, the characteristic horizontal scale of  
     1353the abyssal hill topography \citep{Goff_JGR2010} and the latitude. 
     1354 
     1355% ================================================================ 
     1356 
     1357 
     1358 
     1359\end{document} 
  • branches/2016/dev_NOC_2016/DOC/TexFiles/Chapters/Introduction.tex

    r6289 r7341  
     1\documentclass[NEMO_book]{subfiles} 
     2\begin{document} 
    13 
    24% ================================================================ 
     
    261263\begin{enumerate} 
    262264\item ... ;  
    263 \end{enumerate} 
    264  
    265  
     265 
     266 
     267\end{enumerate} 
     268 
     269 
     270\end{document} 
  • branches/2016/dev_NOC_2016/NEMOGCM/ARCH/CMCC/arch-ifort_athena_xios.fcm

    r6140 r7341  
    3434 
    3535# required modules 
    36 # module load  INTEL/intel_xe_2013 NETCDF/netcdf-4.3_parallel_shared NETCDF/parallel-netcdf-1.3.1 HDF5/hdf5-1.8.11_parallel_shared 
     36# module load  INTEL/intel_xe_2013 NETCDF/netcdf-4.3_parallel NETCDF/parallel-netcdf-1.7.0 HDF5/hdf5-1.8.11_parallel 
    3737 
    38 # Environment variables set by user. Others should automatically define when loading modules. 
     38# NETCDF and PNETCDF should be set automatically when loading modules. 
     39# The following environment variables must be set by the user. 
    3940#export XIOS=/users/home/models/nemo/xios 
    40 #export HDF5=/users/home/opt/hdf5/hdf5-1.8.11_parallel_shared 
    41 #export NETCDF=/users/home/opt/netcdf/netcdf-4.3_parallel_shared 
     41#export HDF5=/users/home/opt/hdf5/hdf5-1.8.11_parallel 
    4242 
    43 %NCDF_INC            -I${NETCDF}/include  
    44 %NCDF_LIB            -L${NETCDF}/lib -lnetcdff -lnetcdf 
     43%NCDF_INC            -I${NETCDF}/include -I${PNETCDF}/include 
     44%NCDF_LIB            -L${NETCDF}/lib -lnetcdff -lnetcdf -L${PNETCDF}/lib -lpnetcdf 
    4545%HDF5_INC            -I${HDF5}/include 
    4646%HDF5_LIB            -L${HDF5}/lib -lhdf5_hl -lhdf5 
     
    4949%CPP                 cpp 
    5050%FC                  mpiifort 
    51 %FCFLAGS             -r8 -O3 -xHost -fp-model source -traceback ${CFLAGS}  
     51%FCFLAGS             -r8 -O3 -xHost -fp-model source -traceback 
    5252%FFLAGS              %FCFLAGS 
    5353%LD                  mpiifort 
    5454%FPPFLAGS            -P -C -traditional 
    55 %LDFLAGS             -lstdc++ -lz -lgpfs -lcurl  ${LDFLAGS} 
     55%LDFLAGS             -lstdc++ -lz -lgpfs -lcurl 
    5656%AR                  ar  
    5757%ARFLAGS             -r 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/AMM12/EXP00/namelist_cfg

    r6140 r7341  
    257257&nameos        !   ocean physical parameters 
    258258!----------------------------------------------------------------------- 
     259   ln_teos10   = .true.         !  = Use TEOS-10 equation of state 
    259260/ 
    260261!----------------------------------------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/C1D_PAPA/EXP00/namelist_cfg

    r6140 r7341  
    205205&nameos        !   ocean physical parameters 
    206206!----------------------------------------------------------------------- 
    207    nn_eos      =  0      !  type of equation of state and Brunt-Vaisala frequency 
    208                                  !  =-1, TEOS-10 
    209                                  !  = 0, EOS-80 
    210                                  !  = 1, S-EOS   (simplified eos) 
    211    ln_useCT    = .false. ! use of Conservative Temp. ==> surface CT converted in Pot. Temp. in sbcssm 
     207   ln_eos80    = .true.         !  = Use EOS80 equation of state 
    212208/ 
    213209!----------------------------------------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/GYRE/EXP00/namelist_cfg

    r6140 r7341  
    187187&nameos        !   ocean physical parameters 
    188188!----------------------------------------------------------------------- 
    189    nn_eos      =  0       !  type of equation of state and Brunt-Vaisala frequency 
    190                                  !  =-1, TEOS-10  
    191                                  !  = 0, EOS-80  
    192                                  !  = 1, S-EOS   (simplified eos) 
    193    ln_useCT    = .false.  ! use of Conservative Temp. ==> surface CT converted in Pot. Temp. in sbcssm 
     189   ln_eos80    = .true.         !  = Use EOS80 equation of state 
    194190   !                             ! 
    195191   !                      ! S-EOS coefficients : 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/GYRE_BFM/EXP00/namelist_cfg

    r6140 r7341  
    190190&nameos        !   ocean physical parameters 
    191191!----------------------------------------------------------------------- 
    192    nn_eos      =  0       !  type of equation of state and Brunt-Vaisala frequency 
    193                                  !  =-1, TEOS-10 
    194                                  !  = 0, EOS-80 
    195                                  !  = 1, S-EOS   (simplified eos) 
    196    ln_useCT    = .false.  ! use of Conservative Temp. ==> surface CT converted in Pot. Temp. in sbcssm 
     192   ln_eos80    = .true.         !  = Use EOS80 equation of state 
    197193   !                             ! 
    198194   !                      ! S-EOS coefficients : 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_cfg

    r6140 r7341  
    109109&nameos        !   ocean physical parameters 
    110110!----------------------------------------------------------------------- 
    111    nn_eos      =  0       !  type of equation of state and Brunt-Vaisala frequency 
    112                                  !  =-1, TEOS-10 
    113                                  !  = 0, EOS-80 
    114                                  !  = 1, S-EOS   (simplified eos) 
    115    ln_useCT    = .false.  ! use of Conservative Temp. ==> surface CT converted in Pot. Temp. in sbcssm 
     111   ln_eos80    = .true.         !  = Use EOS80 equation of state 
    116112   !                             ! 
    117113   !                      ! S-EOS coefficients : 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/GYRE_XIOS/EXP00/namelist_cfg

    r6140 r7341  
    183183&nameos        !   ocean physical parameters 
    184184!----------------------------------------------------------------------- 
    185    nn_eos      =   0       !  type of equation of state and Brunt-Vaisala frequency 
     185   ln_eos80    = .true.         !  = Use EOS80 equation of state 
    186186/ 
    187187!----------------------------------------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/1_namelist_cfg

    r6140 r7341  
    132132&nameos        !   ocean physical parameters 
    133133!----------------------------------------------------------------------- 
     134   ln_teos10    = .true.         !  = Use TEOS-10 equation of state 
    134135/ 
    135136!----------------------------------------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist_cfg

    r6140 r7341  
    110110&nameos        !   ocean physical parameters 
    111111!----------------------------------------------------------------------- 
     112   ln_teos10    = .true.         !  = Use TEOS-10 equation of state 
    112113/ 
    113114!----------------------------------------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/namelist_cfg

    r6140 r7341  
    109109&nameos        !   ocean physical parameters 
    110110!----------------------------------------------------------------------- 
     111   ln_teos10    = .true.         !  = Use TEOS-10 equation of state 
    111112/ 
    112113!----------------------------------------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/ORCA2_LIM_CFC_C14b/EXP00/namelist_cfg

    r6140 r7341  
    169169&nameos        !   ocean physical parameters 
    170170!----------------------------------------------------------------------- 
     171   ln_teos10    = .true.         !  = Use TEOS-10 equation of state 
    171172/ 
    172173!----------------------------------------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_cfg

    r6140 r7341  
    106106&nameos        !   ocean physical parameters 
    107107!----------------------------------------------------------------------- 
     108   ln_teos10    = .true.         !  = Use TEOS-10 equation of state 
    108109/ 
    109110!----------------------------------------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_cfg

    r6140 r7341  
    8585&nameos        !   ocean physical parameters 
    8686!----------------------------------------------------------------------- 
     87   ln_teos10    = .true.         !  = Use TEOS-10 equation of state 
    8788/ 
    8889!---------------------------------------------------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/ORCA2_SAS_LIM/EXP00/namelist_cfg

    r6140 r7341  
    8787&nameos        !   ocean physical parameters 
    8888!----------------------------------------------------------------------- 
     89   ln_teos10    = .true.         !  = Use TEOS-10 equation of state 
    8990/ 
    9091!----------------------------------------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/SHARED/field_def.xml

    r7339 r7341  
    183183         <field id="empmr"        long_name="Net Upward Water Flux"                standard_name="water_flux_out_of_sea_ice_and_sea_water"                              unit="kg/m2/s"   /> 
    184184         <field id="empbmr"       long_name="Net Upward Water Flux at pre. tstep"  standard_name="water_flux_out_of_sea_ice_and_sea_water"                              unit="kg/m2/s"   /> 
     185         <field id="emp_oce"      long_name="Evap minus Precip over ocean"         standard_name="evap_minus_precip_over_sea_water"                                     unit="kg/m2/s"   /> 
     186         <field id="emp_ice"      long_name="Evap minus Precip over ice"           standard_name="evap_minus_precip_over_sea_ice"                                       unit="kg/m2/s"   /> 
    185187         <field id="saltflx"      long_name="Downward salt flux"                                                                                                        unit="1e-3/m2/s" /> 
    186188         <field id="fmmflx"       long_name="Water flux due to freezing/melting"                                                                                        unit="kg/m2/s"   /> 
     
    275277         <field id="emp_x_sst"    long_name="Concentration/Dilution term on SST"                                                                                              unit="kg*degC/m2/s" /> 
    276278         <field id="emp_x_sss"    long_name="Concentration/Dilution term on SSS"                                                                                              unit="kg*1e-3/m2/s" />         
     279         <field id="rnf_x_sst"    long_name="Runoff term on SST"                                                                                                              unit="kg*degC/m2/s" /> 
     280         <field id="rnf_x_sss"    long_name="Runoff term on SSS"                                                                                                              unit="kg*1e-3/m2/s" /> 
    277281        
    278282         <field id="iceconc"      long_name="ice concentration"                                            standard_name="sea_ice_area_fraction"                              unit="%"            /> 
     
    289293         <field id="micesalt"     long_name="Mean ice salinity"                                                                                                               unit="1e-3"         /> 
    290294         <field id="miceage"      long_name="Mean ice age"                                                                                                                    unit="years"        /> 
     295         <field id="alb_ice"      long_name="Mean albedo over sea ice"                                                                                                        unit=""             /> 
     296         <field id="albedo"       long_name="Mean albedo over sea ice and ocean"                                                                                              unit=""             /> 
    291297 
    292298         <field id="iceage_cat"   long_name="Ice age for categories"                                       unit="days"   axis_ref="ncatice" /> 
     
    326332         <field id="sfxsni"       long_name="salt flux from snow-ice formation"                            unit="1e-3*kg/m2/day" /> 
    327333         <field id="sfxopw"       long_name="salt flux from open water ice formation"                      unit="1e-3*kg/m2/day" /> 
     334         <field id="sfxsub"       long_name="salt flux from sublimation"                                   unit="1e-3*kg/m2/day" /> 
    328335         <field id="sfx"          long_name="salt flux total"                                              unit="1e-3*kg/m2/day" /> 
    329336 
     
    339346         <field id="vfxsub"       long_name="snw sublimation"                                              unit="m/day"   /> 
    340347         <field id="vfxspr"       long_name="snw precipitation on ice"                                     unit="m/day"   /> 
     348         <field id="vfxthin"      long_name="daily thermo ice prod. for thin ice(<20cm) + open water"      unit="m/day"   /> 
    341349 
    342350         <field id="afxtot"       long_name="area tendency (total)"                                        unit="day-1"   /> 
     
    563571         <field id="ibgsfxbom"    long_name="global mean salt flux (thermo)"                         unit="1e-3*m/day" /> 
    564572         <field id="ibgsfxsum"    long_name="global mean salt flux (thermo)"                         unit="1e-3*m/day" /> 
     573         <field id="ibgsfxsub"    long_name="global mean salt flux (thermo)"                         unit="1e-3*m/day" /> 
    565574 
    566575         <field id="ibghfxdhc"    long_name="Heat content variation in snow and ice"                 unit="W"          /> 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/SHARED/namelist_ice_lim3_ref

    r5429 r7341  
    2121   cn_icerst_outdir = "."          !  directory in which to write output ice restarts 
    2222   ln_limdyn     = .true.          !  ice dynamics (T) or thermodynamics only (F) 
    23    rn_amax       = 0.999           !  maximum tolerated ice concentration  
     23   rn_amax_n     = 0.999           !  maximum tolerated ice concentration NH 
     24   rn_amax_s     = 0.999           !  maximum tolerated ice concentration SH 
    2425   ln_limdiahsb  = .false.         !  check the heat and salt budgets (T) or not (F) 
    2526   ln_limdiaout  = .true.          !  output the heat and salt budgets (T) or not (F) 
     
    8586   rn_hnewice  = 0.1               !  thickness for new ice formation in open water (m) 
    8687   ln_frazil   = .false.           !  use frazil ice collection thickness as a function of wind (T) or not (F) 
    87    rn_maxfrazb = 0.0               !  maximum fraction of frazil ice collecting at the ice base 
     88   rn_maxfrazb = 1.0               !  maximum fraction of frazil ice collecting at the ice base 
    8889   rn_vfrazb   = 0.417             !  thresold drift speed for frazil ice collecting at the ice bottom (m/s) 
    8990   rn_Cfrazb   = 5.0               !  squeezing coefficient for frazil ice collecting at the ice bottom 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/SHARED/namelist_pisces_ref

    r5385 r7341  
    6666   qdfelim    =  7.E-6    ! Optimal quota of diatoms 
    6767   caco3r     =  0.3      ! mean rain ratio 
     68   oxymin    =  1.E-6     ! Half-saturation constant for anoxia 
    6869/ 
    6970!''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
     
    162163   xsiremlab =  0.03      ! fast remineralization rate of Si 
    163164   xsilab    =  0.5       ! Fraction of labile biogenic silica 
    164    oxymin    =  1.E-6     ! Half-saturation constant for anoxia 
    165165/ 
    166166!''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/SHARED/namelist_ref

    r6386 r7341  
    33!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    44!! NEMO/OPA  :  1 - run manager      (namrun) 
    5 !! namelists    2 - Domain           (namcfg, namzgr, namzgr_sco, namdom, namtsd) 
     5!! namelists    2 - Domain           (namcfg, namzgr, namzgr_sco, namdom, namtsd, namcrs, namc1d, namc1d_uvd) 
    66!!              3 - Surface boundary (namsbc, namsbc_ana, namsbc_flx, namsbc_clio, namsbc_core, namsbc_sas 
    77!!                                    namsbc_cpl, namtra_qsr, namsbc_rnf, 
     
    5959!!====================================================================== 
    6060!!   namcfg       parameters of the configuration 
    61 !!   namzgr       vertical coordinate 
     61!!   namzgr       vertical coordinate                                   (default: NO selection) 
    6262!!   namzgr_sco   s-coordinate or hybrid z-s-coordinate 
    6363!!   namdom       space and time domain (bathymetry, mesh, timestep) 
     64!!   namwad       Wetting and drying                                    (default F) 
     65!!   namtsd       data: temperature & salinity 
    6466!!   namcrs       coarsened grid (for outputs and/or TOP)               ("key_crs") 
    6567!!   namc1d       1D configuration options                              ("key_c1d") 
     68!!   namc1d_dyndmp 1D newtonian damping applied on currents             ("key_c1d") 
    6669!!   namc1d_uvd   1D data (currents)                                    ("key_c1d") 
    67 !!   namc1d_dyndmp 1D newtonian damping applied on currents             ("key_c1d") 
    68 !!   namtsd       data: temperature & salinity 
    6970!!====================================================================== 
    7071! 
     
    101102/ 
    102103!----------------------------------------------------------------------- 
    103 &namzgr_sco    !   s-coordinate or hybrid z-s-coordinate 
     104&namzgr_sco    !   s-coordinate or hybrid z-s-coordinate                (default F) 
    104105!----------------------------------------------------------------------- 
    105106   ln_s_sh94   = .false.    !  Song & Haidvogel 1994 hybrid S-sigma   (T)| 
     
    165166/ 
    166167!----------------------------------------------------------------------- 
     168&namwad        !   Wetting and drying                                   (default F) 
     169!----------------------------------------------------------------------- 
     170   ln_wd       = .false.   !  T/F activation of wetting and drying 
     171   rn_wdmin1   =  0.1      !  Minimum wet depth on dried cells 
     172   rn_wdmin2   =  0.01     !  Tolerance of min wet depth on dried cells 
     173   rn_wdld     =  20.0     !  Land elevation below which wetting/drying is allowed 
     174   nn_wdit     =  10       !  Max iterations for W/D limiter 
     175/ 
     176!----------------------------------------------------------------------- 
     177&namtsd        !   data : Temperature  & Salinity 
     178!----------------------------------------------------------------------- 
     179!              !  file name                 ! frequency (hours) ! variable ! time interp.!  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
     180!              !                            !  (if <0  months)  !   name   !  (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      ! 
     181   sn_tem = 'data_1m_potential_temperature_nomask',     -1      ,'votemper',   .true.    , .true. , 'yearly'  ,    ''    ,    ''    ,    '' 
     182   sn_sal = 'data_1m_salinity_nomask'             ,     -1      ,'vosaline',   .true.    , .true. , 'yearly'  ,    ''    ,    ''    ,    '' 
     183   ! 
     184   cn_dir      = './'      !  root directory for the location of the runoff files 
     185   ln_tsd_init = .true.    !  Initialisation of ocean T & S with T & S input data (T) or not (F) 
     186   ln_tsd_tradmp = .true.  !  damping of ocean T & S toward T & S input data (T) or not (F) 
     187/ 
     188!----------------------------------------------------------------------- 
    167189&namcrs        !   coarsened grid (for outputs and/or TOP)              ("key_crs") 
    168190!----------------------------------------------------------------------- 
     
    202224   ln_uvd_init   = .false. !  Initialisation of ocean U & V with U & V input data (T) or not (F) 
    203225   ln_uvd_dyndmp = .false. !  damping of ocean U & V toward U & V input data (T) or not (F) 
    204 / 
    205 !----------------------------------------------------------------------- 
    206 &namtsd    !   data : Temperature  & Salinity 
    207 !----------------------------------------------------------------------- 
    208 !          !  file name                            ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
    209 !          !                                       !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      ! 
    210    sn_tem  = 'data_1m_potential_temperature_nomask',         -1        ,'votemper' ,    .true.    , .true. , 'yearly'   , ''       ,   ''    ,    '' 
    211    sn_sal  = 'data_1m_salinity_nomask'             ,         -1        ,'vosaline' ,    .true.    , .true. , 'yearly'   , ''       ,   ''    ,    '' 
    212    ! 
    213    cn_dir        = './'     !  root directory for the location of the runoff files 
    214    ln_tsd_init   = .true.   !  Initialisation of ocean T & S with T &S input data (T) or not (F) 
    215    ln_tsd_tradmp = .true.   !  damping of ocean T & S toward T &S input data (T) or not (F) 
    216226/ 
    217227 
     
    278288   ln_apr_dyn  = .false.   !  Patm gradient added in ocean & ice Eqs.   (T => fill namsbc_apr ) 
    279289   ln_isf      = .false.   !  ice shelf                                 (T   => fill namsbc_isf) 
    280    ln_wave = .false.       !  coupling with surface wave                (T => fill namsbc_wave) 
    281    nn_lsm  = 0             !  =0 land/sea mask for input fields is not applied (keep empty land/sea mask filename field) , 
     290   ln_wave     = .false.   !  coupling with surface wave                (T => fill namsbc_wave) 
     291   nn_lsm      = 0         !  =0 land/sea mask for input fields is not applied (keep empty land/sea mask filename field) , 
    282292                           !  =1:n number of iterations of land/sea mask application for input fields (fill land/sea mask filename field) 
    283293/ 
     
    382392   sn_rcv_co2    =   'coupled'              ,    'no'    ,     ''      ,         ''          ,   '' 
    383393! 
    384    nn_cplmodel   =     1     !  Maximum number of models to/from which NEMO is potentialy sending/receiving data 
    385    ln_usecplmask = .false.   !  use a coupling mask file to merge data received from several models 
    386                              !   -> file cplmask.nc with the float variable called cplmask (jpi,jpj,nn_cplmodel) 
     394   nn_cplmodel   =     1   !  Maximum number of models to/from which NEMO is potentialy sending/receiving data 
     395   ln_usecplmask = .false. !  use a coupling mask file to merge data received from several models 
     396   !                       !   -> file cplmask.nc with the float variable called cplmask (jpi,jpj,nn_cplmodel) 
    387397/ 
    388398!----------------------------------------------------------------------- 
    389399&namsbc_sas    !   analytical surface boundary condition 
    390400!----------------------------------------------------------------------- 
    391 !              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
    392 !              !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      ! 
    393    sn_usp      = 'sas_grid_U' ,    120           , 'vozocrtx' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , '' 
    394    sn_vsp      = 'sas_grid_V' ,    120           , 'vomecrty' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , '' 
    395    sn_tem      = 'sas_grid_T' ,    120           , 'sosstsst' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , '' 
    396    sn_sal      = 'sas_grid_T' ,    120           , 'sosaline' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , '' 
    397    sn_ssh      = 'sas_grid_T' ,    120           , 'sossheig' ,  .true.    , .true. ,   'yearly'  , ''       , ''             , '' 
    398    sn_e3t      = 'sas_grid_T' ,    120           , 'e3t_m'    ,  .true.    , .true. ,   'yearly'  , ''       , ''             , '' 
    399    sn_frq      = 'sas_grid_T' ,    120           , 'frq_m'    ,  .true.    , .true. ,   'yearly'  , ''       , ''             , '' 
     401!              !  file name  ! frequency (hours) ! variable  ! time interp.!  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
     402!              !             !  (if <0  months)  !   name    !  (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      ! 
     403   sn_usp      = 'sas_grid_U',     120           , 'vozocrtx',   .true.    , .true. , 'yearly'  ,    ''    ,    ''    ,    '' 
     404   sn_vsp      = 'sas_grid_V',     120           , 'vomecrty',   .true.    , .true. , 'yearly'  ,    ''    ,    ''    ,    '' 
     405   sn_tem      = 'sas_grid_T',     120           , 'sosstsst',   .true.    , .true. , 'yearly'  ,    ''    ,    ''    ,    '' 
     406   sn_sal      = 'sas_grid_T',     120           , 'sosaline',   .true.    , .true. , 'yearly'  ,    ''    ,    ''    ,    '' 
     407   sn_ssh      = 'sas_grid_T',     120           , 'sossheig',   .true.    , .true. , 'yearly'  ,    ''    ,    ''    ,    '' 
     408   sn_e3t      = 'sas_grid_T',     120           , 'e3t_m'   ,   .true.    , .true. , 'yearly'  ,    ''    ,    ''    ,    '' 
     409   sn_frq      = 'sas_grid_T',     120           , 'frq_m'   ,   .true.    , .true. , 'yearly'  ,    ''    ,    ''    ,    '' 
    400410 
    401411   ln_3d_uve   = .true.    !  specify whether we are supplying a 3D u,v and e3 field 
    402    ln_read_frq = .false.    !  specify whether we must read frq or not 
     412   ln_read_frq = .false.   !  specify whether we must read frq or not 
    403413   cn_dir      = './'      !  root directory for the location of the bulk files are 
    404414/ 
     
    431441   sn_dep_rnf  = 'runoffs'            ,         0         , 'rodepth' ,   .false.    , .true. , 'yearly'  , ''       , ''       , '' 
    432442 
    433    cn_dir       = './'      !  root directory for the location of the runoff files 
    434    ln_rnf_mouth = .true.    !  specific treatment at rivers mouths 
    435    rn_hrnf      =  15.e0    !  depth over which enhanced vertical mixing is used 
    436    rn_avt_rnf   =   1.e-3   !  value of the additional vertical mixing coef. [m2/s] 
    437    rn_rfact     =   1.e0    !  multiplicative factor for runoff 
    438    ln_rnf_depth = .false.   !  read in depth information for runoff 
    439    ln_rnf_tem   = .false.   !  read in temperature information for runoff 
    440    ln_rnf_sal   = .false.   !  read in salinity information for runoff 
    441    ln_rnf_depth_ini = .false.  ! compute depth at initialisation from runoff file 
    442    rn_rnf_max   = 5.735e-4  !  max value of the runoff climatologie over global domain ( ln_rnf_depth_ini = .true ) 
    443    rn_dep_max   = 150.      !  depth over which runoffs is spread ( ln_rnf_depth_ini = .true ) 
    444    nn_rnf_depth_file = 0    !  create (=1) a runoff depth file or not (=0) 
     443   cn_dir      = './'      !  root directory for the location of the runoff files 
     444   ln_rnf_mouth= .true.    !  specific treatment at rivers mouths 
     445      rn_hrnf     =  15.e0    !  depth over which enhanced vertical mixing is used    (ln_rnf_mouth=T) 
     446      rn_avt_rnf  =   1.e-3   !  value of the additional vertical mixing coef. [m2/s] (ln_rnf_mouth=T) 
     447   rn_rfact    =   1.e0    !  multiplicative factor for runoff 
     448   ln_rnf_depth= .false.   !  read in depth information for runoff 
     449   ln_rnf_tem  = .false.   !  read in temperature information for runoff 
     450   ln_rnf_sal  = .false.   !  read in salinity information for runoff 
     451   ln_rnf_depth_ini = .false. ! compute depth at initialisation from runoff file 
     452      rn_rnf_max  = 5.735e-4  !  max value of the runoff climatologie over global domain ( ln_rnf_depth_ini = .true ) 
     453      rn_dep_max  = 150.      !  depth over which runoffs is spread ( ln_rnf_depth_ini = .true ) 
     454      nn_rnf_depth_file = 0   !  create (=1) a runoff depth file or not (=0) 
    445455/ 
    446456!----------------------------------------------------------------------- 
    447457&namsbc_isf    !  Top boundary layer (ISF)                              (nn_isf >0) 
    448458!----------------------------------------------------------------------- 
    449 !              ! file name ! frequency (hours) ! variable ! time interp. !  clim   ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
    450 !              !           !  (if <0  months)  !   name   !  (logical)   !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      ! 
     459!              ! file name ! frequency (hours) ! variable ! time interp.!  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
     460!              !           !  (if <0  months)  !   name   !  (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      ! 
    451461! nn_isf == 4 
    452    sn_fwfisf   = 'rnfisf'  ,         -12       ,'sowflisf',   .false.    , .true.  , 'yearly'  ,  ''      ,   ''     , '' 
     462   sn_fwfisf   = 'rnfisf'  ,         -12       ,'sowflisf',   .false.   , .true. , 'yearly'  ,    ''    ,   ''     ,    '' 
    453463! nn_isf == 3 
    454    sn_rnfisf   = 'rnfisf'  ,         -12       ,'sofwfisf',   .false.    , .true.  , 'yearly'  ,  ''      ,   ''     , '' 
     464   sn_rnfisf   = 'rnfisf'  ,         -12       ,'sofwfisf',   .false.   , .true. , 'yearly'  ,    ''    ,   ''     ,    '' 
    455465! nn_isf == 2 and 3 
    456    sn_depmax_isf='rnfisf'  ,         -12       ,'sozisfmax',  .false.    , .true.  , 'yearly'  ,  ''      ,   ''     , '' 
    457    sn_depmin_isf='rnfisf'  ,         -12       ,'sozisfmin',  .false.    , .true.  , 'yearly'  ,  ''      ,   ''     , '' 
     466   sn_depmax_isf='rnfisf'  ,         -12       ,'sozisfmax',  .false.   , .true. , 'yearly'  ,    ''    ,   ''     ,    '' 
     467   sn_depmin_isf='rnfisf'  ,         -12       ,'sozisfmin',  .false.   , .true. , 'yearly'  ,    ''    ,   ''     ,    '' 
    458468! nn_isf == 2 
    459    sn_Leff_isf = 'rnfisf'  ,         -12       ,'Leff'    ,   .false.    , .true.  , 'yearly'  ,  ''      ,   ''     , '' 
     469   sn_Leff_isf = 'rnfisf'  ,         -12       ,'Leff'    ,   .false.   , .true. , 'yearly'  ,    ''    ,   ''     ,    '' 
    460470! 
    461471! for all case 
     
    465475                           !  option 1 and 4 need ln_isfcav = .true. (domzgr) 
    466476! only for nn_isf = 1 or 2 
    467    rn_gammat0  = 1.e-4    ! gammat coefficient used in blk formula 
    468    rn_gammas0  = 1.e-4    ! gammas coefficient used in blk formula 
     477   rn_gammat0  = 1.e-4     ! gammat coefficient used in blk formula 
     478   rn_gammas0  = 1.e-4     ! gammas coefficient used in blk formula 
    469479! only for nn_isf = 1 or 4 
    470480   rn_hisf_tbl =  30.      ! thickness of the top boundary layer    (Losh et al. 2008) 
    471                           ! 0 => thickness of the tbl = thickness of the first wet cell 
     481   !                       ! 0 => thickness of the tbl = thickness of the first wet cell 
    472482! only for nn_isf = 1 
    473    nn_isfblk   = 1        ! 1 ISOMIP  like: 2 equations formulation (Hunter et al., 2006) 
    474                           ! 2 ISOMIP+ like: 3 equations formulation (Asay-Davis et al., 2015) 
    475    nn_gammablk = 1        ! 0 = cst Gammat (= gammat/s) 
    476                           ! 1 = velocity dependend Gamma (u* * gammat/s)  (Jenkins et al. 2010) 
    477                           ! 2 = velocity and stability dependent Gamma    (Holland et al. 1999) 
     483   nn_isfblk   = 1         ! 1 ISOMIP  like: 2 equations formulation (Hunter et al., 2006) 
     484   !                       ! 2 ISOMIP+ like: 3 equations formulation (Asay-Davis et al., 2015) 
     485   nn_gammablk = 1         ! 0 = cst Gammat (= gammat/s) 
     486   !                       ! 1 = velocity dependend Gamma (u* * gammat/s)  (Jenkins et al. 2010) 
     487   !                       ! 2 = velocity and stability dependent Gamma    (Holland et al. 1999) 
    478488/ 
    479489!----------------------------------------------------------------------- 
    480490&namsbc_iscpl  !   land ice / ocean coupling option                      
    481491!----------------------------------------------------------------------- 
    482    nn_drown  = 10       ! number of iteration of the extrapolation loop (fill the new wet cells) 
    483    ln_hsb    = .false.  ! activate conservation module (conservation exact after a time of rn_fiscpl) 
    484    nn_fiscpl = 43800    ! (number of time step) conservation period (maybe should be fix to the coupling frequencey of restart frequency) 
     492   nn_drown    = 10        ! number of iteration of the extrapolation loop (fill the new wet cells) 
     493   ln_hsb      = .false.   ! activate conservation module (conservation exact after a time of rn_fiscpl) 
     494   nn_fiscpl   = 43800     ! (number of time step) conservation period (maybe should be fix to the coupling frequencey of restart frequency) 
    485495/ 
    486496!----------------------------------------------------------------------- 
    487497&namsbc_apr    !   Atmospheric pressure used as ocean forcing or in bulk 
    488498!----------------------------------------------------------------------- 
    489 !              !  file name ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
    490 !              !            !  (if <0  months)  !   name    !  (logical)   !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      ! 
    491    sn_apr      = 'patm'     ,         -1        ,'somslpre',    .true.     , .true. , 'yearly'  ,  ''      ,   ''     , '' 
    492  
    493    cn_dir      = './'       !  root directory for the location of the bulk files 
    494    rn_pref     = 101000.    !  reference atmospheric pressure   [N/m2]/ 
    495    ln_ref_apr  = .false.    !  ref. pressure: global mean Patm (T) or a constant (F) 
    496    ln_apr_obc  = .false.    !  inverse barometer added to OBC ssh data 
     499!              ! file name ! frequency (hours) ! variable ! time interp.!  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
     500!              !           !  (if <0  months)  !   name   !  (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      ! 
     501   sn_apr      = 'patm'    ,         -1        ,'somslpre',   .true.    , .true. , 'yearly'  ,    ''    ,    ''    ,      '' 
     502 
     503   cn_dir      = './'      !  root directory for the location of the bulk files 
     504   rn_pref     = 101000.   !  reference atmospheric pressure   [N/m2]/ 
     505   ln_ref_apr  = .false.   !  ref. pressure: global mean Patm (T) or a constant (F) 
     506   ln_apr_obc  = .false.   !  inverse barometer added to OBC ssh data 
    497507/ 
    498508!----------------------------------------------------------------------- 
    499509&namsbc_ssr    !   surface boundary condition : sea surface restoring   (ln_ssr=T) 
    500510!----------------------------------------------------------------------- 
    501 !              !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
    502 !              !             !  (if <0  months)  !   name    !   (logical) !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      ! 
    503    sn_sst      = 'sst_data'  ,        24         ,  'sst'    ,    .false.   , .false., 'yearly'  , ''       , ''       , '' 
    504    sn_sss      = 'sss_data'  ,        -1         ,  'sss'    ,    .true.    , .true. , 'yearly'  , ''       , ''       , '' 
     511!              ! file name ! frequency (hours) ! variable ! time interp.!  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
     512!              !           !  (if <0  months)  !   name   !   (logical) !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      ! 
     513   sn_sst      = 'sst_data',        24         ,  'sst'   ,    .false.  , .false., 'yearly'  ,    ''    ,    ''    ,    '' 
     514   sn_sss      = 'sss_data',        -1         ,  'sss'   ,    .true.   , .true. , 'yearly'  ,    ''    ,    ''    ,    '' 
    505515 
    506516   cn_dir      = './'      !  root directory for the location of the runoff files 
     
    510520   rn_dqdt     =   -40.    !  magnitude of the retroaction on temperature   [W/m2/K] 
    511521   rn_deds     =  -166.67  !  magnitude of the damping on salinity   [mm/day] 
    512    ln_sssr_bnd =   .true.  !  flag to bound erp term (associated with nn_sssr=2) 
     522   ln_sssr_bnd =  .true.   !  flag to bound erp term (associated with nn_sssr=2) 
    513523   rn_sssr_bnd =   4.e0    !  ABS(Max/Min) value of the damping erp term [mm/day] 
    514524/ 
     
    516526&namsbc_alb    !   albedo parameters 
    517527!----------------------------------------------------------------------- 
    518    rn_cloud    =    0.06   !  cloud correction to snow and ice albedo 
    519    rn_albice   =    0.53   !  albedo of melting ice in the arctic and antarctic 
    520    rn_alphd    =    0.80   !  coefficients for linear interpolation used to 
    521    rn_alphc    =    0.65   !  compute albedo between two extremes values 
    522    rn_alphdi   =    0.72   !  (Pyane, 1972) 
     528   nn_ice_alb  =    0      !  parameterization of ice/snow albedo 
     529                           !     0: Shine & Henderson-Sellers (JGR 1985) 
     530                           !     1: "home made" based on Brandt et al. (J. Climate 2005) 
     531                           !                         and Grenfell & Perovich (JGR 2004) 
     532   rn_albice   =  0.53     !  albedo of bare puddled ice (values from 0.49 to 0.58) 
     533                           !     0.53 (default) => if nn_ice_alb=0 
     534                           !     0.50 (default) => if nn_ice_alb=1 
    523535/ 
    524536!----------------------------------------------------------------------- 
    525537&namsbc_wave   ! External fields from wave model                        (ln_wave=T) 
    526538!----------------------------------------------------------------------- 
    527 !              !  file name  ! frequency (hours) ! variable    ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
    528 !              !             !  (if <0  months)  !   name      !  (logical)   !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      ! 
    529    sn_cdg      =  'cdg_wave' ,        1          , 'drag_coeff',     .true.   , .false., 'daily'   ,  ''      , ''       , '' 
    530    sn_usd      =  'sdw_wave' ,        1          , 'u_sd2d'    ,     .true.   , .false., 'daily'   ,  ''      , ''       , '' 
    531    sn_vsd      =  'sdw_wave' ,        1          , 'v_sd2d'    ,     .true.   , .false., 'daily'   ,  ''      , ''       , '' 
    532    sn_wn       =  'sdw_wave' ,        1          , 'wave_num'  ,     .true.   , .false., 'daily'   ,  ''      , ''       , '' 
     539!              ! file name ! frequency (hours) ! variable    ! time interp.!  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
     540!              !           !  (if <0  months)  !   name      !  (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      ! 
     541   sn_cdg      = 'cdg_wave',        1          , 'drag_coeff',   .true.    , .false., 'daily'   ,    ''      , ''       , '' 
     542   sn_usd      = 'sdw_wave',        1          , 'u_sd2d'    ,   .true.    , .false., 'daily'   ,    ''      , ''       , '' 
     543   sn_vsd      = 'sdw_wave',        1          , 'v_sd2d'    ,   .true.    , .false., 'daily'   ,    ''      , ''       , '' 
     544   sn_wn       = 'sdw_wave',        1          , 'wave_num'  ,   .true.    , .false., 'daily'   ,    ''      , ''       , '' 
    533545! 
    534546   cn_dir_cdg  = './'      !  root directory for the location of drag coefficient files 
    535    ln_cdgw = .false.       !  Neutral drag coefficient read from wave model 
    536    ln_sdw  = .false.       !  Computation of 3D stokes drift                
     547   ln_cdgw     = .false.   !  Neutral drag coefficient read from wave model 
     548   ln_sdw      = .false.   !  Computation of 3D stokes drift                
    537549/ 
    538550!----------------------------------------------------------------------- 
     
    564576      rn_speed_limit           = 0.                   ! CFL speed limit for a berg 
    565577 
    566 !            ! file name ! frequency (hours) !   variable   ! time interp. !  clim   ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
    567 !            !           !  (if <0  months)  !     name     !   (logical)  !  (T/F ) ! 'monthly' ! filename ! pairing  ! filename      ! 
    568       sn_icb =  'calving',       -1          , 'calvingmask',  .true.      , .true.  , 'yearly'  , ''       , ''       , '' 
     578!            ! file name ! frequency (hours) !   variable   ! time interp.!  clim   ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
     579!            !           !  (if <0  months)  !     name     !  (logical)  !  (T/F ) ! 'monthly' ! filename ! pairing  ! filename      ! 
     580      sn_icb =  'calving',       -1          , 'calvingmask',   .true.    , .true.  , 'yearly'  ,    ''    ,    ''    ,    '' 
    569581 
    570582      cn_dir = './' 
     
    575587!!====================================================================== 
    576588!!   namlbc        lateral momentum boundary condition 
    577 !!   namobc        open boundaries parameters                           ("key_obc") 
    578589!!   namagrif      agrif nested grid ( read by child model only )       ("key_agrif") 
     590!!   nam_tide      Tidal forcing  
    579591!!   nambdy        Unstructured open boundaries                         ("key_bdy") 
    580 !!   namtide       Tidal forcing at open boundaries                     ("key_bdy_tides") 
     592!!   nambdy_dta    Unstructured open boundaries - external data         ("key_bdy") 
     593!!   nambdy_tide   tidal forcing at open boundaries                     ("key_bdy_tides") 
    581594!!====================================================================== 
    582595! 
     
    600613&nam_tide      !   tide parameters                                      ("key_tide") 
    601614!----------------------------------------------------------------------- 
    602    ln_tide_pot   = .true.   !  use tidal potential forcing 
    603    ln_tide_ramp  = .false.  ! 
    604    rdttideramp   =    0.    ! 
    605    clname(1)     = 'DUMMY'  !  name of constituent - all tidal components must be set in namelist_cfg 
     615   ln_tide_pot = .true.    !  use tidal potential forcing 
     616   ln_tide_ramp= .false.   ! 
     617   rdttideramp =    0.     ! 
     618   clname(1)   = 'DUMMY'   !  name of constituent - all tidal components must be set in namelist_cfg 
    606619/ 
    607620!----------------------------------------------------------------------- 
     
    642655&nambdy_dta    !  open boundaries - external data                       ("key_bdy") 
    643656!----------------------------------------------------------------------- 
    644 !              !  file name      ! frequency (hours) ! variable  ! time interp. !  clim   ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
    645 !              !                 !  (if <0  months)  !   name    !  (logical)   !  (T/F ) ! 'monthly' ! filename ! pairing  ! filename      ! 
    646    bn_ssh =     'amm12_bdyT_u2d' ,         24        , 'sossheig',     .true.   , .false. ,  'daily'  ,    ''    ,   ''     , '' 
    647    bn_u2d =     'amm12_bdyU_u2d' ,         24        , 'vobtcrtx',     .true.   , .false. ,  'daily'  ,    ''    ,   ''     , '' 
    648    bn_v2d =     'amm12_bdyV_u2d' ,         24        , 'vobtcrty',     .true.   , .false. ,  'daily'  ,    ''    ,   ''     , '' 
    649    bn_u3d  =    'amm12_bdyU_u3d' ,         24        , 'vozocrtx',     .true.   , .false. ,  'daily'  ,    ''    ,   ''     , '' 
    650    bn_v3d  =    'amm12_bdyV_u3d' ,         24        , 'vomecrty',     .true.   , .false. ,  'daily'  ,    ''    ,   ''     , '' 
    651    bn_tem  =    'amm12_bdyT_tra' ,         24        , 'votemper',     .true.   , .false. ,  'daily'  ,    ''    ,   ''     , '' 
    652    bn_sal  =    'amm12_bdyT_tra' ,         24        , 'vosaline',     .true.   , .false. ,  'daily'  ,    ''    ,   ''     , '' 
     657!              !  file name      ! frequency (hours) ! variable  ! time interp.!  clim   ! 'yearly'/ ! weights  ! rotation ! land/sea mask ! 
     658!              !                 !  (if <0  months)  !   name    !  (logical)  !  (T/F ) ! 'monthly' ! filename ! pairing  ! filename      ! 
     659   bn_ssh      = 'amm12_bdyT_u2d',         24        , 'sossheig',    .true.   , .false. ,  'daily'  ,    ''    ,   ''     ,    '' 
     660   bn_u2d      = 'amm12_bdyU_u2d',         24        , 'vobtcrtx',    .true.   , .false. ,  'daily'  ,    ''    ,   ''     ,    '' 
     661   bn_v2d      = 'amm12_bdyV_u2d',         24        , 'vobtcrty',    .true.   , .false. ,  'daily'  ,    ''    ,   ''     ,    '' 
     662   bn_u3d      = 'amm12_bdyU_u3d',         24        , 'vozocrtx',    .true.   , .false. ,  'daily'  ,    ''    ,   ''     ,    '' 
     663   bn_v3d      = 'amm12_bdyV_u3d',         24        , 'vomecrty',    .true.   , .false. ,  'daily'  ,    ''    ,   ''     ,    '' 
     664   bn_tem      = 'amm12_bdyT_tra',         24        , 'votemper',    .true.   , .false. ,  'daily'  ,    ''    ,   ''     ,    '' 
     665   bn_sal      = 'amm12_bdyT_tra',         24        , 'vosaline',    .true.   , .false. ,  'daily'  ,    ''    ,   ''     ,    '' 
    653666! for lim2 
    654 !   bn_frld  =   'amm12_bdyT_ice' ,         24        , 'ileadfra',     .true.   , .false. ,  'daily'  ,    ''    ,   ''     , '' 
    655 !   bn_hicif =   'amm12_bdyT_ice' ,         24        , 'iicethic',     .true.   , .false. ,  'daily'  ,    ''    ,   ''     , '' 
    656 !   bn_hsnif =   'amm12_bdyT_ice' ,         24        , 'isnowthi',     .true.   , .false. ,  'daily'  ,    ''    ,   ''     , '' 
     667!   bn_frld    = 'amm12_bdyT_ice',         24        , 'ileadfra',    .true.   , .false. ,  'daily'  ,    ''    ,   ''     ,    '' 
     668!   bn_hicif   = 'amm12_bdyT_ice',         24        , 'iicethic',    .true.   , .false. ,  'daily'  ,    ''    ,   ''     ,    '' 
     669!   bn_hsnif   = 'amm12_bdyT_ice',         24        , 'isnowthi',    .true.   , .false. ,  'daily'  ,    ''    ,   ''     ,    '' 
    657670! for lim3 
    658 !   bn_a_i  =    'amm12_bdyT_ice' ,         24        , 'ileadfra',     .true.   , .false. ,  'daily'  ,    ''    ,   ''     , '' 
    659 !   bn_ht_i =    'amm12_bdyT_ice' ,         24        , 'iicethic',     .true.   , .false. ,  'daily'  ,    ''    ,   ''     , '' 
    660 !   bn_ht_s =    'amm12_bdyT_ice' ,         24        , 'isnowthi',     .true.   , .false. ,  'daily'  ,    ''    ,   ''     , '' 
    661  
    662    cn_dir      =    'bdydta/'  !  root directory for the location of the bulk files 
    663    ln_full_vel = .false.         
    664 / 
    665 !----------------------------------------------------------------------- 
    666 &nambdy_tide     ! tidal forcing at open boundaries 
     671!   bn_a_i     = 'amm12_bdyT_ice',         24        , 'ileadfra',    .true.   , .false. ,  'daily'  ,    ''    ,   ''     ,    '' 
     672!   bn_ht_i    = 'amm12_bdyT_ice',         24        , 'iicethic',    .true.   , .false. ,  'daily'  ,    ''    ,   ''     ,    '' 
     673!   bn_ht_s    = 'amm12_bdyT_ice',         24        , 'isnowthi',    .true.   , .false. ,  'daily'  ,    ''    ,   ''     ,    '' 
     674 
     675   cn_dir      = 'bdydta/' !  root directory for the location of the bulk files 
     676   ln_full_vel = .false.    
     677/ 
     678!----------------------------------------------------------------------- 
     679&nambdy_tide   ! tidal forcing at open boundaries 
    667680!----------------------------------------------------------------------- 
    668681   filtide          = 'bdydta/amm12_bdytide_'   !  file name root of tidal forcing files 
     
    670683   ln_bdytide_conj  = .false.                   !  
    671684/ 
     685 
    672686!!====================================================================== 
    673687!!                 ***  Bottom boundary condition  *** 
     
    685699   rn_bfri1    =    4.e-4  !  bottom drag coefficient (linear case) 
    686700   rn_bfri2    =    1.e-3  !  bottom drag coefficient (non linear case). Minimum coeft if ln_loglayer=T 
    687    rn_bfri2_max =   1.e-1  !  max. bottom drag coefficient (non linear case and ln_loglayer=T) 
     701   rn_bfri2_max=    1.e-1  !  max. bottom drag coefficient (non linear case and ln_loglayer=T) 
    688702   rn_bfeb2    =    2.5e-3 !  bottom turbulent kinetic energy background  (m2/s2) 
    689703   rn_bfrz0    =    3.e-3  !  bottom roughness [m] if ln_loglayer=T 
     
    692706   rn_tfri1    =    4.e-4  !  top drag coefficient (linear case) 
    693707   rn_tfri2    =    2.5e-3 !  top drag coefficient (non linear case). Minimum coeft if ln_loglayer=T 
    694    rn_tfri2_max =   1.e-1  !  max. top drag coefficient (non linear case and ln_loglayer=T) 
     708   rn_tfri2_max=    1.e-1  !  max. top drag coefficient (non linear case and ln_loglayer=T) 
    695709   rn_tfeb2    =    0.0    !  top turbulent kinetic energy background  (m2/s2) 
    696710   rn_tfrz0    =    3.e-3  !  top roughness [m] if ln_loglayer=T 
    697711   ln_tfr2d    = .false.   !  horizontal variation of the top friction coef (read a 2D mask file ) 
    698    rn_tfrien   =    50.    !  local multiplying factor of tfr (ln_tfr2d=T) 
     712   rn_tfrien   =   50.     !  local multiplying factor of tfr (ln_tfr2d=T) 
    699713 
    700714   ln_bfrimp   = .true.    !  implicit bottom friction (requires ln_zdfexp = .false. if true) 
     
    718732&nambbl        !   bottom boundary layer scheme                         ("key_trabbl") 
    719733!----------------------------------------------------------------------- 
    720    nn_bbl_ldf  =  1      !  diffusive bbl (=1)   or not (=0) 
    721    nn_bbl_adv  =  0      !  advective bbl (=1/2) or not (=0) 
    722    rn_ahtbbl   =  1000.  !  lateral mixing coefficient in the bbl  [m2/s] 
    723    rn_gambbl   =  10.    !  advective bbl coefficient                 [s] 
     734   nn_bbl_ldf  =  1        !  diffusive bbl (=1)   or not (=0) 
     735   nn_bbl_adv  =  0        !  advective bbl (=1/2) or not (=0) 
     736   rn_ahtbbl   =  1000.    !  lateral mixing coefficient in the bbl  [m2/s] 
     737   rn_gambbl   =  10.      !  advective bbl coefficient                 [s] 
    724738/ 
    725739 
     
    738752&nameos        !   ocean physical parameters 
    739753!----------------------------------------------------------------------- 
    740    nn_eos      =  -1     !  type of equation of state and Brunt-Vaisala frequency 
    741                                  !  =-1, TEOS-10 
    742                                  !  = 0, EOS-80 
    743                                  !  = 1, S-EOS   (simplified eos) 
    744    ln_useCT    = .true.  ! use of Conservative Temp. ==> surface CT converted in Pot. Temp. in sbcssm 
     754   ln_teos10   = .false.         !  = Use TEOS-10 equation of state 
     755   ln_eos80    = .false.         !  = Use EOS80 equation of state 
     756   ln_seos     = .false.         !  = Use simplified equation of state (S-EOS) 
    745757                                 ! 
    746    !                     ! S-EOS coefficients : 
    747                                  !  rd(T,S,Z)*rau0 = -a0*(1+.5*lambda*dT+mu*Z+nu*dS)*dT+b0*dS 
     758   !                     ! S-EOS coefficients (ln_seos=T): 
     759   !                             !  rd(T,S,Z)*rau0 = -a0*(1+.5*lambda*dT+mu*Z+nu*dS)*dT+b0*dS 
    748760   rn_a0       =  1.6550e-1      !  thermal expension coefficient (nn_eos= 1) 
    749761   rn_b0       =  7.6554e-1      !  saline  expension coefficient (nn_eos= 1) 
     
    757769&namtra_adv    !   advection scheme for tracer                          (default: NO advection) 
    758770!----------------------------------------------------------------------- 
    759    ln_traadv_cen =  .false. !  2nd order centered scheme 
    760       nn_cen_h   =  4               !  =2/4, horizontal 2nd order CEN / 4th order CEN 
    761       nn_cen_v   =  4               !  =2/4, vertical   2nd order CEN / 4th order COMPACT 
    762    ln_traadv_fct =  .false. !  FCT scheme 
    763       nn_fct_h   =  2               !  =2/4, horizontal 2nd / 4th order  
    764       nn_fct_v   =  2               !  =2/4, vertical   2nd / COMPACT 4th order  
    765       nn_fct_zts =  0               !  >=1,  2nd order FCT scheme with vertical sub-timestepping 
    766       !                             !        (number of sub-timestep = nn_fct_zts) 
    767    ln_traadv_mus =  .false. !  MUSCL scheme 
    768       ln_mus_ups =  .false.         !  use upstream scheme near river mouths 
    769    ln_traadv_ubs =  .false. !  UBS scheme 
    770       nn_ubs_v   =  2               !  =2  , vertical 2nd order FCT / COMPACT 4th order 
    771    ln_traadv_qck =  .false. !  QUICKEST scheme 
     771   ln_traadv_cen = .false. !  2nd order centered scheme 
     772      nn_cen_h   =  4            !  =2/4, horizontal 2nd order CEN / 4th order CEN 
     773      nn_cen_v   =  4            !  =2/4, vertical   2nd order CEN / 4th order COMPACT 
     774   ln_traadv_fct = .false. !  FCT scheme 
     775      nn_fct_h   =  2            !  =2/4, horizontal 2nd / 4th order  
     776      nn_fct_v   =  2            !  =2/4, vertical   2nd / COMPACT 4th order  
     777      nn_fct_zts =  0            !  >=1,  2nd order FCT scheme with vertical sub-timestepping 
     778      !                          !        (number of sub-timestep = nn_fct_zts) 
     779   ln_traadv_mus = .false. !  MUSCL scheme 
     780      ln_mus_ups = .false.       !  use upstream scheme near river mouths 
     781   ln_traadv_ubs = .false. !  UBS scheme 
     782      nn_ubs_v   =  2            !  =2  , vertical 2nd order FCT / COMPACT 4th order 
     783   ln_traadv_qck = .false. !  QUICKEST scheme 
    772784/ 
    773785!----------------------------------------------------------------------- 
    774786&namtra_adv_mle !   mixed layer eddy parametrisation (Fox-Kemper param) (default: NO) 
    775787!----------------------------------------------------------------------- 
    776    ln_mle    = .false.      ! (T) use the Mixed Layer Eddy (MLE) parameterisation 
    777    rn_ce     = 0.06        ! magnitude of the MLE (typical value: 0.06 to 0.08) 
    778    nn_mle    = 1           ! MLE type: =0 standard Fox-Kemper ; =1 new formulation 
    779    rn_lf     = 5.e+3       ! typical scale of mixed layer front (meters)                      (case rn_mle=0) 
    780    rn_time   = 172800.     ! time scale for mixing momentum across the mixed layer (seconds)  (case rn_mle=0) 
    781    rn_lat    = 20.         ! reference latitude (degrees) of MLE coef.                        (case rn_mle=1) 
    782    nn_mld_uv = 0           ! space interpolation of MLD at u- & v-pts (0=min,1=averaged,2=max) 
    783    nn_conv   = 0           ! =1 no MLE in case of convection ; =0 always MLE 
    784    rn_rho_c_mle  = 0.01    ! delta rho criterion used to calculate MLD for FK 
     788   ln_mle      = .false.   ! (T) use the Mixed Layer Eddy (MLE) parameterisation 
     789   rn_ce       = 0.06      ! magnitude of the MLE (typical value: 0.06 to 0.08) 
     790   nn_mle      = 1         ! MLE type: =0 standard Fox-Kemper ; =1 new formulation 
     791   rn_lf       = 5.e+3     ! typical scale of mixed layer front (meters)                      (case rn_mle=0) 
     792   rn_time     = 172800.   ! time scale for mixing momentum across the mixed layer (seconds)  (case rn_mle=0) 
     793   rn_lat      = 20.       ! reference latitude (degrees) of MLE coef.                        (case rn_mle=1) 
     794   nn_mld_uv   = 0         ! space interpolation of MLD at u- & v-pts (0=min,1=averaged,2=max) 
     795   nn_conv     = 0         ! =1 no MLE in case of convection ; =0 always MLE 
     796   rn_rho_c_mle= 0.01      ! delta rho criterion used to calculate MLD for FK 
    785797/ 
    786798!----------------------------------------------------------------------- 
     
    791803   ln_traldf_lap   =  .false.  !    laplacian operator 
    792804   ln_traldf_blp   =  .false.  !  bilaplacian operator 
     805   ! 
    793806   !                       !  Direction of action: 
    794807   ln_traldf_lev   =  .false.  !  iso-level 
     
    866879   ln_vvl_layer  = .false.          !  full layer vertical coordinate 
    867880   ln_vvl_ztilde_as_zstar = .false. !  ztilde vertical coordinate emulating zstar 
    868    ln_vvl_zstar_at_eqtor = .false. !  ztilde near the equator 
     881   ln_vvl_zstar_at_eqtor  = .false. !  ztilde near the equator 
    869882   rn_ahe3       = 0.0e0            !  thickness diffusion coefficient 
    870883   rn_rst_e3t    = 30.e0            !  ztilde to zstar restoration timescale [days] 
     
    874887/ 
    875888!----------------------------------------------------------------------- 
    876 &namdyn_vor    !   option of physics/algorithm                          (default: NO) 
     889&namdyn_vor    !   Vorticity / Coriolis scheme                          (default: NO) 
    877890!----------------------------------------------------------------------- 
    878891   ln_dynvor_ene = .false. !  enstrophy conserving scheme 
     
    957970   nn_havtb    =    0      !  horizontal shape for avtb (=1) or not (=0) 
    958971   ln_zdfevd   = .true.    !  enhanced vertical diffusion (evd) (T) or not (F) 
    959    nn_evdm     =    0      ! evd apply on tracer (=0) or on tracer and momentum (=1) 
    960    rn_avevd    =  100.     !  evd mixing coefficient [m2/s] 
     972      nn_evdm     =    0        ! evd apply on tracer (=0) or on tracer and momentum (=1) 
     973      rn_avevd    =  100.       !  evd mixing coefficient [m2/s] 
    961974   ln_zdfnpc   = .false.   !  Non-Penetrative Convective algorithm (T) or not (F) 
    962    nn_npc      =    1            ! frequency of application of npc 
    963    nn_npcp     =  365            ! npc control print frequency 
     975      nn_npc      =    1        ! frequency of application of npc 
     976      nn_npcp     =  365        ! npc control print frequency 
    964977   ln_zdfexp   = .false.   !  time-stepping: split-explicit (T) or implicit (F) time stepping 
    965    nn_zdfexp   =    3            ! number of sub-timestep for ln_zdfexp=T 
     978      nn_zdfexp   =    3        ! number of sub-timestep for ln_zdfexp=T 
    966979/ 
    967980!----------------------------------------------------------------------- 
    968981&namzdf_ric    !   richardson number dependent vertical diffusion       ("key_zdfric" ) 
    969982!----------------------------------------------------------------------- 
    970    rn_avmri    = 100.e-4   !  maximum value of the vertical viscosity 
    971    rn_alp      =   5.      !  coefficient of the parameterization 
    972    nn_ric      =   2       !  coefficient of the parameterization 
    973    rn_ekmfc    =   0.7     !  Factor in the Ekman depth Equation 
    974    rn_mldmin   =   1.0     !  minimum allowable mixed-layer depth estimate (m) 
    975    rn_mldmax   =1000.0     !  maximum allowable mixed-layer depth estimate (m) 
    976    rn_wtmix    =  10.0     !  vertical eddy viscosity coeff [m2/s] in the mixed-layer 
    977    rn_wvmix    =  10.0     !  vertical eddy diffusion coeff [m2/s] in the mixed-layer 
    978    ln_mldw     = .true.    !  Flag to use or not the mixed layer depth param. 
     983   rn_avmri    =  100.e-4  !  maximum value of the vertical viscosity 
     984   rn_alp      =    5.     !  coefficient of the parameterization 
     985   nn_ric      =    2      !  coefficient of the parameterization 
     986   rn_ekmfc    =    0.7    !  Factor in the Ekman depth Equation 
     987   rn_mldmin   =    1.0    !  minimum allowable mixed-layer depth estimate (m) 
     988   rn_mldmax   = 1000.0    !  maximum allowable mixed-layer depth estimate (m) 
     989   rn_wtmix    =   10.0    !  vertical eddy viscosity coeff [m2/s] in the mixed-layer 
     990   rn_wvmix    =   10.0    !  vertical eddy diffusion coeff [m2/s] in the mixed-layer 
     991   ln_mldw     =  .true.   !  Flag to use or not the mixed layer depth param. 
    979992/ 
    980993!----------------------------------------------------------------------- 
     
    9961009   ln_lc       = .true.    !  Langmuir cell parameterisation (Axell 2002) 
    9971010   rn_lc       =   0.15    !  coef. associated to Langmuir cells 
    998    nn_etau     =   1       !  penetration of tke below the mixed layer (ML) due to internal & intertial waves 
     1011   nn_etau     =   1       !  penetration of tke below the mixed layer (ML) due to near intertial waves 
    9991012                           !        = 0 no penetration 
    10001013                           !        = 1 add a tke source below the ML 
    10011014                           !        = 2 add a tke source just at the base of the ML 
    1002                            !        = 3 as = 1 applied on HF part of the stress    ("key_oasis3") 
     1015                           !        = 3 as = 1 applied on HF part of the stress           (ln_cpl=T) 
    10031016   rn_efr      =   0.05    !  fraction of surface tke value which penetrates below the ML (nn_etau=1 or 2) 
    10041017   nn_htau     =   1       !  type of exponential decrease of tke penetration below the ML 
     
    10071020/ 
    10081021!----------------------------------------------------------------------- 
    1009 &namzdf_gls                !   GLS vertical diffusion                   ("key_zdfgls") 
     1022&namzdf_gls    !   GLS vertical diffusion                               ("key_zdfgls") 
    10101023!----------------------------------------------------------------------- 
    10111024   rn_emin       = 1.e-7   !  minimum value of e   [m2/s2] 
     
    10401053   rn_tfe_itf  = 1.        !  ITF tidal dissipation efficiency 
    10411054/ 
     1055!----------------------------------------------------------------------- 
     1056&namzdf_tmx_new !   internal wave-driven mixing parameterization        ("key_zdftmx_new" & "key_zdfddm") 
     1057!----------------------------------------------------------------------- 
     1058   nn_zpyc     = 1         !  pycnocline-intensified dissipation scales as N (=1) or N^2 (=2) 
     1059   ln_mevar    = .true.    !  variable (T) or constant (F) mixing efficiency 
     1060   ln_tsdiff   = .true.    !  account for differential T/S mixing (T) or not (F) 
     1061/ 
     1062 
    10421063 
    10431064!!====================================================================== 
     
    10771098/ 
    10781099!----------------------------------------------------------------------- 
    1079 &namsto       ! Stochastic parametrization of EOS                       (default: NO) 
    1080 !----------------------------------------------------------------------- 
    1081    ln_sto_eos   = .false.  ! stochastic equation of state 
    1082    nn_sto_eos   = 1        ! number of independent random walks 
    1083    rn_eos_stdxy = 1.4      ! random walk horz. standard deviation (in grid points) 
    1084    rn_eos_stdz  = 0.7      ! random walk vert. standard deviation (in grid points) 
    1085    rn_eos_tcor  = 1440.    ! random walk time correlation (in timesteps) 
    1086    nn_eos_ord   = 1        ! order of autoregressive processes 
    1087    nn_eos_flt   = 0        ! passes of Laplacian filter 
    1088    rn_eos_lim   = 2.0      ! limitation factor (default = 3.0) 
    1089    ln_rststo    = .false.  ! start from mean parameter (F) or from restart file (T) 
    1090    ln_rstseed = .true.           ! read seed of RNG from restart file 
     1100&namsto        ! Stochastic parametrization of EOS                      (default: NO) 
     1101!----------------------------------------------------------------------- 
     1102   ln_sto_eos  = .false.   ! stochastic equation of state 
     1103   nn_sto_eos  = 1         ! number of independent random walks 
     1104   rn_eos_stdxy= 1.4       ! random walk horz. standard deviation (in grid points) 
     1105   rn_eos_stdz = 0.7       ! random walk vert. standard deviation (in grid points) 
     1106   rn_eos_tcor = 1440.     ! random walk time correlation (in timesteps) 
     1107   nn_eos_ord  = 1         ! order of autoregressive processes 
     1108   nn_eos_flt  = 0         ! passes of Laplacian filter 
     1109   rn_eos_lim  = 2.0       ! limitation factor (default = 3.0) 
     1110   ln_rststo   = .false.   ! start from mean parameter (F) or from restart file (T) 
     1111   ln_rstseed  = .true.    ! read seed of RNG from restart file 
    10911112   cn_storst_in  = "restart_sto" !  suffix of stochastic parameter restart file (input) 
    10921113   cn_storst_out = "restart_sto" !  suffix of stochastic parameter restart file (output) 
     
    10961117!!                  ***  Diagnostics namelists  *** 
    10971118!!====================================================================== 
    1098 !!   namtrd       dynamics and/or tracer trends 
    1099 !!   namptr       Poleward Transport Diagnostics 
    1100 !!   namhsb       Heat and salt budgets 
     1119!!   namtrd       dynamics and/or tracer trends                         (default F) 
     1120!!   namptr       Poleward Transport Diagnostics                        (default F) 
     1121!!   namhsb       Heat and salt budgets                                 (default F) 
     1122!!   namdiu       Cool skin and warm layer models                       (default F) 
    11011123!!   namflo       float parameters                                      ("key_float") 
    1102 !!   nam_diaharm  Harmonic analysis of tidal constituents               ('key_diaharm') 
    1103 !!   namdct       transports through some sections 
     1124!!   nam_diaharm  Harmonic analysis of tidal constituents               ("key_diaharm") 
     1125!!   namdct       transports through some sections                      ("key_diadct") 
     1126!!   nam_diatmb   Top Middle Bottom Output                              (default F) 
     1127!!   nam_dia25h   25h Mean Output                                       (default F) 
    11041128!!   namnc4       netcdf4 chunking and compression settings             ("key_netcdf4") 
    11051129!!====================================================================== 
    11061130! 
    11071131!----------------------------------------------------------------------- 
    1108 &namtrd        !   diagnostics on dynamics and/or tracer trends         (default F) 
    1109 !              !   and/or mixed-layer trends and/or barotropic vorticity 
     1132&namtrd        !   trend diagnostics                                    (default F) 
    11101133!----------------------------------------------------------------------- 
    11111134   ln_glo_trd  = .false.   ! (T) global domain averaged diag for T, T^2, KE, and PE 
     
    11271150!!gm 
    11281151!----------------------------------------------------------------------- 
    1129 &namptr       !   Poleward Transport Diagnostic                         (default F) 
    1130 !----------------------------------------------------------------------- 
    1131    ln_diaptr  = .false.    !  Poleward heat and salt transport (T) or not (F) 
    1132    ln_subbas  = .false.     !  Atlantic/Pacific/Indian basins computation (T) or not 
    1133 / 
    1134 !----------------------------------------------------------------------- 
    1135 &namhsb       !  Heat and salt budgets                                  (default F) 
    1136 !----------------------------------------------------------------------- 
    1137    ln_diahsb  = .false.    !  check the heat and salt budgets (T) or not (F) 
    1138 / 
    1139 !----------------------------------------------------------------------- 
    1140 &namflo       !   float parameters                                      ("key_float") 
    1141 !----------------------------------------------------------------------- 
    1142    jpnfl         = 1          !  total number of floats during the run 
    1143    jpnnewflo     = 0          !  number of floats for the restart 
    1144    ln_rstflo     = .false.    !  float restart (T) or not (F) 
    1145    nn_writefl    =      75    !  frequency of writing in float output file 
    1146    nn_stockfl    =    5475    !  frequency of creation of the float restart file 
    1147    ln_argo       = .false.    !  Argo type floats (stay at the surface each 10 days) 
    1148    ln_flork4     = .false.    !  trajectories computed with a 4th order Runge-Kutta (T) 
    1149                               !  or computed with Blanke' scheme (F) 
    1150    ln_ariane     = .true.     !  Input with Ariane tool convention(T) 
    1151    ln_flo_ascii  = .true.     !  Output with Ariane tool netcdf convention(F) or ascii file (T) 
    1152 / 
    1153 !----------------------------------------------------------------------- 
    1154 &nam_diaharm   !   Harmonic analysis of tidal constituents              ('key_diaharm') 
     1152&namptr        !   Poleward Transport Diagnostic                         (default F) 
     1153!----------------------------------------------------------------------- 
     1154   ln_diaptr   = .false.   !  Poleward heat and salt transport (T) or not (F) 
     1155   ln_subbas   = .false.   !  Atlantic/Pacific/Indian basins computation (T) or not 
     1156/ 
     1157!----------------------------------------------------------------------- 
     1158&namhsb        !  Heat and salt budgets                                  (default F) 
     1159!----------------------------------------------------------------------- 
     1160   ln_diahsb   = .false.   !  check the heat and salt budgets (T) or not (F) 
     1161/ 
     1162!----------------------------------------------------------------------- 
     1163&namdiu        !   Cool skin and warm layer models                       (default F) 
     1164!----------------------------------------------------------------------- 
     1165   ln_diurnal      = .false.   !  
     1166   ln_diurnal_only = .false.   ! 
     1167/ 
     1168!----------------------------------------------------------------------- 
     1169&namflo        !   float parameters                                      ("key_float") 
     1170!----------------------------------------------------------------------- 
     1171   jpnfl       = 1         !  total number of floats during the run 
     1172   jpnnewflo   = 0         !  number of floats for the restart 
     1173   ln_rstflo   = .false.   !  float restart (T) or not (F) 
     1174   nn_writefl  =      75   !  frequency of writing in float output file 
     1175   nn_stockfl  =    5475   !  frequency of creation of the float restart file 
     1176   ln_argo     = .false.   !  Argo type floats (stay at the surface each 10 days) 
     1177   ln_flork4   = .false.   !  trajectories computed with a 4th order Runge-Kutta (T) 
     1178   !                       !  or computed with Blanke' scheme (F) 
     1179   ln_ariane   = .true.    !  Input with Ariane tool convention(T) 
     1180   ln_flo_ascii= .true.    !  Output with Ariane tool netcdf convention(F) or ascii file (T) 
     1181/ 
     1182!----------------------------------------------------------------------- 
     1183&nam_diaharm   !   Harmonic analysis of tidal constituents               ("key_diaharm") 
    11551184!----------------------------------------------------------------------- 
    11561185    nit000_han = 1         ! First time step used for harmonic analysis 
     
    11611190/ 
    11621191!----------------------------------------------------------------------- 
    1163 &namdct        ! transports through some sections 
    1164 !----------------------------------------------------------------------- 
    1165     nn_dct      = 15       !  time step frequency for transports computing 
    1166     nn_dctwri   = 15       !  time step frequency for transports writing 
    1167     nn_secdebug = 112      !      0 : no section to debug 
    1168                            !     -1 : debug all section 
    1169                            !  0 < n : debug section number n 
    1170 / 
    1171 !----------------------------------------------------------------------- 
    1172 &namnc4        !   netcdf4 chunking and compression settings            ("key_netcdf4") 
     1192&namdct        ! transports through some sections                        ("key_diadct") 
     1193!----------------------------------------------------------------------- 
     1194    nn_dct     = 15        !  time step frequency for transports computing 
     1195    nn_dctwri  = 15        !  time step frequency for transports writing 
     1196    nn_secdebug= 112       !      0 : no section to debug 
     1197    !                      !     -1 : debug all section 
     1198    !                      !  0 < n : debug section number n 
     1199/ 
     1200!----------------------------------------------------------------------- 
     1201&nam_diatmb    !  Top Middle Bottom Output                               (default F) 
     1202!----------------------------------------------------------------------- 
     1203   ln_diatmb   = .false.   !  Choose Top Middle and Bottom output or not 
     1204/ 
     1205!----------------------------------------------------------------------- 
     1206&nam_dia25h    !  25h Mean Output                                        (default F) 
     1207!----------------------------------------------------------------------- 
     1208   ln_dia25h   = .false.   ! Choose 25h mean output or not 
     1209/ 
     1210!----------------------------------------------------------------------- 
     1211&namnc4        !   netcdf4 chunking and compression settings             ("key_netcdf4") 
    11731212!----------------------------------------------------------------------- 
    11741213   nn_nchunks_i=   4       !  number of chunks in i-dimension 
    11751214   nn_nchunks_j=   4       !  number of chunks in j-dimension 
    11761215   nn_nchunks_k=   31      !  number of chunks in k-dimension 
    1177                            !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which 
    1178                            !  is optimal for postprocessing which works exclusively with horizontal slabs 
     1216   !                       !  setting nn_nchunks_k = jpk will give a chunk size of 1 in the vertical which 
     1217   !                       !  is optimal for postprocessing which works exclusively with horizontal slabs 
    11791218   ln_nc4zip   = .true.    !  (T) use netcdf4 chunking and compression 
    1180                            !  (F) ignore chunking information and produce netcdf3-compatible files 
     1219   !                       !  (F) ignore chunking information and produce netcdf3-compatible files 
    11811220/ 
    11821221 
     
    11891228! 
    11901229!----------------------------------------------------------------------- 
    1191 &namobs       !  observation usage switch 
    1192 !----------------------------------------------------------------------- 
    1193    ln_diaobs  = .false.             ! Logical switch for the observation operator 
    1194    ln_t3d     = .false.             ! Logical switch for T profile observations 
    1195    ln_s3d     = .false.             ! Logical switch for S profile observations 
    1196    ln_sla     = .false.             ! Logical switch for SLA observations 
    1197    ln_sst     = .false.             ! Logical switch for SST observations 
    1198    ln_sic     = .false.             ! Logical switch for Sea Ice observations 
    1199    ln_vel3d   = .false.             ! Logical switch for velocity observations 
    1200    ln_altbias = .false.             ! Logical switch for altimeter bias correction 
    1201    ln_nea     = .false.             ! Logical switch for rejection of observations near land 
    1202    ln_grid_global = .true.          ! Logical switch for global distribution of observations 
    1203    ln_grid_search_lookup = .false.  ! Logical switch for obs grid search w/lookup table 
    1204    ln_ignmis  = .true.              ! Logical switch for ignoring missing files 
    1205    ln_s_at_t  = .false.             ! Logical switch for computing model S at T obs if not there 
    1206    ln_sstnight = .false.            ! Logical switch for calculating night-time average for SST obs 
     1230&namobs        !  observation usage switch 
     1231!----------------------------------------------------------------------- 
     1232   ln_diaobs   = .false.             ! Logical switch for the observation operator 
     1233   ln_t3d      = .false.             ! Logical switch for T profile observations 
     1234   ln_s3d      = .false.             ! Logical switch for S profile observations 
     1235   ln_sla      = .false.             ! Logical switch for SLA observations 
     1236   ln_sst      = .false.             ! Logical switch for SST observations 
     1237   ln_sic      = .false.             ! Logical switch for Sea Ice observations 
     1238   ln_vel3d    = .false.             ! Logical switch for velocity observations 
     1239   ln_altbias  = .false.             ! Logical switch for altimeter bias correction 
     1240   ln_nea      = .false.             ! Logical switch for rejection of observations near land 
     1241   ln_grid_global = .true.           ! Logical switch for global distribution of observations 
     1242   ln_grid_search_lookup = .false.   ! Logical switch for obs grid search w/lookup table 
     1243   ln_ignmis   = .true.              ! Logical switch for ignoring missing files 
     1244   ln_s_at_t   = .false.             ! Logical switch for computing model S at T obs if not there 
     1245   ln_sstnight = .false.             ! Logical switch for calculating night-time average for SST obs 
    12071246! All of the *files* variables below are arrays. Use namelist_cfg to add more files 
    1208    cn_profbfiles = 'profiles_01.nc'    ! Profile feedback input observation file names 
    1209    cn_slafbfiles = 'sla_01.nc'         ! SLA feedback input observation file names 
    1210    cn_sstfbfiles = 'sst_01.nc'         ! SST feedback input observation file names 
    1211    cn_sicfbfiles = 'sic_01.nc'         ! SIC feedback input observation file names 
    1212    cn_velfbfiles = 'vel_01.nc'         ! Velocity feedback input observation file names 
    1213    cn_altbiasfile = 'altbias.nc'       ! Altimeter bias input file name 
    1214    cn_gridsearchfile = 'gridsearch.nc' ! Grid search file name 
    1215    rn_gridsearchres = 0.5              ! Grid search resolution 
    1216    rn_dobsini = 00010101.000000        ! Initial date in window YYYYMMDD.HHMMSS 
    1217    rn_dobsend = 00010102.000000        ! Final date in window YYYYMMDD.HHMMSS 
    1218    nn_1dint = 0                        ! Type of vertical interpolation method 
    1219    nn_2dint = 0                        ! Type of horizontal interpolation method 
    1220    nn_msshc = 0                        ! MSSH correction scheme 
    1221    rn_mdtcorr = 1.61                   ! MDT  correction 
    1222    rn_mdtcutoff = 65.0                 ! MDT cutoff for computed correction 
    1223    nn_profdavtypes = -1                ! Profile daily average types - array 
    1224    ln_sstbias = .false.  
    1225    cn_sstbias_files = 'sstbias.nc' 
    1226 / 
    1227 !----------------------------------------------------------------------- 
    1228 &nam_asminc   !   assimilation increments                               ('key_asminc') 
    1229 !----------------------------------------------------------------------- 
    1230     ln_bkgwri = .false.    !  Logical switch for writing out background state 
    1231     ln_trainc = .false.    !  Logical switch for applying tracer increments 
    1232     ln_dyninc = .false.    !  Logical switch for applying velocity increments 
    1233     ln_sshinc = .false.    !  Logical switch for applying SSH increments 
    1234     ln_asmdin = .false.    !  Logical switch for Direct Initialization (DI) 
    1235     ln_asmiau = .false.    !  Logical switch for Incremental Analysis Updating (IAU) 
    1236     nitbkg    = 0          !  Timestep of background in [0,nitend-nit000-1] 
    1237     nitdin    = 0          !  Timestep of background for DI in [0,nitend-nit000-1] 
    1238     nitiaustr = 1          !  Timestep of start of IAU interval in [0,nitend-nit000-1] 
    1239     nitiaufin = 15         !  Timestep of end of IAU interval in [0,nitend-nit000-1] 
    1240     niaufn    = 0          !  Type of IAU weighting function 
    1241     ln_salfix = .false.    !  Logical switch for ensuring that the sa > salfixmin 
    1242     salfixmin = -9999      !  Minimum salinity after applying the increments 
    1243     nn_divdmp = 0          !  Number of iterations of divergence damping operator 
    1244 / 
    1245 !----------------------------------------------------------------------- 
    1246 &namdiu !   Cool skin and warm layer models 
    1247 !----------------------------------------------------------------------- 
    1248    ln_diurnal      = .false.   !  
    1249    ln_diurnal_only = .false.   ! 
    1250 / 
    1251 !----------------------------------------------------------------------- 
    1252 &nam_diatmb  !  Top Middle Bottom Output 
    1253 !----------------------------------------------------------------------- 
    1254    ln_diatmb  = .false.    !  Choose Top Middle and Bottom output or not 
    1255 / 
    1256 !----------------------------------------------------------------------- 
    1257 &namwad  !   Wetting and drying 
    1258 !----------------------------------------------------------------------- 
    1259    ln_wd             = .false.  ! T/F activation of wetting and drying 
    1260    rn_wdmin1         =  0.1     ! Minimum wet depth on dried cells 
    1261    rn_wdmin2         =  0.01    ! Tolerance of min wet depth on dried cells 
    1262    rn_wdld           =  20.0    ! Land elevation below which wetting/drying is allowed 
    1263    nn_wdit           =  10      ! Max iterations for W/D limiter 
    1264 / 
    1265 !----------------------------------------------------------------------- 
    1266 &nam_dia25h  !  25h Mean Output 
    1267 !----------------------------------------------------------------------- 
    1268    ln_dia25h  = .false.    ! Choose 25h mean output or not 
    1269 / 
     1247   cn_profbfiles = 'profiles_01.nc'  ! Profile feedback input observation file names 
     1248   cn_slafbfiles = 'sla_01.nc'       ! SLA feedback input observation file names 
     1249   cn_sstfbfiles = 'sst_01.nc'       ! SST feedback input observation file names 
     1250   cn_sicfbfiles = 'sic_01.nc'       ! SIC feedback input observation file names 
     1251   cn_velfbfiles = 'vel_01.nc'       ! Velocity feedback input observation file names 
     1252   cn_altbiasfile = 'altbias.nc'     ! Altimeter bias input file name 
     1253   cn_gridsearchfile='gridsearch.nc' ! Grid search file name 
     1254   rn_gridsearchres = 0.5            ! Grid search resolution 
     1255   rn_dobsini  = 00010101.000000     ! Initial date in window YYYYMMDD.HHMMSS 
     1256   rn_dobsend  = 00010102.000000     ! Final date in window YYYYMMDD.HHMMSS 
     1257   nn_1dint    = 0                   ! Type of vertical interpolation method 
     1258   nn_2dint    = 0                   ! Type of horizontal interpolation method 
     1259   nn_msshc    = 0                   ! MSSH correction scheme 
     1260   rn_mdtcorr  = 1.61                ! MDT  correction 
     1261   rn_mdtcutoff = 65.0               ! MDT cutoff for computed correction 
     1262   nn_profdavtypes = -1              ! Profile daily average types - array 
     1263   ln_sstbias  = .false.             ! 
     1264   cn_sstbias_files = 'sstbias.nc'   ! 
     1265/ 
     1266!----------------------------------------------------------------------- 
     1267&nam_asminc    !   assimilation increments                              ('key_asminc') 
     1268!----------------------------------------------------------------------- 
     1269    ln_bkgwri  = .false.   !  Logical switch for writing out background state 
     1270    ln_trainc  = .false.   !  Logical switch for applying tracer increments 
     1271    ln_dyninc  = .false.   !  Logical switch for applying velocity increments 
     1272    ln_sshinc  = .false.   !  Logical switch for applying SSH increments 
     1273    ln_asmdin  = .false.   !  Logical switch for Direct Initialization (DI) 
     1274    ln_asmiau  = .false.   !  Logical switch for Incremental Analysis Updating (IAU) 
     1275    nitbkg     = 0         !  Timestep of background in [0,nitend-nit000-1] 
     1276    nitdin     = 0         !  Timestep of background for DI in [0,nitend-nit000-1] 
     1277    nitiaustr  = 1         !  Timestep of start of IAU interval in [0,nitend-nit000-1] 
     1278    nitiaufin  = 15        !  Timestep of end of IAU interval in [0,nitend-nit000-1] 
     1279    niaufn     = 0         !  Type of IAU weighting function 
     1280    ln_salfix  = .false.   !  Logical switch for ensuring that the sa > salfixmin 
     1281    salfixmin  = -9999     !  Minimum salinity after applying the increments 
     1282    nn_divdmp  = 0         !  Number of iterations of divergence damping operator 
     1283/ 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/SHARED/namelist_top_ref

    r6140 r7341  
    6868   rn_ahtrc_0      = 2000.       !  lateral eddy diffusivity   (lap. operator) [m2/s] 
    6969   rn_bhtrc_0      = 1.e+12      !  lateral eddy diffusivity (bilap. operator) [m4/s] 
     70   ! 
     71   rn_fact_lap      =     1.     !     enhanced zonal eddy diffusivity 
    7072/ 
    7173!----------------------------------------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/CONFIG/cfg.txt

    r7339 r7341  
    66GYRE_BFM OPA_SRC TOP_SRC 
    77AMM12 OPA_SRC 
    8 ORCA2_LIM_PISCES OPA_SRC LIM_SRC_2 NST_SRC TOP_SRC 
    98ORCA2_LIM3 OPA_SRC LIM_SRC_3 NST_SRC 
    109ORCA2_LIM OPA_SRC LIM_SRC_2 NST_SRC 
    1110ORCA2_OFF_PISCES OPA_SRC OFF_SRC TOP_SRC 
    1211GYRE OPA_SRC 
     12ORCA2_LIM_PISCES OPA_SRC LIM_SRC_2 NST_SRC TOP_SRC 
    1313WAD_TEST_CASES OPA_SRC 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/ice.F90

    r5341 r7341  
    234234   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   u_oce, v_oce   !: surface ocean velocity used in ice dynamics 
    235235   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ahiu , ahiv    !: hor. diffusivity coeff. at U- and V-points [m2/s] 
    236    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   pahu , pahv    !: ice hor. eddy diffusivity coef. at U- and V-points 
    237236   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ust2s, hicol   !: friction velocity, ice collection thickness accreted in leads 
    238237   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   strp1, strp2   !: strength at previous time steps 
     
    253252   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fhld        !: heat flux from the lead used for bottom melting 
    254253 
    255    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_snw    !: snow-ocean mass exchange over 1 time step [kg/m2] 
    256    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_spr    !: snow precipitation on ice over 1 time step [kg/m2] 
    257    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_sub    !: snow sublimation over 1 time step [kg/m2] 
    258  
    259    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_ice    !: ice-ocean mass exchange over 1 time step [kg/m2] 
    260    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_sni    !: snow ice growth component of wfx_ice [kg/m2] 
    261    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_opw    !: lateral ice growth component of wfx_ice [kg/m2] 
    262    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_bog    !: bottom ice growth component of wfx_ice [kg/m2] 
    263    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_dyn    !: dynamical ice growth component of wfx_ice [kg/m2] 
    264    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_bom    !: bottom melt component of wfx_ice [kg/m2] 
    265    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_sum    !: surface melt component of wfx_ice [kg/m2] 
    266    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_res    !: residual component of wfx_ice [kg/m2] 
    267  
    268    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   afx_tot     !: ice concentration tendency (total) [s-1] 
     254   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_snw    !: snow-ocean mass exchange   [kg.m-2.s-1] 
     255   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_spr    !: snow precipitation on ice  [kg.m-2.s-1] 
     256   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_sub    !: snow/ice sublimation       [kg.m-2.s-1] 
     257 
     258   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_ice    !: ice-ocean mass exchange                   [kg.m-2.s-1] 
     259   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_sni    !: snow ice growth component of wfx_ice      [kg.m-2.s-1] 
     260   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_opw    !: lateral ice growth component of wfx_ice   [kg.m-2.s-1] 
     261   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_bog    !: bottom ice growth component of wfx_ice    [kg.m-2.s-1] 
     262   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_dyn    !: dynamical ice growth component of wfx_ice [kg.m-2.s-1] 
     263   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_bom    !: bottom melt component of wfx_ice          [kg.m-2.s-1] 
     264   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_sum    !: surface melt component of wfx_ice         [kg.m-2.s-1] 
     265   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_res    !: residual component of wfx_ice             [kg.m-2.s-1] 
     266 
     267   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   afx_tot     !: ice concentration tendency (total)          [s-1] 
    269268   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   afx_thd     !: ice concentration tendency (thermodynamics) [s-1] 
    270    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   afx_dyn     !: ice concentration tendency (dynamics) [s-1] 
     269   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   afx_dyn     !: ice concentration tendency (dynamics)       [s-1] 
    271270 
    272271   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sfx_bog     !: salt flux due to ice growth/melt                      [PSU/m2/s] 
     
    279278   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sfx_res     !: residual salt flux due to correction of ice thickness [PSU/m2/s] 
    280279 
    281    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_bog     !: total heat flux causing bottom ice growth  
    282    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_bom     !: total heat flux causing bottom ice melt  
    283    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_sum     !: total heat flux causing surface ice melt  
    284    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_opw     !: total heat flux causing open water ice formation 
    285    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_dif     !: total heat flux causing Temp change in the ice  
    286    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_snw     !: heat flux for snow melt  
    287    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_err     !: heat flux error after heat diffusion  
    288    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_err_dif !: heat flux remaining due to change in non-solar flux 
    289    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_err_rem !: heat flux error after heat remapping  
    290    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_in      !: heat flux available for thermo transformations  
    291    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_out     !: heat flux remaining at the end of thermo transformations  
    292  
     280   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sfx_sub     !: salt flux due to ice sublimation 
     281 
     282   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_bog     !: total heat flux causing bottom ice growth        [W.m-2] 
     283   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_bom     !: total heat flux causing bottom ice melt          [W.m-2] 
     284   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_sum     !: total heat flux causing surface ice melt         [W.m-2] 
     285   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_opw     !: total heat flux causing open water ice formation [W.m-2] 
     286   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_dif     !: total heat flux causing Temp change in the ice   [W.m-2] 
     287   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_snw     !: heat flux for snow melt                          [W.m-2] 
     288   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_err     !: heat flux error after heat diffusion             [W.m-2] 
     289   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_err_dif !: heat flux remaining due to change in non-solar flux [W.m-2] 
     290   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_err_rem !: heat flux error after heat remapping             [W.m-2] 
     291   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_in      !: heat flux available for thermo transformations   [W.m-2] 
     292   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_out     !: heat flux remaining at the end of thermo transformations  [W.m-2] 
     293   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   wfx_err_sub !: mass flux error after sublimation [kg.m-2.s-1] 
     294    
    293295   ! heat flux associated with ice-atmosphere mass exchange 
    294    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_sub     !: heat flux for sublimation  
    295    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_spr     !: heat flux of the snow precipitation  
     296   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_sub     !: heat flux for sublimation  [W.m-2] 
     297   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_spr     !: heat flux of the snow precipitation  [W.m-2] 
    296298 
    297299   ! heat flux associated with ice-ocean mass exchange 
    298    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_thd     !: ice-ocean heat flux from thermo processes (limthd_dh)  
    299    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_dyn     !: ice-ocean heat flux from mecanical processes (limitd_me)  
    300    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_res     !: residual heat flux due to correction of ice thickness 
    301  
    302    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ftr_ice   !: transmitted solar radiation under ice 
     300   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_thd     !: ice-ocean heat flux from thermo processes (limthd_dh)  [W.m-2] 
     301   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_dyn     !: ice-ocean heat flux from mecanical processes (limitd_me)  [W.m-2] 
     302   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hfx_res     !: residual heat flux due to correction of ice thickness [W.m-2] 
     303 
     304   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ftr_ice   !: transmitted solar radiation under ice    
     305   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   pahu3D , pahv3D 
     306   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   rn_amax_2d  !: maximum ice concentration 2d array 
    303307 
    304308   !!-------------------------------------------------------------------------- 
     
    369373   !!-------------------------------------------------------------------------- 
    370374   !                                                  !!: ** Namelist namicerun read in sbc_lim_init ** 
    371    INTEGER          , PUBLIC ::   jpl             !: number of ice  categories  
    372    INTEGER          , PUBLIC ::   nlay_i          !: number of ice  layers  
    373    INTEGER          , PUBLIC ::   nlay_s          !: number of snow layers  
    374    CHARACTER(len=32), PUBLIC ::   cn_icerst_in    !: suffix of ice restart name (input) 
     375   INTEGER           , PUBLIC ::   jpl             !: number of ice  categories  
     376   INTEGER           , PUBLIC ::   nlay_i          !: number of ice  layers  
     377   INTEGER           , PUBLIC ::   nlay_s          !: number of snow layers  
     378   CHARACTER(len=32) , PUBLIC ::   cn_icerst_in    !: suffix of ice restart name (input) 
    375379   CHARACTER(len=256), PUBLIC ::   cn_icerst_indir !: ice restart input directory 
    376    CHARACTER(len=32), PUBLIC ::   cn_icerst_out   !: suffix of ice restart name (output) 
     380   CHARACTER(len=32) , PUBLIC ::   cn_icerst_out   !: suffix of ice restart name (output) 
    377381   CHARACTER(len=256), PUBLIC ::   cn_icerst_outdir!: ice restart output directory 
    378    LOGICAL          , PUBLIC ::   ln_limdyn       !: flag for ice dynamics (T) or not (F) 
    379    LOGICAL          , PUBLIC ::   ln_icectl       !: flag for sea-ice points output (T) or not (F) 
    380    REAL(wp)         , PUBLIC ::   rn_amax         !: maximum ice concentration 
    381    INTEGER          , PUBLIC ::   iiceprt         !: debug i-point 
    382    INTEGER          , PUBLIC ::   jiceprt         !: debug j-point 
     382   LOGICAL           , PUBLIC ::   ln_limdyn       !: flag for ice dynamics (T) or not (F) 
     383   LOGICAL           , PUBLIC ::   ln_icectl       !: flag for sea-ice points output (T) or not (F) 
     384   REAL(wp)          , PUBLIC ::   rn_amax_n       !: maximum ice concentration Northern hemisphere 
     385   REAL(wp)          , PUBLIC ::   rn_amax_s       !: maximum ice concentration Southern hemisphere 
     386   INTEGER           , PUBLIC ::   iiceprt         !: debug i-point 
     387   INTEGER           , PUBLIC ::   jiceprt         !: debug j-point 
    383388   ! 
    384389   !!-------------------------------------------------------------------------- 
     
    424429      ALLOCATE( u_oce    (jpi,jpj) , v_oce    (jpi,jpj) ,                           & 
    425430         &      ahiu     (jpi,jpj) , ahiv     (jpi,jpj) ,                           & 
    426          &      pahu     (jpi,jpj) , pahv     (jpi,jpj) ,                           & 
    427431         &      ust2s    (jpi,jpj) , hicol    (jpi,jpj) ,                           & 
    428432         &      strp1    (jpi,jpj) , strp2    (jpi,jpj) , strength  (jpi,jpj) ,     & 
     
    437441         &      wfx_res(jpi,jpj) , wfx_sni(jpi,jpj) , wfx_opw(jpi,jpj) , wfx_spr(jpi,jpj) ,     & 
    438442         &      afx_tot(jpi,jpj) , afx_thd(jpi,jpj),  afx_dyn(jpi,jpj) ,                        & 
    439          &      fhtur  (jpi,jpj) , ftr_ice(jpi,jpj,jpl), qlead  (jpi,jpj) ,                     & 
    440          &      sfx_res(jpi,jpj) , sfx_bri(jpi,jpj) , sfx_dyn(jpi,jpj) ,                        & 
     443         &      fhtur  (jpi,jpj) , ftr_ice(jpi,jpj,jpl), pahu3D(jpi,jpj,jpl+1), pahv3D(jpi,jpj,jpl+1),            & 
     444         &      rn_amax_2d (jpi,jpj) , qlead  (jpi,jpj) ,                                                         & 
     445         &      sfx_res(jpi,jpj) , sfx_bri(jpi,jpj) , sfx_dyn(jpi,jpj) , sfx_sub(jpi,jpj),                        & 
    441446         &      sfx_bog(jpi,jpj) , sfx_bom(jpi,jpj) , sfx_sum(jpi,jpj) , sfx_sni(jpi,jpj) , sfx_opw(jpi,jpj) ,    & 
    442447         &      hfx_res(jpi,jpj) , hfx_snw(jpi,jpj) , hfx_sub(jpi,jpj) , hfx_err(jpi,jpj) ,     &  
    443          &      hfx_err_dif(jpi,jpj) , hfx_err_rem(jpi,jpj) ,                                   & 
     448         &      hfx_err_dif(jpi,jpj) , hfx_err_rem(jpi,jpj) , wfx_err_sub(jpi,jpj) ,       & 
    444449         &      hfx_in (jpi,jpj) , hfx_out(jpi,jpj) , fhld(jpi,jpj) ,                           & 
    445450         &      hfx_sum(jpi,jpj) , hfx_bom(jpi,jpj) , hfx_bog(jpi,jpj) , hfx_dif(jpi,jpj) , hfx_opw(jpi,jpj) ,    & 
     
    508513   !!====================================================================== 
    509514END MODULE ice 
     515 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limcons.F90

    r5836 r7341  
    2424   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)   
    2525   USE sbc_oce , ONLY : sfx  ! Surface boundary condition: ocean fields 
    26  
     26   USE sbc_ice , ONLY : qevap_ice 
     27    
    2728   IMPLICIT NONE 
    2829   PRIVATE 
     
    184185         ! salt flux 
    185186         zfs_b  = glob_sum(  ( sfx_bri(:,:) + sfx_bog(:,:) + sfx_bom(:,:) + sfx_sum(:,:) + sfx_sni(:,:) +  & 
    186             &                  sfx_opw(:,:) + sfx_res(:,:) + sfx_dyn(:,:)                                  & 
     187            &                  sfx_opw(:,:) + sfx_res(:,:) + sfx_dyn(:,:) + sfx_sub(:,:)                   & 
    187188            &                ) *  e1e2t(:,:) * tmask(:,:,1) * zconv ) 
    188189 
     
    209210         ! salt flux 
    210211         zfs  = glob_sum(  ( sfx_bri(:,:) + sfx_bog(:,:) + sfx_bom(:,:) + sfx_sum(:,:) + sfx_sni(:,:) +  & 
    211             &                sfx_opw(:,:) + sfx_res(:,:) + sfx_dyn(:,:)                                  &  
     212            &                sfx_opw(:,:) + sfx_res(:,:) + sfx_dyn(:,:) + sfx_sub(:,:)                   &  
    212213            &              ) * e1e2t(:,:) * tmask(:,:,1) * zconv ) - zfs_b 
    213214 
     
    256257            ENDIF 
    257258            IF (     zvmin   < -epsi10 ) WRITE(numout,*) 'violation v_i<0  [m]          (',cd_routine,') = ',zvmin 
    258             IF (     zamax   > rn_amax+epsi10 .AND. cd_routine /= 'limtrp' .AND. cd_routine /= 'limitd_me' ) THEN 
     259            IF (     zamax   > MAX( rn_amax_n, rn_amax_s ) + epsi10 .AND. & 
     260               &                         cd_routine /= 'limtrp' .AND. cd_routine /= 'limitd_me' ) THEN 
    259261                                         WRITE(numout,*) 'violation a_i>amax            (',cd_routine,') = ',zamax 
    260262            ENDIF 
     
    286288#if ! defined key_bdy 
    287289      ! heat flux 
    288       zhfx  = glob_sum( ( hfx_in - hfx_out - diag_heat - diag_trp_ei - diag_trp_es - hfx_sub ) * e1e2t * tmask(:,:,1) * zconv )  
     290      zhfx  = glob_sum( ( hfx_in - hfx_out - diag_heat - diag_trp_ei - diag_trp_es - SUM( qevap_ice * a_i_b, dim=3 ) )  & 
     291         &              * e1e2t * tmask(:,:,1) * zconv )  
    289292      ! salt flux 
    290293      zsfx  = glob_sum( ( sfx + diag_smvi ) * e1e2t * tmask(:,:,1) * zconv ) * rday 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limdiahsb.F90

    r5836 r7341  
    5656      real(wp)   ::   zbg_ivo, zbg_svo, zbg_are, zbg_sal ,zbg_tem ,zbg_ihc ,zbg_shc 
    5757      real(wp)   ::   zbg_sfx, zbg_sfx_bri, zbg_sfx_bog, zbg_sfx_bom, zbg_sfx_sum, zbg_sfx_sni,   & 
    58       &               zbg_sfx_opw, zbg_sfx_res, zbg_sfx_dyn  
     58      &               zbg_sfx_opw, zbg_sfx_res, zbg_sfx_dyn, zbg_sfx_sub  
    5959      real(wp)   ::   zbg_vfx, zbg_vfx_bog, zbg_vfx_opw, zbg_vfx_sni, zbg_vfx_dyn 
    6060      real(wp)   ::   zbg_vfx_bom, zbg_vfx_sum, zbg_vfx_res, zbg_vfx_spr, zbg_vfx_snw, zbg_vfx_sub   
     
    111111      zbg_sfx_bom = ztmp * glob_sum( sfx_bom(:,:) * e1e2t(:,:) * tmask(:,:,1) ) 
    112112      zbg_sfx_sum = ztmp * glob_sum( sfx_sum(:,:) * e1e2t(:,:) * tmask(:,:,1) ) 
     113      zbg_sfx_sub = ztmp * glob_sum( sfx_sub(:,:) * e1e2t(:,:) * tmask(:,:,1) ) 
    113114 
    114115      ! Heat budget 
    115       zbg_ihc      = glob_sum( et_i(:,:) * e1e2t(:,:) ) * 1.e-20 ! ice heat content  [1.e20 J] 
    116       zbg_shc      = glob_sum( et_s(:,:) * e1e2t(:,:) ) * 1.e-20 ! snow heat content [1.e20 J] 
     116      zbg_ihc      = glob_sum( et_i(:,:) * e1e2t(:,:) * 1.e-20 ) ! ice heat content  [1.e20 J] 
     117      zbg_shc      = glob_sum( et_s(:,:) * e1e2t(:,:) * 1.e-20 ) ! snow heat content [1.e20 J] 
    117118      zbg_hfx_dhc  = glob_sum( diag_heat(:,:) * e1e2t(:,:) * tmask(:,:,1) ) ! [in W] 
    118119      zbg_hfx_spr  = glob_sum( hfx_spr(:,:) * e1e2t(:,:) * tmask(:,:,1) ) ! [in W] 
     
    189190      CALL iom_put( 'ibgsfxbom' , zbg_sfx_bom                              )   ! salt flux bottom melt       - 
    190191      CALL iom_put( 'ibgsfxsum' , zbg_sfx_sum                              )   ! salt flux surface melt      - 
     192      CALL iom_put( 'ibgsfxsub' , zbg_sfx_sub                              )   ! salt flux sublimation      - 
    191193 
    192194      CALL iom_put( 'ibghfxdhc' , zbg_hfx_dhc                              )   ! Heat content variation in snow and ice [W] 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limhdf.F90

    r5836 r7341  
    77   !!             -   !  2001-05 (G. Madec, R. Hordoir) opa norm 
    88   !!            1.0  !  2002-08 (C. Ethe)  F90, free form 
     9   !!            3.0  !  2015-08 (O. Tintó and M. Castrillo)  added lim_hdf (multiple) 
    910   !!---------------------------------------------------------------------- 
    1011#if defined key_lim3 
     
    2728   PRIVATE 
    2829 
    29    PUBLIC   lim_hdf         ! called by lim_trp 
     30   PUBLIC   lim_hdf ! called by lim_trp 
    3031   PUBLIC   lim_hdf_init    ! called by sbc_lim_init 
    3132 
     
    4344CONTAINS 
    4445 
    45    SUBROUTINE lim_hdf( ptab ) 
     46   SUBROUTINE lim_hdf( ptab , ihdf_vars , jpl , nlay_i ) 
    4647      !!------------------------------------------------------------------- 
    4748      !!                  ***  ROUTINE lim_hdf  *** 
     
    5455      !! ** Action  :    update ptab with the diffusive contribution 
    5556      !!------------------------------------------------------------------- 
    56       REAL(wp), DIMENSION(jpi,jpj), INTENT( inout ) ::   ptab    ! Field on which the diffusion is applied 
    57       ! 
    58       INTEGER                           ::  ji, jj                    ! dummy loop indices 
     57      INTEGER                           :: jpl, nlay_i, isize, ihdf_vars 
     58      REAL(wp),  DIMENSION(:,:,:), INTENT( inout ),TARGET ::   ptab    ! Field on which the diffusion is applied 
     59      ! 
     60      INTEGER                           ::  ji, jj, jk, jl , jm               ! dummy loop indices 
    5961      INTEGER                           ::  iter, ierr           ! local integers 
    60       REAL(wp)                          ::  zrlxint, zconv     ! local scalars 
    61       REAL(wp), POINTER, DIMENSION(:,:) ::  zrlx, zflu, zflv, zdiv0, zdiv, ztab0 
     62      REAL(wp)                          ::  zrlxint     ! local scalars 
     63      REAL(wp), POINTER , DIMENSION ( : )        :: zconv     ! local scalars 
     64      REAL(wp), POINTER , DIMENSION(:,:,:) ::  zrlx,zdiv0, ztab0 
     65      REAL(wp), POINTER , DIMENSION(:,:) ::  zflu, zflv, zdiv 
    6266      CHARACTER(lc)                     ::  charout                   ! local character 
    6367      REAL(wp), PARAMETER               ::  zrelax = 0.5_wp           ! relaxation constant for iterative procedure 
     
    6569      INTEGER , PARAMETER               ::  its    = 100              ! Maximum number of iteration 
    6670      !!------------------------------------------------------------------- 
     71      TYPE(arrayptr)   , ALLOCATABLE, DIMENSION(:) ::   pt2d_array, zrlx_array 
     72      CHARACTER(len=1) , ALLOCATABLE, DIMENSION(:) ::   type_array ! define the nature of ptab array grid-points 
     73      !                                                            ! = T , U , V , F , W and I points 
     74      REAL(wp)        , ALLOCATABLE, DIMENSION(:)  ::   psgn_array    ! =-1 the sign change across the north fold boundary 
     75 
     76     !!---------------------------------------------------------------------  
     77 
     78      !                       !==  Initialisation  ==! 
     79      ! +1 open water diffusion 
     80      isize = jpl*(ihdf_vars+nlay_i)+1 
     81      ALLOCATE( zconv (isize) ) 
     82      ALLOCATE( pt2d_array(isize) , zrlx_array(isize) ) 
     83      ALLOCATE( type_array(isize) ) 
     84      ALLOCATE( psgn_array(isize) ) 
    6785       
    68       CALL wrk_alloc( jpi, jpj, zrlx, zflu, zflv, zdiv0, zdiv, ztab0 ) 
    69  
    70       !                       !==  Initialisation  ==! 
     86      CALL wrk_alloc( jpi, jpj, isize, zrlx, zdiv0, ztab0 ) 
     87      CALL wrk_alloc( jpi, jpj, zflu, zflv, zdiv ) 
     88 
     89      DO jk= 1 , isize 
     90         pt2d_array(jk)%pt2d=>ptab(:,:,jk) 
     91         zrlx_array(jk)%pt2d=>zrlx(:,:,jk) 
     92         type_array(jk)='T' 
     93         psgn_array(jk)=1. 
     94      END DO 
     95 
    7196      ! 
    7297      IF( linit ) THEN              ! Metric coefficient (compute at the first call and saved in efact) 
     
    7499         IF( lk_mpp    )   CALL mpp_sum( ierr ) 
    75100         IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'lim_hdf : unable to allocate arrays' ) 
    76          DO jj = 2, jpjm1   
     101         DO jj = 2, jpjm1 
    77102            DO ji = fs_2 , fs_jpim1   ! vector opt. 
    78103               efact(ji,jj) = ( e2u(ji,jj) + e2u(ji-1,jj) + e1v(ji,jj) + e1v(ji,jj-1) ) * r1_e1e2t(ji,jj) 
     
    83108      !                             ! Time integration parameters 
    84109      ! 
    85       ztab0(:, : ) = ptab(:,:)      ! Arrays initialization 
    86       zdiv0(:, 1 ) = 0._wp 
    87       zdiv0(:,jpj) = 0._wp 
    88       zflu (jpi,:) = 0._wp    
    89       zflv (jpi,:) = 0._wp 
    90       zdiv0(1,  :) = 0._wp 
    91       zdiv0(jpi,:) = 0._wp 
     110      zflu (jpi,: ) = 0._wp 
     111      zflv (jpi,: ) = 0._wp 
     112 
     113      DO jk=1 , isize 
     114         ztab0(:, : , jk ) = ptab(:,:,jk)      ! Arrays initialization 
     115         zdiv0(:, 1 , jk ) = 0._wp 
     116         zdiv0(:,jpj, jk ) = 0._wp 
     117         zdiv0(1,  :, jk ) = 0._wp 
     118         zdiv0(jpi,:, jk ) = 0._wp 
     119      END DO 
    92120 
    93121      zconv = 1._wp           !==  horizontal diffusion using a Crant-Nicholson scheme  ==! 
    94122      iter  = 0 
    95123      ! 
    96       DO WHILE( zconv > ( 2._wp * 1.e-04 ) .AND. iter <= its )   ! Sub-time step loop 
     124      DO WHILE( MAXVAL(zconv(:)) > ( 2._wp * 1.e-04 ) .AND. iter <= its )   ! Sub-time step loop 
    97125         ! 
    98126         iter = iter + 1                                 ! incrementation of the sub-time step number 
    99127         ! 
     128         DO jk = 1 , isize 
     129            jl = (jk-1) /( ihdf_vars+nlay_i)+1 
     130            IF (zconv(jk) > ( 2._wp * 1.e-04 )) THEN 
     131               DO jj = 1, jpjm1                                ! diffusive fluxes in U- and V- direction 
     132                  DO ji = 1 , fs_jpim1   ! vector opt. 
     133                     zflu(ji,jj) = pahu3D(ji,jj,jl) * e2u(ji,jj) * r1_e1u(ji,jj) * ( ptab(ji+1,jj,jk) - ptab(ji,jj,jk) ) 
     134                     zflv(ji,jj) = pahv3D(ji,jj,jl) * e1v(ji,jj) * r1_e2v(ji,jj) * ( ptab(ji,jj+1,jk) - ptab(ji,jj,jk) ) 
     135                  END DO 
     136               END DO 
     137               ! 
     138               DO jj= 2, jpjm1                                 ! diffusive trend : divergence of the fluxes 
     139                  DO ji = fs_2 , fs_jpim1   ! vector opt.  
     140                     zdiv(ji,jj) = ( zflu(ji,jj) - zflu(ji-1,jj) + zflv(ji,jj) - zflv(ji,jj-1) ) * r1_e1e2t(ji,jj) 
     141                  END DO 
     142               END DO 
     143               ! 
     144               IF( iter == 1 )   zdiv0(:,:,jk) = zdiv(:,:)        ! save the 1st evaluation of the diffusive trend in zdiv0 
     145               ! 
     146               DO jj = 2, jpjm1                                ! iterative evaluation 
     147                  DO ji = fs_2 , fs_jpim1   ! vector opt. 
     148                     zrlxint = (   ztab0(ji,jj,jk)    & 
     149                        &       +  rdt_ice * (           zalfa   * ( zdiv(ji,jj) + efact(ji,jj) * ptab(ji,jj,jk) )   & 
     150                        &                      + ( 1.0 - zalfa ) *   zdiv0(ji,jj,jk) )                               & 
     151                        &      ) / ( 1.0 + zalfa * rdt_ice * efact(ji,jj) ) 
     152                     zrlx(ji,jj,jk) = ptab(ji,jj,jk) + zrelax * ( zrlxint - ptab(ji,jj,jk) ) 
     153                  END DO 
     154               END DO 
     155            END IF 
     156 
     157         END DO 
     158 
     159         CALL lbc_lnk_multi( zrlx_array, type_array , psgn_array , isize ) ! Multiple interchange of all the variables 
     160         ! 
     161         IF ( MOD( iter-1 , nn_convfrq ) == 0 )  THEN   !Convergence test every nn_convfrq iterations (perf. optimization )  
     162            DO jk=1,isize 
     163               zconv(jk) = 0._wp                                   ! convergence test 
     164               DO jj = 2, jpjm1 
     165                  DO ji = fs_2, fs_jpim1 
     166                     zconv(jk) = MAX( zconv(jk), ABS( zrlx(ji,jj,jk) - ptab(ji,jj,jk) )  ) 
     167                  END DO 
     168               END DO 
     169            END DO 
     170            IF( lk_mpp ) CALL mpp_max_multiple( zconv , isize )            ! max over the global domain for all the variables 
     171         ENDIF 
     172         ! 
     173         DO jk=1,isize 
     174            ptab(:,:,jk) = zrlx(:,:,jk) 
     175         END DO 
     176         ! 
     177      END DO                                       ! end of sub-time step loop 
     178 
     179     ! ----------------------- 
     180      !!! final step (clem) !!! 
     181      DO jk = 1, isize 
     182         jl = (jk-1) /( ihdf_vars+nlay_i)+1 
    100183         DO jj = 1, jpjm1                                ! diffusive fluxes in U- and V- direction 
    101184            DO ji = 1 , fs_jpim1   ! vector opt. 
    102                zflu(ji,jj) = pahu(ji,jj) * e2u(ji,jj) * r1_e1u(ji,jj) * ( ptab(ji+1,jj) - ptab(ji,jj) ) 
    103                zflv(ji,jj) = pahv(ji,jj) * e1v(ji,jj) * r1_e2v(ji,jj) * ( ptab(ji,jj+1) - ptab(ji,jj) ) 
     185               zflu(ji,jj) = pahu3D(ji,jj,jl) * e2u(ji,jj) * r1_e1u(ji,jj) * ( ptab(ji+1,jj,jk) - ptab(ji,jj,jk) ) 
     186               zflv(ji,jj) = pahv3D(ji,jj,jl) * e1v(ji,jj) * r1_e2v(ji,jj) * ( ptab(ji,jj+1,jk) - ptab(ji,jj,jk) ) 
    104187            END DO 
    105188         END DO 
     
    108191            DO ji = fs_2 , fs_jpim1   ! vector opt.  
    109192               zdiv(ji,jj) = ( zflu(ji,jj) - zflu(ji-1,jj) + zflv(ji,jj) - zflv(ji,jj-1) ) * r1_e1e2t(ji,jj) 
    110             END DO 
    111          END DO 
    112          ! 
    113          IF( iter == 1 )   zdiv0(:,:) = zdiv(:,:)        ! save the 1st evaluation of the diffusive trend in zdiv0 
    114          ! 
    115          DO jj = 2, jpjm1                                ! iterative evaluation 
    116             DO ji = fs_2 , fs_jpim1   ! vector opt. 
    117                zrlxint = (   ztab0(ji,jj)    & 
    118                   &       +  rdt_ice * (           zalfa   * ( zdiv(ji,jj) + efact(ji,jj) * ptab(ji,jj) )   & 
    119                   &                      + ( 1.0 - zalfa ) *   zdiv0(ji,jj) )                               &  
    120                   &      ) / ( 1.0 + zalfa * rdt_ice * efact(ji,jj) ) 
    121                zrlx(ji,jj) = ptab(ji,jj) + zrelax * ( zrlxint - ptab(ji,jj) ) 
    122             END DO 
    123          END DO 
    124          CALL lbc_lnk( zrlx, 'T', 1. )                   ! lateral boundary condition 
    125          ! 
    126          IF ( MOD( iter, nn_convfrq ) == 0 )  THEN    ! convergence test every nn_convfrq iterations (perf. optimization) 
    127             zconv = 0._wp 
    128             DO jj = 2, jpjm1 
    129                DO ji = fs_2, fs_jpim1 
    130                   zconv = MAX( zconv, ABS( zrlx(ji,jj) - ptab(ji,jj) )  ) 
    131                END DO 
    132             END DO 
    133             IF( lk_mpp )   CALL mpp_max( zconv )      ! max over the global domain 
    134          ENDIF 
    135          ! 
    136          ptab(:,:) = zrlx(:,:) 
    137          ! 
    138       END DO                                       ! end of sub-time step loop 
    139  
    140       ! ----------------------- 
    141       !!! final step (clem) !!! 
    142       DO jj = 1, jpjm1                                ! diffusive fluxes in U- and V- direction 
    143          DO ji = 1 , fs_jpim1   ! vector opt. 
    144             zflu(ji,jj) = pahu(ji,jj) * e2u(ji,jj) * r1_e1u(ji,jj) * ( ptab(ji+1,jj) - ptab(ji,jj) ) 
    145             zflv(ji,jj) = pahv(ji,jj) * e1v(ji,jj) * r1_e2v(ji,jj) * ( ptab(ji,jj+1) - ptab(ji,jj) ) 
     193               ptab(ji,jj,jk) = ztab0(ji,jj,jk) + 0.5 * ( zdiv(ji,jj) + zdiv0(ji,jj,jk) ) 
     194            END DO 
    146195         END DO 
    147196      END DO 
    148       ! 
    149       DO jj= 2, jpjm1                                 ! diffusive trend : divergence of the fluxes 
    150          DO ji = fs_2 , fs_jpim1   ! vector opt.  
    151             zdiv(ji,jj) = ( zflu(ji,jj) - zflu(ji-1,jj) + zflv(ji,jj) - zflv(ji,jj-1) ) * r1_e1e2t(ji,jj) 
    152             ptab(ji,jj) = ztab0(ji,jj) + 0.5 * ( zdiv(ji,jj) + zdiv0(ji,jj) ) 
    153          END DO 
    154       END DO 
    155       CALL lbc_lnk( ptab, 'T', 1. )                   ! lateral boundary condition 
     197 
     198      CALL lbc_lnk_multi( pt2d_array, type_array , psgn_array , isize ) ! Multiple interchange of all the variables 
     199 
    156200      !!! final step (clem) !!! 
    157201      ! ----------------------- 
    158202 
    159203      IF(ln_ctl)   THEN 
    160          zrlx(:,:) = ptab(:,:) - ztab0(:,:) 
    161          WRITE(charout,FMT="(' lim_hdf  : zconv =',D23.16, ' iter =',I4,2X)") zconv, iter 
    162          CALL prt_ctl( tab2d_1=zrlx, clinfo1=charout ) 
    163       ENDIF 
    164       ! 
    165       CALL wrk_dealloc( jpi, jpj, zrlx, zflu, zflv, zdiv0, zdiv, ztab0 ) 
     204         DO jk = 1 , isize 
     205            zrlx(:,:,jk) = ptab(:,:,jk) - ztab0(:,:,jk) 
     206            WRITE(charout,FMT="(' lim_hdf  : zconv =',D23.16, ' iter =',I4,2X)") zconv, iter 
     207            CALL prt_ctl( tab2d_1=zrlx(:,:,jk), clinfo1=charout ) 
     208         END DO 
     209      ENDIF 
     210      ! 
     211      CALL wrk_dealloc( jpi, jpj, isize, zrlx, zdiv0, ztab0 ) 
     212      CALL wrk_dealloc( jpi, jpj, zflu, zflv, zdiv ) 
     213 
     214      DEALLOCATE( zconv ) 
     215      DEALLOCATE( pt2d_array , zrlx_array ) 
     216      DEALLOCATE( type_array ) 
     217      DEALLOCATE( psgn_array ) 
    166218      ! 
    167219   END SUBROUTINE lim_hdf 
     220 
    168221 
    169222    
     
    179232      !!------------------------------------------------------------------- 
    180233      INTEGER  ::   ios                 ! Local integer output status for namelist read 
    181       NAMELIST/namicehdf/ nn_convfrq 
     234      NAMELIST/namicehdf/ nn_convfrq  
    182235      !!------------------------------------------------------------------- 
    183236      ! 
     
    212265   !!====================================================================== 
    213266END MODULE limhdf 
     267 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90

    r6140 r7341  
    2424   USE par_oce          ! ocean parameters 
    2525   USE dom_ice          ! sea-ice domain 
     26   USE limvar           ! lim_var_salprof 
    2627   USE in_out_manager   ! I/O manager 
    2728   USE lib_mpp          ! MPP library 
     
    277278                           ztest_1 = 1 
    278279                        ELSE  
    279                           !this write is useful 
    280                           IF(lwp)  WRITE(numout,*) ' * TEST1 AREA NOT CONSERVED *** zA_cons = ', zA_cons,' zat_i_ini = ',zat_i_ini(ji,jj)  
    281280                          ztest_1 = 0 
    282281                        ENDIF 
     
    289288                           ztest_2 = 1 
    290289                        ELSE 
    291                            !this write is useful 
    292                            IF(lwp)  WRITE(numout,*) ' * TEST2 VOLUME NOT CONSERVED *** zV_cons = ', zV_cons, & 
    293                                                     ' zvt_i_ini = ', zvt_i_ini(ji,jj) 
    294290                           ztest_2 = 0 
    295291                        ENDIF 
     
    299295                           ztest_3 = 1 
    300296                        ELSE 
    301                            ! this write is useful 
    302                            IF(lwp) WRITE(numout,*) ' * TEST 3 THICKNESS OF THE LAST CATEGORY OUT OF BOUNDS *** zh_i_ini(ji,jj,i_fill) = ', & 
    303                            zh_i_ini(ji,jj,i_fill), ' hi_max(jpl-1) = ', hi_max(i_fill-1) 
    304                            IF(lwp) WRITE(numout,*) ' ji,jj,i_fill ',ji,jj,i_fill 
    305                            IF(lwp) WRITE(numout,*) 'zht_i_ini ',zht_i_ini(ji,jj) 
    306297                           ztest_3 = 0 
    307298                        ENDIF 
     
    311302                        DO jl = 1, jpl 
    312303                           IF ( za_i_ini(ji,jj,jl) .LT. 0._wp ) THEN  
    313                               ! this write is useful 
    314                               IF(lwp) WRITE(numout,*) ' * TEST 4 POSITIVITY NOT OK FOR CAT ', jl, ' WITH A = ', za_i_ini(ji,jj,jl) 
    315304                              ztest_4 = 0 
    316305                           ENDIF 
     
    379368         END DO 
    380369 
     370         ! for constant salinity in time 
     371         IF( nn_icesal == 1 .OR. nn_icesal == 3 )  THEN 
     372            CALL lim_var_salprof 
     373            smv_i = sm_i * v_i 
     374         ENDIF 
     375          
    381376         ! Snow temperature and heat content 
    382377         DO jk = 1, nlay_s 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limitd_me.F90

    r5836 r7341  
    4545   REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   asum     ! sum of total ice and open water area 
    4646   REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   aksum    ! ratio of area removed to area ridged 
    47    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   athorn   ! participation function; fraction of ridging/ 
    48    !                                                     ! closing associated w/ category n 
     47   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   athorn   ! participation function; fraction of ridging/closing associated w/ category n 
    4948   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   hrmin    ! minimum ridge thickness 
    5049   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   hrmax    ! maximum ridge thickness 
    5150   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   hraft    ! thickness of rafted ice 
    52    REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   krdg     ! mean ridge thickness/thickness of ridging ice  
     51   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   krdg     ! thickness of ridging ice / mean ridge thickness 
    5352   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   aridge   ! participating ice ridging 
    5453   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   araft    ! participating ice rafting 
    5554 
    5655   REAL(wp), PARAMETER ::   krdgmin = 1.1_wp    ! min ridge thickness multiplier 
    57    REAL(wp), PARAMETER ::   kraft   = 2.0_wp    ! rafting multipliyer 
    58    REAL(wp), PARAMETER ::   kamax   = 1.0_wp    ! max of ice area authorized (clem: scheme is not stable if kamax <= 0.99) 
     56   REAL(wp), PARAMETER ::   kraft   = 0.5_wp    ! rafting multipliyer 
    5957 
    6058   REAL(wp) ::   Cp                             !  
    6159   ! 
    62    !----------------------------------------------------------------------- 
    63    ! Ridging diagnostic arrays for history files 
    64    !----------------------------------------------------------------------- 
    65    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   dardg1dt   ! rate of fractional area loss by ridging ice (1/s) 
    66    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   dardg2dt   ! rate of fractional area gain by new ridges (1/s) 
    67    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   dvirdgdt   ! rate of ice volume ridged (m/s) 
    68    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   opening    ! rate of opening due to divergence/shear (1/s) 
    6960   ! 
    7061   !!---------------------------------------------------------------------- 
     
    8374         &      asum (jpi,jpj)     , athorn(jpi,jpj,0:jpl)                    ,     & 
    8475         &      aksum(jpi,jpj)                                                ,     & 
    85          ! 
    8676         &      hrmin(jpi,jpj,jpl) , hraft(jpi,jpj,jpl) , aridge(jpi,jpj,jpl) ,     & 
    87          &      hrmax(jpi,jpj,jpl) , krdg (jpi,jpj,jpl) , araft (jpi,jpj,jpl) ,     & 
    88          ! 
    89          !* Ridging diagnostic arrays for history files 
    90          &      dardg1dt(jpi,jpj)  , dardg2dt(jpi,jpj)                        ,     &  
    91          &      dvirdgdt(jpi,jpj)  , opening(jpi,jpj)                         , STAT=lim_itd_me_alloc ) 
     77         &      hrmax(jpi,jpj,jpl) , krdg (jpi,jpj,jpl) , araft (jpi,jpj,jpl) , STAT=lim_itd_me_alloc ) 
    9278         ! 
    9379      IF( lim_itd_me_alloc /= 0 )   CALL ctl_warn( 'lim_itd_me_alloc: failed to allocate arrays' ) 
     
    132118      REAL(wp), POINTER, DIMENSION(:,:)   ::   opning          ! rate of opening due to divergence/shear 
    133119      REAL(wp), POINTER, DIMENSION(:,:)   ::   closing_gross   ! rate at which area removed, not counting area of new ridges 
    134       REAL(wp), POINTER, DIMENSION(:,:)   ::   msnow_mlt       ! mass of snow added to ocean (kg m-2) 
    135       REAL(wp), POINTER, DIMENSION(:,:)   ::   esnow_mlt       ! energy needed to melt snow in ocean (J m-2) 
    136       REAL(wp), POINTER, DIMENSION(:,:)   ::   vt_i_init, vt_i_final  !  ice volume summed over categories 
    137120      ! 
    138121      INTEGER, PARAMETER ::   nitermax = 20     
     
    142125      IF( nn_timing == 1 )  CALL timing_start('limitd_me') 
    143126 
    144       CALL wrk_alloc( jpi,jpj, closing_net, divu_adv, opning, closing_gross, msnow_mlt, esnow_mlt, vt_i_init, vt_i_final ) 
     127      CALL wrk_alloc( jpi,jpj, closing_net, divu_adv, opning, closing_gross ) 
    145128 
    146129      IF(ln_ctl) THEN 
     
    154137      IF( ln_limdiahsb ) CALL lim_cons_hsm(0, 'limitd_me', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b) 
    155138 
    156       CALL lim_var_zapsmall 
    157       CALL lim_var_glo2eqv            ! equivalent variables, requested for rafting 
    158  
    159139      !-----------------------------------------------------------------------------! 
    160140      ! 1) Thickness categories boundaries, ice / o.w. concentrations, init_ons 
     
    164144      CALL lim_itd_me_ridgeprep                                    ! prepare ridging 
    165145      ! 
    166       IF( con_i)   CALL lim_column_sum( jpl, v_i, vt_i_init )      ! conservation check 
    167146 
    168147      DO jj = 1, jpj                                     ! Initialize arrays. 
    169148         DO ji = 1, jpi 
    170             msnow_mlt(ji,jj) = 0._wp 
    171             esnow_mlt(ji,jj) = 0._wp 
    172             dardg1dt (ji,jj) = 0._wp 
    173             dardg2dt (ji,jj) = 0._wp 
    174             dvirdgdt (ji,jj) = 0._wp 
    175             opening  (ji,jj) = 0._wp 
    176149 
    177150            !-----------------------------------------------------------------------------! 
     
    204177            ! If divu_adv < 0, make sure the closing rate is large enough 
    205178            ! to give asum = 1.0 after ridging. 
    206  
    207             divu_adv(ji,jj) = ( kamax - asum(ji,jj) ) * r1_rdtice  ! asum found in ridgeprep 
     179             
     180            divu_adv(ji,jj) = ( 1._wp - asum(ji,jj) ) * r1_rdtice  ! asum found in ridgeprep 
    208181 
    209182            IF( divu_adv(ji,jj) < 0._wp )   closing_net(ji,jj) = MAX( closing_net(ji,jj), -divu_adv(ji,jj) ) 
     
    224197      DO WHILE ( iterate_ridging > 0 .AND. niter < nitermax ) 
    225198 
     199         ! 3.2 closing_gross 
     200         !-----------------------------------------------------------------------------! 
     201         ! Based on the ITD of ridging and ridged ice, convert the net 
     202         !  closing rate to a gross closing rate.   
     203         ! NOTE: 0 < aksum <= 1 
     204         closing_gross(:,:) = closing_net(:,:) / aksum(:,:) 
     205 
     206         ! correction to closing rate and opening if closing rate is excessive 
     207         !--------------------------------------------------------------------- 
     208         ! Reduce the closing rate if more than 100% of the open water  
     209         ! would be removed.  Reduce the opening rate proportionately. 
    226210         DO jj = 1, jpj 
    227211            DO ji = 1, jpi 
    228  
    229                ! 3.2 closing_gross 
    230                !-----------------------------------------------------------------------------! 
    231                ! Based on the ITD of ridging and ridged ice, convert the net 
    232                !  closing rate to a gross closing rate.   
    233                ! NOTE: 0 < aksum <= 1 
    234                closing_gross(ji,jj) = closing_net(ji,jj) / aksum(ji,jj) 
    235  
    236                ! correction to closing rate and opening if closing rate is excessive 
    237                !--------------------------------------------------------------------- 
    238                ! Reduce the closing rate if more than 100% of the open water  
    239                ! would be removed.  Reduce the opening rate proportionately. 
    240                za   = athorn(ji,jj,0) * closing_gross(ji,jj) * rdt_ice 
    241                IF( za > epsi20 ) THEN 
    242                   zfac = MIN( 1._wp, ato_i(ji,jj) / za ) 
    243                   closing_gross(ji,jj) = closing_gross(ji,jj) * zfac 
    244                   opning       (ji,jj) = opning       (ji,jj) * zfac 
     212               za   = ( opning(ji,jj) - athorn(ji,jj,0) * closing_gross(ji,jj) ) * rdt_ice 
     213               IF( za < 0._wp .AND. za > - ato_i(ji,jj) ) THEN  ! would lead to negative ato_i 
     214                  zfac = - ato_i(ji,jj) / za 
     215                  opning(ji,jj) = athorn(ji,jj,0) * closing_gross(ji,jj) - ato_i(ji,jj) * r1_rdtice  
     216               ELSEIF( za > 0._wp .AND. za > ( asum(ji,jj) - ato_i(ji,jj) ) ) THEN  ! would lead to ato_i > asum 
     217                  zfac = ( asum(ji,jj) - ato_i(ji,jj) ) / za 
     218                  opning(ji,jj) = athorn(ji,jj,0) * closing_gross(ji,jj) + ( asum(ji,jj) - ato_i(ji,jj) ) * r1_rdtice  
    245219               ENDIF 
    246  
    247220            END DO 
    248221         END DO 
     
    256229               DO ji = 1, jpi 
    257230                  za = athorn(ji,jj,jl) * closing_gross(ji,jj) * rdt_ice 
    258                   IF( za  >  epsi20 ) THEN 
    259                      zfac = MIN( 1._wp, a_i(ji,jj,jl) / za ) 
     231                  IF( za  >  a_i(ji,jj,jl) ) THEN 
     232                     zfac = a_i(ji,jj,jl) / za 
    260233                     closing_gross(ji,jj) = closing_gross(ji,jj) * zfac 
    261                      opning       (ji,jj) = opning       (ji,jj) * zfac 
    262234                  ENDIF 
    263235               END DO 
     
    268240         !-----------------------------------------------------------------------------! 
    269241 
    270          CALL lim_itd_me_ridgeshift( opning, closing_gross, msnow_mlt, esnow_mlt ) 
    271  
     242         CALL lim_itd_me_ridgeshift( opning, closing_gross ) 
     243 
     244          
    272245         ! 3.4 Compute total area of ice plus open water after ridging. 
    273246         !-----------------------------------------------------------------------------! 
    274247         ! This is in general not equal to one because of divergence during transport 
    275          asum(:,:) = ato_i(:,:) 
    276          DO jl = 1, jpl 
    277             asum(:,:) = asum(:,:) + a_i(:,:,jl) 
    278          END DO 
     248         asum(:,:) = ato_i(:,:) + SUM( a_i, dim=3 ) 
    279249 
    280250         ! 3.5 Do we keep on iterating ??? 
     
    284254 
    285255         iterate_ridging = 0 
    286  
    287256         DO jj = 1, jpj 
    288257            DO ji = 1, jpi 
    289                IF (ABS(asum(ji,jj) - kamax ) < epsi10) THEN 
     258               IF( ABS( asum(ji,jj) - 1._wp ) < epsi10 ) THEN 
    290259                  closing_net(ji,jj) = 0._wp 
    291260                  opning     (ji,jj) = 0._wp 
    292261               ELSE 
    293262                  iterate_ridging    = 1 
    294                   divu_adv   (ji,jj) = ( kamax - asum(ji,jj) ) * r1_rdtice 
     263                  divu_adv   (ji,jj) = ( 1._wp - asum(ji,jj) ) * r1_rdtice 
    295264                  closing_net(ji,jj) = MAX( 0._wp, -divu_adv(ji,jj) ) 
    296265                  opning     (ji,jj) = MAX( 0._wp,  divu_adv(ji,jj) ) 
     
    309278 
    310279         IF( iterate_ridging == 1 ) THEN 
     280            CALL lim_itd_me_ridgeprep 
    311281            IF( niter  >  nitermax ) THEN 
    312282               WRITE(numout,*) ' ALERTE : non-converging ridging scheme ' 
    313283               WRITE(numout,*) ' niter, iterate_ridging ', niter, iterate_ridging 
    314284            ENDIF 
    315             CALL lim_itd_me_ridgeprep 
    316285         ENDIF 
    317286 
    318287      END DO !! on the do while over iter 
    319  
    320       !-----------------------------------------------------------------------------! 
    321       ! 4) Ridging diagnostics 
    322       !-----------------------------------------------------------------------------! 
    323       ! Convert ridging rate diagnostics to correct units. 
    324       ! Update fresh water and heat fluxes due to snow melt. 
    325       DO jj = 1, jpj 
    326          DO ji = 1, jpi 
    327  
    328             dardg1dt(ji,jj) = dardg1dt(ji,jj) * r1_rdtice 
    329             dardg2dt(ji,jj) = dardg2dt(ji,jj) * r1_rdtice 
    330             dvirdgdt(ji,jj) = dvirdgdt(ji,jj) * r1_rdtice 
    331             opening (ji,jj) = opening (ji,jj) * r1_rdtice 
    332  
    333             !-----------------------------------------------------------------------------! 
    334             ! 5) Heat, salt and freshwater fluxes 
    335             !-----------------------------------------------------------------------------! 
    336             wfx_snw(ji,jj) = wfx_snw(ji,jj) + msnow_mlt(ji,jj) * r1_rdtice     ! fresh water source for ocean 
    337             hfx_dyn(ji,jj) = hfx_dyn(ji,jj) + esnow_mlt(ji,jj) * r1_rdtice     ! heat sink for ocean (<0, W.m-2) 
    338  
    339          END DO 
    340       END DO 
    341  
    342       ! Check if there is a ridging error 
    343       IF( lwp ) THEN 
    344          DO jj = 1, jpj 
    345             DO ji = 1, jpi 
    346                IF( ABS( asum(ji,jj) - kamax)  >  epsi10 ) THEN   ! there is a bug 
    347                   WRITE(numout,*) ' ' 
    348                   WRITE(numout,*) ' ALERTE : Ridging error: total area = ', asum(ji,jj) 
    349                   WRITE(numout,*) ' limitd_me ' 
    350                   WRITE(numout,*) ' POINT : ', ji, jj 
    351                   WRITE(numout,*) ' jpl, a_i, athorn ' 
    352                   WRITE(numout,*) 0, ato_i(ji,jj), athorn(ji,jj,0) 
    353                   DO jl = 1, jpl 
    354                      WRITE(numout,*) jl, a_i(ji,jj,jl), athorn(ji,jj,jl) 
    355                   END DO 
    356                ENDIF 
    357             END DO 
    358          END DO 
    359       END IF 
    360  
    361       ! Conservation check 
    362       IF ( con_i ) THEN 
    363          CALL lim_column_sum (jpl,   v_i, vt_i_final) 
    364          fieldid = ' v_i : limitd_me ' 
    365          CALL lim_cons_check (vt_i_init, vt_i_final, 1.0e-6, fieldid)  
    366       ENDIF 
    367288 
    368289      CALL lim_var_agg( 1 )  
     
    377298         CALL prt_ctl_info(' - Cell values : ') 
    378299         CALL prt_ctl_info('   ~~~~~~~~~~~~~ ') 
    379          CALL prt_ctl(tab2d_1=e1e2t, clinfo1=' lim_itd_me  : cell area :') 
     300         CALL prt_ctl(tab2d_1=e1e2t , clinfo1=' lim_itd_me  : cell area :') 
    380301         CALL prt_ctl(tab2d_1=at_i , clinfo1=' lim_itd_me  : at_i      :') 
    381302         CALL prt_ctl(tab2d_1=vt_i , clinfo1=' lim_itd_me  : vt_i      :') 
     
    410331      ENDIF  ! ln_limdyn=.true. 
    411332      ! 
    412       CALL wrk_dealloc( jpi, jpj, closing_net, divu_adv, opning, closing_gross, msnow_mlt, esnow_mlt, vt_i_init, vt_i_final ) 
     333      CALL wrk_dealloc( jpi, jpj, closing_net, divu_adv, opning, closing_gross ) 
    413334      ! 
    414335      IF( nn_timing == 1 )  CALL timing_stop('limitd_me') 
    415336   END SUBROUTINE lim_itd_me 
    416337 
     338   SUBROUTINE lim_itd_me_ridgeprep 
     339      !!---------------------------------------------------------------------! 
     340      !!                ***  ROUTINE lim_itd_me_ridgeprep *** 
     341      !! 
     342      !! ** Purpose :   preparation for ridging and strength calculations 
     343      !! 
     344      !! ** Method  :   Compute the thickness distribution of the ice and open water  
     345      !!              participating in ridging and of the resulting ridges. 
     346      !!---------------------------------------------------------------------! 
     347      INTEGER ::   ji,jj, jl    ! dummy loop indices 
     348      REAL(wp) ::   Gstari, astari, hrmean, zdummy   ! local scalar 
     349      REAL(wp), POINTER, DIMENSION(:,:,:) ::   Gsum      ! Gsum(n) = sum of areas in categories 0 to n 
     350      !------------------------------------------------------------------------------! 
     351 
     352      CALL wrk_alloc( jpi,jpj,jpl+2, Gsum, kkstart = -1 ) 
     353 
     354      Gstari     = 1.0/rn_gstar     
     355      astari     = 1.0/rn_astar     
     356      aksum(:,:)    = 0.0 
     357      athorn(:,:,:) = 0.0 
     358      aridge(:,:,:) = 0.0 
     359      araft (:,:,:) = 0.0 
     360 
     361      ! Zero out categories with very small areas 
     362      CALL lim_var_zapsmall 
     363 
     364      ! Ice thickness needed for rafting 
     365      DO jl = 1, jpl 
     366         DO jj = 1, jpj 
     367            DO ji = 1, jpi 
     368               rswitch = MAX( 0._wp , SIGN( 1._wp, a_i(ji,jj,jl) - epsi20 ) ) 
     369               ht_i(ji,jj,jl) = v_i (ji,jj,jl) / MAX( a_i(ji,jj,jl) , epsi20 ) * rswitch 
     370            END DO 
     371         END DO 
     372      END DO 
     373 
     374      !------------------------------------------------------------------------------! 
     375      ! 1) Participation function  
     376      !------------------------------------------------------------------------------! 
     377 
     378      ! Compute total area of ice plus open water. 
     379      ! This is in general not equal to one because of divergence during transport 
     380      asum(:,:) = ato_i(:,:) + SUM( a_i, dim=3 ) 
     381 
     382      ! Compute cumulative thickness distribution function 
     383      ! Compute the cumulative thickness distribution function Gsum, 
     384      ! where Gsum(n) is the fractional area in categories 0 to n. 
     385      ! initial value (in h = 0) equals open water area 
     386      Gsum(:,:,-1) = 0._wp 
     387      Gsum(:,:,0 ) = ato_i(:,:) 
     388      ! for each value of h, you have to add ice concentration then 
     389      DO jl = 1, jpl 
     390         Gsum(:,:,jl) = Gsum(:,:,jl-1) + a_i(:,:,jl) 
     391      END DO 
     392 
     393      ! Normalize the cumulative distribution to 1 
     394      DO jl = 0, jpl 
     395         Gsum(:,:,jl) = Gsum(:,:,jl) / asum(:,:) 
     396      END DO 
     397 
     398      ! 1.3 Compute participation function a(h) = b(h).g(h) (athorn) 
     399      !-------------------------------------------------------------------------------------------------- 
     400      ! Compute the participation function athorn; this is analogous to 
     401      ! a(h) = b(h)g(h) as defined in Thorndike et al. (1975). 
     402      ! area lost from category n due to ridging/closing 
     403      ! athorn(n)   = total area lost due to ridging/closing 
     404      ! assume b(h) = (2/Gstar) * (1 - G(h)/Gstar).  
     405      ! 
     406      ! The expressions for athorn are found by integrating b(h)g(h) between 
     407      ! the category boundaries. 
     408      ! athorn is always >= 0 and SUM(athorn(0:jpl))=1 
     409      !----------------------------------------------------------------- 
     410 
     411      IF( nn_partfun == 0 ) THEN       !--- Linear formulation (Thorndike et al., 1975) 
     412         DO jl = 0, jpl     
     413            DO jj = 1, jpj  
     414               DO ji = 1, jpi 
     415                  IF    ( Gsum(ji,jj,jl)   < rn_gstar ) THEN 
     416                     athorn(ji,jj,jl) = Gstari * ( Gsum(ji,jj,jl) - Gsum(ji,jj,jl-1) ) * & 
     417                        &                        ( 2._wp - ( Gsum(ji,jj,jl-1) + Gsum(ji,jj,jl) ) * Gstari ) 
     418                  ELSEIF( Gsum(ji,jj,jl-1) < rn_gstar ) THEN 
     419                     athorn(ji,jj,jl) = Gstari * ( rn_gstar       - Gsum(ji,jj,jl-1) ) *  & 
     420                        &                        ( 2._wp - ( Gsum(ji,jj,jl-1) + rn_gstar       ) * Gstari ) 
     421                  ELSE 
     422                     athorn(ji,jj,jl) = 0._wp 
     423                  ENDIF 
     424               END DO 
     425            END DO 
     426         END DO 
     427 
     428      ELSE                             !--- Exponential, more stable formulation (Lipscomb et al, 2007) 
     429         !                         
     430         zdummy = 1._wp / ( 1._wp - EXP(-astari) )        ! precompute exponential terms using Gsum as a work array 
     431         DO jl = -1, jpl 
     432            Gsum(:,:,jl) = EXP( -Gsum(:,:,jl) * astari ) * zdummy 
     433         END DO 
     434         DO jl = 0, jpl 
     435             athorn(:,:,jl) = Gsum(:,:,jl-1) - Gsum(:,:,jl) 
     436         END DO 
     437         ! 
     438      ENDIF 
     439 
     440      IF( ln_rafting ) THEN      ! Ridging and rafting ice participation functions 
     441         ! 
     442         DO jl = 1, jpl 
     443            DO jj = 1, jpj  
     444               DO ji = 1, jpi 
     445                  zdummy           = TANH ( rn_craft * ( ht_i(ji,jj,jl) - rn_hraft ) ) 
     446                  aridge(ji,jj,jl) = ( 1._wp + zdummy ) * 0.5_wp * athorn(ji,jj,jl) 
     447                  araft (ji,jj,jl) = ( 1._wp - zdummy ) * 0.5_wp * athorn(ji,jj,jl) 
     448               END DO 
     449            END DO 
     450         END DO 
     451 
     452      ELSE 
     453         ! 
     454         DO jl = 1, jpl 
     455            aridge(:,:,jl) = athorn(:,:,jl) 
     456         END DO 
     457         ! 
     458      ENDIF 
     459 
     460      !----------------------------------------------------------------- 
     461      ! 2) Transfer function 
     462      !----------------------------------------------------------------- 
     463      ! Compute max and min ridged ice thickness for each ridging category. 
     464      ! Assume ridged ice is uniformly distributed between hrmin and hrmax. 
     465      !  
     466      ! This parameterization is a modified version of Hibler (1980). 
     467      ! The mean ridging thickness, hrmean, is proportional to hi^(0.5) 
     468      !  and for very thick ridging ice must be >= krdgmin*hi 
     469      ! 
     470      ! The minimum ridging thickness, hrmin, is equal to 2*hi  
     471      !  (i.e., rafting) and for very thick ridging ice is 
     472      !  constrained by hrmin <= (hrmean + hi)/2. 
     473      !  
     474      ! The maximum ridging thickness, hrmax, is determined by 
     475      !  hrmean and hrmin. 
     476      ! 
     477      ! These modifications have the effect of reducing the ice strength 
     478      ! (relative to the Hibler formulation) when very thick ice is 
     479      ! ridging. 
     480      ! 
     481      ! aksum = net area removed/ total area removed 
     482      ! where total area removed = area of ice that ridges 
     483      !         net area removed = total area removed - area of new ridges 
     484      !----------------------------------------------------------------- 
     485 
     486      aksum(:,:) = athorn(:,:,0) 
     487      ! Transfer function 
     488      DO jl = 1, jpl !all categories have a specific transfer function 
     489         DO jj = 1, jpj 
     490            DO ji = 1, jpi 
     491                
     492               IF( athorn(ji,jj,jl) > 0._wp ) THEN 
     493                  hrmean          = MAX( SQRT( rn_hstar * ht_i(ji,jj,jl) ), ht_i(ji,jj,jl) * krdgmin ) 
     494                  hrmin(ji,jj,jl) = MIN( 2._wp * ht_i(ji,jj,jl), 0.5_wp * ( hrmean + ht_i(ji,jj,jl) ) ) 
     495                  hrmax(ji,jj,jl) = 2._wp * hrmean - hrmin(ji,jj,jl) 
     496                  hraft(ji,jj,jl) = ht_i(ji,jj,jl) / kraft 
     497                  krdg(ji,jj,jl)  = ht_i(ji,jj,jl) / MAX( hrmean, epsi20 ) 
     498 
     499                  ! Normalization factor : aksum, ensures mass conservation 
     500                  aksum(ji,jj) = aksum(ji,jj) + aridge(ji,jj,jl) * ( 1._wp - krdg(ji,jj,jl) )    & 
     501                     &                        + araft (ji,jj,jl) * ( 1._wp - kraft          ) 
     502 
     503               ELSE 
     504                  hrmin(ji,jj,jl)  = 0._wp  
     505                  hrmax(ji,jj,jl)  = 0._wp  
     506                  hraft(ji,jj,jl)  = 0._wp  
     507                  krdg (ji,jj,jl)  = 1._wp 
     508               ENDIF 
     509 
     510            END DO 
     511         END DO 
     512      END DO 
     513      ! 
     514      CALL wrk_dealloc( jpi,jpj,jpl+2, Gsum, kkstart = -1 ) 
     515      ! 
     516   END SUBROUTINE lim_itd_me_ridgeprep 
     517 
     518 
     519   SUBROUTINE lim_itd_me_ridgeshift( opning, closing_gross ) 
     520      !!---------------------------------------------------------------------- 
     521      !!                ***  ROUTINE lim_itd_me_icestrength *** 
     522      !! 
     523      !! ** Purpose :   shift ridging ice among thickness categories of ice thickness 
     524      !! 
     525      !! ** Method  :   Remove area, volume, and energy from each ridging category 
     526      !!              and add to thicker ice categories. 
     527      !!---------------------------------------------------------------------- 
     528      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) ::   opning         ! rate of opening due to divergence/shear 
     529      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) ::   closing_gross  ! rate at which area removed, excluding area of new ridges 
     530      ! 
     531      CHARACTER (len=80) ::   fieldid   ! field identifier 
     532      ! 
     533      INTEGER ::   ji, jj, jl, jl1, jl2, jk   ! dummy loop indices 
     534      INTEGER ::   ij                ! horizontal index, combines i and j loops 
     535      INTEGER ::   icells            ! number of cells with a_i > puny 
     536      REAL(wp) ::   hL, hR, farea    ! left and right limits of integration 
     537 
     538      INTEGER , POINTER, DIMENSION(:) ::   indxi, indxj   ! compressed indices 
     539      REAL(wp), POINTER, DIMENSION(:) ::   zswitch, fvol   ! new ridge volume going to n2 
     540 
     541      REAL(wp), POINTER, DIMENSION(:) ::   afrac            ! fraction of category area ridged  
     542      REAL(wp), POINTER, DIMENSION(:) ::   ardg1 , ardg2    ! area of ice ridged & new ridges 
     543      REAL(wp), POINTER, DIMENSION(:) ::   vsrdg , esrdg    ! snow volume & energy of ridging ice 
     544      REAL(wp), POINTER, DIMENSION(:) ::   dhr   , dhr2     ! hrmax - hrmin  &  hrmax^2 - hrmin^2 
     545 
     546      REAL(wp), POINTER, DIMENSION(:) ::   vrdg1   ! volume of ice ridged 
     547      REAL(wp), POINTER, DIMENSION(:) ::   vrdg2   ! volume of new ridges 
     548      REAL(wp), POINTER, DIMENSION(:) ::   vsw     ! volume of seawater trapped into ridges 
     549      REAL(wp), POINTER, DIMENSION(:) ::   srdg1   ! sal*volume of ice ridged 
     550      REAL(wp), POINTER, DIMENSION(:) ::   srdg2   ! sal*volume of new ridges 
     551      REAL(wp), POINTER, DIMENSION(:) ::   smsw    ! sal*volume of water trapped into ridges 
     552      REAL(wp), POINTER, DIMENSION(:) ::   oirdg1, oirdg2   ! ice age of ice ridged 
     553 
     554      REAL(wp), POINTER, DIMENSION(:) ::   afrft            ! fraction of category area rafted 
     555      REAL(wp), POINTER, DIMENSION(:) ::   arft1 , arft2    ! area of ice rafted and new rafted zone 
     556      REAL(wp), POINTER, DIMENSION(:) ::   virft , vsrft    ! ice & snow volume of rafting ice 
     557      REAL(wp), POINTER, DIMENSION(:) ::   esrft , smrft    ! snow energy & salinity of rafting ice 
     558      REAL(wp), POINTER, DIMENSION(:) ::   oirft1, oirft2   ! ice age of ice rafted 
     559 
     560      REAL(wp), POINTER, DIMENSION(:,:) ::   eirft      ! ice energy of rafting ice 
     561      REAL(wp), POINTER, DIMENSION(:,:) ::   erdg1      ! enth*volume of ice ridged 
     562      REAL(wp), POINTER, DIMENSION(:,:) ::   erdg2      ! enth*volume of new ridges 
     563      REAL(wp), POINTER, DIMENSION(:,:) ::   ersw       ! enth of water trapped into ridges 
     564      !!---------------------------------------------------------------------- 
     565 
     566      CALL wrk_alloc( jpij,        indxi, indxj ) 
     567      CALL wrk_alloc( jpij,        zswitch, fvol ) 
     568      CALL wrk_alloc( jpij,        afrac, ardg1, ardg2, vsrdg, esrdg, dhr, dhr2 ) 
     569      CALL wrk_alloc( jpij,        vrdg1, vrdg2, vsw  , srdg1, srdg2, smsw, oirdg1, oirdg2 ) 
     570      CALL wrk_alloc( jpij,        afrft, arft1, arft2, virft, vsrft, esrft, smrft, oirft1, oirft2 ) 
     571      CALL wrk_alloc( jpij,nlay_i, eirft, erdg1, erdg2, ersw ) 
     572 
     573      !------------------------------------------------------------------------------- 
     574      ! 1) Compute change in open water area due to closing and opening. 
     575      !------------------------------------------------------------------------------- 
     576      DO jj = 1, jpj 
     577         DO ji = 1, jpi 
     578            ato_i(ji,jj) = MAX( 0._wp, ato_i(ji,jj) +  & 
     579               &                     ( opning(ji,jj) - athorn(ji,jj,0) * closing_gross(ji,jj) ) * rdt_ice ) 
     580         END DO 
     581      END DO 
     582 
     583      !----------------------------------------------------------------- 
     584      ! 3) Pump everything from ice which is being ridged / rafted 
     585      !----------------------------------------------------------------- 
     586      ! Compute the area, volume, and energy of ice ridging in each 
     587      ! category, along with the area of the resulting ridge. 
     588 
     589      DO jl1 = 1, jpl !jl1 describes the ridging category 
     590 
     591         !------------------------------------------------ 
     592         ! 3.1) Identify grid cells with nonzero ridging 
     593         !------------------------------------------------ 
     594         icells = 0 
     595         DO jj = 1, jpj 
     596            DO ji = 1, jpi 
     597               IF( athorn(ji,jj,jl1) > 0._wp .AND. closing_gross(ji,jj) > 0._wp ) THEN 
     598                  icells = icells + 1 
     599                  indxi(icells) = ji 
     600                  indxj(icells) = jj 
     601               ENDIF 
     602            END DO 
     603         END DO 
     604 
     605         DO ij = 1, icells 
     606            ji = indxi(ij) ; jj = indxj(ij) 
     607 
     608            !-------------------------------------------------------------------- 
     609            ! 3.2) Compute area of ridging ice (ardg1) and of new ridge (ardg2) 
     610            !-------------------------------------------------------------------- 
     611            ardg1(ij) = aridge(ji,jj,jl1) * closing_gross(ji,jj) * rdt_ice 
     612            arft1(ij) = araft (ji,jj,jl1) * closing_gross(ji,jj) * rdt_ice 
     613 
     614            !--------------------------------------------------------------- 
     615            ! 3.3) Compute ridging /rafting fractions, make sure afrac <=1  
     616            !--------------------------------------------------------------- 
     617            afrac(ij) = ardg1(ij) / a_i(ji,jj,jl1) !ridging 
     618            afrft(ij) = arft1(ij) / a_i(ji,jj,jl1) !rafting 
     619            ardg2(ij) = ardg1(ij) * krdg(ji,jj,jl1) 
     620            arft2(ij) = arft1(ij) * kraft 
     621 
     622            !-------------------------------------------------------------------------- 
     623            ! 3.4) Subtract area, volume, and energy from ridging  
     624            !     / rafting category n1. 
     625            !-------------------------------------------------------------------------- 
     626            vrdg1(ij) = v_i(ji,jj,jl1) * afrac(ij) 
     627            vrdg2(ij) = vrdg1(ij) * ( 1. + rn_por_rdg ) 
     628            vsw  (ij) = vrdg1(ij) * rn_por_rdg 
     629 
     630            vsrdg (ij) = v_s  (ji,jj,  jl1) * afrac(ij) 
     631            esrdg (ij) = e_s  (ji,jj,1,jl1) * afrac(ij) 
     632            srdg1 (ij) = smv_i(ji,jj,  jl1) * afrac(ij) 
     633            oirdg1(ij) = oa_i (ji,jj,  jl1) * afrac(ij) 
     634            oirdg2(ij) = oa_i (ji,jj,  jl1) * afrac(ij) * krdg(ji,jj,jl1)  
     635 
     636            ! rafting volumes, heat contents ... 
     637            virft (ij) = v_i  (ji,jj,  jl1) * afrft(ij) 
     638            vsrft (ij) = v_s  (ji,jj,  jl1) * afrft(ij) 
     639            esrft (ij) = e_s  (ji,jj,1,jl1) * afrft(ij) 
     640            smrft (ij) = smv_i(ji,jj,  jl1) * afrft(ij)  
     641            oirft1(ij) = oa_i (ji,jj,  jl1) * afrft(ij)  
     642            oirft2(ij) = oa_i (ji,jj,  jl1) * afrft(ij) * kraft  
     643 
     644            !----------------------------------------------------------------- 
     645            ! 3.5) Compute properties of new ridges 
     646            !----------------------------------------------------------------- 
     647            smsw(ij)  = vsw(ij) * sss_m(ji,jj)                   ! salt content of seawater frozen in voids 
     648            srdg2(ij) = srdg1(ij) + smsw(ij)                     ! salt content of new ridge 
     649             
     650            sfx_dyn(ji,jj) = sfx_dyn(ji,jj) - smsw(ij) * rhoic * r1_rdtice 
     651            wfx_dyn(ji,jj) = wfx_dyn(ji,jj) - vsw (ij) * rhoic * r1_rdtice   ! increase in ice volume due to seawater frozen in voids 
     652 
     653            ! virtual salt flux to keep salinity constant 
     654            IF( nn_icesal == 1 .OR. nn_icesal == 3 )  THEN 
     655               srdg2(ij)      = srdg2(ij) - vsw(ij) * ( sss_m(ji,jj) - sm_i(ji,jj,jl1) )           ! ridge salinity = sm_i 
     656               sfx_bri(ji,jj) = sfx_bri(ji,jj) + sss_m(ji,jj)    * vsw(ij) * rhoic * r1_rdtice  &  ! put back sss_m into the ocean 
     657                  &                            - sm_i(ji,jj,jl1) * vsw(ij) * rhoic * r1_rdtice     ! and get  sm_i  from the ocean  
     658            ENDIF 
     659             
     660            !------------------------------------------             
     661            ! 3.7 Put the snow somewhere in the ocean 
     662            !------------------------------------------             
     663            !  Place part of the snow lost by ridging into the ocean.  
     664            !  Note that esrdg > 0; the ocean must cool to melt snow. 
     665            !  If the ocean temp = Tf already, new ice must grow. 
     666            !  During the next time step, thermo_rates will determine whether 
     667            !  the ocean cools or new ice grows. 
     668            wfx_snw(ji,jj) = wfx_snw(ji,jj) + ( rhosn * vsrdg(ij) * ( 1._wp - rn_fsnowrdg )   &  
     669               &                              + rhosn * vsrft(ij) * ( 1._wp - rn_fsnowrft ) ) * r1_rdtice  ! fresh water source for ocean 
     670 
     671            hfx_dyn(ji,jj) = hfx_dyn(ji,jj) + ( - esrdg(ij) * ( 1._wp - rn_fsnowrdg )         &  
     672               &                                - esrft(ij) * ( 1._wp - rn_fsnowrft ) ) * r1_rdtice        ! heat sink for ocean (<0, W.m-2) 
     673 
     674            !----------------------------------------------------------------- 
     675            ! 3.8 Compute quantities used to apportion ice among categories 
     676            ! in the n2 loop below 
     677            !----------------------------------------------------------------- 
     678            dhr (ij) = 1._wp / ( hrmax(ji,jj,jl1)                    - hrmin(ji,jj,jl1)                    ) 
     679            dhr2(ij) = 1._wp / ( hrmax(ji,jj,jl1) * hrmax(ji,jj,jl1) - hrmin(ji,jj,jl1) * hrmin(ji,jj,jl1) ) 
     680 
     681 
     682            ! update jl1 (removing ridged/rafted area) 
     683            a_i  (ji,jj,  jl1) = a_i  (ji,jj,  jl1) - ardg1 (ij) - arft1 (ij) 
     684            v_i  (ji,jj,  jl1) = v_i  (ji,jj,  jl1) - vrdg1 (ij) - virft (ij) 
     685            v_s  (ji,jj,  jl1) = v_s  (ji,jj,  jl1) - vsrdg (ij) - vsrft (ij) 
     686            e_s  (ji,jj,1,jl1) = e_s  (ji,jj,1,jl1) - esrdg (ij) - esrft (ij) 
     687            smv_i(ji,jj,  jl1) = smv_i(ji,jj,  jl1) - srdg1 (ij) - smrft (ij) 
     688            oa_i (ji,jj,  jl1) = oa_i (ji,jj,  jl1) - oirdg1(ij) - oirft1(ij) 
     689 
     690         END DO 
     691 
     692         !-------------------------------------------------------------------- 
     693         ! 3.9 Compute ridging ice enthalpy, remove it from ridging ice and 
     694         !      compute ridged ice enthalpy  
     695         !-------------------------------------------------------------------- 
     696         DO jk = 1, nlay_i 
     697            DO ij = 1, icells 
     698               ji = indxi(ij) ; jj = indxj(ij) 
     699               ! heat content of ridged ice 
     700               erdg1(ij,jk) = e_i(ji,jj,jk,jl1) * afrac(ij)  
     701               eirft(ij,jk) = e_i(ji,jj,jk,jl1) * afrft(ij)                
     702                
     703               ! enthalpy of the trapped seawater (J/m2, >0) 
     704               ! clem: if sst>0, then ersw <0 (is that possible?) 
     705               ersw(ij,jk)  = - rhoic * vsw(ij) * rcp * sst_m(ji,jj) * r1_nlay_i 
     706 
     707               ! heat flux to the ocean 
     708               hfx_dyn(ji,jj) = hfx_dyn(ji,jj) + ersw(ij,jk) * r1_rdtice  ! > 0 [W.m-2] ocean->ice flux  
     709 
     710               ! it is added to sea ice because the sign convention is the opposite of the sign convention for the ocean 
     711               erdg2(ij,jk) = erdg1(ij,jk) + ersw(ij,jk) 
     712 
     713               ! update jl1 
     714               e_i  (ji,jj,jk,jl1) = e_i(ji,jj,jk,jl1) - erdg1(ij,jk) - eirft(ij,jk) 
     715 
     716            END DO 
     717         END DO 
     718 
     719         !------------------------------------------------------------------------------- 
     720         ! 4) Add area, volume, and energy of new ridge to each category jl2 
     721         !------------------------------------------------------------------------------- 
     722         DO jl2  = 1, jpl  
     723            ! over categories to which ridged/rafted ice is transferred 
     724            DO ij = 1, icells 
     725               ji = indxi(ij) ; jj = indxj(ij) 
     726 
     727               ! Compute the fraction of ridged ice area and volume going to thickness category jl2. 
     728               IF( hrmin(ji,jj,jl1) <= hi_max(jl2) .AND. hrmax(ji,jj,jl1) > hi_max(jl2-1) ) THEN 
     729                  hL = MAX( hrmin(ji,jj,jl1), hi_max(jl2-1) ) 
     730                  hR = MIN( hrmax(ji,jj,jl1), hi_max(jl2)   ) 
     731                  farea    = ( hR      - hL      ) * dhr(ij)  
     732                  fvol(ij) = ( hR * hR - hL * hL ) * dhr2(ij) 
     733               ELSE 
     734                  farea    = 0._wp  
     735                  fvol(ij) = 0._wp                   
     736               ENDIF 
     737 
     738               ! Compute the fraction of rafted ice area and volume going to thickness category jl2 
     739               IF( hraft(ji,jj,jl1) <= hi_max(jl2) .AND. hraft(ji,jj,jl1) >  hi_max(jl2-1) ) THEN 
     740                  zswitch(ij) = 1._wp 
     741               ELSE 
     742                  zswitch(ij) = 0._wp                   
     743               ENDIF 
     744 
     745               a_i  (ji,jj  ,jl2) = a_i  (ji,jj  ,jl2) + ( ardg2 (ij) * farea    + arft2 (ij) * zswitch(ij) ) 
     746               oa_i (ji,jj  ,jl2) = oa_i (ji,jj  ,jl2) + ( oirdg2(ij) * farea    + oirft2(ij) * zswitch(ij) ) 
     747               v_i  (ji,jj  ,jl2) = v_i  (ji,jj  ,jl2) + ( vrdg2 (ij) * fvol(ij) + virft (ij) * zswitch(ij) ) 
     748               smv_i(ji,jj  ,jl2) = smv_i(ji,jj  ,jl2) + ( srdg2 (ij) * fvol(ij) + smrft (ij) * zswitch(ij) ) 
     749               v_s  (ji,jj  ,jl2) = v_s  (ji,jj  ,jl2) + ( vsrdg (ij) * rn_fsnowrdg * fvol(ij)  +  & 
     750                  &                                        vsrft (ij) * rn_fsnowrft * zswitch(ij) ) 
     751               e_s  (ji,jj,1,jl2) = e_s  (ji,jj,1,jl2) + ( esrdg (ij) * rn_fsnowrdg * fvol(ij)  +  & 
     752                  &                                        esrft (ij) * rn_fsnowrft * zswitch(ij) ) 
     753 
     754            END DO 
     755 
     756            ! Transfer ice energy to category jl2 by ridging 
     757            DO jk = 1, nlay_i 
     758               DO ij = 1, icells 
     759                  ji = indxi(ij) ; jj = indxj(ij) 
     760                  e_i(ji,jj,jk,jl2) = e_i(ji,jj,jk,jl2) + erdg2(ij,jk) * fvol(ij) + eirft(ij,jk) * zswitch(ij)                   
     761               END DO 
     762            END DO 
     763            ! 
     764         END DO ! jl2 
     765          
     766      END DO ! jl1 (deforming categories) 
     767 
     768      ! 
     769      CALL wrk_dealloc( jpij,        indxi, indxj ) 
     770      CALL wrk_dealloc( jpij,        zswitch, fvol ) 
     771      CALL wrk_dealloc( jpij,        afrac, ardg1, ardg2, vsrdg, esrdg, dhr, dhr2 ) 
     772      CALL wrk_dealloc( jpij,        vrdg1, vrdg2, vsw  , srdg1, srdg2, smsw, oirdg1, oirdg2 ) 
     773      CALL wrk_dealloc( jpij,        afrft, arft1, arft2, virft, vsrft, esrft, smrft, oirft1, oirft2 ) 
     774      CALL wrk_dealloc( jpij,nlay_i, eirft, erdg1, erdg2, ersw ) 
     775      ! 
     776   END SUBROUTINE lim_itd_me_ridgeshift 
    417777 
    418778   SUBROUTINE lim_itd_me_icestrength( kstrngth ) 
     
    434794      INTEGER             ::   ksmooth     ! smoothing the resistance to deformation 
    435795      INTEGER             ::   numts_rm    ! number of time steps for the P smoothing 
    436       REAL(wp)            ::   zhi, zp, z1_3  ! local scalars 
     796      REAL(wp)            ::   zp, z1_3    ! local scalars 
    437797      REAL(wp), POINTER, DIMENSION(:,:) ::   zworka   ! temporary array used here 
    438798      !!---------------------------------------------------------------------- 
     
    459819               DO ji = 1, jpi 
    460820                  ! 
    461                   IF( a_i(ji,jj,jl) > epsi10 .AND. athorn(ji,jj,jl) > 0._wp ) THEN 
    462                      zhi = v_i(ji,jj,jl) / a_i(ji,jj,jl) 
     821                  IF( athorn(ji,jj,jl) > 0._wp ) THEN 
    463822                     !---------------------------- 
    464823                     ! PE loss from deforming ice 
    465824                     !---------------------------- 
    466                      strength(ji,jj) = strength(ji,jj) - athorn(ji,jj,jl) * zhi * zhi 
     825                     strength(ji,jj) = strength(ji,jj) - athorn(ji,jj,jl) * ht_i(ji,jj,jl) * ht_i(ji,jj,jl) 
    467826 
    468827                     !-------------------------- 
    469828                     ! PE gain from rafting ice 
    470829                     !-------------------------- 
    471                      strength(ji,jj) = strength(ji,jj) + 2._wp * araft(ji,jj,jl) * zhi * zhi 
     830                     strength(ji,jj) = strength(ji,jj) + 2._wp * araft(ji,jj,jl) * ht_i(ji,jj,jl) * ht_i(ji,jj,jl) 
    472831 
    473832                     !---------------------------- 
    474833                     ! PE gain from ridging ice 
    475834                     !---------------------------- 
    476                      strength(ji,jj) = strength(ji,jj) + aridge(ji,jj,jl) / krdg(ji,jj,jl)     & 
    477                         * z1_3 * ( hrmax(ji,jj,jl)**2 + hrmin(ji,jj,jl)**2 +  hrmax(ji,jj,jl) * hrmin(ji,jj,jl) )   
     835                     strength(ji,jj) = strength(ji,jj) + aridge(ji,jj,jl) * krdg(ji,jj,jl) * z1_3 *  & 
     836                        &                              ( hrmax(ji,jj,jl) * hrmax(ji,jj,jl) +         & 
     837                        &                                hrmin(ji,jj,jl) * hrmin(ji,jj,jl) +         & 
     838                        &                                hrmax(ji,jj,jl) * hrmin(ji,jj,jl) )   
    478839                        !!(a**3-b**3)/(a-b) = a*a+ab+b*b                       
    479840                  ENDIF 
     
    497858         ! 
    498859      ENDIF                     ! kstrngth 
    499  
    500860      ! 
    501861      !------------------------------------------------------------------------------! 
     
    503863      !------------------------------------------------------------------------------! 
    504864      ! CAN BE REMOVED 
    505       ! 
    506865      IF( ln_icestr_bvf ) THEN 
    507  
    508866         DO jj = 1, jpj 
    509867            DO ji = 1, jpi 
     
    511869            END DO 
    512870         END DO 
    513  
    514871      ENDIF 
    515  
    516872      ! 
    517873      !------------------------------------------------------------------------------! 
     
    558914      IF ( ksmooth == 2 ) THEN 
    559915 
    560  
    561916         CALL lbc_lnk( strength, 'T', 1. ) 
    562917 
     
    565920               IF ( ( asum(ji,jj) - ato_i(ji,jj) ) > 0._wp) THEN  
    566921                  numts_rm = 1 ! number of time steps for the running mean 
    567                   IF ( strp1(ji,jj) > 0.0 ) numts_rm = numts_rm + 1 
    568                   IF ( strp2(ji,jj) > 0.0 ) numts_rm = numts_rm + 1 
     922                  IF ( strp1(ji,jj) > 0._wp ) numts_rm = numts_rm + 1 
     923                  IF ( strp2(ji,jj) > 0._wp ) numts_rm = numts_rm + 1 
    569924                  zp = ( strength(ji,jj) + strp1(ji,jj) + strp2(ji,jj) ) / numts_rm 
    570925                  strp2(ji,jj) = strp1(ji,jj) 
     
    583938      ! 
    584939   END SUBROUTINE lim_itd_me_icestrength 
    585  
    586  
    587    SUBROUTINE lim_itd_me_ridgeprep 
    588       !!---------------------------------------------------------------------! 
    589       !!                ***  ROUTINE lim_itd_me_ridgeprep *** 
    590       !! 
    591       !! ** Purpose :   preparation for ridging and strength calculations 
    592       !! 
    593       !! ** Method  :   Compute the thickness distribution of the ice and open water  
    594       !!              participating in ridging and of the resulting ridges. 
    595       !!---------------------------------------------------------------------! 
    596       INTEGER ::   ji,jj, jl    ! dummy loop indices 
    597       REAL(wp) ::   Gstari, astari, zhi, hrmean, zdummy   ! local scalar 
    598       REAL(wp), POINTER, DIMENSION(:,:)   ::   zworka    ! temporary array used here 
    599       REAL(wp), POINTER, DIMENSION(:,:,:) ::   Gsum      ! Gsum(n) = sum of areas in categories 0 to n 
    600       !------------------------------------------------------------------------------! 
    601  
    602       CALL wrk_alloc( jpi,jpj, zworka ) 
    603       CALL wrk_alloc( jpi,jpj,jpl+2, Gsum, kkstart = -1 ) 
    604  
    605       Gstari     = 1.0/rn_gstar     
    606       astari     = 1.0/rn_astar     
    607       aksum(:,:)    = 0.0 
    608       athorn(:,:,:) = 0.0 
    609       aridge(:,:,:) = 0.0 
    610       araft (:,:,:) = 0.0 
    611       hrmin(:,:,:)  = 0.0  
    612       hrmax(:,:,:)  = 0.0  
    613       hraft(:,:,:)  = 0.0  
    614       krdg (:,:,:)  = 1.0 
    615  
    616       !     ! Zero out categories with very small areas 
    617       CALL lim_var_zapsmall 
    618  
    619       !------------------------------------------------------------------------------! 
    620       ! 1) Participation function  
    621       !------------------------------------------------------------------------------! 
    622  
    623       ! Compute total area of ice plus open water. 
    624       ! This is in general not equal to one because of divergence during transport 
    625       asum(:,:) = ato_i(:,:) 
    626       DO jl = 1, jpl 
    627          asum(:,:) = asum(:,:) + a_i(:,:,jl) 
    628       END DO 
    629  
    630       ! Compute cumulative thickness distribution function 
    631       ! Compute the cumulative thickness distribution function Gsum, 
    632       ! where Gsum(n) is the fractional area in categories 0 to n. 
    633       ! initial value (in h = 0) equals open water area 
    634  
    635       Gsum(:,:,-1) = 0._wp 
    636       Gsum(:,:,0 ) = ato_i(:,:) 
    637  
    638       ! for each value of h, you have to add ice concentration then 
    639       DO jl = 1, jpl 
    640          Gsum(:,:,jl) = Gsum(:,:,jl-1) + a_i(:,:,jl) 
    641       END DO 
    642  
    643       ! Normalize the cumulative distribution to 1 
    644       zworka(:,:) = 1._wp / Gsum(:,:,jpl) 
    645       DO jl = 0, jpl 
    646          Gsum(:,:,jl) = Gsum(:,:,jl) * zworka(:,:) 
    647       END DO 
    648  
    649       ! 1.3 Compute participation function a(h) = b(h).g(h) (athorn) 
    650       !-------------------------------------------------------------------------------------------------- 
    651       ! Compute the participation function athorn; this is analogous to 
    652       ! a(h) = b(h)g(h) as defined in Thorndike et al. (1975). 
    653       ! area lost from category n due to ridging/closing 
    654       ! athorn(n)   = total area lost due to ridging/closing 
    655       ! assume b(h) = (2/Gstar) * (1 - G(h)/Gstar).  
    656       ! 
    657       ! The expressions for athorn are found by integrating b(h)g(h) between 
    658       ! the category boundaries. 
    659       !----------------------------------------------------------------- 
    660  
    661       IF( nn_partfun == 0 ) THEN       !--- Linear formulation (Thorndike et al., 1975) 
    662          DO jl = 0, jpl     
    663             DO jj = 1, jpj  
    664                DO ji = 1, jpi 
    665                   IF( Gsum(ji,jj,jl) < rn_gstar) THEN 
    666                      athorn(ji,jj,jl) = Gstari * ( Gsum(ji,jj,jl) - Gsum(ji,jj,jl-1) ) * & 
    667                         &                        ( 2.0 - (Gsum(ji,jj,jl-1) + Gsum(ji,jj,jl) ) * Gstari ) 
    668                   ELSEIF (Gsum(ji,jj,jl-1) < rn_gstar) THEN 
    669                      athorn(ji,jj,jl) = Gstari * ( rn_gstar - Gsum(ji,jj,jl-1) ) *  & 
    670                         &                        ( 2.0 - ( Gsum(ji,jj,jl-1) + rn_gstar ) * Gstari ) 
    671                   ELSE 
    672                      athorn(ji,jj,jl) = 0.0 
    673                   ENDIF 
    674                END DO 
    675             END DO 
    676          END DO 
    677  
    678       ELSE                             !--- Exponential, more stable formulation (Lipscomb et al, 2007) 
    679          !                         
    680          zdummy = 1._wp / ( 1._wp - EXP(-astari) )        ! precompute exponential terms using Gsum as a work array 
    681          DO jl = -1, jpl 
    682             Gsum(:,:,jl) = EXP( -Gsum(:,:,jl) * astari ) * zdummy 
    683          END DO 
    684          DO jl = 0, jpl 
    685              athorn(:,:,jl) = Gsum(:,:,jl-1) - Gsum(:,:,jl) 
    686          END DO 
    687          ! 
    688       ENDIF 
    689  
    690       IF( ln_rafting ) THEN      ! Ridging and rafting ice participation functions 
    691          ! 
    692          DO jl = 1, jpl 
    693             DO jj = 1, jpj  
    694                DO ji = 1, jpi 
    695                   IF ( athorn(ji,jj,jl) > 0._wp ) THEN 
    696 !!gm  TANH( -X ) = - TANH( X )  so can be computed only 1 time.... 
    697                      aridge(ji,jj,jl) = ( TANH (  rn_craft * ( ht_i(ji,jj,jl) - rn_hraft ) ) + 1.0 ) * 0.5 * athorn(ji,jj,jl) 
    698                      araft (ji,jj,jl) = ( TANH ( -rn_craft * ( ht_i(ji,jj,jl) - rn_hraft ) ) + 1.0 ) * 0.5 * athorn(ji,jj,jl) 
    699                      IF ( araft(ji,jj,jl) < epsi06 )   araft(ji,jj,jl)  = 0._wp 
    700                      aridge(ji,jj,jl) = MAX( athorn(ji,jj,jl) - araft(ji,jj,jl), 0.0 ) 
    701                   ENDIF 
    702                END DO 
    703             END DO 
    704          END DO 
    705  
    706       ELSE 
    707          ! 
    708          DO jl = 1, jpl 
    709             aridge(:,:,jl) = athorn(:,:,jl) 
    710          END DO 
    711          ! 
    712       ENDIF 
    713  
    714       IF( ln_rafting ) THEN 
    715  
    716          IF( MAXVAL(aridge + araft - athorn(:,:,1:jpl)) > epsi10 .AND. lwp ) THEN 
    717             DO jl = 1, jpl 
    718                DO jj = 1, jpj 
    719                   DO ji = 1, jpi 
    720                      IF ( aridge(ji,jj,jl) + araft(ji,jj,jl) - athorn(ji,jj,jl) > epsi10 ) THEN 
    721                         WRITE(numout,*) ' ALERTE 96 : wrong participation function ... ' 
    722                         WRITE(numout,*) ' ji, jj, jl : ', ji, jj, jl 
    723                         WRITE(numout,*) ' lat, lon   : ', gphit(ji,jj), glamt(ji,jj) 
    724                         WRITE(numout,*) ' aridge     : ', aridge(ji,jj,1:jpl) 
    725                         WRITE(numout,*) ' araft      : ', araft(ji,jj,1:jpl) 
    726                         WRITE(numout,*) ' athorn     : ', athorn(ji,jj,1:jpl) 
    727                      ENDIF 
    728                   END DO 
    729                END DO 
    730             END DO 
    731          ENDIF 
    732  
    733       ENDIF 
    734  
    735       !----------------------------------------------------------------- 
    736       ! 2) Transfer function 
    737       !----------------------------------------------------------------- 
    738       ! Compute max and min ridged ice thickness for each ridging category. 
    739       ! Assume ridged ice is uniformly distributed between hrmin and hrmax. 
    740       !  
    741       ! This parameterization is a modified version of Hibler (1980). 
    742       ! The mean ridging thickness, hrmean, is proportional to hi^(0.5) 
    743       !  and for very thick ridging ice must be >= krdgmin*hi 
    744       ! 
    745       ! The minimum ridging thickness, hrmin, is equal to 2*hi  
    746       !  (i.e., rafting) and for very thick ridging ice is 
    747       !  constrained by hrmin <= (hrmean + hi)/2. 
    748       !  
    749       ! The maximum ridging thickness, hrmax, is determined by 
    750       !  hrmean and hrmin. 
    751       ! 
    752       ! These modifications have the effect of reducing the ice strength 
    753       ! (relative to the Hibler formulation) when very thick ice is 
    754       ! ridging. 
    755       ! 
    756       ! aksum = net area removed/ total area removed 
    757       ! where total area removed = area of ice that ridges 
    758       !         net area removed = total area removed - area of new ridges 
    759       !----------------------------------------------------------------- 
    760  
    761       ! Transfer function 
    762       DO jl = 1, jpl !all categories have a specific transfer function 
    763          DO jj = 1, jpj 
    764             DO ji = 1, jpi 
    765  
    766                IF (a_i(ji,jj,jl) > epsi10 .AND. athorn(ji,jj,jl) > 0.0 ) THEN 
    767                   zhi = v_i(ji,jj,jl) / a_i(ji,jj,jl) 
    768                   hrmean          = MAX(SQRT(rn_hstar*zhi), zhi*krdgmin) 
    769                   hrmin(ji,jj,jl) = MIN(2.0*zhi, 0.5*(hrmean + zhi)) 
    770                   hrmax(ji,jj,jl) = 2.0*hrmean - hrmin(ji,jj,jl) 
    771                   hraft(ji,jj,jl) = kraft*zhi 
    772                   krdg(ji,jj,jl)  = hrmean / zhi 
    773                ELSE 
    774                   hraft(ji,jj,jl) = 0.0 
    775                   hrmin(ji,jj,jl) = 0.0  
    776                   hrmax(ji,jj,jl) = 0.0  
    777                   krdg (ji,jj,jl) = 1.0 
    778                ENDIF 
    779  
    780             END DO 
    781          END DO 
    782       END DO 
    783  
    784       ! Normalization factor : aksum, ensures mass conservation 
    785       aksum(:,:) = athorn(:,:,0) 
    786       DO jl = 1, jpl  
    787          aksum(:,:)    = aksum(:,:) + aridge(:,:,jl) * ( 1._wp - 1._wp / krdg(:,:,jl) )    & 
    788             &                       + araft (:,:,jl) * ( 1._wp - 1._wp / kraft        ) 
    789       END DO 
    790       ! 
    791       CALL wrk_dealloc( jpi,jpj, zworka ) 
    792       CALL wrk_dealloc( jpi,jpj,jpl+2, Gsum, kkstart = -1 ) 
    793       ! 
    794    END SUBROUTINE lim_itd_me_ridgeprep 
    795  
    796  
    797    SUBROUTINE lim_itd_me_ridgeshift( opning, closing_gross, msnow_mlt, esnow_mlt ) 
    798       !!---------------------------------------------------------------------- 
    799       !!                ***  ROUTINE lim_itd_me_icestrength *** 
    800       !! 
    801       !! ** Purpose :   shift ridging ice among thickness categories of ice thickness 
    802       !! 
    803       !! ** Method  :   Remove area, volume, and energy from each ridging category 
    804       !!              and add to thicker ice categories. 
    805       !!---------------------------------------------------------------------- 
    806       REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) ::   opning         ! rate of opening due to divergence/shear 
    807       REAL(wp), DIMENSION(jpi,jpj), INTENT(in   ) ::   closing_gross  ! rate at which area removed, excluding area of new ridges 
    808       REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   msnow_mlt      ! mass of snow added to ocean (kg m-2) 
    809       REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) ::   esnow_mlt      ! energy needed to melt snow in ocean (J m-2) 
    810       ! 
    811       CHARACTER (len=80) ::   fieldid   ! field identifier 
    812       LOGICAL, PARAMETER ::   l_conservation_check = .true.  ! if true, check conservation (useful for debugging) 
    813       ! 
    814       INTEGER ::   ji, jj, jl, jl1, jl2, jk   ! dummy loop indices 
    815       INTEGER ::   ij                ! horizontal index, combines i and j loops 
    816       INTEGER ::   icells            ! number of cells with aicen > puny 
    817       REAL(wp) ::   hL, hR, farea, ztmelts    ! left and right limits of integration 
    818  
    819       INTEGER , POINTER, DIMENSION(:) ::   indxi, indxj   ! compressed indices 
    820  
    821       REAL(wp), POINTER, DIMENSION(:,:) ::   vice_init, vice_final   ! ice volume summed over categories 
    822       REAL(wp), POINTER, DIMENSION(:,:) ::   eice_init, eice_final   ! ice energy summed over layers 
    823  
    824       REAL(wp), POINTER, DIMENSION(:,:,:) ::   aicen_init, vicen_init   ! ice  area    & volume before ridging 
    825       REAL(wp), POINTER, DIMENSION(:,:,:) ::   vsnwn_init, esnwn_init   ! snow volume  & energy before ridging 
    826       REAL(wp), POINTER, DIMENSION(:,:,:) ::   smv_i_init, oa_i_init    ! ice salinity & age    before ridging 
    827  
    828       REAL(wp), POINTER, DIMENSION(:,:,:,:) ::   eicen_init        ! ice energy before ridging 
    829  
    830       REAL(wp), POINTER, DIMENSION(:,:) ::   afrac , fvol     ! fraction of category area ridged & new ridge volume going to n2 
    831       REAL(wp), POINTER, DIMENSION(:,:) ::   ardg1 , ardg2    ! area of ice ridged & new ridges 
    832       REAL(wp), POINTER, DIMENSION(:,:) ::   vsrdg , esrdg    ! snow volume & energy of ridging ice 
    833       REAL(wp), POINTER, DIMENSION(:,:) ::   dhr   , dhr2     ! hrmax - hrmin  &  hrmax^2 - hrmin^2 
    834  
    835       REAL(wp), POINTER, DIMENSION(:,:) ::   vrdg1   ! volume of ice ridged 
    836       REAL(wp), POINTER, DIMENSION(:,:) ::   vrdg2   ! volume of new ridges 
    837       REAL(wp), POINTER, DIMENSION(:,:) ::   vsw     ! volume of seawater trapped into ridges 
    838       REAL(wp), POINTER, DIMENSION(:,:) ::   srdg1   ! sal*volume of ice ridged 
    839       REAL(wp), POINTER, DIMENSION(:,:) ::   srdg2   ! sal*volume of new ridges 
    840       REAL(wp), POINTER, DIMENSION(:,:) ::   smsw    ! sal*volume of water trapped into ridges 
    841       REAL(wp), POINTER, DIMENSION(:,:) ::   oirdg1, oirdg2   ! ice age of ice ridged 
    842  
    843       REAL(wp), POINTER, DIMENSION(:,:) ::   afrft            ! fraction of category area rafted 
    844       REAL(wp), POINTER, DIMENSION(:,:) ::   arft1 , arft2    ! area of ice rafted and new rafted zone 
    845       REAL(wp), POINTER, DIMENSION(:,:) ::   virft , vsrft    ! ice & snow volume of rafting ice 
    846       REAL(wp), POINTER, DIMENSION(:,:) ::   esrft , smrft    ! snow energy & salinity of rafting ice 
    847       REAL(wp), POINTER, DIMENSION(:,:) ::   oirft1, oirft2   ! ice age of ice rafted 
    848  
    849       REAL(wp), POINTER, DIMENSION(:,:,:) ::   eirft      ! ice energy of rafting ice 
    850       REAL(wp), POINTER, DIMENSION(:,:,:) ::   erdg1      ! enth*volume of ice ridged 
    851       REAL(wp), POINTER, DIMENSION(:,:,:) ::   erdg2      ! enth*volume of new ridges 
    852       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ersw       ! enth of water trapped into ridges 
    853       !!---------------------------------------------------------------------- 
    854  
    855       CALL wrk_alloc( (jpi+1)*(jpj+1),       indxi, indxj ) 
    856       CALL wrk_alloc( jpi, jpj,              vice_init, vice_final, eice_init, eice_final ) 
    857       CALL wrk_alloc( jpi, jpj,              afrac, fvol , ardg1, ardg2, vsrdg, esrdg, dhr, dhr2 ) 
    858       CALL wrk_alloc( jpi, jpj,              vrdg1, vrdg2, vsw  , srdg1, srdg2, smsw, oirdg1, oirdg2 ) 
    859       CALL wrk_alloc( jpi, jpj,              afrft, arft1, arft2, virft, vsrft, esrft, smrft, oirft1, oirft2 ) 
    860       CALL wrk_alloc( jpi, jpj, jpl,         aicen_init, vicen_init, vsnwn_init, esnwn_init, smv_i_init, oa_i_init ) 
    861       CALL wrk_alloc( jpi, jpj, nlay_i,      eirft, erdg1, erdg2, ersw ) 
    862       CALL wrk_alloc( jpi, jpj, nlay_i, jpl, eicen_init ) 
    863  
    864       ! Conservation check 
    865       eice_init(:,:) = 0._wp 
    866  
    867       IF( con_i ) THEN 
    868          CALL lim_column_sum        (jpl,    v_i,       vice_init ) 
    869          CALL lim_column_sum_energy (jpl, nlay_i,  e_i, eice_init ) 
    870          DO ji = mi0(iiceprt), mi1(iiceprt) 
    871             DO jj = mj0(jiceprt), mj1(jiceprt) 
    872                WRITE(numout,*) ' vice_init  : ', vice_init(ji,jj) 
    873                WRITE(numout,*) ' eice_init  : ', eice_init(ji,jj) 
    874             END DO 
    875          END DO 
    876       ENDIF 
    877  
    878       !------------------------------------------------------------------------------- 
    879       ! 1) Compute change in open water area due to closing and opening. 
    880       !------------------------------------------------------------------------------- 
    881       DO jj = 1, jpj 
    882          DO ji = 1, jpi 
    883             ato_i(ji,jj) = ato_i(ji,jj) - athorn(ji,jj,0) * closing_gross(ji,jj) * rdt_ice        & 
    884                &                        + opning(ji,jj)                          * rdt_ice 
    885             IF    ( ato_i(ji,jj) < -epsi10 ) THEN    ! there is a bug 
    886                IF(lwp)   WRITE(numout,*) 'Ridging error: ato_i < 0 -- ato_i : ',ato_i(ji,jj) 
    887             ELSEIF( ato_i(ji,jj) < 0._wp   ) THEN    ! roundoff error 
    888                ato_i(ji,jj) = 0._wp 
    889             ENDIF 
    890          END DO 
    891       END DO 
    892  
    893       !----------------------------------------------------------------- 
    894       ! 2) Save initial state variables 
    895       !----------------------------------------------------------------- 
    896       aicen_init(:,:,:)   = a_i  (:,:,:) 
    897       vicen_init(:,:,:)   = v_i  (:,:,:) 
    898       vsnwn_init(:,:,:)   = v_s  (:,:,:) 
    899       smv_i_init(:,:,:)   = smv_i(:,:,:) 
    900       esnwn_init(:,:,:)   = e_s  (:,:,1,:) 
    901       eicen_init(:,:,:,:) = e_i  (:,:,:,:) 
    902       oa_i_init (:,:,:)   = oa_i (:,:,:) 
    903  
    904       ! 
    905       !----------------------------------------------------------------- 
    906       ! 3) Pump everything from ice which is being ridged / rafted 
    907       !----------------------------------------------------------------- 
    908       ! Compute the area, volume, and energy of ice ridging in each 
    909       ! category, along with the area of the resulting ridge. 
    910  
    911       DO jl1 = 1, jpl !jl1 describes the ridging category 
    912  
    913          !------------------------------------------------ 
    914          ! 3.1) Identify grid cells with nonzero ridging 
    915          !------------------------------------------------ 
    916  
    917          icells = 0 
    918          DO jj = 1, jpj 
    919             DO ji = 1, jpi 
    920                IF( aicen_init(ji,jj,jl1) > epsi10 .AND. athorn(ji,jj,jl1) > 0._wp  & 
    921                   &   .AND. closing_gross(ji,jj) > 0._wp ) THEN 
    922                   icells = icells + 1 
    923                   indxi(icells) = ji 
    924                   indxj(icells) = jj 
    925                ENDIF 
    926             END DO 
    927          END DO 
    928  
    929          DO ij = 1, icells 
    930             ji = indxi(ij) 
    931             jj = indxj(ij) 
    932  
    933             !-------------------------------------------------------------------- 
    934             ! 3.2) Compute area of ridging ice (ardg1) and of new ridge (ardg2) 
    935             !-------------------------------------------------------------------- 
    936  
    937             ardg1(ji,jj) = aridge(ji,jj,jl1)*closing_gross(ji,jj)*rdt_ice 
    938             arft1(ji,jj) = araft (ji,jj,jl1)*closing_gross(ji,jj)*rdt_ice 
    939             ardg2(ji,jj) = ardg1(ji,jj) / krdg(ji,jj,jl1) 
    940             arft2(ji,jj) = arft1(ji,jj) / kraft 
    941  
    942             !--------------------------------------------------------------- 
    943             ! 3.3) Compute ridging /rafting fractions, make sure afrac <=1  
    944             !--------------------------------------------------------------- 
    945  
    946             afrac(ji,jj) = ardg1(ji,jj) / aicen_init(ji,jj,jl1) !ridging 
    947             afrft(ji,jj) = arft1(ji,jj) / aicen_init(ji,jj,jl1) !rafting 
    948  
    949             IF( afrac(ji,jj) > kamax + epsi10 ) THEN  ! there is a bug 
    950                IF(lwp)   WRITE(numout,*) ' ardg > a_i -- ardg, aicen_init : ', ardg1(ji,jj), aicen_init(ji,jj,jl1) 
    951             ELSEIF( afrac(ji,jj) > kamax ) THEN       ! roundoff error 
    952                afrac(ji,jj) = kamax 
    953             ENDIF 
    954  
    955             IF( afrft(ji,jj) > kamax + epsi10 ) THEN ! there is a bug 
    956                IF(lwp)   WRITE(numout,*) ' arft > a_i -- arft, aicen_init : ', arft1(ji,jj), aicen_init(ji,jj,jl1)  
    957             ELSEIF( afrft(ji,jj) > kamax) THEN       ! roundoff error 
    958                afrft(ji,jj) = kamax 
    959             ENDIF 
    960  
    961             !-------------------------------------------------------------------------- 
    962             ! 3.4) Subtract area, volume, and energy from ridging  
    963             !     / rafting category n1. 
    964             !-------------------------------------------------------------------------- 
    965             vrdg1(ji,jj) = vicen_init(ji,jj,jl1) * afrac(ji,jj) 
    966             vrdg2(ji,jj) = vrdg1(ji,jj) * ( 1. + rn_por_rdg ) 
    967             vsw  (ji,jj) = vrdg1(ji,jj) * rn_por_rdg 
    968  
    969             vsrdg (ji,jj) = vsnwn_init(ji,jj,jl1) * afrac(ji,jj) 
    970             esrdg (ji,jj) = esnwn_init(ji,jj,jl1) * afrac(ji,jj) 
    971             srdg1 (ji,jj) = smv_i_init(ji,jj,jl1) * afrac(ji,jj) 
    972             oirdg1(ji,jj) = oa_i_init (ji,jj,jl1) * afrac(ji,jj) 
    973             oirdg2(ji,jj) = oa_i_init (ji,jj,jl1) * afrac(ji,jj) / krdg(ji,jj,jl1)  
    974  
    975             ! rafting volumes, heat contents ... 
    976             virft (ji,jj) = vicen_init(ji,jj,jl1) * afrft(ji,jj) 
    977             vsrft (ji,jj) = vsnwn_init(ji,jj,jl1) * afrft(ji,jj) 
    978             esrft (ji,jj) = esnwn_init(ji,jj,jl1) * afrft(ji,jj) 
    979             smrft (ji,jj) = smv_i_init(ji,jj,jl1) * afrft(ji,jj)  
    980             oirft1(ji,jj) = oa_i_init (ji,jj,jl1) * afrft(ji,jj)  
    981             oirft2(ji,jj) = oa_i_init (ji,jj,jl1) * afrft(ji,jj) / kraft  
    982  
    983             ! substract everything 
    984             a_i(ji,jj,jl1)   = a_i(ji,jj,jl1)   - ardg1 (ji,jj) - arft1 (ji,jj) 
    985             v_i(ji,jj,jl1)   = v_i(ji,jj,jl1)   - vrdg1 (ji,jj) - virft (ji,jj) 
    986             v_s(ji,jj,jl1)   = v_s(ji,jj,jl1)   - vsrdg (ji,jj) - vsrft (ji,jj) 
    987             e_s(ji,jj,1,jl1) = e_s(ji,jj,1,jl1) - esrdg (ji,jj) - esrft (ji,jj) 
    988             smv_i(ji,jj,jl1) = smv_i(ji,jj,jl1) - srdg1 (ji,jj) - smrft (ji,jj) 
    989             oa_i(ji,jj,jl1)  = oa_i(ji,jj,jl1)  - oirdg1(ji,jj) - oirft1(ji,jj) 
    990  
    991             !----------------------------------------------------------------- 
    992             ! 3.5) Compute properties of new ridges 
    993             !----------------------------------------------------------------- 
    994             !--------- 
    995             ! Salinity 
    996             !--------- 
    997             smsw(ji,jj)  = vsw(ji,jj) * sss_m(ji,jj)                      ! salt content of seawater frozen in voids !! MV HC2014 
    998             srdg2(ji,jj) = srdg1(ji,jj) + smsw(ji,jj)                     ! salt content of new ridge 
    999  
    1000             !srdg2(ji,jj) = MIN( rn_simax * vrdg2(ji,jj) , zsrdg2 )         ! impose a maximum salinity 
    1001              
    1002             sfx_dyn(ji,jj) = sfx_dyn(ji,jj) - smsw(ji,jj) * rhoic * r1_rdtice 
    1003             wfx_dyn(ji,jj) = wfx_dyn(ji,jj) - vsw (ji,jj) * rhoic * r1_rdtice   ! increase in ice volume du to seawater frozen in voids              
    1004  
    1005             !------------------------------------             
    1006             ! 3.6 Increment ridging diagnostics 
    1007             !------------------------------------             
    1008  
    1009             !        jl1 looping 1-jpl 
    1010             !           ij looping 1-icells 
    1011  
    1012             dardg1dt   (ji,jj) = dardg1dt(ji,jj) + ardg1(ji,jj) + arft1(ji,jj) 
    1013             dardg2dt   (ji,jj) = dardg2dt(ji,jj) + ardg2(ji,jj) + arft2(ji,jj) 
    1014             opening    (ji,jj) = opening (ji,jj) + opning(ji,jj) * rdt_ice 
    1015  
    1016             IF( con_i )   vice_init(ji,jj) = vice_init(ji,jj) + vrdg2(ji,jj) - vrdg1(ji,jj) 
    1017  
    1018             !------------------------------------------             
    1019             ! 3.7 Put the snow somewhere in the ocean 
    1020             !------------------------------------------             
    1021             !  Place part of the snow lost by ridging into the ocean.  
    1022             !  Note that esnow_mlt < 0; the ocean must cool to melt snow. 
    1023             !  If the ocean temp = Tf already, new ice must grow. 
    1024             !  During the next time step, thermo_rates will determine whether 
    1025             !  the ocean cools or new ice grows. 
    1026             !        jl1 looping 1-jpl 
    1027             !           ij looping 1-icells 
    1028  
    1029             msnow_mlt(ji,jj) = msnow_mlt(ji,jj) + rhosn*vsrdg(ji,jj)*(1.0-rn_fsnowrdg)   &   ! rafting included 
    1030                &                                + rhosn*vsrft(ji,jj)*(1.0-rn_fsnowrft) 
    1031  
    1032             ! in J/m2 (same as e_s) 
    1033             esnow_mlt(ji,jj) = esnow_mlt(ji,jj) - esrdg(ji,jj)*(1.0-rn_fsnowrdg)         &   !rafting included 
    1034                &                                - esrft(ji,jj)*(1.0-rn_fsnowrft)           
    1035  
    1036             !----------------------------------------------------------------- 
    1037             ! 3.8 Compute quantities used to apportion ice among categories 
    1038             ! in the n2 loop below 
    1039             !----------------------------------------------------------------- 
    1040  
    1041             !        jl1 looping 1-jpl 
    1042             !           ij looping 1-icells 
    1043  
    1044             dhr (ji,jj) = hrmax(ji,jj,jl1) - hrmin(ji,jj,jl1) 
    1045             dhr2(ji,jj) = hrmax(ji,jj,jl1) * hrmax(ji,jj,jl1) - hrmin(ji,jj,jl1) * hrmin(ji,jj,jl1) 
    1046  
    1047          END DO 
    1048  
    1049          !-------------------------------------------------------------------- 
    1050          ! 3.9 Compute ridging ice enthalpy, remove it from ridging ice and 
    1051          !      compute ridged ice enthalpy  
    1052          !-------------------------------------------------------------------- 
    1053          DO jk = 1, nlay_i 
    1054             DO ij = 1, icells 
    1055                ji = indxi(ij) 
    1056                jj = indxj(ij) 
    1057                ! heat content of ridged ice 
    1058                erdg1(ji,jj,jk)      = eicen_init(ji,jj,jk,jl1) * afrac(ji,jj)  
    1059                eirft(ji,jj,jk)      = eicen_init(ji,jj,jk,jl1) * afrft(ji,jj) 
    1060                e_i  (ji,jj,jk,jl1)  = e_i(ji,jj,jk,jl1) - erdg1(ji,jj,jk) - eirft(ji,jj,jk) 
    1061                 
    1062                 
    1063                ! enthalpy of the trapped seawater (J/m2, >0) 
    1064                ! clem: if sst>0, then ersw <0 (is that possible?) 
    1065                ersw(ji,jj,jk)   = - rhoic * vsw(ji,jj) * rcp * sst_m(ji,jj) * r1_nlay_i 
    1066  
    1067                ! heat flux to the ocean 
    1068                hfx_dyn(ji,jj) = hfx_dyn(ji,jj) + ersw(ji,jj,jk) * r1_rdtice  ! > 0 [W.m-2] ocean->ice flux  
    1069  
    1070                ! it is added to sea ice because the sign convention is the opposite of the sign convention for the ocean 
    1071                erdg2(ji,jj,jk)  = erdg1(ji,jj,jk) + ersw(ji,jj,jk) 
    1072  
    1073             END DO 
    1074          END DO 
    1075  
    1076  
    1077          IF( con_i ) THEN 
    1078             DO jk = 1, nlay_i 
    1079                DO ij = 1, icells 
    1080                   ji = indxi(ij) 
    1081                   jj = indxj(ij) 
    1082                   eice_init(ji,jj) = eice_init(ji,jj) + erdg2(ji,jj,jk) - erdg1(ji,jj,jk) 
    1083                END DO 
    1084             END DO 
    1085          ENDIF 
    1086  
    1087          !------------------------------------------------------------------------------- 
    1088          ! 4) Add area, volume, and energy of new ridge to each category jl2 
    1089          !------------------------------------------------------------------------------- 
    1090          !        jl1 looping 1-jpl 
    1091          DO jl2  = 1, jpl  
    1092             ! over categories to which ridged ice is transferred 
    1093             DO ij = 1, icells 
    1094                ji = indxi(ij) 
    1095                jj = indxj(ij) 
    1096  
    1097                ! Compute the fraction of ridged ice area and volume going to  
    1098                ! thickness category jl2. 
    1099                ! Transfer area, volume, and energy accordingly. 
    1100  
    1101                IF( hrmin(ji,jj,jl1) >= hi_max(jl2) .OR. hrmax(ji,jj,jl1) <= hi_max(jl2-1) ) THEN 
    1102                   hL = 0._wp 
    1103                   hR = 0._wp 
    1104                ELSE 
    1105                   hL = MAX( hrmin(ji,jj,jl1), hi_max(jl2-1) ) 
    1106                   hR = MIN( hrmax(ji,jj,jl1), hi_max(jl2)   ) 
    1107                ENDIF 
    1108  
    1109                ! fraction of ridged ice area and volume going to n2 
    1110                farea = ( hR - hL ) / dhr(ji,jj)  
    1111                fvol(ji,jj) = ( hR*hR - hL*hL ) / dhr2(ji,jj) 
    1112  
    1113                a_i  (ji,jj  ,jl2) = a_i  (ji,jj  ,jl2) + ardg2 (ji,jj) * farea 
    1114                v_i  (ji,jj  ,jl2) = v_i  (ji,jj  ,jl2) + vrdg2 (ji,jj) * fvol(ji,jj) 
    1115                v_s  (ji,jj  ,jl2) = v_s  (ji,jj  ,jl2) + vsrdg (ji,jj) * fvol(ji,jj) * rn_fsnowrdg 
    1116                e_s  (ji,jj,1,jl2) = e_s  (ji,jj,1,jl2) + esrdg (ji,jj) * fvol(ji,jj) * rn_fsnowrdg 
    1117                smv_i(ji,jj  ,jl2) = smv_i(ji,jj  ,jl2) + srdg2 (ji,jj) * fvol(ji,jj) 
    1118                oa_i (ji,jj  ,jl2) = oa_i (ji,jj  ,jl2) + oirdg2(ji,jj) * farea 
    1119  
    1120             END DO 
    1121  
    1122             ! Transfer ice energy to category jl2 by ridging 
    1123             DO jk = 1, nlay_i 
    1124                DO ij = 1, icells 
    1125                   ji = indxi(ij) 
    1126                   jj = indxj(ij) 
    1127                   e_i(ji,jj,jk,jl2) = e_i(ji,jj,jk,jl2) + fvol(ji,jj) * erdg2(ji,jj,jk) 
    1128                END DO 
    1129             END DO 
    1130             ! 
    1131          END DO                 ! jl2 (new ridges)             
    1132  
    1133          DO jl2 = 1, jpl  
    1134  
    1135             DO ij = 1, icells 
    1136                ji = indxi(ij) 
    1137                jj = indxj(ij) 
    1138                ! Compute the fraction of rafted ice area and volume going to  
    1139                ! thickness category jl2, transfer area, volume, and energy accordingly. 
    1140                ! 
    1141                IF( hraft(ji,jj,jl1) <= hi_max(jl2) .AND. hraft(ji,jj,jl1) >  hi_max(jl2-1) ) THEN 
    1142                   a_i  (ji,jj  ,jl2) = a_i  (ji,jj  ,jl2) + arft2 (ji,jj) 
    1143                   v_i  (ji,jj  ,jl2) = v_i  (ji,jj  ,jl2) + virft (ji,jj) 
    1144                   v_s  (ji,jj  ,jl2) = v_s  (ji,jj  ,jl2) + vsrft (ji,jj) * rn_fsnowrft 
    1145                   e_s  (ji,jj,1,jl2) = e_s  (ji,jj,1,jl2) + esrft (ji,jj) * rn_fsnowrft 
    1146                   smv_i(ji,jj  ,jl2) = smv_i(ji,jj  ,jl2) + smrft (ji,jj)     
    1147                   oa_i (ji,jj  ,jl2) = oa_i (ji,jj  ,jl2) + oirft2(ji,jj) 
    1148                ENDIF 
    1149                ! 
    1150             END DO 
    1151  
    1152             ! Transfer rafted ice energy to category jl2  
    1153             DO jk = 1, nlay_i 
    1154                DO ij = 1, icells 
    1155                   ji = indxi(ij) 
    1156                   jj = indxj(ij) 
    1157                   IF( hraft(ji,jj,jl1) <= hi_max(jl2) .AND. hraft(ji,jj,jl1) > hi_max(jl2-1)  ) THEN 
    1158                      e_i(ji,jj,jk,jl2) = e_i(ji,jj,jk,jl2) + eirft(ji,jj,jk) 
    1159                   ENDIF 
    1160                END DO 
    1161             END DO 
    1162  
    1163          END DO 
    1164  
    1165       END DO ! jl1 (deforming categories) 
    1166  
    1167       ! Conservation check 
    1168       IF ( con_i ) THEN 
    1169          CALL lim_column_sum (jpl,   v_i, vice_final) 
    1170          fieldid = ' v_i : limitd_me ' 
    1171          CALL lim_cons_check (vice_init, vice_final, 1.0e-6, fieldid)  
    1172  
    1173          CALL lim_column_sum_energy (jpl, nlay_i,  e_i, eice_final ) 
    1174          fieldid = ' e_i : limitd_me ' 
    1175          CALL lim_cons_check (eice_init, eice_final, 1.0e-2, fieldid)  
    1176  
    1177          DO ji = mi0(iiceprt), mi1(iiceprt) 
    1178             DO jj = mj0(jiceprt), mj1(jiceprt) 
    1179                WRITE(numout,*) ' vice_init  : ', vice_init (ji,jj) 
    1180                WRITE(numout,*) ' vice_final : ', vice_final(ji,jj) 
    1181                WRITE(numout,*) ' eice_init  : ', eice_init (ji,jj) 
    1182                WRITE(numout,*) ' eice_final : ', eice_final(ji,jj) 
    1183             END DO 
    1184          END DO 
    1185       ENDIF 
    1186       ! 
    1187       CALL wrk_dealloc( (jpi+1)*(jpj+1),        indxi, indxj ) 
    1188       CALL wrk_dealloc( jpi, jpj,               vice_init, vice_final, eice_init, eice_final ) 
    1189       CALL wrk_dealloc( jpi, jpj,               afrac, fvol , ardg1, ardg2, vsrdg, esrdg, dhr, dhr2 ) 
    1190       CALL wrk_dealloc( jpi, jpj,               vrdg1, vrdg2, vsw  , srdg1, srdg2, smsw, oirdg1, oirdg2 ) 
    1191       CALL wrk_dealloc( jpi, jpj,               afrft, arft1, arft2, virft, vsrft, esrft, smrft, oirft1, oirft2 ) 
    1192       CALL wrk_dealloc( jpi, jpj, jpl,          aicen_init, vicen_init, vsnwn_init, esnwn_init, smv_i_init, oa_i_init ) 
    1193       CALL wrk_dealloc( jpi, jpj, nlay_i,       eirft, erdg1, erdg2, ersw ) 
    1194       CALL wrk_dealloc( jpi, jpj, nlay_i, jpl,  eicen_init ) 
    1195       ! 
    1196    END SUBROUTINE lim_itd_me_ridgeshift 
    1197940 
    1198941   SUBROUTINE lim_itd_me_init 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90

    r5836 r7341  
    159159      CALL wrk_alloc( jpi,jpj, u_oce2, u_ice2, v_oce1 , v_ice1 , zmask               ) 
    160160      CALL wrk_alloc( jpi,jpj, zf1   , zu_ice, zf2   , zv_ice , zdt    , zds  ) 
    161       CALL wrk_alloc( jpi,jpj, zdt   , zds   , zs1   , zs2   , zs12   , zresr , zpice                 ) 
     161      CALL wrk_alloc( jpi,jpj, zs1   , zs2   , zs12   , zresr , zpice                 ) 
    162162 
    163163#if  defined key_lim2 && ! defined key_lim2_vp 
     
    690690      CALL wrk_dealloc( jpi,jpj, u_oce2, u_ice2, v_oce1 , v_ice1 , zmask               ) 
    691691      CALL wrk_dealloc( jpi,jpj, zf1   , zu_ice, zf2   , zv_ice , zdt    , zds  ) 
    692       CALL wrk_dealloc( jpi,jpj, zdt   , zds   , zs1   , zs2   , zs12   , zresr , zpice                 ) 
     692      CALL wrk_dealloc( jpi,jpj, zs1   , zs2   , zs12   , zresr , zpice                 ) 
    693693 
    694694   END SUBROUTINE lim_rhg 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90

    r6140 r7341  
    107107      REAL(wp) ::   zqsr             ! New solar flux received by the ocean 
    108108      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zalb_cs, zalb_os     ! 3D workspace 
     109      REAL(wp), POINTER, DIMENSION(:,:)   ::   zalb                 ! 2D workspace 
    109110      !!--------------------------------------------------------------------- 
    110111      ! 
    111112      ! make calls for heat fluxes before it is modified 
     113      ! pfrld is the lead fraction at the previous time step (actually between TRP and THD) 
    112114      IF( iom_use('qsr_oce') )   CALL iom_put( "qsr_oce" , qsr_oce(:,:) * pfrld(:,:) )                                   !     solar flux at ocean surface 
    113115      IF( iom_use('qns_oce') )   CALL iom_put( "qns_oce" , qns_oce(:,:) * pfrld(:,:) + qemp_oce(:,:) )                   ! non-solar flux at ocean surface 
     
    118120      IF( iom_use('qt_ice' ) )   CALL iom_put( "qt_ice"  , SUM( ( qns_ice(:,:,:) + qsr_ice(:,:,:) )   & 
    119121         &                                                      * a_i_b(:,:,:), dim=3 ) + qemp_ice(:,:) ) 
    120       IF( iom_use('qemp_oce' ) )   CALL iom_put( "qemp_oce"  , qemp_oce(:,:) )   
    121       IF( iom_use('qemp_ice' ) )   CALL iom_put( "qemp_ice"  , qemp_ice(:,:) )   
    122  
    123       ! pfrld is the lead fraction at the previous time step (actually between TRP and THD) 
     122      IF( iom_use('qemp_oce') )  CALL iom_put( "qemp_oce" , qemp_oce(:,:) )   
     123      IF( iom_use('qemp_ice') )  CALL iom_put( "qemp_ice" , qemp_ice(:,:) )   
     124      IF( iom_use('emp_oce' ) )  CALL iom_put( "emp_oce"  , emp_oce(:,:) )   ! emp over ocean (taking into account the snow blown away from the ice) 
     125      IF( iom_use('emp_ice' ) )  CALL iom_put( "emp_ice"  , emp_ice(:,:) )   ! emp over ice   (taking into account the snow blown away from the ice) 
     126 
     127      ! albedo output 
     128      CALL wrk_alloc( jpi,jpj, zalb )     
     129 
     130      zalb(:,:) = 0._wp 
     131      WHERE     ( SUM( a_i_b, dim=3 ) <= epsi06 )  ;  zalb(:,:) = 0.066_wp 
     132      ELSEWHERE                                    ;  zalb(:,:) = SUM( alb_ice * a_i_b, dim=3 ) / SUM( a_i_b, dim=3 ) 
     133      END WHERE 
     134      IF( iom_use('alb_ice' ) )  CALL iom_put( "alb_ice"  , zalb(:,:) )           ! ice albedo output 
     135 
     136      zalb(:,:) = SUM( alb_ice * a_i_b, dim=3 ) + 0.066_wp * ( 1._wp - SUM( a_i_b, dim=3 ) )       
     137      IF( iom_use('albedo'  ) )  CALL iom_put( "albedo"  , zalb(:,:) )           ! ice albedo output 
     138 
     139      CALL wrk_dealloc( jpi,jpj, zalb )     
     140 
    124141      DO jj = 1, jpj 
    125142         DO ji = 1, jpi 
     
    140157            hfx_out(ji,jj) = hfx_out(ji,jj) + zqmass + zqsr 
    141158 
    142             ! Add the residual from heat diffusion equation (W.m-2) 
    143             !------------------------------------------------------- 
    144             hfx_out(ji,jj) = hfx_out(ji,jj) + hfx_err_dif(ji,jj) 
     159            ! Add the residual from heat diffusion equation and sublimation (W.m-2) 
     160            !---------------------------------------------------------------------- 
     161            hfx_out(ji,jj) = hfx_out(ji,jj) + hfx_err_dif(ji,jj) +   & 
     162               &           ( hfx_sub(ji,jj) - SUM( qevap_ice(ji,jj,:) * a_i_b(ji,jj,:) ) ) 
    145163 
    146164            ! New qsr and qns used to compute the oceanic heat flux at the next time step 
    147             !--------------------------------------------------- 
     165            !---------------------------------------------------------------------------- 
    148166            qsr(ji,jj) = zqsr                                       
    149167            qns(ji,jj) = hfx_out(ji,jj) - zqsr               
     
    165183 
    166184            ! mass flux at the ocean/ice interface 
    167             fmmflx(ji,jj) = - ( wfx_ice(ji,jj) + wfx_snw(ji,jj) ) * r1_rdtice  ! F/M mass flux save at least for biogeochemical model 
    168             emp(ji,jj)    = emp_oce(ji,jj) - wfx_ice(ji,jj) - wfx_snw(ji,jj)   ! mass flux + F/M mass flux (always ice/ocean mass exchange) 
    169              
     185            fmmflx(ji,jj) = - ( wfx_ice(ji,jj) + wfx_snw(ji,jj) + wfx_err_sub(ji,jj) )              ! F/M mass flux save at least for biogeochemical model 
     186            emp(ji,jj)    = emp_oce(ji,jj) - wfx_ice(ji,jj) - wfx_snw(ji,jj) - wfx_err_sub(ji,jj)   ! mass flux + F/M mass flux (always ice/ocean mass exchange)             
    170187         END DO 
    171188      END DO 
     
    175192      !------------------------------------------! 
    176193      sfx(:,:) = sfx_bog(:,:) + sfx_bom(:,:) + sfx_sum(:,:) + sfx_sni(:,:) + sfx_opw(:,:)   & 
    177          &     + sfx_res(:,:) + sfx_dyn(:,:) + sfx_bri(:,:) 
     194         &     + sfx_res(:,:) + sfx_dyn(:,:) + sfx_bri(:,:) + sfx_sub(:,:) 
    178195 
    179196      !-------------------------------------------------------------! 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90

    r6140 r7341  
    440440      ! 
    441441      DO ji = kideb, kiut 
    442          zdh_mel = MIN( 0._wp, dh_i_surf(ji) + dh_i_bott(ji) + dh_snowice(ji) ) 
     442         zdh_mel = MIN( 0._wp, dh_i_surf(ji) + dh_i_bott(ji) + dh_snowice(ji) + dh_i_sub(ji) ) 
    443443         IF( zdh_mel < 0._wp .AND. a_i_1d(ji) > 0._wp )  THEN 
    444444            zvi          = a_i_1d(ji) * ht_i_1d(ji) 
     
    495495         ! 
    496496         CALL tab_2d_1d( nbpb, qprec_ice_1d(1:nbpb), qprec_ice(:,:) , jpi, jpj, npb(1:nbpb) ) 
     497         CALL tab_2d_1d( nbpb, qevap_ice_1d(1:nbpb), qevap_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) ) 
    497498         CALL tab_2d_1d( nbpb, qsr_ice_1d (1:nbpb), qsr_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) ) 
    498499         CALL tab_2d_1d( nbpb, fr1_i0_1d  (1:nbpb), fr1_i0          , jpi, jpj, npb(1:nbpb) ) 
     
    524525         CALL tab_2d_1d( nbpb, sfx_bri_1d (1:nbpb), sfx_bri         , jpi, jpj, npb(1:nbpb) ) 
    525526         CALL tab_2d_1d( nbpb, sfx_res_1d (1:nbpb), sfx_res         , jpi, jpj, npb(1:nbpb) ) 
     527         CALL tab_2d_1d( nbpb, sfx_sub_1d (1:nbpb), sfx_sub         , jpi, jpj,npb(1:nbpb) ) 
    526528         ! 
    527529         CALL tab_2d_1d( nbpb, hfx_thd_1d (1:nbpb), hfx_thd         , jpi, jpj, npb(1:nbpb) ) 
     
    574576         CALL tab_1d_2d( nbpb, sfx_res       , npb, sfx_res_1d(1:nbpb)   , jpi, jpj ) 
    575577         CALL tab_1d_2d( nbpb, sfx_bri       , npb, sfx_bri_1d(1:nbpb)   , jpi, jpj ) 
     578         CALL tab_1d_2d( nbpb, sfx_sub       , npb, sfx_sub_1d(1:nbpb)   , jpi, jpj )         
    576579         ! 
    577580         CALL tab_1d_2d( nbpb, hfx_thd       , npb, hfx_thd_1d(1:nbpb)   , jpi, jpj ) 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limthd_dh.F90

    r5487 r7341  
    7474 
    7575      REAL(wp) ::   ztmelts             ! local scalar 
    76       REAL(wp) ::   zfdum        
     76      REAL(wp) ::   zdum        
    7777      REAL(wp) ::   zfracs       ! fractionation coefficient for bottom salt entrapment 
    7878      REAL(wp) ::   zs_snic      ! snow-ice salinity 
     
    9595      REAL(wp), POINTER, DIMENSION(:) ::   zq_rema     ! remaining heat at the end of the routine    (J.m-2) 
    9696      REAL(wp), POINTER, DIMENSION(:) ::   zf_tt       ! Heat budget to determine melting or freezing(W.m-2) 
     97      REAL(wp), POINTER, DIMENSION(:) ::   zevap_rema  ! remaining mass flux from sublimation        (kg.m-2) 
    9798 
    9899      REAL(wp), POINTER, DIMENSION(:) ::   zdh_s_mel   ! snow melt  
     
    105106 
    106107      REAL(wp), POINTER, DIMENSION(:) ::   zqh_i       ! total ice heat content  (J.m-2) 
    107       REAL(wp), POINTER, DIMENSION(:) ::   zqh_s       ! total snow heat content (J.m-2) 
    108       REAL(wp), POINTER, DIMENSION(:) ::   zq_s        ! total snow enthalpy     (J.m-3) 
    109108      REAL(wp), POINTER, DIMENSION(:) ::   zsnw        ! distribution of snow after wind blowing 
    110109 
     
    118117      ! Discriminate between varying salinity (nn_icesal=2) and prescribed cases (other values) 
    119118      SELECT CASE( nn_icesal )                       ! varying salinity or not 
    120          CASE( 1, 3, 4 ) ;   zswitch_sal = 0       ! prescribed salinity profile 
    121          CASE( 2 )       ;   zswitch_sal = 1       ! varying salinity profile 
     119         CASE( 1, 3 ) ;   zswitch_sal = 0       ! prescribed salinity profile 
     120         CASE( 2 )    ;   zswitch_sal = 1       ! varying salinity profile 
    122121      END SELECT 
    123122 
    124       CALL wrk_alloc( jpij, zqprec, zq_su, zq_bo, zf_tt, zq_rema, zsnw ) 
    125       CALL wrk_alloc( jpij, zdh_s_mel, zdh_s_pre, zdh_s_sub, zqh_i, zqh_s, zq_s ) 
     123      CALL wrk_alloc( jpij, zqprec, zq_su, zq_bo, zf_tt, zq_rema, zsnw, zevap_rema ) 
     124      CALL wrk_alloc( jpij, zdh_s_mel, zdh_s_pre, zdh_s_sub, zqh_i ) 
    126125      CALL wrk_alloc( jpij, nlay_i, zdeltah, zh_i ) 
    127126      CALL wrk_alloc( jpij, nlay_i, icount ) 
    128127        
    129       dh_i_surf  (:) = 0._wp ; dh_i_bott  (:) = 0._wp ; dh_snowice(:) = 0._wp 
     128      dh_i_surf  (:) = 0._wp ; dh_i_bott  (:) = 0._wp ; dh_snowice(:) = 0._wp ; dh_i_sub(:) = 0._wp 
    130129      dsm_i_se_1d(:) = 0._wp ; dsm_i_si_1d(:) = 0._wp    
    131130 
    132131      zqprec   (:) = 0._wp ; zq_su    (:) = 0._wp ; zq_bo    (:) = 0._wp ; zf_tt(:) = 0._wp 
    133       zq_rema  (:) = 0._wp ; zsnw     (:) = 0._wp 
     132      zq_rema  (:) = 0._wp ; zsnw     (:) = 0._wp ; zevap_rema(:) = 0._wp ; 
    134133      zdh_s_mel(:) = 0._wp ; zdh_s_pre(:) = 0._wp ; zdh_s_sub(:) = 0._wp ; zqh_i(:) = 0._wp 
    135       zqh_s    (:) = 0._wp ; zq_s     (:) = 0._wp      
    136134 
    137135      zdeltah(:,:) = 0._wp ; zh_i(:,:) = 0._wp        
     
    159157      ! 
    160158      DO ji = kideb, kiut 
    161          zfdum      = qns_ice_1d(ji) + ( 1._wp - i0(ji) ) * qsr_ice_1d(ji) - fc_su(ji)  
     159         zdum       = qns_ice_1d(ji) + ( 1._wp - i0(ji) ) * qsr_ice_1d(ji) - fc_su(ji)  
    162160         zf_tt(ji)  = fc_bo_i(ji) + fhtur_1d(ji) + fhld_1d(ji)  
    163161 
    164          zq_su (ji) = MAX( 0._wp, zfdum     * rdt_ice ) * MAX( 0._wp , SIGN( 1._wp, t_su_1d(ji) - rt0 ) ) 
     162         zq_su (ji) = MAX( 0._wp, zdum      * rdt_ice ) * MAX( 0._wp , SIGN( 1._wp, t_su_1d(ji) - rt0 ) ) 
    165163         zq_bo (ji) = MAX( 0._wp, zf_tt(ji) * rdt_ice ) 
    166164      END DO 
     
    187185      !  2) Computing layer thicknesses and enthalpies.            ! 
    188186      !------------------------------------------------------------! 
    189       ! 
    190       DO jk = 1, nlay_s 
    191          DO ji = kideb, kiut 
    192             zqh_s(ji) =  zqh_s(ji) + q_s_1d(ji,jk) * ht_s_1d(ji) * r1_nlay_s 
    193          END DO 
    194       END DO 
    195187      ! 
    196188      DO jk = 1, nlay_i 
     
    275267      END DO 
    276268 
    277       !---------------------- 
    278       ! 3.2 Snow sublimation  
    279       !---------------------- 
     269      !------------------------------ 
     270      ! 3.2 Sublimation (part1: snow)  
     271      !------------------------------ 
    280272      ! qla_ice is always >=0 (upwards), heat goes to the atmosphere, therefore snow sublimates 
    281273      ! clem comment: not counted in mass/heat exchange in limsbc since this is an exchange with atm. (not ocean) 
    282       ! clem comment: ice should also sublimate 
    283274      zdeltah(:,:) = 0._wp 
    284       ! coupled mode: sublimation is set to 0 (evap_ice = 0) until further notice 
    285       ! forced  mode: snow thickness change due to sublimation 
    286       DO ji = kideb, kiut 
    287          zdh_s_sub(ji)  =  MAX( - ht_s_1d(ji) , - evap_ice_1d(ji) * r1_rhosn * rdt_ice ) 
    288          ! Heat flux by sublimation [W.m-2], < 0 
    289          !      sublimate first snow that had fallen, then pre-existing snow 
     275      DO ji = kideb, kiut 
     276         zdh_s_sub(ji)  = MAX( - ht_s_1d(ji) , - evap_ice_1d(ji) * r1_rhosn * rdt_ice ) 
     277         ! remaining evap in kg.m-2 (used for ice melting later on) 
     278         zevap_rema(ji)  = evap_ice_1d(ji) * rdt_ice + zdh_s_sub(ji) * rhosn 
     279         ! Heat flux by sublimation [W.m-2], < 0 (sublimate first snow that had fallen, then pre-existing snow) 
    290280         zdeltah(ji,1)  = MAX( zdh_s_sub(ji), - zdh_s_pre(ji) ) 
    291281         hfx_sub_1d(ji) = hfx_sub_1d(ji) + ( zdeltah(ji,1) * zqprec(ji) + ( zdh_s_sub(ji) - zdeltah(ji,1) ) * q_s_1d(ji,1)  & 
     
    309299      !------------------------------------------- 
    310300      ! new temp and enthalpy of the snow (remaining snow precip + remaining pre-existing snow) 
    311       zq_s(:) = 0._wp  
    312301      DO jk = 1, nlay_s 
    313302         DO ji = kideb,kiut 
    314             rswitch       = MAX(  0._wp , SIGN( 1._wp, ht_s_1d(ji) - epsi20 )  ) 
    315             q_s_1d(ji,jk) = rswitch / MAX( ht_s_1d(ji), epsi20 ) *                          & 
    316               &            ( (   zdh_s_pre(ji)             ) * zqprec(ji) +  & 
    317               &              (   ht_s_1d(ji) - zdh_s_pre(ji) ) * rhosn * ( cpic * ( rt0 - t_s_1d(ji,jk) ) + lfus ) ) 
    318             zq_s(ji)     =  zq_s(ji) + q_s_1d(ji,jk) 
     303            rswitch       = MAX( 0._wp , SIGN( 1._wp, ht_s_1d(ji) - epsi20 ) ) 
     304            q_s_1d(ji,jk) = rswitch / MAX( ht_s_1d(ji), epsi20 ) *           & 
     305              &            ( ( zdh_s_pre(ji)               ) * zqprec(ji) +  & 
     306              &              ( ht_s_1d(ji) - zdh_s_pre(ji) ) * rhosn * ( cpic * ( rt0 - t_s_1d(ji,jk) ) + lfus ) ) 
    319307         END DO 
    320308      END DO 
     
    370358               zQm            = zfmdt * zEw                           ! Energy of the melt water sent to the ocean [J/m2, <0] 
    371359                
    372                ! Contribution to salt flux (clem: using sm_i_1d and not s_i_1d(jk) is ok) 
     360               ! Contribution to salt flux >0 (clem: using sm_i_1d and not s_i_1d(jk) is ok) 
    373361               sfx_sum_1d(ji) = sfx_sum_1d(ji) - rhoic * a_i_1d(ji) * zdeltah(ji,jk) * sm_i_1d(ji) * r1_rdtice 
    374362                
     
    383371                
    384372            END IF 
     373            ! ---------------------- 
     374            ! Sublimation part2: ice 
     375            ! ---------------------- 
     376            zdum      = MAX( - ( zh_i(ji,jk) + zdeltah(ji,jk) ) , - zevap_rema(ji) * r1_rhoic ) 
     377            zdeltah(ji,jk) = zdeltah(ji,jk) + zdum 
     378            dh_i_sub(ji)  = dh_i_sub(ji) + zdum 
     379            ! Salt flux > 0 (clem2016: flux is sent to the ocean for simplicity but salt should remain in the ice except if all ice is melted. 
     380            !                          It must be corrected at some point) 
     381            sfx_sub_1d(ji) = sfx_sub_1d(ji) - rhoic * a_i_1d(ji) * zdum * sm_i_1d(ji) * r1_rdtice 
     382            ! Heat flux [W.m-2], < 0 
     383            hfx_sub_1d(ji) = hfx_sub_1d(ji) + zdum * q_i_1d(ji,jk) * a_i_1d(ji) * r1_rdtice 
     384            ! Mass flux > 0 
     385            wfx_sub_1d(ji) =  wfx_sub_1d(ji) - rhoic * a_i_1d(ji) * zdum * r1_rdtice 
     386            ! update remaining mass flux 
     387            zevap_rema(ji)  = zevap_rema(ji) + zdum * rhoic 
     388             
    385389            ! record which layers have disappeared (for bottom melting)  
    386390            !    => icount=0 : no layer has vanished 
     
    389393            icount(ji,jk) = NINT( rswitch ) 
    390394            zh_i(ji,jk)   = MAX( 0._wp , zh_i(ji,jk) + zdeltah(ji,jk) ) 
    391  
     395                         
    392396            ! update heat content (J.m-2) and layer thickness 
    393397            qh_i_old(ji,jk) = qh_i_old(ji,jk) + zdeltah(ji,jk) * q_i_1d(ji,jk) 
     
    397401      ! update ice thickness 
    398402      DO ji = kideb, kiut 
    399          ht_i_1d(ji) =  MAX( 0._wp , ht_i_1d(ji) + dh_i_surf(ji) ) 
     403         ht_i_1d(ji) =  MAX( 0._wp , ht_i_1d(ji) + dh_i_surf(ji) + dh_i_sub(ji) ) 
     404      END DO 
     405 
     406      ! remaining "potential" evap is sent to ocean 
     407      DO ji = kideb, kiut 
     408         ii = MOD( npb(ji) - 1, jpi ) + 1 ; ij = ( npb(ji) - 1 ) / jpi + 1 
     409         wfx_err_sub(ii,ij) = wfx_err_sub(ii,ij) - zevap_rema(ji) * a_i_1d(ji) * r1_rdtice  ! <=0 (net evap for the ocean in kg.m-2.s-1) 
    400410      END DO 
    401411 
     
    653663         sfx_sni_1d(ji) = sfx_sni_1d(ji) + sss_m(ii,ij) * a_i_1d(ji) * zfmdt * r1_rdtice  
    654664           
     665         ! virtual salt flux to keep salinity constant 
     666         IF( nn_icesal == 1 .OR. nn_icesal == 3 )  THEN 
     667            sfx_bri_1d(ji) = sfx_bri_1d(ji) - sss_m(ii,ij) * a_i_1d(ji) * zfmdt                  * r1_rdtice  & ! put back sss_m into the ocean 
     668               &                            - sm_i_1d(ji)  * a_i_1d(ji) * dh_snowice(ji) * rhoic * r1_rdtice    ! and get  sm_i  from the ocean  
     669         ENDIF 
     670 
    655671         ! Contribution to mass flux 
    656672         ! All snow is thrown in the ocean, and seawater is taken to replace the volume 
     
    686702      WHERE( ht_i_1d == 0._wp ) a_i_1d = 0._wp 
    687703       
    688       CALL wrk_dealloc( jpij, zqprec, zq_su, zq_bo, zf_tt, zq_rema, zsnw ) 
    689       CALL wrk_dealloc( jpij, zdh_s_mel, zdh_s_pre, zdh_s_sub, zqh_i, zqh_s, zq_s ) 
     704      CALL wrk_dealloc( jpij, zqprec, zq_su, zq_bo, zf_tt, zq_rema, zsnw, zevap_rema ) 
     705      CALL wrk_dealloc( jpij, zdh_s_mel, zdh_s_pre, zdh_s_sub, zqh_i ) 
    690706      CALL wrk_dealloc( jpij, nlay_i, zdeltah, zh_i ) 
    691707      CALL wrk_dealloc( jpij, nlay_i, icount ) 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limthd_lac.F90

    r5202 r7341  
    7575      INTEGER ::   ii, ij, iter     !   -       - 
    7676      REAL(wp)  ::   ztmelts, zdv, zfrazb, zweight, zde                         ! local scalars 
    77       REAL(wp) ::   zgamafr, zvfrx, zvgx, ztaux, ztwogp, zf , zhicol_new        !   -      - 
     77      REAL(wp) ::   zgamafr, zvfrx, zvgx, ztaux, ztwogp, zf                     !   -      - 
    7878      REAL(wp) ::   ztenagm, zvfry, zvgy, ztauy, zvrel2, zfp, zsqcd , zhicrit   !   -      - 
    79       LOGICAL  ::   iterate_frazil   ! iterate frazil ice collection thickness 
    8079      CHARACTER (len = 15) :: fieldid 
    8180 
     
    108107      REAL(wp), POINTER, DIMENSION(:,:) ::   zsmv_i_1d ! 1-D version of smv_i 
    109108 
    110       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ze_i_1d   !: 1-D version of e_i 
    111  
    112       REAL(wp), POINTER, DIMENSION(:,:) ::   zvrel                   ! relative ice / frazil velocity 
    113  
    114       REAL(wp) :: zcai = 1.4e-3_wp 
     109      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ze_i_1d !: 1-D version of e_i 
     110 
     111      REAL(wp), POINTER, DIMENSION(:,:) ::   zvrel     ! relative ice / frazil velocity 
     112 
     113      REAL(wp) :: zcai = 1.4e-3_wp                     ! ice-air drag (clem: should be dependent on coupling/forcing used) 
    115114      !!-----------------------------------------------------------------------! 
    116115 
     
    143142      !------------------------------------------------------------------------------!     
    144143      ! hicol is the thickness of new ice formed in open water 
    145       ! hicol can be either prescribed (frazswi = 0) 
    146       ! or computed (frazswi = 1) 
     144      ! hicol can be either prescribed (frazswi = 0) or computed (frazswi = 1) 
    147145      ! Frazil ice forms in open water, is transported by wind 
    148146      ! accumulates at the edge of the consolidated ice edge 
     
    155153      zvrel(:,:) = 0._wp 
    156154 
    157       ! Default new ice thickness  
    158       hicol(:,:) = rn_hnewice 
     155      ! Default new ice thickness 
     156      WHERE( qlead(:,:) < 0._wp ) ; hicol = rn_hnewice 
     157      ELSEWHERE                   ; hicol = 0._wp 
     158      END WHERE 
    159159 
    160160      IF( ln_frazil ) THEN 
     
    182182                     &          +   vtau_ice(ji  ,jj  ) * vmask(ji  ,jj  ,1) ) * 0.5_wp 
    183183                  ! Square root of wind stress 
    184                   ztenagm       =  SQRT( SQRT( ztaux**2 + ztauy**2 ) ) 
     184                  ztenagm       =  SQRT( SQRT( ztaux * ztaux + ztauy * ztauy ) ) 
    185185 
    186186                  !--------------------- 
     
    205205                  zvrel2 = MAX(  ( zvfrx - zvgx ) * ( zvfrx - zvgx )   & 
    206206                     &         + ( zvfry - zvgy ) * ( zvfry - zvgy ) , 0.15 * 0.15 ) 
    207                   zvrel(ji,jj)  = SQRT( zvrel2 ) 
     207                  zvrel(ji,jj) = SQRT( zvrel2 ) 
    208208 
    209209                  !--------------------- 
    210210                  ! Iterative procedure 
    211211                  !--------------------- 
    212                   hicol(ji,jj) = zhicrit + 0.1  
    213                   hicol(ji,jj) = zhicrit +   hicol(ji,jj)    & 
    214                      &                   / ( hicol(ji,jj) * hicol(ji,jj) -  zhicrit * zhicrit ) * ztwogp * zvrel2 
    215  
    216 !!gm better coding: above: hicol(ji,jj) * hicol(ji,jj) = (zhicrit + 0.1)*(zhicrit + 0.1) 
    217 !!gm                                                   = zhicrit**2 + 0.2*zhicrit +0.01 
    218 !!gm                therefore the 2 lines with hicol can be replaced by 1 line: 
    219 !!gm              hicol(ji,jj) = zhicrit + (zhicrit + 0.1) / ( 0.2 * zhicrit + 0.01 ) * ztwogp * zvrel2 
    220 !!gm further more (zhicrit + 0.1)/(0.2 * zhicrit + 0.01 )*ztwogp can be computed one for all outside the DO loop 
     212                  hicol(ji,jj) = zhicrit +   ( zhicrit + 0.1 )    & 
     213                     &                   / ( ( zhicrit + 0.1 ) * ( zhicrit + 0.1 ) -  zhicrit * zhicrit ) * ztwogp * zvrel2 
    221214 
    222215                  iter = 1 
    223                   iterate_frazil = .true. 
    224  
    225                   DO WHILE ( iter < 100 .AND. iterate_frazil )  
    226                      zf = ( hicol(ji,jj) - zhicrit ) * ( hicol(ji,jj)**2 - zhicrit**2 ) & 
    227                         - hicol(ji,jj) * zhicrit * ztwogp * zvrel2 
    228                      zfp = ( hicol(ji,jj) - zhicrit ) * ( 3.0*hicol(ji,jj) + zhicrit ) & 
    229                         - zhicrit * ztwogp * zvrel2 
    230                      zhicol_new = hicol(ji,jj) - zf/zfp 
    231                      hicol(ji,jj)   = zhicol_new 
    232  
     216                  DO WHILE ( iter < 20 )  
     217                     zf  = ( hicol(ji,jj) - zhicrit ) * ( hicol(ji,jj) * hicol(ji,jj) - zhicrit * zhicrit ) -   & 
     218                        &    hicol(ji,jj) * zhicrit * ztwogp * zvrel2 
     219                     zfp = ( hicol(ji,jj) - zhicrit ) * ( 3.0 * hicol(ji,jj) + zhicrit ) - zhicrit * ztwogp * zvrel2 
     220 
     221                     hicol(ji,jj) = hicol(ji,jj) - zf/zfp 
    233222                     iter = iter + 1 
    234  
    235                   END DO ! do while 
     223                  END DO 
    236224 
    237225               ENDIF ! end of selection of pixels where ice forms 
    238226 
    239             END DO ! loop on ji ends 
    240          END DO ! loop on jj ends 
    241       !  
    242       CALL lbc_lnk( zvrel(:,:), 'T', 1. ) 
    243       CALL lbc_lnk( hicol(:,:), 'T', 1. ) 
     227            END DO  
     228         END DO  
     229         !  
     230         CALL lbc_lnk( zvrel(:,:), 'T', 1. ) 
     231         CALL lbc_lnk( hicol(:,:), 'T', 1. ) 
    244232 
    245233      ENDIF ! End of computation of frazil ice collection thickness 
     
    282270      ! Move from 2-D to 1-D vectors 
    283271      !------------------------------ 
    284       ! If ocean gains heat do nothing  
    285       ! 0therwise compute new ice formation 
     272      ! If ocean gains heat do nothing. Otherwise compute new ice formation 
    286273 
    287274      IF ( nbpac > 0 ) THEN 
     
    297284         END DO 
    298285 
    299          CALL tab_2d_1d( nbpac, qlead_1d  (1:nbpac)     , qlead  , jpi, jpj, npac(1:nbpac) ) 
    300          CALL tab_2d_1d( nbpac, t_bo_1d   (1:nbpac)     , t_bo   , jpi, jpj, npac(1:nbpac) ) 
    301          CALL tab_2d_1d( nbpac, sfx_opw_1d(1:nbpac)     , sfx_opw, jpi, jpj, npac(1:nbpac) ) 
    302          CALL tab_2d_1d( nbpac, wfx_opw_1d(1:nbpac)     , wfx_opw, jpi, jpj, npac(1:nbpac) ) 
    303          CALL tab_2d_1d( nbpac, hicol_1d  (1:nbpac)     , hicol  , jpi, jpj, npac(1:nbpac) ) 
    304          CALL tab_2d_1d( nbpac, zvrel_1d  (1:nbpac)     , zvrel  , jpi, jpj, npac(1:nbpac) ) 
    305  
    306          CALL tab_2d_1d( nbpac, hfx_thd_1d(1:nbpac)     , hfx_thd, jpi, jpj, npac(1:nbpac) ) 
    307          CALL tab_2d_1d( nbpac, hfx_opw_1d(1:nbpac)     , hfx_opw, jpi, jpj, npac(1:nbpac) ) 
     286         CALL tab_2d_1d( nbpac, qlead_1d  (1:nbpac)     , qlead     , jpi, jpj, npac(1:nbpac) ) 
     287         CALL tab_2d_1d( nbpac, t_bo_1d   (1:nbpac)     , t_bo      , jpi, jpj, npac(1:nbpac) ) 
     288         CALL tab_2d_1d( nbpac, sfx_opw_1d(1:nbpac)     , sfx_opw   , jpi, jpj, npac(1:nbpac) ) 
     289         CALL tab_2d_1d( nbpac, wfx_opw_1d(1:nbpac)     , wfx_opw   , jpi, jpj, npac(1:nbpac) ) 
     290         CALL tab_2d_1d( nbpac, hicol_1d  (1:nbpac)     , hicol     , jpi, jpj, npac(1:nbpac) ) 
     291         CALL tab_2d_1d( nbpac, zvrel_1d  (1:nbpac)     , zvrel     , jpi, jpj, npac(1:nbpac) ) 
     292 
     293         CALL tab_2d_1d( nbpac, hfx_thd_1d(1:nbpac)     , hfx_thd   , jpi, jpj, npac(1:nbpac) ) 
     294         CALL tab_2d_1d( nbpac, hfx_opw_1d(1:nbpac)     , hfx_opw   , jpi, jpj, npac(1:nbpac) ) 
     295         CALL tab_2d_1d( nbpac, rn_amax_1d(1:nbpac)     , rn_amax_2d, jpi, jpj, npac(1:nbpac) ) 
    308296 
    309297         !------------------------------------------------------------------------------! 
     
    316304         zv_b(1:nbpac,:) = zv_i_1d(1:nbpac,:)  
    317305         za_b(1:nbpac,:) = za_i_1d(1:nbpac,:) 
     306 
    318307         !---------------------- 
    319308         ! Thickness of new ice 
    320309         !---------------------- 
    321          DO ji = 1, nbpac 
    322             zh_newice(ji) = rn_hnewice 
    323          END DO 
    324          IF( ln_frazil ) zh_newice(1:nbpac) = hicol_1d(1:nbpac) 
     310         zh_newice(1:nbpac) = hicol_1d(1:nbpac) 
    325311 
    326312         !---------------------- 
     
    346332         DO ji = 1, nbpac 
    347333            ztmelts       = - tmut * zs_newice(ji) + rt0                  ! Melting point (K) 
    348             ze_newice(ji) =   rhoic * (  cpic * ( ztmelts - t_bo_1d(ji) )                             & 
     334            ze_newice(ji) =   rhoic * (  cpic * ( ztmelts - t_bo_1d(ji) )                                         & 
    349335               &                       + lfus * ( 1.0 - ( ztmelts - rt0 ) / MIN( t_bo_1d(ji) - rt0, -epsi10 ) )   & 
    350336               &                       - rcp  *         ( ztmelts - rt0 )  ) 
     
    384370            ! salt flux 
    385371            sfx_opw_1d(ji) = sfx_opw_1d(ji) - zv_newice(ji) * rhoic * zs_newice(ji) * r1_rdtice 
    386  
     372         END DO 
     373          
     374         zv_frazb(:) = 0._wp 
     375         IF( ln_frazil ) THEN 
    387376            ! A fraction zfrazb of frazil ice is accreted at the ice bottom 
    388             rswitch       = 1._wp - MAX( 0._wp, SIGN( 1._wp , - zat_i_1d(ji) ) ) 
    389             zfrazb        = rswitch * ( TANH ( rn_Cfrazb * ( zvrel_1d(ji) - rn_vfrazb ) ) + 1.0 ) * 0.5 * rn_maxfrazb 
    390             zv_frazb(ji)  =         zfrazb   * zv_newice(ji) 
    391             zv_newice(ji) = ( 1.0 - zfrazb ) * zv_newice(ji) 
    392          END DO 
    393  
     377            DO ji = 1, nbpac 
     378               rswitch       = 1._wp - MAX( 0._wp, SIGN( 1._wp , - zat_i_1d(ji) ) ) 
     379               zfrazb        = rswitch * ( TANH( rn_Cfrazb * ( zvrel_1d(ji) - rn_vfrazb ) ) + 1.0 ) * 0.5 * rn_maxfrazb 
     380               zv_frazb(ji)  =         zfrazb   * zv_newice(ji) 
     381               zv_newice(ji) = ( 1.0 - zfrazb ) * zv_newice(ji) 
     382            END DO 
     383         END IF 
     384          
    394385         !----------------- 
    395386         ! Area of new ice 
     
    409400         ! we keep the excessive volume in memory and attribute it later to bottom accretion 
    410401         DO ji = 1, nbpac 
    411             IF ( za_newice(ji) >  ( rn_amax - zat_i_1d(ji) ) ) THEN 
    412                zda_res(ji)   = za_newice(ji) - ( rn_amax - zat_i_1d(ji) ) 
     402            IF ( za_newice(ji) >  ( rn_amax_1d(ji) - zat_i_1d(ji) ) ) THEN 
     403               zda_res(ji)   = za_newice(ji) - ( rn_amax_1d(ji) - zat_i_1d(ji) ) 
    413404               zdv_res(ji)   = zda_res  (ji) * zh_newice(ji)  
    414405               za_newice(ji) = za_newice(ji) - zda_res  (ji) 
     
    443434               jl = jcat(ji) 
    444435               rswitch = MAX( 0._wp, SIGN( 1._wp , zv_i_1d(ji,jl) - epsi20 ) ) 
    445                ze_i_1d(ji,jk,jl) = zswinew(ji)   *   ze_newice(ji) +                                                      & 
     436               ze_i_1d(ji,jk,jl) = zswinew(ji)   *   ze_newice(ji) +                                                    & 
    446437                  &        ( 1.0 - zswinew(ji) ) * ( ze_newice(ji) * zv_newice(ji) + ze_i_1d(ji,jk,jl) * zv_b(ji,jl) )  & 
    447438                  &        * rswitch / MAX( zv_i_1d(ji,jl), epsi20 ) 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limthd_sal.F90

    r5123 r7341  
    6262      END DO 
    6363  
    64       !------------------------------------------------------------------------------| 
    65       ! 1) Constant salinity, constant in time                                       | 
    66       !------------------------------------------------------------------------------| 
    67 !!gm comment: if nn_icesal = 1 s_i_new, s_i_1d and sm_i_1d can be set to rn_icesal one for all in the initialisation phase !! 
    68 !!gm           ===>>>   simplification of almost all test on nn_icesal value 
    69       IF(  nn_icesal == 1  ) THEN 
    70             s_i_1d (kideb:kiut,1:nlay_i) =  rn_icesal 
    71             sm_i_1d(kideb:kiut)          =  rn_icesal  
    72             s_i_new(kideb:kiut)          =  rn_icesal 
    73       ENDIF 
     64      !--------------------------------------------------------------------| 
     65      ! 1) salinity constant in time                                       | 
     66      !--------------------------------------------------------------------| 
     67      ! do nothing 
    7468 
    75       !------------------------------------------------------------------------------| 
    76       !  Module 2 : Constant salinity varying in time                                | 
    77       !------------------------------------------------------------------------------| 
     69      !----------------------------------------------------------------------| 
     70      !  2) salinity varying in time                                         | 
     71      !----------------------------------------------------------------------| 
    7872      IF(  nn_icesal == 2  ) THEN 
    7973 
     
    113107 
    114108      !------------------------------------------------------------------------------| 
    115       !  Module 3 : Profile of salinity, constant in time                            | 
     109      !  3) vertical profile of salinity, constant in time                           | 
    116110      !------------------------------------------------------------------------------| 
    117111      IF(  nn_icesal == 3  )   CALL lim_var_salprof1d( kideb, kiut ) 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limtrp.F90

    r5836 r7341  
    6363      INTEGER, INTENT(in) ::   kt           ! number of iteration 
    6464      ! 
    65       INTEGER  ::   ji, jj, jk, jl, jt      ! dummy loop indices 
     65      INTEGER  ::   ji, jj, jk, jm , jl, jt      ! dummy loop indices 
    6666      INTEGER  ::   initad                  ! number of sub-timestep for the advection 
    6767      REAL(wp) ::   zcfl , zusnit           !   -      - 
     
    7575      REAL(wp), POINTER, DIMENSION(:,:,:)    ::   zhimax                   ! old ice thickness 
    7676      REAL(wp), POINTER, DIMENSION(:,:)      ::   zatold, zeiold, zesold   ! old concentration, enthalpies 
     77      REAL(wp), POINTER, DIMENSION(:,:,:)             ::   zhdfptab 
    7778      REAL(wp) ::    zdv, zvi, zvs, zsmv, zes, zei 
    7879      REAL(wp) ::    zvi_b, zsmv_b, zei_b, zfs_b, zfw_b, zft_b 
     80      !!--------------------------------------------------------------------- 
     81      INTEGER                                ::  ihdf_vars  = 6  !!Number of variables in which we apply horizontal diffusion 
     82                                                                   !!  inside limtrp for each ice category , not counting the  
     83                                                                   !!  variables corresponding to ice_layers  
    7984      !!--------------------------------------------------------------------- 
    8085      IF( nn_timing == 1 )  CALL timing_start('limtrp') 
     
    8590      CALL wrk_alloc( jpi,jpj,nlay_i,jpl, z0ei ) 
    8691      CALL wrk_alloc( jpi,jpj,jpl,        zhimax, zviold, zvsold, zsmvold ) 
     92      CALL wrk_alloc( jpi,jpj,jpl*(ihdf_vars + nlay_i)+1,zhdfptab) 
    8793 
    8894      IF( numit == nstart .AND. lwp ) THEN 
     
    170176            z0oi (:,:,jl)   = oa_i (:,:,  jl) * e1e2t(:,:)  ! Age content 
    171177            z0es (:,:,jl)   = e_s  (:,:,1,jl) * e1e2t(:,:)  ! Snow heat content 
    172             DO jk = 1, nlay_i 
     178           DO jk = 1, nlay_i 
    173179               z0ei  (:,:,jk,jl) = e_i  (:,:,jk,jl) * e1e2t(:,:) ! Ice  heat content 
    174180            END DO 
     
    284290         ! Diffusion of Ice fields                   
    285291         !------------------------------------------------------------------------------! 
    286  
     292         !------------------------------------ 
     293         !  Diffusion of other ice variables 
     294         !------------------------------------ 
     295         jm=1 
     296         DO jl = 1, jpl 
     297         !                             ! Masked eddy diffusivity coefficient at ocean U- and V-points 
     298         !   DO jj = 1, jpjm1                 ! NB: has not to be defined on jpj line and jpi row 
     299         !      DO ji = 1 , fs_jpim1   ! vector opt. 
     300         !         pahu(ji,jj) = ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -a_i(ji  ,jj,jl) ) ) )   & 
     301         !            &        * ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -a_i(ji+1,jj,jl) ) ) ) * ahiu(ji,jj) 
     302         !         pahv(ji,jj) = ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -a_i(ji,jj  ,jl) ) ) )   & 
     303         !            &        * ( 1._wp - MAX( 0._wp, SIGN( 1._wp,- a_i(ji,jj+1,jl) ) ) ) * ahiv(ji,jj) 
     304         !      END DO 
     305         !   END DO 
     306            DO jj = 1, jpjm1                 ! NB: has not to be defined on jpj line and jpi row 
     307               DO ji = 1 , fs_jpim1   ! vector opt. 
     308                  pahu3D(ji,jj,jl) = ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -a_i(ji  ,jj,  jl ) ) ) )   & 
     309                  &                * ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -a_i(ji+1,jj,  jl ) ) ) ) * ahiu(ji,jj) 
     310                  pahv3D(ji,jj,jl) = ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -a_i(ji,  jj,  jl ) ) ) )   & 
     311                  &                * ( 1._wp - MAX( 0._wp, SIGN( 1._wp,- a_i(ji,  jj+1,jl ) ) ) ) * ahiv(ji,jj) 
     312               END DO 
     313            END DO 
     314 
     315            zhdfptab(:,:,jm)= a_i  (:,:,  jl); jm = jm + 1     
     316            zhdfptab(:,:,jm)= v_i  (:,:,  jl); jm = jm + 1 
     317            zhdfptab(:,:,jm)= v_s  (:,:,  jl); jm = jm + 1  
     318            zhdfptab(:,:,jm)= smv_i(:,:,  jl); jm = jm + 1 
     319            zhdfptab(:,:,jm)= oa_i (:,:,  jl); jm = jm + 1 
     320            zhdfptab(:,:,jm)= e_s  (:,:,1,jl); jm = jm + 1 
     321         ! Sample of adding more variables to apply lim_hdf using lim_hdf optimization--- 
     322         !   zhdfptab(:,:,jm) = variable_1 (:,:,1,jl); jm = jm + 1   
     323         !   zhdfptab(:,:,jm) = variable_2 (:,:,1,jl); jm = jm + 1  
     324         ! 
     325         ! and in this example the parameter ihdf_vars musb be changed to 8 (necessary for allocation) 
     326         !---------------------------------------------------------------------------------------- 
     327            DO jk = 1, nlay_i 
     328              zhdfptab(:,:,jm)=e_i(:,:,jk,jl); jm= jm+1 
     329            END DO 
     330         END DO 
    287331         ! 
    288332         !-------------------------------- 
     
    290334         !-------------------------------- 
    291335         !                             ! Masked eddy diffusivity coefficient at ocean U- and V-points 
     336         !DO jj = 1, jpjm1                    ! NB: has not to be defined on jpj line and jpi row 
     337         !   DO ji = 1 , fs_jpim1   ! vector opt. 
     338         !      pahu(ji,jj) = ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -at_i(ji  ,jj) ) ) )   & 
     339         !         &        * ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -at_i(ji+1,jj) ) ) ) * ahiu(ji,jj) 
     340         !      pahv(ji,jj) = ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -at_i(ji,jj  ) ) ) )   & 
     341         !         &        * ( 1._wp - MAX( 0._wp, SIGN( 1._wp,- at_i(ji,jj+1) ) ) ) * ahiv(ji,jj) 
     342         !   END DO 
     343         !END DO 
     344          
    292345         DO jj = 1, jpjm1                    ! NB: has not to be defined on jpj line and jpi row 
    293346            DO ji = 1 , fs_jpim1   ! vector opt. 
    294                pahu(ji,jj) = ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -at_i(ji  ,jj) ) ) )   & 
    295                   &        * ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -at_i(ji+1,jj) ) ) ) * ahiu(ji,jj) 
    296                pahv(ji,jj) = ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -at_i(ji,jj  ) ) ) )   & 
    297                   &        * ( 1._wp - MAX( 0._wp, SIGN( 1._wp,- at_i(ji,jj+1) ) ) ) * ahiv(ji,jj) 
     347               pahu3D(ji,jj,jpl+1) = ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -at_i(ji  ,jj) ) ) )   & 
     348                  &                * ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -at_i(ji+1,jj) ) ) ) * ahiu(ji,jj) 
     349               pahv3D(ji,jj,jpl+1) = ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -at_i(ji,jj  ) ) ) )   & 
     350                  &                * ( 1._wp - MAX( 0._wp, SIGN( 1._wp,- at_i(ji,jj+1) ) ) ) * ahiv(ji,jj) 
    298351            END DO 
    299352         END DO 
    300353         ! 
    301          CALL lim_hdf( ato_i (:,:) ) 
    302  
    303          !------------------------------------ 
    304          !  Diffusion of other ice variables 
    305          !------------------------------------ 
    306          DO jl = 1, jpl 
    307          !                             ! Masked eddy diffusivity coefficient at ocean U- and V-points 
    308             DO jj = 1, jpjm1                 ! NB: has not to be defined on jpj line and jpi row 
    309                DO ji = 1 , fs_jpim1   ! vector opt. 
    310                   pahu(ji,jj) = ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -a_i(ji  ,jj,jl) ) ) )   & 
    311                      &        * ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -a_i(ji+1,jj,jl) ) ) ) * ahiu(ji,jj) 
    312                   pahv(ji,jj) = ( 1._wp - MAX( 0._wp, SIGN( 1._wp, -a_i(ji,jj  ,jl) ) ) )   & 
    313                      &        * ( 1._wp - MAX( 0._wp, SIGN( 1._wp,- a_i(ji,jj+1,jl) ) ) ) * ahiv(ji,jj) 
    314                END DO 
    315             END DO 
    316  
    317             CALL lim_hdf( v_i  (:,:,  jl) ) 
    318             CALL lim_hdf( v_s  (:,:,  jl) ) 
    319             CALL lim_hdf( smv_i(:,:,  jl) ) 
    320             CALL lim_hdf( oa_i (:,:,  jl) ) 
    321             CALL lim_hdf( a_i  (:,:,  jl) ) 
    322             CALL lim_hdf( e_s  (:,:,1,jl) ) 
     354         zhdfptab(:,:,jm)= ato_i  (:,:); 
     355         CALL lim_hdf( zhdfptab, ihdf_vars, jpl, nlay_i)  
     356 
     357         jm=1 
     358         DO jl = 1, jpl 
     359            a_i  (:,:,  jl) = zhdfptab(:,:,jm); jm = jm + 1       
     360            v_i  (:,:,  jl) = zhdfptab(:,:,jm); jm = jm + 1  
     361            v_s  (:,:,  jl) = zhdfptab(:,:,jm); jm = jm + 1  
     362            smv_i(:,:,  jl) = zhdfptab(:,:,jm); jm = jm + 1  
     363            oa_i (:,:,  jl) = zhdfptab(:,:,jm); jm = jm + 1  
     364            e_s  (:,:,1,jl) = zhdfptab(:,:,jm); jm = jm + 1  
     365         ! Sample of adding more variables to apply lim_hdf--------- 
     366         !   variable_1  (:,:,1,jl) = zhdfptab(:,:, jm  ) ; jm + 1  
     367         !   variable_2  (:,:,1,jl) = zhdfptab(:,:, jm  ) ; jm + 1 
     368         !----------------------------------------------------------- 
    323369            DO jk = 1, nlay_i 
    324                CALL lim_hdf( e_i(:,:,jk,jl) ) 
    325             END DO 
    326          END DO 
     370               e_i(:,:,jk,jl) = zhdfptab(:,:,jm);jm= jm + 1  
     371            END DO 
     372         END DO 
     373 
     374         ato_i  (:,:) = zhdfptab(:,:,jm) 
    327375 
    328376         !------------------------------------------------------------------------------! 
     
    422470            DO jj = 1, jpj 
    423471               DO ji = 1, jpi 
    424                   a_i(ji,jj,1)  = MIN( a_i(ji,jj,1), rn_amax ) 
     472                  a_i(ji,jj,1)  = MIN( a_i(ji,jj,1), rn_amax_2d(ji,jj) ) 
    425473               END DO 
    426474            END DO 
     
    464512      CALL wrk_dealloc( jpi,jpj,nlay_i,jpl, z0ei ) 
    465513      CALL wrk_dealloc( jpi,jpj,jpl,        zviold, zvsold, zhimax, zsmvold ) 
     514      CALL wrk_dealloc( jpi,jpj,jpl*(ihdf_vars+nlay_i)+1,zhdfptab) 
    466515      ! 
    467516      IF( nn_timing == 1 )  CALL timing_stop('limtrp') 
     
    479528   !!====================================================================== 
    480529END MODULE limtrp 
     530 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limupdate1.F90

    r5836 r7341  
    8080         DO jj = 1, jpj 
    8181            DO ji = 1, jpi 
    82                IF( at_i(ji,jj) > rn_amax .AND. a_i(ji,jj,jl) > 0._wp ) THEN 
    83                   a_i (ji,jj,jl) = a_i (ji,jj,jl) * ( 1._wp - ( 1._wp - rn_amax / at_i(ji,jj) ) ) 
    84                   oa_i(ji,jj,jl) = oa_i(ji,jj,jl) * ( 1._wp - ( 1._wp - rn_amax / at_i(ji,jj) ) ) 
     82               IF( at_i(ji,jj) > rn_amax_2d(ji,jj) .AND. a_i(ji,jj,jl) > 0._wp ) THEN 
     83                  a_i (ji,jj,jl) = a_i (ji,jj,jl) * ( 1._wp - ( 1._wp - rn_amax_2d(ji,jj) / at_i(ji,jj) ) ) 
     84                  oa_i(ji,jj,jl) = oa_i(ji,jj,jl) * ( 1._wp - ( 1._wp - rn_amax_2d(ji,jj) / at_i(ji,jj) ) ) 
    8585               ENDIF 
    8686            END DO 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limupdate2.F90

    r5836 r7341  
    9494         DO jj = 1, jpj 
    9595            DO ji = 1, jpi 
    96                IF( at_i(ji,jj) > rn_amax .AND. a_i(ji,jj,jl) > 0._wp ) THEN 
    97                   a_i (ji,jj,jl) = a_i (ji,jj,jl) * ( 1._wp - ( 1._wp - rn_amax / at_i(ji,jj) ) ) 
    98                   oa_i(ji,jj,jl) = oa_i(ji,jj,jl) * ( 1._wp - ( 1._wp - rn_amax / at_i(ji,jj) ) ) 
     96               IF( at_i(ji,jj) > rn_amax_2d(ji,jj) .AND. a_i(ji,jj,jl) > 0._wp ) THEN 
     97                  a_i (ji,jj,jl) = a_i (ji,jj,jl) * ( 1._wp - ( 1._wp - rn_amax_2d(ji,jj) / at_i(ji,jj) ) ) 
     98                  oa_i(ji,jj,jl) = oa_i(ji,jj,jl) * ( 1._wp - ( 1._wp - rn_amax_2d(ji,jj) / at_i(ji,jj) ) ) 
    9999               ENDIF 
    100100            END DO 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limvar.F90

    r5202 r7341  
    163163               rswitch = MAX( 0._wp , SIGN( 1._wp, a_i(ji,jj,jl) - epsi20 ) )   !0 if no ice and 1 if yes 
    164164               ht_i(ji,jj,jl) = v_i (ji,jj,jl) / MAX( a_i(ji,jj,jl) , epsi20 ) * rswitch 
     165            END DO 
     166         END DO 
     167      END DO 
     168      ! Force the upper limit of ht_i to always be < hi_max (99 m). 
     169      DO jj = 1, jpj 
     170         DO ji = 1, jpi 
     171            rswitch = MAX( 0._wp , SIGN( 1._wp, ht_i(ji,jj,jpl) - epsi20 ) ) 
     172            ht_i(ji,jj,jpl) = MIN( ht_i(ji,jj,jpl) , hi_max(jpl) ) 
     173            a_i (ji,jj,jpl) = v_i(ji,jj,jpl) / MAX( ht_i(ji,jj,jpl) , epsi20 ) * rswitch 
     174         END DO 
     175      END DO 
     176 
     177      DO jl = 1, jpl 
     178         DO jj = 1, jpj 
     179            DO ji = 1, jpi 
     180               rswitch = MAX( 0._wp , SIGN( 1._wp, a_i(ji,jj,jl) - epsi20 ) )   !0 if no ice and 1 if yes 
    165181               ht_s(ji,jj,jl) = v_s (ji,jj,jl) / MAX( a_i(ji,jj,jl) , epsi20 ) * rswitch 
    166182               o_i(ji,jj,jl)  = oa_i(ji,jj,jl) / MAX( a_i(ji,jj,jl) , epsi20 ) * rswitch 
     
    168184         END DO 
    169185      END DO 
    170  
     186       
    171187      IF(  nn_icesal == 2  )THEN 
    172188         DO jl = 1, jpl 
     
    298314      ! Vertically constant, constant in time 
    299315      !--------------------------------------- 
    300       IF(  nn_icesal == 1  )   s_i(:,:,:,:) = rn_icesal 
     316      IF(  nn_icesal == 1  )  THEN 
     317         s_i (:,:,:,:) = rn_icesal 
     318         sm_i(:,:,:)   = rn_icesal 
     319      ENDIF 
    301320 
    302321      !----------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/limwri.F90

    r6140 r7341  
    154154      ENDIF 
    155155 
    156       IF ( iom_use( "icecolf" ) ) THEN  
    157          DO jj = 1, jpj 
    158             DO ji = 1, jpi 
    159                rswitch  = MAX( 0._wp , SIGN( 1._wp , at_i(ji,jj) ) ) 
    160                z2d(ji,jj) = hicol(ji,jj) * rswitch 
    161             END DO 
    162          END DO 
    163          CALL iom_put( "icecolf"     , z2d              )        ! frazil ice collection thickness 
    164       ENDIF 
    165  
     156      IF ( iom_use( "icecolf" ) )   CALL iom_put( "icecolf", hicol )  ! frazil ice collection thickness 
     157  
    166158      CALL iom_put( "isst"        , sst_m               )        ! sea surface temperature 
    167159      CALL iom_put( "isss"        , sss_m               )        ! sea surface salinity 
     
    187179      CALL iom_put( "destrp"      , diag_trp_es         )        ! advected snw enthalpy (W/m2) 
    188180 
    189       CALL iom_put( "sfxbog"      , sfx_bog * rday      )        ! salt flux from brines 
    190       CALL iom_put( "sfxbom"      , sfx_bom * rday      )        ! salt flux from brines 
    191       CALL iom_put( "sfxsum"      , sfx_sum * rday      )        ! salt flux from brines 
    192       CALL iom_put( "sfxsni"      , sfx_sni * rday      )        ! salt flux from brines 
    193       CALL iom_put( "sfxopw"      , sfx_opw * rday      )        ! salt flux from brines 
     181      CALL iom_put( "sfxbog"      , sfx_bog * rday      )        ! salt flux from bottom growth 
     182      CALL iom_put( "sfxbom"      , sfx_bom * rday      )        ! salt flux from bottom melt 
     183      CALL iom_put( "sfxsum"      , sfx_sum * rday      )        ! salt flux from surface melt 
     184      CALL iom_put( "sfxsni"      , sfx_sni * rday      )        ! salt flux from snow ice formation 
     185      CALL iom_put( "sfxopw"      , sfx_opw * rday      )        ! salt flux from open water formation 
    194186      CALL iom_put( "sfxdyn"      , sfx_dyn * rday      )        ! salt flux from ridging rafting 
    195       CALL iom_put( "sfxres"      , sfx_res * rday      )        ! salt flux from limupdate (resultant) 
     187      CALL iom_put( "sfxres"      , sfx_res * rday      )        ! salt flux from residual 
    196188      CALL iom_put( "sfxbri"      , sfx_bri * rday      )        ! salt flux from brines 
     189      CALL iom_put( "sfxsub"      , sfx_sub * rday      )        ! salt flux from sublimation 
    197190      CALL iom_put( "sfx"         , sfx     * rday      )        ! total salt flux 
    198191 
     
    233226      CALL iom_put ('hfxspr'     , hfx_spr(:,:)         )   ! Heat content of snow precip  
    234227       
     228      IF ( iom_use( "vfxthin" ) ) THEN   ! ice production for open water + thin ice (<20cm) => comparable to observations   
     229         DO jj = 1, jpj  
     230            DO ji = 1, jpi 
     231               z2d(ji,jj)  = vt_i(ji,jj) / MAX( at_i(ji,jj), epsi06 ) * zswi(ji,jj) ! mean ice thickness 
     232            END DO 
     233         END DO 
     234         WHERE( z2d(:,:) < 0.2 .AND. z2d(:,:) > 0. ) ; z2da = wfx_bog 
     235         ELSEWHERE                                   ; z2da = 0._wp 
     236         END WHERE 
     237         CALL iom_put( "vfxthin", ( wfx_opw + z2da ) * ztmp ) 
     238      ENDIF 
     239 
    235240      !-------------------------------- 
    236241      ! Output values for each category 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/LIM_SRC_3/thd_ice.F90

    r5407 r7341  
    4545   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   qns_ice_1d   
    4646   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   t_bo_1d      
     47   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   rn_amax_1d 
    4748 
    4849   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   hfx_sum_1d 
     
    8384   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   sfx_res_1d   
    8485 
     86   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   sfx_sub_1d 
     87 
    8588   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   sprecip_1d    !: <==> the 2D  sprecip 
    8689   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   frld_1d       !: <==> the 2D  frld 
     
    9194   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   evap_ice_1d   !: <==> the 2D  evap_ice 
    9295   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   qprec_ice_1d  !: <==> the 2D  qprec_ice 
     96   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   qevap_ice_1d  !: <==> the 3D  qevap_ice 
    9397   !                                                     ! to reintegrate longwave flux inside the ice thermodynamics 
    9498   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   i0            !: fraction of radiation transmitted to the ice 
     
    107111   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   dh_s_tot      !: Snow accretion/ablation        [m] 
    108112   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   dh_i_surf     !: Ice surface accretion/ablation [m] 
     113   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   dh_i_sub      !: Ice surface sublimation [m] 
    109114   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   dh_i_bott     !: Ice bottom accretion/ablation  [m] 
    110115   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   dh_snowice    !: Snow ice formation             [m of ice] 
     
    144149         &      hfx_sum_1d(jpij) , hfx_bom_1d(jpij) ,hfx_bog_1d(jpij) ,    &  
    145150         &      hfx_dif_1d(jpij) , hfx_opw_1d(jpij) ,                      & 
     151         &      rn_amax_1d(jpij) ,                                         & 
    146152         &      hfx_thd_1d(jpij) , hfx_spr_1d(jpij) ,                      & 
    147153         &      hfx_snw_1d(jpij) , hfx_sub_1d(jpij) , hfx_err_1d(jpij) ,   & 
     
    153159         &      wfx_sum_1d(jpij)  , wfx_sni_1d (jpij) , wfx_opw_1d (jpij) , wfx_res_1d(jpij) ,  & 
    154160         &      dqns_ice_1d(jpij) , evap_ice_1d (jpij),                                         & 
    155          &      qprec_ice_1d(jpij), i0         (jpij) ,                                         &   
     161         &      qprec_ice_1d(jpij), qevap_ice_1d(jpij), i0         (jpij) ,                     &   
    156162         &      sfx_bri_1d (jpij) , sfx_bog_1d (jpij) , sfx_bom_1d (jpij) , sfx_sum_1d (jpij),  & 
    157          &      sfx_sni_1d (jpij) , sfx_opw_1d (jpij) , sfx_res_1d (jpij) ,                     & 
     163         &      sfx_sni_1d (jpij) , sfx_opw_1d (jpij) , sfx_res_1d (jpij) , sfx_sub_1d (jpij),  & 
    158164         &      dsm_i_fl_1d(jpij) , dsm_i_gd_1d(jpij) , dsm_i_se_1d(jpij) ,                     &      
    159165         &      dsm_i_si_1d(jpij) , hicol_1d    (jpij)                     , STAT=ierr(2) ) 
     
    161167      ALLOCATE( t_su_1d   (jpij) , a_i_1d   (jpij) , ht_i_1d  (jpij) ,    &    
    162168         &      ht_s_1d   (jpij) , fc_su    (jpij) , fc_bo_i  (jpij) ,    &     
    163          &      dh_s_tot  (jpij) , dh_i_surf(jpij) , dh_i_bott(jpij) ,    &     
    164          &      dh_snowice(jpij) , sm_i_1d  (jpij) , s_i_new  (jpij) ,    & 
    165          &      t_s_1d(jpij,nlay_s) , t_i_1d(jpij,nlay_i) , s_i_1d(jpij,nlay_i) ,  &             
    166          &      q_i_1d(jpij,nlay_i+1) , q_s_1d(jpij,nlay_s) ,                        & 
     169         &      dh_s_tot  (jpij) , dh_i_surf(jpij) , dh_i_sub (jpij) ,    &     
     170         &      dh_i_bott (jpij) ,dh_snowice(jpij) , sm_i_1d  (jpij) , s_i_new  (jpij) ,    & 
     171         &      t_s_1d(jpij,nlay_s) , t_i_1d(jpij,nlay_i) , s_i_1d(jpij,nlay_i) ,           &             
     172         &      q_i_1d(jpij,nlay_i+1) , q_s_1d(jpij,nlay_s) ,                               & 
    167173         &      qh_i_old(jpij,0:nlay_i+1), h_i_old(jpij,0:nlay_i+1) , STAT=ierr(3)) 
    168174      ! 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/NST_SRC/agrif_lim2_interp.F90

    r5656 r7341  
    392392      INTEGER :: ji,jj,jn 
    393393      REAL(wp) :: zalpha 
    394       REAL(wp), DIMENSION(jpi,jpj,7) :: tabice_agr  
    395394      !!-----------------------------------------------------------------------       
    396395      ! 
     
    529528            END DO 
    530529         END DO 
     530      ELSE 
     531         DO jj=MAX(j1,2),j2 
     532            DO ji=MAX(i1,2),i2 
     533               uice_agr(ji,jj) = tabres(ji,jj) 
     534            END DO 
     535         END DO 
    531536      ENDIF 
    532537#else 
     
    541546            END DO 
    542547         END DO 
     548      ELSE 
     549         DO jj= j1, j2 
     550            DO ji= i1, i2 
     551               uice_agr(ji,jj) = tabres(ji,jj) 
     552            END DO 
     553         END DO 
    543554      ENDIF 
    544555#endif 
     
    566577                  tabres(ji,jj) = e1f(ji-1,jj-1) * v_ice(ji,jj) 
    567578               ENDIF 
     579            END DO 
     580         END DO 
     581      ELSE 
     582         DO jj=MAX(j1,2),j2 
     583            DO ji=MAX(i1,2),i2 
     584               vice_agr(ji,jj) = tabres(ji,jj) 
    568585            END DO 
    569586         END DO 
     
    580597            END DO 
    581598         END DO 
     599      ELSE 
     600         DO jj= j1 ,j2 
     601            DO ji = i1, i2 
     602               vice_agr(ji,jj) = tabres(ji,jj) 
     603            END DO 
     604         END DO 
    582605      ENDIF 
    583606#endif 
     
    585608 
    586609 
    587    SUBROUTINE interp_adv_ice( tabres, i1, i2, j1, j2, before ) 
     610   SUBROUTINE interp_adv_ice( tabres, i1, i2, j1, j2, k1, k2, before ) 
    588611      !!----------------------------------------------------------------------- 
    589612      !!                    *** ROUTINE interp_adv_ice ***                            
     
    593616      !!              put -9999 where no ice for correct extrapolation              
    594617      !!----------------------------------------------------------------------- 
    595       INTEGER, INTENT(in) :: i1, i2, j1, j2 
    596       REAL(wp), DIMENSION(i1:i2,j1:j2,7), INTENT(inout) :: tabres 
     618      INTEGER, INTENT(in) :: i1, i2, j1, j2, k1, k2 
     619      REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2), INTENT(inout) :: tabres 
    597620      LOGICAL, INTENT(in) :: before 
    598621      !! 
     
    601624      ! 
    602625      IF( before ) THEN 
    603          DO jj=j1,j2 
    604             DO ji=i1,i2 
    605                IF( tms(ji,jj) == 0. ) THEN 
    606                   tabres(ji,jj,:) = -9999.  
    607                ELSE 
    608                   tabres(ji,jj, 1) = frld  (ji,jj) 
    609                   tabres(ji,jj, 2) = hicif (ji,jj) 
    610                   tabres(ji,jj, 3) = hsnif (ji,jj) 
    611                   tabres(ji,jj, 4) = tbif  (ji,jj,1) 
    612                   tabres(ji,jj, 5) = tbif  (ji,jj,2) 
    613                   tabres(ji,jj, 6) = tbif  (ji,jj,3) 
    614                   tabres(ji,jj, 7) = qstoif(ji,jj) 
    615                ENDIF 
    616             END DO 
    617          END DO 
     626         DO jj=j1,j2 
     627       DO ji=i1,i2 
     628          IF( tms(ji,jj) == 0. ) THEN 
     629             tabres(ji,jj,:) = -9999  
     630          ELSE 
     631             tabres(ji,jj, 1) = frld  (ji,jj) 
     632             tabres(ji,jj, 2) = hicif (ji,jj) 
     633             tabres(ji,jj, 3) = hsnif (ji,jj) 
     634             tabres(ji,jj, 4) = tbif  (ji,jj,1) 
     635             tabres(ji,jj, 5) = tbif  (ji,jj,2) 
     636             tabres(ji,jj, 6) = tbif  (ji,jj,3) 
     637             tabres(ji,jj, 7) = qstoif(ji,jj) 
     638          ENDIF 
     639       END DO 
     640         END DO 
     641      ELSE 
     642    DO jj=j1,j2 
     643       DO ji=i1,i2 
     644               DO jk=k1, k2 
     645             tabice_agr(ji,jj,jk) = tabres(ji,jj,jk) 
     646               END DO 
     647       END DO 
     648    END DO 
    618649      ENDIF 
    619650      ! 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/DIA/diaar5.F90

    r6140 r7341  
    212212      REAL(wp) ::   zztmp   
    213213      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::   zsaldta   ! Jan/Dec levitus salinity 
    214       ! reading initial file 
    215       LOGICAL  ::   ln_tsd_init      !: T & S data flag 
    216       LOGICAL  ::   ln_tsd_tradmp    !: internal damping toward input data flag 
    217       CHARACTER(len=100)            ::   cn_dir 
    218       TYPE(FLD_N)                   ::  sn_tem,sn_sal 
    219       INTEGER  ::   ios=0 
    220  
    221       NAMELIST/namtsd/ ln_tsd_init,ln_tsd_tradmp,cn_dir,sn_tem,sn_sal 
    222       ! 
    223  
    224       REWIND( numnam_ref )              ! Namelist namtsd in reference namelist : 
    225       READ  ( numnam_ref, namtsd, IOSTAT = ios, ERR = 901) 
    226 901   IF( ios /= 0 ) CALL ctl_nam ( ios , ' namtsd in reference namelist for dia_ar5', lwp ) 
    227       REWIND( numnam_cfg )              ! Namelist namtsd in configuration namelist : Parameters of the run 
    228       READ  ( numnam_cfg, namtsd, IOSTAT = ios, ERR = 902 ) 
    229 902   IF( ios /= 0 ) CALL ctl_nam ( ios , ' namtsd in configuration namelist for dia_ar5', lwp ) 
    230       IF(lwm) WRITE ( numond, namtsd ) 
    231214      ! 
    232215      !!---------------------------------------------------------------------- 
     
    250233      IF( lk_mpp )   CALL mpp_sum( vol0 ) 
    251234 
    252       CALL iom_open ( TRIM( cn_dir )//TRIM(sn_sal%clname), inum ) 
    253       CALL iom_get  ( inum, jpdom_data, TRIM(sn_sal%clvar), zsaldta(:,:,:,1), 1  ) 
    254       CALL iom_get  ( inum, jpdom_data, TRIM(sn_sal%clvar), zsaldta(:,:,:,2), 12 ) 
     235 
     236      CALL iom_open ( 'sali_ref_clim_monthly', inum ) 
     237      CALL iom_get  ( inum, jpdom_data, 'vosaline' , zsaldta(:,:,:,1), 1  ) 
     238      CALL iom_get  ( inum, jpdom_data, 'vosaline' , zsaldta(:,:,:,2), 12 ) 
    255239      CALL iom_close( inum ) 
     240 
    256241      sn0(:,:,:) = 0.5_wp * ( zsaldta(:,:,:,1) + zsaldta(:,:,:,2) )         
    257242      sn0(:,:,:) = sn0(:,:,:) * tmask(:,:,:) 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90

    • Property svn:executable deleted
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/DIU/cool_skin.F90

    r6075 r7341  
    1717   USE in_out_manager 
    1818   USE sbc_oce 
     19   USE lib_mpp 
    1920   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    2021    
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/DOM/domwri.F90

    r5836 r7341  
    7171      ! 
    7272      !                                                         ! horizontal mesh (inum3) 
    73       CALL iom_rstput( 0, 0, inum0, 'glamt', glamt, ktype = jp_r4 )     !    ! latitude 
    74       CALL iom_rstput( 0, 0, inum0, 'glamu', glamu, ktype = jp_r4 ) 
    75       CALL iom_rstput( 0, 0, inum0, 'glamv', glamv, ktype = jp_r4 ) 
    76       CALL iom_rstput( 0, 0, inum0, 'glamf', glamf, ktype = jp_r4 ) 
    77        
    78       CALL iom_rstput( 0, 0, inum0, 'gphit', gphit, ktype = jp_r4 )     !    ! longitude 
    79       CALL iom_rstput( 0, 0, inum0, 'gphiu', gphiu, ktype = jp_r4 ) 
    80       CALL iom_rstput( 0, 0, inum0, 'gphiv', gphiv, ktype = jp_r4 ) 
    81       CALL iom_rstput( 0, 0, inum0, 'gphif', gphif, ktype = jp_r4 ) 
     73      CALL iom_rstput( 0, 0, inum0, 'glamt', glamt, ktype = jp_r8 )     !    ! latitude 
     74      CALL iom_rstput( 0, 0, inum0, 'glamu', glamu, ktype = jp_r8 ) 
     75      CALL iom_rstput( 0, 0, inum0, 'glamv', glamv, ktype = jp_r8 ) 
     76      CALL iom_rstput( 0, 0, inum0, 'glamf', glamf, ktype = jp_r8 ) 
     77       
     78      CALL iom_rstput( 0, 0, inum0, 'gphit', gphit, ktype = jp_r8 )     !    ! longitude 
     79      CALL iom_rstput( 0, 0, inum0, 'gphiu', gphiu, ktype = jp_r8 ) 
     80      CALL iom_rstput( 0, 0, inum0, 'gphiv', gphiv, ktype = jp_r8 ) 
     81      CALL iom_rstput( 0, 0, inum0, 'gphif', gphif, ktype = jp_r8 ) 
    8282       
    8383      CALL iom_rstput( 0, 0, inum0, 'e1t', e1t, ktype = jp_r8 )         !    ! e1 scale factors 
     
    229229 
    230230      !                                                         ! horizontal mesh (inum3) 
    231       CALL iom_rstput( 0, 0, inum3, 'glamt', glamt, ktype = jp_r4 )     !    ! latitude 
    232       CALL iom_rstput( 0, 0, inum3, 'glamu', glamu, ktype = jp_r4 ) 
    233       CALL iom_rstput( 0, 0, inum3, 'glamv', glamv, ktype = jp_r4 ) 
    234       CALL iom_rstput( 0, 0, inum3, 'glamf', glamf, ktype = jp_r4 ) 
    235        
    236       CALL iom_rstput( 0, 0, inum3, 'gphit', gphit, ktype = jp_r4 )     !    ! longitude 
    237       CALL iom_rstput( 0, 0, inum3, 'gphiu', gphiu, ktype = jp_r4 ) 
    238       CALL iom_rstput( 0, 0, inum3, 'gphiv', gphiv, ktype = jp_r4 ) 
    239       CALL iom_rstput( 0, 0, inum3, 'gphif', gphif, ktype = jp_r4 ) 
     231      CALL iom_rstput( 0, 0, inum3, 'glamt', glamt, ktype = jp_r8 )     !    ! latitude 
     232      CALL iom_rstput( 0, 0, inum3, 'glamu', glamu, ktype = jp_r8 ) 
     233      CALL iom_rstput( 0, 0, inum3, 'glamv', glamv, ktype = jp_r8 ) 
     234      CALL iom_rstput( 0, 0, inum3, 'glamf', glamf, ktype = jp_r8 ) 
     235       
     236      CALL iom_rstput( 0, 0, inum3, 'gphit', gphit, ktype = jp_r8 )     !    ! longitude 
     237      CALL iom_rstput( 0, 0, inum3, 'gphiu', gphiu, ktype = jp_r8 ) 
     238      CALL iom_rstput( 0, 0, inum3, 'gphiv', gphiv, ktype = jp_r8 ) 
     239      CALL iom_rstput( 0, 0, inum3, 'gphif', gphif, ktype = jp_r8 ) 
    240240       
    241241      CALL iom_rstput( 0, 0, inum3, 'e1t', e1t, ktype = jp_r8 )         !    ! e1 scale factors 
     
    257257      CALL iom_rstput( 0, 0, inum4, 'misf', zprt, ktype = jp_i2 )       !    ! nb of ocean T-points 
    258258      zprt(:,:) = ssmask(:,:) * REAL( risfdep(:,:) , wp ) 
    259       CALL iom_rstput( 0, 0, inum4, 'isfdraft', zprt, ktype = jp_r4 )       !    ! nb of ocean T-points 
     259      CALL iom_rstput( 0, 0, inum4, 'isfdraft', zprt, ktype = jp_r8 )       !    ! nb of ocean T-points 
    260260             
    261261      IF( ln_sco ) THEN                                         ! s-coordinate 
     
    279279         CALL iom_rstput( 0, 0, inum4, 'gdept_1d' , gdept_1d )  !    ! stretched system 
    280280         CALL iom_rstput( 0, 0, inum4, 'gdepw_1d' , gdepw_1d ) 
    281          CALL iom_rstput( 0, 0, inum4, 'gdept_0', gdept_0, ktype = jp_r4 )      
    282          CALL iom_rstput( 0, 0, inum4, 'gdepw_0', gdepw_0, ktype = jp_r4 ) 
     281         CALL iom_rstput( 0, 0, inum4, 'gdept_0', gdept_0, ktype = jp_r8 )      
     282         CALL iom_rstput( 0, 0, inum4, 'gdepw_0', gdepw_0, ktype = jp_r8 ) 
    283283      ENDIF 
    284284       
     
    302302         ! 
    303303         IF( nmsh <= 3 ) THEN                                   !    ! 3D depth 
    304             CALL iom_rstput( 0, 0, inum4, 'gdept_0', gdept_0, ktype = jp_r4 )      
     304            CALL iom_rstput( 0, 0, inum4, 'gdept_0', gdept_0, ktype = jp_r8 )      
    305305            DO jk = 1,jpk    
    306306               DO jj = 1, jpjm1    
     
    312312            END DO 
    313313            CALL lbc_lnk( zdepu, 'U', 1. )   ;   CALL lbc_lnk( zdepv, 'V', 1. )  
    314             CALL iom_rstput( 0, 0, inum4, 'gdepu', zdepu, ktype = jp_r4 ) 
    315             CALL iom_rstput( 0, 0, inum4, 'gdepv', zdepv, ktype = jp_r4 ) 
    316             CALL iom_rstput( 0, 0, inum4, 'gdepw_0', gdepw_0, ktype = jp_r4 ) 
     314            CALL iom_rstput( 0, 0, inum4, 'gdepu', zdepu, ktype = jp_r8 ) 
     315            CALL iom_rstput( 0, 0, inum4, 'gdepv', zdepv, ktype = jp_r8 ) 
     316            CALL iom_rstput( 0, 0, inum4, 'gdepw_0', gdepw_0, ktype = jp_r8 ) 
    317317         ELSE                                                   !    ! 2D bottom depth 
    318318            DO jj = 1,jpj    
     
    322322               END DO 
    323323            END DO 
    324             CALL iom_rstput( 0, 0, inum4, 'hdept', zprt, ktype = jp_r4 )      
    325             CALL iom_rstput( 0, 0, inum4, 'hdepw', zprw, ktype = jp_r4 )  
     324            CALL iom_rstput( 0, 0, inum4, 'hdept', zprt, ktype = jp_r8 )      
     325            CALL iom_rstput( 0, 0, inum4, 'hdepw', zprw, ktype = jp_r8 )  
    326326         ENDIF 
    327327         ! 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/DOM/domzgr.F90

    r7339 r7341  
    137137      IF( ln_sco      )   ioptio = ioptio + 1 
    138138      IF( ioptio /= 1 )   CALL ctl_stop( ' none or several vertical coordinate options used' ) 
     139      ! 
     140      ioptio = 0 
     141      IF ( ln_zco .AND. ln_isfcav ) ioptio = ioptio + 1 
     142      IF ( ln_sco .AND. ln_isfcav ) ioptio = ioptio + 1 
     143      IF( ioptio > 0 )   CALL ctl_stop( ' Cavity not tested/compatible with full step (zco) and sigma (ln_sco) ' ) 
    139144      ! 
    140145      ! Build the vertical coordinate system 
     
    645650            CALL iom_close( inum ) 
    646651            mbathy(:,:) = INT( bathy(:,:) ) 
     652            ! initialisation isf variables 
     653            risfdep(:,:)=0._wp ; misfdep(:,:)=1              
    647654            !                                                ! ===================== 
    648655            IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN    ! ORCA R2 configuration 
     
    681688            CALL iom_close( inum ) 
    682689            !                                                 
    683             risfdep(:,:)=0._wp          
    684             misfdep(:,:)=1              
     690            ! initialisation isf variables 
     691            risfdep(:,:)=0._wp ; misfdep(:,:)=1              
     692            ! 
    685693            IF ( ln_isfcav ) THEN 
    686694               CALL iom_open ( 'isf_draft_meter.nc', inum )  
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv_cen2.F90

    r6140 r7341  
    118118      ENDIF 
    119119      DO jk = 2, jpkm1                    ! interior advective fluxes 
    120          DO jj = 2, jpjm1                       ! 1/4 * Vertical transport 
    121             DO ji = fs_2, fs_jpim1 
     120         DO jj = 2, jpj                       ! 1/4 * Vertical transport 
     121            DO ji = 2, jpi 
    122122               zfw(ji,jj,jk) = 0.25_wp * e1e2t(ji,jj) * wn(ji,jj,jk) 
    123123            END DO 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv_ubs.F90

    r6140 r7341  
    211211      ENDIF 
    212212      DO jk = 2, jpkm1                          ! interior fluxes 
    213          DO jj = 2, jpjm1 
    214             DO ji = fs_2, fs_jpim1 
     213         DO jj = 2, jpj 
     214            DO ji = 2, jpi 
    215215               zfw(ji,jj,jk) = 0.25_wp * e1e2t(ji,jj) * wn(ji,jj,jk) 
    216216            END DO 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_imp.F90

    r6140 r7341  
    294294            ze3va =  ( 1._wp - r_vvl ) * e3v_n(ji,jj,1) + r_vvl * e3v_a(ji,jj,1)  
    295295            va(ji,jj,1) = va(ji,jj,1) + p2dt * 0.5_wp * ( vtau_b(ji,jj) + vtau(ji,jj) )   & 
    296                &                                      / ( ze3va * rau0 )  
     296               &                                      / ( ze3va * rau0 ) * vmask(ji,jj,1)  
    297297         END DO 
    298298      END DO 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/ICB/icbini.F90

    r5215 r7341  
    120120      ! first entry with narea for this processor is left hand interior index 
    121121      ! last  entry                               is right hand interior index 
    122       jj = jpj/2 
     122      jj = nlcj/2 
    123123      nicbdi = -1 
    124124      nicbei = -1 
     
    136136      ! 
    137137      ! repeat for j direction 
    138       ji = jpi/2 
     138      ji = nlci/2 
    139139      nicbdj = -1 
    140140      nicbej = -1 
     
    153153      ! special for east-west boundary exchange we save the destination index 
    154154      i1 = MAX( nicbdi-1, 1) 
    155       i3 = INT( src_calving(i1,jpj/2) ) 
     155      i3 = INT( src_calving(i1,nlcj/2) ) 
    156156      jj = INT( i3/nicbpack ) 
    157157      ricb_left = REAL( i3 - nicbpack*jj, wp ) 
    158158      i1 = MIN( nicbei+1, jpi ) 
    159       i3 = INT( src_calving(i1,jpj/2) ) 
     159      i3 = INT( src_calving(i1,nlcj/2) ) 
    160160      jj = INT( i3/nicbpack ) 
    161161      ricb_right = REAL( i3 - nicbpack*jj, wp ) 
     
    196196         WRITE(numicb,*) 'berg left       ', ricb_left 
    197197         WRITE(numicb,*) 'berg right      ', ricb_right 
    198          jj = jpj/2 
     198         jj = nlcj/2 
    199199         WRITE(numicb,*) "central j line:" 
    200200         WRITE(numicb,*) "i processor" 
     
    202202         WRITE(numicb,*) "i point" 
    203203         WRITE(numicb,*) (INT(src_calving(ji,jj)), ji=1,jpi) 
    204          ji = jpi/2 
     204         ji = nlci/2 
    205205         WRITE(numicb,*) "central i line:" 
    206206         WRITE(numicb,*) "j processor" 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90

    r6140 r7341  
    114114      CASE (30)   ;   CALL xios_set_context_attr(TRIM(clname), calendar_type= "D360") 
    115115      END SELECT 
    116       WRITE(cldate,"(i4.4,'-',i2.2,'-',i2.2,' 00:00:00')") nyear,nmonth,nday  
     116      WRITE(cldate,"(i4.4,'-',i2.2,'-',i2.2,' ',i2.2,':',i2.2,':00')") nyear,nmonth,nday,nhour,nminute 
    117117      CALL xios_set_context_attr(TRIM(clname), start_date=cldate ) 
    118118 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/LBC/lbclnk.F90

    r6140 r7341  
    99   !!            3.5  ! 2012     (S.Mocavero, I. Epicoco) optimization of BDY comm. via lbc_bdy_lnk and lbc_obc_lnk 
    1010   !!            3.4  ! 2012-12  (R. Bourdalle-Badie, G. Reffray)  add a C1D case   
     11   !!            3.6  ! 2015-06  (O. Tintó and M. Castrillo)  add lbc_lnk_multi   
    1112   !!---------------------------------------------------------------------- 
    1213#if defined key_mpp_mpi 
     
    2223 
    2324   INTERFACE lbc_lnk_multi 
    24       MODULE PROCEDURE mpp_lnk_2d_9 
     25      MODULE PROCEDURE mpp_lnk_2d_9, mpp_lnk_2d_multiple 
    2526   END INTERFACE 
    2627   ! 
     
    2930   END INTERFACE 
    3031   ! 
    31 !JMM interface not defined if not key_mpp_mpi : likely do not compile without this CPP key !!!! 
    3232   INTERFACE lbc_sum 
    3333      MODULE PROCEDURE mpp_lnk_sum_3d, mpp_lnk_sum_2d 
    3434   END INTERFACE 
    35  
     35   ! 
    3636   INTERFACE lbc_bdy_lnk 
    3737      MODULE PROCEDURE mpp_lnk_bdy_2d, mpp_lnk_bdy_3d 
     
    8383   ! 
    8484   INTERFACE lbc_sum 
    85       MODULE PROCEDURE mpp_lnk_sum_3d, mpp_lnk_sum_2d 
     85      MODULE PROCEDURE lbc_lnk_sum_3d, lbc_lnk_sum_2d 
    8686   END INTERFACE 
    8787 
     
    9090   END INTERFACE 
    9191   ! 
     92   INTERFACE lbc_lnk_multi 
     93      MODULE PROCEDURE lbc_lnk_2d_9, lbc_lnk_2d_multiple 
     94   END INTERFACE 
     95 
    9296   INTERFACE lbc_bdy_lnk 
    9397      MODULE PROCEDURE lbc_bdy_lnk_2d, lbc_bdy_lnk_3d 
     
    97101      MODULE PROCEDURE lbc_lnk_2d_e 
    98102   END INTERFACE 
     103    
     104   TYPE arrayptr 
     105      REAL , DIMENSION (:,:),  POINTER :: pt2d 
     106   END TYPE arrayptr 
     107   PUBLIC   arrayptr 
    99108 
    100109   PUBLIC   lbc_lnk       ! ocean/ice  lateral boundary conditions 
     110   PUBLIC   lbc_sum       ! ocean/ice  lateral boundary conditions (sum of the overlap region) 
    101111   PUBLIC   lbc_lnk_e     ! 
     112   PUBLIC   lbc_lnk_multi ! modified ocean lateral boundary conditions 
    102113   PUBLIC   lbc_bdy_lnk   ! ocean lateral BDY boundary conditions 
    103114   PUBLIC   lbc_lnk_icb   ! 
     
    181192      ! 
    182193   END SUBROUTINE lbc_lnk_2d 
     194    
     195   SUBROUTINE lbc_lnk_2d_multiple( pt2d_array , type_array , psgn_array , num_fields ) 
     196      !! 
     197      INTEGER :: num_fields 
     198      TYPE( arrayptr ), DIMENSION(:) :: pt2d_array 
     199      CHARACTER(len=1), DIMENSION(:), INTENT(in   ) ::   type_array   ! define the nature of ptab array grid-points 
     200      !                                                               ! = T , U , V , F , W and I points 
     201      REAL(wp)        , DIMENSION(:), INTENT(in   ) ::   psgn_array   ! =-1 the sign change across the north fold boundary 
     202      !                                                               ! =  1. , the sign is kept 
     203      ! 
     204      INTEGER  ::   ii    !!MULTI SEND DUMMY LOOP INDICES 
     205      ! 
     206      DO ii = 1, num_fields 
     207        CALL lbc_lnk_2d( pt2d_array(ii)%pt2d, type_array(ii), psgn_array(ii) ) 
     208      END DO      
     209      ! 
     210   END SUBROUTINE lbc_lnk_2d_multiple 
     211 
     212   SUBROUTINE lbc_lnk_2d_9( pt2dA, cd_typeA, psgnA, pt2dB, cd_typeB, psgnB, pt2dC, cd_typeC, psgnC   & 
     213      &                   , pt2dD, cd_typeD, psgnD, pt2dE, cd_typeE, psgnE, pt2dF, cd_typeF, psgnF   & 
     214      &                   , pt2dG, cd_typeG, psgnG, pt2dH, cd_typeH, psgnH, pt2dI, cd_typeI, psgnI, cd_mpp, pval) 
     215      !!--------------------------------------------------------------------- 
     216      ! Second 2D array on which the boundary condition is applied 
     217      REAL(wp), DIMENSION(jpi,jpj), TARGET          , INTENT(inout) ::   pt2dA 
     218      REAL(wp), DIMENSION(jpi,jpj), TARGET, OPTIONAL, INTENT(inout) ::   pt2dB , pt2dC , pt2dD , pt2dE 
     219      REAL(wp), DIMENSION(jpi,jpj), TARGET, OPTIONAL, INTENT(inout) ::   pt2dF , pt2dG , pt2dH , pt2dI 
     220      ! define the nature of ptab array grid-points 
     221      CHARACTER(len=1)                              , INTENT(in   ) ::   cd_typeA 
     222      CHARACTER(len=1)                    , OPTIONAL, INTENT(in   ) ::   cd_typeB , cd_typeC , cd_typeD , cd_typeE 
     223      CHARACTER(len=1)                    , OPTIONAL, INTENT(in   ) ::   cd_typeF , cd_typeG , cd_typeH , cd_typeI 
     224      ! =-1 the sign change across the north fold boundary 
     225      REAL(wp)                                      , INTENT(in   ) ::   psgnA 
     226      REAL(wp)                            , OPTIONAL, INTENT(in   ) ::   psgnB , psgnC , psgnD , psgnE 
     227      REAL(wp)                            , OPTIONAL, INTENT(in   ) ::   psgnF , psgnG , psgnH , psgnI 
     228      CHARACTER(len=3)                    , OPTIONAL, INTENT(in   ) ::   cd_mpp   ! fill the overlap area only 
     229      REAL(wp)                            , OPTIONAL, INTENT(in   ) ::   pval     ! background value (used at closed boundaries) 
     230      !! 
     231      !!--------------------------------------------------------------------- 
     232 
     233      !!The first array 
     234      CALL lbc_lnk( pt2dA, cd_typeA, psgnA )  
     235 
     236      !! Look if more arrays to process 
     237      IF(PRESENT (psgnB) )CALL lbc_lnk( pt2dA, cd_typeA, psgnA )  
     238      IF(PRESENT (psgnC) )CALL lbc_lnk( pt2dC, cd_typeC, psgnC )  
     239      IF(PRESENT (psgnD) )CALL lbc_lnk( pt2dD, cd_typeD, psgnD )  
     240      IF(PRESENT (psgnE) )CALL lbc_lnk( pt2dE, cd_typeE, psgnE )  
     241      IF(PRESENT (psgnF) )CALL lbc_lnk( pt2dF, cd_typeF, psgnF )  
     242      IF(PRESENT (psgnG) )CALL lbc_lnk( pt2dG, cd_typeG, psgnG )  
     243      IF(PRESENT (psgnH) )CALL lbc_lnk( pt2dH, cd_typeH, psgnH )  
     244      IF(PRESENT (psgnI) )CALL lbc_lnk( pt2dI, cd_typeI, psgnI )  
     245 
     246   END SUBROUTINE lbc_lnk_2d_9 
     247 
     248 
     249 
     250 
    183251 
    184252#else 
     
    379447      !     
    380448   END SUBROUTINE lbc_lnk_2d 
     449    
     450   SUBROUTINE lbc_lnk_2d_multiple( pt2d_array , type_array , psgn_array , num_fields ) 
     451      !! 
     452      INTEGER :: num_fields 
     453      TYPE( arrayptr ), DIMENSION(:) :: pt2d_array 
     454      CHARACTER(len=1), DIMENSION(:), INTENT(in   ) ::   type_array   ! define the nature of ptab array grid-points 
     455      !                                                               ! = T , U , V , F , W and I points 
     456      REAL(wp)        , DIMENSION(:), INTENT(in   ) ::   psgn_array   ! =-1 the sign change across the north fold boundary 
     457      !                                                               ! =  1. , the sign is kept 
     458      ! 
     459      INTEGER  ::   ii    !!MULTI SEND DUMMY LOOP INDICES 
     460      ! 
     461      DO ii = 1, num_fields 
     462        CALL lbc_lnk_2d( pt2d_array(ii)%pt2d, type_array(ii), psgn_array(ii) ) 
     463      END DO      
     464      ! 
     465   END SUBROUTINE lbc_lnk_2d_multiple 
     466 
     467   SUBROUTINE lbc_lnk_2d_9( pt2dA, cd_typeA, psgnA, pt2dB, cd_typeB, psgnB, pt2dC, cd_typeC, psgnC   & 
     468      &                   , pt2dD, cd_typeD, psgnD, pt2dE, cd_typeE, psgnE, pt2dF, cd_typeF, psgnF   & 
     469      &                   , pt2dG, cd_typeG, psgnG, pt2dH, cd_typeH, psgnH, pt2dI, cd_typeI, psgnI, cd_mpp, pval) 
     470      !!--------------------------------------------------------------------- 
     471      ! Second 2D array on which the boundary condition is applied 
     472      REAL(wp), DIMENSION(jpi,jpj), TARGET          , INTENT(inout) ::   pt2dA 
     473      REAL(wp), DIMENSION(jpi,jpj), TARGET, OPTIONAL, INTENT(inout) ::   pt2dB , pt2dC , pt2dD , pt2dE 
     474      REAL(wp), DIMENSION(jpi,jpj), TARGET, OPTIONAL, INTENT(inout) ::   pt2dF , pt2dG , pt2dH , pt2dI 
     475      ! define the nature of ptab array grid-points 
     476      CHARACTER(len=1)                              , INTENT(in   ) ::   cd_typeA 
     477      CHARACTER(len=1)                    , OPTIONAL, INTENT(in   ) ::   cd_typeB , cd_typeC , cd_typeD , cd_typeE 
     478      CHARACTER(len=1)                    , OPTIONAL, INTENT(in   ) ::   cd_typeF , cd_typeG , cd_typeH , cd_typeI 
     479      ! =-1 the sign change across the north fold boundary 
     480      REAL(wp)                                      , INTENT(in   ) ::   psgnA 
     481      REAL(wp)                            , OPTIONAL, INTENT(in   ) ::   psgnB , psgnC , psgnD , psgnE 
     482      REAL(wp)                            , OPTIONAL, INTENT(in   ) ::   psgnF , psgnG , psgnH , psgnI 
     483      CHARACTER(len=3)                    , OPTIONAL, INTENT(in   ) ::   cd_mpp   ! fill the overlap area only 
     484      REAL(wp)                            , OPTIONAL, INTENT(in   ) ::   pval     ! background value (used at closed boundaries) 
     485      !! 
     486      !!--------------------------------------------------------------------- 
     487 
     488      !!The first array 
     489      CALL lbc_lnk( pt2dA, cd_typeA, psgnA )  
     490 
     491      !! Look if more arrays to process 
     492      IF(PRESENT (psgnB) )CALL lbc_lnk( pt2dA, cd_typeA, psgnA )  
     493      IF(PRESENT (psgnC) )CALL lbc_lnk( pt2dC, cd_typeC, psgnC )  
     494      IF(PRESENT (psgnD) )CALL lbc_lnk( pt2dD, cd_typeD, psgnD )  
     495      IF(PRESENT (psgnE) )CALL lbc_lnk( pt2dE, cd_typeE, psgnE )  
     496      IF(PRESENT (psgnF) )CALL lbc_lnk( pt2dF, cd_typeF, psgnF )  
     497      IF(PRESENT (psgnG) )CALL lbc_lnk( pt2dG, cd_typeG, psgnG )  
     498      IF(PRESENT (psgnH) )CALL lbc_lnk( pt2dH, cd_typeH, psgnH )  
     499      IF(PRESENT (psgnI) )CALL lbc_lnk( pt2dI, cd_typeI, psgnI )  
     500 
     501   END SUBROUTINE lbc_lnk_2d_9 
     502 
     503   SUBROUTINE lbc_lnk_sum_2d( pt2d, cd_type, psgn, cd_mpp, pval ) 
     504      !!--------------------------------------------------------------------- 
     505      !!                 ***  ROUTINE lbc_lnk_sum_2d  *** 
     506      !! 
     507      !! ** Purpose :   set lateral boundary conditions on a 2D array (non mpp case) 
     508      !! 
     509      !! ** Comments:   compute the sum of the common cell (overlap region) for the ice sheet/ocean  
     510      !!                coupling if conservation option activated. As no ice shelf are present along 
     511      !!                this line, nothing is done along the north fold. 
     512      !!---------------------------------------------------------------------- 
     513      CHARACTER(len=1)            , INTENT(in   )           ::   cd_type   ! nature of pt3d grid-points 
     514      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout)           ::   pt2d      ! 2D array on which the lbc is applied 
     515      REAL(wp)                    , INTENT(in   )           ::   psgn      ! control of the sign  
     516      CHARACTER(len=3)            , INTENT(in   ), OPTIONAL ::   cd_mpp    ! MPP only (here do nothing) 
     517      REAL(wp)                    , INTENT(in   ), OPTIONAL ::   pval      ! background value (for closed boundaries) 
     518      !! 
     519      REAL(wp) ::   zland 
     520      !!---------------------------------------------------------------------- 
     521 
     522      IF( PRESENT( pval ) ) THEN   ;   zland = pval      ! set land value (zero by default) 
     523      ELSE                         ;   zland = 0._wp 
     524      ENDIF 
     525 
     526      IF (PRESENT(cd_mpp)) THEN 
     527         ! only fill the overlap area and extra allows  
     528         ! this is in mpp case. In this module, just do nothing 
     529      ELSE 
     530         !                                     ! East-West boundaries 
     531         !                                     ! ==================== 
     532         SELECT CASE ( nperio ) 
     533         ! 
     534         CASE ( 1 , 4 , 6 )                       !** cyclic east-west 
     535            pt2d(jpim1,:) = pt2d(jpim1,:) + pt2d( 1 ,:) 
     536            pt2d(  2  ,:) = pt2d(  2  ,:) + pt2d(jpi,:) 
     537            pt2d( 1 ,:) = 0.0_wp               ! all points 
     538            pt2d(jpi,:) = 0.0_wp 
     539            ! 
     540         CASE DEFAULT                             !** East closed  --  West closed 
     541            SELECT CASE ( cd_type ) 
     542            CASE ( 'T' , 'U' , 'V' , 'W' )            ! T-, U-, V-, W-points 
     543               pt2d( 1 ,:) = zland 
     544               pt2d(jpi,:) = zland 
     545            CASE ( 'F' )                              ! F-point 
     546               pt2d(jpi,:) = zland 
     547            END SELECT 
     548            ! 
     549         END SELECT 
     550         !                                     ! North-South boundaries 
     551         !                                     ! ====================== 
     552         ! Nothing to do for the north fold, there is no ice shelf along this line. 
     553         ! 
     554      END IF 
     555 
     556   END SUBROUTINE 
     557 
     558   SUBROUTINE lbc_lnk_sum_3d( pt3d, cd_type, psgn, cd_mpp, pval ) 
     559      !!--------------------------------------------------------------------- 
     560      !!                 ***  ROUTINE lbc_lnk_sum_3d  *** 
     561      !! 
     562      !! ** Purpose :   set lateral boundary conditions on a 3D array (non mpp case) 
     563      !! 
     564      !! ** Comments:   compute the sum of the common cell (overlap region) for the ice sheet/ocean  
     565      !!                coupling if conservation option activated. As no ice shelf are present along 
     566      !!                this line, nothing is done along the north fold. 
     567      !!---------------------------------------------------------------------- 
     568      CHARACTER(len=1)                , INTENT(in   )           ::   cd_type   ! nature of pt3d grid-points 
     569      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout)           ::   pt3d      ! 3D array on which the lbc is applied 
     570      REAL(wp)                        , INTENT(in   )           ::   psgn      ! control of the sign  
     571      CHARACTER(len=3)                , INTENT(in   ), OPTIONAL ::   cd_mpp    ! MPP only (here do nothing) 
     572      REAL(wp)                        , INTENT(in   ), OPTIONAL ::   pval      ! background value (for closed boundaries) 
     573      !! 
     574      REAL(wp) ::   zland 
     575      !!---------------------------------------------------------------------- 
     576 
     577      IF( PRESENT( pval ) ) THEN   ;   zland = pval      ! set land value (zero by default) 
     578      ELSE                         ;   zland = 0._wp 
     579      ENDIF 
     580 
     581 
     582      IF( PRESENT( cd_mpp ) ) THEN 
     583         ! only fill the overlap area and extra allows  
     584         ! this is in mpp case. In this module, just do nothing 
     585      ELSE 
     586         !                                     !  East-West boundaries 
     587         !                                     ! ====================== 
     588         SELECT CASE ( nperio ) 
     589         ! 
     590         CASE ( 1 , 4 , 6 )                       !**  cyclic east-west 
     591            pt3d(jpim1,:,:) = pt3d(jpim1,:,:) + pt3d( 1 ,:,:) 
     592            pt3d(  2  ,:,:) = pt3d(  2  ,:,:) + pt3d(jpi,:,:)  
     593            pt3d( 1 ,:,:) = 0.0_wp            ! all points 
     594            pt3d(jpi,:,:) = 0.0_wp 
     595            ! 
     596         CASE DEFAULT                             !**  East closed  --  West closed 
     597            SELECT CASE ( cd_type ) 
     598            CASE ( 'T' , 'U' , 'V' , 'W' )             ! T-, U-, V-, W-points 
     599               pt3d( 1 ,:,:) = zland 
     600               pt3d(jpi,:,:) = zland 
     601            CASE ( 'F' )                               ! F-point 
     602               pt3d(jpi,:,:) = zland 
     603            END SELECT 
     604            ! 
     605         END SELECT 
     606         !                                     ! North-South boundaries 
     607         !                                     ! ====================== 
     608         ! Nothing to do for the north fold, there is no ice shelf along this line. 
     609         ! 
     610      END IF 
     611   END SUBROUTINE 
     612 
    381613 
    382614#endif 
     
    448680   !!====================================================================== 
    449681END MODULE lbclnk 
     682 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90

    r6140 r7341  
    2424   !!            3.5  !  2013  ( C. Ethe, G. Madec ) message passing arrays as local variables  
    2525   !!            3.5  !  2013  (S.Mocavero, I.Epicoco - CMCC) north fold optimizations 
     26   !!            3.6  !  2015 (O. Tintó and M. Castrillo - BSC) Added 'mpp_lnk_2d_multiple', 'mpp_lbc_north_2d_multiple', 'mpp_max_multiple'  
    2627   !!---------------------------------------------------------------------- 
    2728 
     
    6263   USE lbcnfd         ! north fold treatment 
    6364   USE in_out_manager ! I/O manager 
     65   USE wrk_nemo       ! work arrays 
    6466 
    6567   IMPLICIT NONE 
     
    7072   PUBLIC   mpp_ini_north, mpp_lbc_north, mpp_lbc_north_e 
    7173   PUBLIC   mpp_min, mpp_max, mpp_sum, mpp_minloc, mpp_maxloc 
     74   PUBLIC   mpp_max_multiple 
    7275   PUBLIC   mpp_lnk_3d, mpp_lnk_3d_gather, mpp_lnk_2d, mpp_lnk_2d_e 
    73    PUBLIC   mpp_lnk_2d_9  
     76   PUBLIC   mpp_lnk_2d_9 , mpp_lnk_2d_multiple  
    7477   PUBLIC   mpp_lnk_sum_3d, mpp_lnk_sum_2d 
    7578   PUBLIC   mppscatter, mppgather 
     
    7982   PUBLIC   mpp_lnk_bdy_2d, mpp_lnk_bdy_3d 
    8083   PUBLIC   mpp_lbc_north_icb, mpp_lnk_2d_icb 
     84   PUBLIC   mpprank 
    8185 
    8286   TYPE arrayptr 
    8387      REAL , DIMENSION (:,:),  POINTER :: pt2d 
    8488   END TYPE arrayptr 
     89   PUBLIC   arrayptr 
    8590    
    8691   !! * Interfaces 
     
    106111   INTERFACE mpp_maxloc 
    107112      MODULE PROCEDURE mpp_maxloc2d ,mpp_maxloc3d 
     113   END INTERFACE 
     114 
     115   INTERFACE mpp_max_multiple 
     116      MODULE PROCEDURE mppmax_real_multiple 
    108117   END INTERFACE 
    109118 
     
    726735      ! ----------------------- 
    727736      ! 
    728       DO ii = 1 , num_fields 
    729737         !First Array 
    730          IF( npolj /= 0 .AND. .NOT. PRESENT(cd_mpp) ) THEN 
    731             ! 
    732             SELECT CASE ( jpni ) 
    733             CASE ( 1 )     ;   CALL lbc_nfd      ( pt2d_array(ii)%pt2d( : , : ), type_array(ii) , psgn_array(ii) )   ! only 1 northern proc, no mpp 
    734             CASE DEFAULT   ;   CALL mpp_lbc_north( pt2d_array(ii)%pt2d( : , : ), type_array(ii), psgn_array(ii) )   ! for all northern procs. 
    735             END SELECT 
    736             ! 
    737          ENDIF 
    738          ! 
    739       END DO 
     738      IF( npolj /= 0 .AND. .NOT. PRESENT(cd_mpp) ) THEN 
     739         ! 
     740         SELECT CASE ( jpni ) 
     741         CASE ( 1 )     ;    
     742             DO ii = 1 , num_fields   
     743                       CALL lbc_nfd      ( pt2d_array(ii)%pt2d( : , : ), type_array(ii) , psgn_array(ii) )   ! only 1 northern proc, no mpp 
     744             END DO 
     745         CASE DEFAULT   ;   CALL mpp_lbc_north_2d_multiple( pt2d_array, type_array, psgn_array, num_fields )   ! for all northern procs. 
     746         END SELECT 
     747         ! 
     748      ENDIF 
     749        ! 
    740750      ! 
    741751      DEALLOCATE( zt2ns, zt2sn, zt2ew, zt2we ) 
     
    20192029   END SUBROUTINE mppmax_real 
    20202030 
     2031   SUBROUTINE mppmax_real_multiple( ptab, NUM , kcom  ) 
     2032      !!---------------------------------------------------------------------- 
     2033      !!                  ***  routine mppmax_real  *** 
     2034      !! 
     2035      !! ** Purpose :   Maximum 
     2036      !! 
     2037      !!---------------------------------------------------------------------- 
     2038      REAL(wp), DIMENSION(:) ,  INTENT(inout)           ::   ptab   ! ??? 
     2039      INTEGER , INTENT(in   )           ::   NUM 
     2040      INTEGER , INTENT(in   ), OPTIONAL ::   kcom   ! ??? 
     2041      !! 
     2042      INTEGER  ::   ierror, localcomm 
     2043      REAL(wp) , POINTER , DIMENSION(:) ::   zwork 
     2044      !!---------------------------------------------------------------------- 
     2045      ! 
     2046      CALL wrk_alloc(NUM , zwork) 
     2047      localcomm = mpi_comm_opa 
     2048      IF( PRESENT(kcom) )   localcomm = kcom 
     2049      ! 
     2050      CALL mpi_allreduce( ptab, zwork, NUM, mpi_double_precision, mpi_max, localcomm, ierror ) 
     2051      ptab = zwork 
     2052      CALL wrk_dealloc(NUM , zwork) 
     2053      ! 
     2054   END SUBROUTINE mppmax_real_multiple 
     2055 
    20212056 
    20222057   SUBROUTINE mppmin_a_real( ptab, kdim, kcom ) 
     
    29122947   END SUBROUTINE mpp_lbc_north_2d 
    29132948 
     2949   SUBROUTINE mpp_lbc_north_2d_multiple( pt2d_array, cd_type, psgn, num_fields) 
     2950      !!--------------------------------------------------------------------- 
     2951      !!                   ***  routine mpp_lbc_north_2d  *** 
     2952      !! 
     2953      !! ** Purpose :   Ensure proper north fold horizontal bondary condition 
     2954      !!              in mpp configuration in case of jpn1 > 1 
     2955      !!              (for multiple 2d arrays ) 
     2956      !! 
     2957      !! ** Method  :   North fold condition and mpp with more than one proc 
     2958      !!              in i-direction require a specific treatment. We gather 
     2959      !!              the 4 northern lines of the global domain on 1 processor 
     2960      !!              and apply lbc north-fold on this sub array. Then we 
     2961      !!              scatter the north fold array back to the processors. 
     2962      !! 
     2963      !!---------------------------------------------------------------------- 
     2964      INTEGER ,  INTENT (in   ) ::   num_fields  ! number of variables contained in pt2d 
     2965      TYPE( arrayptr ), DIMENSION(:) :: pt2d_array 
     2966      CHARACTER(len=1), DIMENSION(:), INTENT(in   ) ::   cd_type   ! nature of pt2d grid-points 
     2967      !                                                          !   = T ,  U , V , F or W  gridpoints 
     2968      REAL(wp), DIMENSION(:), INTENT(in   ) ::   psgn      ! = -1. the sign change across the north fold  
     2969      !!                                                             ! =  1. , the sign is kept 
     2970      INTEGER ::   ji, jj, jr, jk 
     2971      INTEGER ::   ierr, itaille, ildi, ilei, iilb 
     2972      INTEGER ::   ijpj, ijpjm1, ij, iproc 
     2973      INTEGER, DIMENSION (jpmaxngh)      ::   ml_req_nf          !for mpi_isend when avoiding mpi_allgather 
     2974      INTEGER                            ::   ml_err             ! for mpi_isend when avoiding mpi_allgather 
     2975      INTEGER, DIMENSION(MPI_STATUS_SIZE)::   ml_stat            ! for mpi_isend when avoiding mpi_allgather 
     2976      !                                                              ! Workspace for message transfers avoiding mpi_allgather 
     2977      REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE   :: ztab 
     2978      REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE   :: znorthloc, zfoldwk 
     2979      REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE   :: znorthgloio 
     2980      REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE   :: ztabl, ztabr 
     2981      INTEGER :: istatus(mpi_status_size) 
     2982      INTEGER :: iflag 
     2983      !!---------------------------------------------------------------------- 
     2984      ! 
     2985      ALLOCATE( ztab(jpiglo,4,num_fields), znorthloc(jpi,4,num_fields), zfoldwk(jpi,4,num_fields),   & 
     2986            &   znorthgloio(jpi,4,num_fields,jpni) )   ! expanded to 3 dimensions 
     2987      ALLOCATE( ztabl(jpi,4,num_fields), ztabr(jpi*jpmaxngh, 4,num_fields) ) 
     2988      ! 
     2989      ijpj   = 4 
     2990      ijpjm1 = 3 
     2991      ! 
     2992       
     2993      DO jk = 1, num_fields 
     2994         DO jj = nlcj-ijpj+1, nlcj             ! put in znorthloc the last 4 jlines of pt2d (for every variable) 
     2995            ij = jj - nlcj + ijpj 
     2996            znorthloc(:,ij,jk) = pt2d_array(jk)%pt2d(:,jj) 
     2997         END DO 
     2998      END DO 
     2999      !                                     ! Build in procs of ncomm_north the znorthgloio 
     3000      itaille = jpi * ijpj 
     3001                                                                   
     3002      IF ( l_north_nogather ) THEN 
     3003         ! 
     3004         ! Avoid the use of mpi_allgather by exchanging only with the processes already identified  
     3005         ! (in nemo_northcomms) as being  involved in this process' northern boundary exchange 
     3006         ! 
     3007         ztabr(:,:,:) = 0 
     3008         ztabl(:,:,:) = 0 
     3009 
     3010         DO jk = 1, num_fields 
     3011            DO jj = nlcj-ijpj+1, nlcj          ! First put local values into the global array 
     3012               ij = jj - nlcj + ijpj 
     3013               DO ji = nfsloop, nfeloop 
     3014                  ztabl(ji,ij,jk) = pt2d_array(jk)%pt2d(ji,jj) 
     3015               END DO 
     3016            END DO 
     3017         END DO 
     3018 
     3019         DO jr = 1,nsndto 
     3020            IF ((nfipproc(isendto(jr),jpnj) .ne. (narea-1)) .and. (nfipproc(isendto(jr),jpnj) .ne. -1)) THEN 
     3021               CALL mppsend(5, znorthloc, itaille*num_fields, nfipproc(isendto(jr),jpnj), ml_req_nf(jr)) ! Buffer expanded "num_fields" times 
     3022            ENDIF 
     3023         END DO 
     3024         DO jr = 1,nsndto 
     3025            iproc = nfipproc(isendto(jr),jpnj) 
     3026            IF(iproc .ne. -1) THEN 
     3027               ilei = nleit (iproc+1) 
     3028               ildi = nldit (iproc+1) 
     3029               iilb = nfiimpp(isendto(jr),jpnj) - nfiimpp(isendto(1),jpnj) 
     3030            ENDIF 
     3031            IF((iproc .ne. (narea-1)) .and. (iproc .ne. -1)) THEN 
     3032              CALL mpprecv(5, zfoldwk, itaille*num_fields, iproc) ! Buffer expanded "num_fields" times 
     3033              DO jk = 1 , num_fields 
     3034                 DO jj = 1, ijpj 
     3035                    DO ji = ildi, ilei 
     3036                       ztabr(iilb+ji,jj,jk) = zfoldwk(ji,jj,jk)       ! Modified to 3D 
     3037                    END DO 
     3038                 END DO 
     3039              END DO 
     3040            ELSE IF (iproc .eq. (narea-1)) THEN 
     3041              DO jk = 1, num_fields 
     3042                 DO jj = 1, ijpj 
     3043                    DO ji = ildi, ilei 
     3044                          ztabr(iilb+ji,jj,jk) = pt2d_array(jk)%pt2d(ji,nlcj-ijpj+jj)       ! Modified to 3D 
     3045                    END DO 
     3046                 END DO 
     3047              END DO 
     3048            ENDIF 
     3049         END DO 
     3050         IF (l_isend) THEN 
     3051            DO jr = 1,nsndto 
     3052               IF ((nfipproc(isendto(jr),jpnj) .ne. (narea-1)) .and. (nfipproc(isendto(jr),jpnj) .ne. -1)) THEN 
     3053                  CALL mpi_wait(ml_req_nf(jr), ml_stat, ml_err) 
     3054               ENDIF 
     3055            END DO 
     3056         ENDIF 
     3057         ! 
     3058         DO ji = 1, num_fields     ! Loop to manage 3D variables 
     3059            CALL mpp_lbc_nfd( ztabl(:,:,ji), ztabr(:,:,ji), cd_type(ji), psgn(ji) )  ! North fold boundary condition 
     3060         END DO 
     3061         ! 
     3062         DO jk = 1, num_fields 
     3063            DO jj = nlcj-ijpj+1, nlcj             ! Scatter back to pt2d 
     3064               ij = jj - nlcj + ijpj 
     3065               DO ji = 1, nlci 
     3066                  pt2d_array(jk)%pt2d(ji,jj) = ztabl(ji,ij,jk)       ! Modified to 3D 
     3067               END DO 
     3068            END DO 
     3069         END DO 
     3070          
     3071         ! 
     3072      ELSE 
     3073         ! 
     3074         CALL MPI_ALLGATHER( znorthloc  , itaille*num_fields, MPI_DOUBLE_PRECISION,        & 
     3075            &                znorthgloio, itaille*num_fields, MPI_DOUBLE_PRECISION, ncomm_north, ierr ) 
     3076         ! 
     3077         ztab(:,:,:) = 0.e0 
     3078         DO jk = 1, num_fields 
     3079            DO jr = 1, ndim_rank_north            ! recover the global north array 
     3080               iproc = nrank_north(jr) + 1 
     3081               ildi = nldit (iproc) 
     3082               ilei = nleit (iproc) 
     3083               iilb = nimppt(iproc) 
     3084               DO jj = 1, ijpj 
     3085                  DO ji = ildi, ilei 
     3086                     ztab(ji+iilb-1,jj,jk) = znorthgloio(ji,jj,jk,jr) 
     3087                  END DO 
     3088               END DO 
     3089            END DO 
     3090         END DO 
     3091          
     3092         DO ji = 1, num_fields 
     3093            CALL lbc_nfd( ztab(:,:,ji), cd_type(ji), psgn(ji) )   ! North fold boundary condition 
     3094         END DO 
     3095         ! 
     3096         DO jk = 1, num_fields 
     3097            DO jj = nlcj-ijpj+1, nlcj             ! Scatter back to pt2d 
     3098               ij = jj - nlcj + ijpj 
     3099               DO ji = 1, nlci 
     3100                  pt2d_array(jk)%pt2d(ji,jj) = ztab(ji+nimpp-1,ij,jk) 
     3101               END DO 
     3102            END DO 
     3103         END DO 
     3104         ! 
     3105         ! 
     3106      ENDIF 
     3107      DEALLOCATE( ztab, znorthloc, zfoldwk, znorthgloio ) 
     3108      DEALLOCATE( ztabl, ztabr ) 
     3109      ! 
     3110   END SUBROUTINE mpp_lbc_north_2d_multiple 
    29143111 
    29153112   SUBROUTINE mpp_lbc_north_e( pt2d, cd_type, psgn) 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/LBC/mppini.F90

    r6140 r7341  
    198198       
    199199#endif 
    200       IF(lwp) THEN 
    201          WRITE(numout,*) 
    202          WRITE(numout,*) '           defines mpp subdomains' 
    203          WRITE(numout,*) '           ----------------------' 
    204          WRITE(numout,*) '           iresti=',iresti,' irestj=',irestj 
    205          WRITE(numout,*) '           jpni  =',jpni  ,' jpnj  =',jpnj 
    206          ifreq = 4 
    207          il1   = 1 
    208          DO jn = 1, (jpni-1)/ifreq+1 
    209             il2 = MIN( jpni, il1+ifreq-1 ) 
    210             WRITE(numout,*) 
    211             WRITE(numout,9200) ('***',ji = il1,il2-1) 
    212             DO jj = jpnj, 1, -1 
    213                WRITE(numout,9203) ('   ',ji = il1,il2-1) 
    214                WRITE(numout,9202) jj, ( ilcit(ji,jj),ilcjt(ji,jj),ji = il1,il2 ) 
    215                WRITE(numout,9203) ('   ',ji = il1,il2-1) 
    216                WRITE(numout,9200) ('***',ji = il1,il2-1) 
    217             END DO 
    218             WRITE(numout,9201) (ji,ji = il1,il2) 
    219             il1 = il1+ifreq 
    220          END DO 
    221  9200    FORMAT('     ***',20('*************',a3)) 
    222  9203    FORMAT('     *     ',20('         *   ',a3)) 
    223  9201    FORMAT('        ',20('   ',i3,'          ')) 
    224  9202    FORMAT(' ',i3,' *  ',20(i3,'  x',i3,'   *   ')) 
    225       ENDIF 
    226  
    227       zidom = nreci 
    228       DO ji = 1, jpni 
    229          zidom = zidom + ilcit(ji,1) - nreci 
    230       END DO 
    231       IF(lwp) WRITE(numout,*) 
    232       IF(lwp) WRITE(numout,*)' sum ilcit(i,1) = ', zidom, ' jpiglo = ', jpiglo 
    233        
    234       zjdom = nrecj 
    235       DO jj = 1, jpnj 
    236          zjdom = zjdom + ilcjt(1,jj) - nrecj 
    237       END DO 
    238       IF(lwp) WRITE(numout,*)' sum ilcit(1,j) = ', zjdom, ' jpjglo = ', jpjglo 
    239       IF(lwp) WRITE(numout,*) 
    240        
    241200 
    242201      !  2. Index arrays for subdomains 
     
    301260         nlejt(jn) = nlej 
    302261      END DO 
    303        
    304  
    305       ! 4. From global to local 
     262 
     263      ! 4. Subdomain print 
     264      ! ------------------ 
     265       
     266      IF(lwp) WRITE(numout,*) 
     267      IF(lwp) WRITE(numout,*) ' mpp_init: defines mpp subdomains' 
     268      IF(lwp) WRITE(numout,*) ' ~~~~~~  ----------------------' 
     269      IF(lwp) WRITE(numout,*) 
     270      IF(lwp) WRITE(numout,*) 'iresti=',iresti,' irestj=',irestj 
     271      IF(lwp) WRITE(numout,*) 
     272      IF(lwp) WRITE(numout,*) 'jpni=',jpni,' jpnj=',jpnj 
     273      zidom = nreci 
     274      DO ji = 1, jpni 
     275         zidom = zidom + ilcit(ji,1) - nreci 
     276      END DO 
     277      IF(lwp) WRITE(numout,*) 
     278      IF(lwp) WRITE(numout,*)' sum ilcit(i,1)=', zidom, ' jpiglo=', jpiglo 
     279 
     280      zjdom = nrecj 
     281      DO jj = 1, jpnj 
     282         zjdom = zjdom + ilcjt(1,jj) - nrecj 
     283      END DO 
     284      IF(lwp) WRITE(numout,*)' sum ilcit(1,j)=', zjdom, ' jpjglo=', jpjglo 
     285      IF(lwp) WRITE(numout,*) 
     286 
     287      IF(lwp) THEN 
     288         ifreq = 4 
     289         il1   = 1 
     290         DO jn = 1, (jpni-1)/ifreq+1 
     291            il2 = MIN( jpni, il1+ifreq-1 ) 
     292            WRITE(numout,*) 
     293            WRITE(numout,9200) ('***',ji = il1,il2-1) 
     294            DO jj = jpnj, 1, -1 
     295               WRITE(numout,9203) ('   ',ji = il1,il2-1) 
     296               WRITE(numout,9202) jj, ( ilcit(ji,jj),ilcjt(ji,jj),ji = il1,il2 ) 
     297               WRITE(numout,9204) (nfipproc(ji,jj),ji=il1,il2) 
     298               WRITE(numout,9203) ('   ',ji = il1,il2-1) 
     299               WRITE(numout,9200) ('***',ji = il1,il2-1) 
     300            END DO 
     301            WRITE(numout,9201) (ji,ji = il1,il2) 
     302            il1 = il1+ifreq 
     303         END DO 
     304 9200     FORMAT('     ***',20('*************',a3)) 
     305 9203     FORMAT('     *     ',20('         *   ',a3)) 
     306 9201     FORMAT('        ',20('   ',i3,'          ')) 
     307 9202     FORMAT(' ',i3,' *  ',20(i3,'  x',i3,'   *   ')) 
     308 9204     FORMAT('     *  ',20('      ',i3,'   *   ')) 
     309      ENDIF 
     310 
     311      ! 5. From global to local 
    306312      ! ----------------------- 
    307313 
     
    310316 
    311317 
    312       ! 5. Subdomain neighbours 
     318      ! 6. Subdomain neighbours 
    313319      ! ---------------------- 
    314320 
     
    433439         WRITE(numout,*) ' nimpp  = ', nimpp 
    434440         WRITE(numout,*) ' njmpp  = ', njmpp 
    435          WRITE(numout,*) ' nbse   = ', nbse  , ' npse   = ', npse 
    436          WRITE(numout,*) ' nbsw   = ', nbsw  , ' npsw   = ', npsw 
    437          WRITE(numout,*) ' nbne   = ', nbne  , ' npne   = ', npne 
    438          WRITE(numout,*) ' nbnw   = ', nbnw  , ' npnw   = ', npnw 
     441         WRITE(numout,*) ' nreci  = ', nreci  , ' npse   = ', npse 
     442         WRITE(numout,*) ' nrecj  = ', nrecj  , ' npsw   = ', npsw 
     443         WRITE(numout,*) ' jpreci = ', jpreci , ' npne   = ', npne 
     444         WRITE(numout,*) ' jprecj = ', jprecj , ' npnw   = ', npnw 
     445         WRITE(numout,*) 
    439446      ENDIF 
    440447 
     
    443450      ! Prepare mpp north fold 
    444451 
    445       IF (jperio >= 3 .AND. jperio <= 6 .AND. jpni > 1 ) THEN 
     452      IF( jperio >= 3 .AND. jperio <= 6 .AND. jpni > 1 ) THEN 
    446453         CALL mpp_ini_north 
    447       END IF 
     454         IF(lwp) WRITE(numout,*) ' mpp_init : North fold boundary prepared for jpni >1' 
     455      ENDIF 
    448456 
    449457      ! Prepare NetCDF output file (if necessary) 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/LBC/mppini_2.h90

    r6140 r7341  
    7272 
    7373      ! read namelist for ln_zco 
    74       NAMELIST/namzgr/ ln_zco, ln_zps, ln_sco, ln_isfcav 
     74      NAMELIST/namzgr/ ln_zco, ln_zps, ln_sco, ln_isfcav, ln_linssh 
    7575 
    7676      !!---------------------------------------------------------------------- 
     
    318318         ENDIF 
    319319 
     320         ! Check wet points over the entire domain to preserve the MPI communication stencil 
    320321         isurf = 0 
    321          DO jj = 1+jprecj, ilj-jprecj 
    322             DO  ji = 1+jpreci, ili-jpreci 
     322         DO jj = 1, ilj 
     323            DO  ji = 1, ili 
    323324               IF( imask(ji+iimppt(ii,ij)-1, jj+ijmppt(ii,ij)-1) == 1) isurf = isurf+1 
    324325            END DO 
    325326         END DO 
     327 
    326328         IF(isurf /= 0) THEN 
    327329            icont = icont + 1 
     
    333335 
    334336      nfipproc(:,:) = ipproc(:,:) 
    335  
    336337 
    337338      ! Control 
     
    441442      ii = iin(narea) 
    442443      ij = ijn(narea) 
     444 
     445      ! set default neighbours 
     446      noso = ioso(ii,ij) 
     447      nowe = iowe(ii,ij) 
     448      noea = ioea(ii,ij) 
     449      nono = iono(ii,ij)  
     450      npse = iose(ii,ij) 
     451      npsw = iosw(ii,ij) 
     452      npne = ione(ii,ij) 
     453      npnw = ionw(ii,ij) 
     454 
     455      ! check neighbours location 
    443456      IF( ioso(ii,ij) >= 0 .AND. ioso(ii,ij) <= (jpni*jpnj-1) ) THEN  
    444457         iiso = 1 + MOD(ioso(ii,ij),jpni) 
     
    511524      IF (lwp) THEN 
    512525         CALL ctl_opn( inum, 'layout.dat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., narea ) 
     526         WRITE(inum,'(a)') '   jpnij     jpi     jpj     jpk  jpiglo  jpjglo' 
    513527         WRITE(inum,'(6i8)') jpnij,jpi,jpj,jpk,jpiglo,jpjglo 
    514528         WRITE(inum,'(a)') 'NAREA nlci nlcj nldi nldj nlei nlej nimpp njmpp' 
     
    523537      END IF 
    524538 
    525       IF( nperio == 1 .AND.jpni /= 1 ) CALL ctl_stop( ' mpp_init2:  error on cyclicity' ) 
    526  
    527       ! Prepare mpp north fold 
    528  
    529       IF( jperio >= 3 .AND. jperio <= 6 .AND. jpni > 1 ) THEN 
    530          CALL mpp_ini_north 
    531          IF(lwp) WRITE(numout,*) ' mpp_init2 : North fold boundary prepared for jpni >1' 
    532       ENDIF 
    533  
    534539      ! Defined npolj, either 0, 3 , 4 , 5 , 6 
    535540      ! In this case the important thing is that npolj /= 0 
     
    548553      ENDIF 
    549554 
     555      ! Periodicity : no corner if nbondi = 2 and nperio != 1 
     556 
     557      IF(lwp) THEN 
     558         WRITE(numout,*) ' nproc  = ', nproc 
     559         WRITE(numout,*) ' nowe   = ', nowe  , ' noea   =  ', noea 
     560         WRITE(numout,*) ' nono   = ', nono  , ' noso   =  ', noso 
     561         WRITE(numout,*) ' nbondi = ', nbondi 
     562         WRITE(numout,*) ' nbondj = ', nbondj 
     563         WRITE(numout,*) ' npolj  = ', npolj 
     564         WRITE(numout,*) ' nperio = ', nperio 
     565         WRITE(numout,*) ' nlci   = ', nlci 
     566         WRITE(numout,*) ' nlcj   = ', nlcj 
     567         WRITE(numout,*) ' nimpp  = ', nimpp 
     568         WRITE(numout,*) ' njmpp  = ', njmpp 
     569         WRITE(numout,*) ' nreci  = ', nreci  , ' npse   = ', npse 
     570         WRITE(numout,*) ' nrecj  = ', nrecj  , ' npsw   = ', npsw 
     571         WRITE(numout,*) ' jpreci = ', jpreci , ' npne   = ', npne 
     572         WRITE(numout,*) ' jprecj = ', jprecj , ' npnw   = ', npnw 
     573         WRITE(numout,*) 
     574      ENDIF 
     575 
     576      IF( nperio == 1 .AND. jpni /= 1 ) CALL ctl_stop( ' mpp_init2: error on cyclicity' ) 
     577 
     578      ! Prepare mpp north fold 
     579 
     580      IF( jperio >= 3 .AND. jperio <= 6 .AND. jpni > 1 ) THEN 
     581         CALL mpp_ini_north 
     582         IF(lwp) WRITE(numout,*) ' mpp_init2 : North fold boundary prepared for jpni >1' 
     583      ENDIF 
     584 
    550585      ! Prepare NetCDF output file (if necessary) 
    551586      CALL mpp_init_ioipsl 
    552587 
    553       ! Periodicity : no corner if nbondi = 2 and nperio != 1 
    554  
    555       IF(lwp) THEN 
    556          WRITE(numout,*) ' nproc=  ',nproc 
    557          WRITE(numout,*) ' nowe=   ',nowe 
    558          WRITE(numout,*) ' noea=   ',noea 
    559          WRITE(numout,*) ' nono=   ',nono 
    560          WRITE(numout,*) ' noso=   ',noso 
    561          WRITE(numout,*) ' nbondi= ',nbondi 
    562          WRITE(numout,*) ' nbondj= ',nbondj 
    563          WRITE(numout,*) ' npolj=  ',npolj 
    564          WRITE(numout,*) ' nperio= ',nperio 
    565          WRITE(numout,*) ' nlci=   ',nlci 
    566          WRITE(numout,*) ' nlcj=   ',nlcj 
    567          WRITE(numout,*) ' nimpp=  ',nimpp 
    568          WRITE(numout,*) ' njmpp=  ',njmpp 
    569          WRITE(numout,*) ' nbse=   ',nbse,' npse= ',npse 
    570          WRITE(numout,*) ' nbsw=   ',nbsw,' npsw= ',npsw 
    571          WRITE(numout,*) ' nbne=   ',nbne,' npne= ',npne 
    572          WRITE(numout,*) ' nbnw=   ',nbnw,' npnw= ',npnw 
    573       ENDIF 
    574588 
    575589   END SUBROUTINE mpp_init2 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/SBC/albedo.F90

    r4624 r7341  
    99   !!             -   ! 2001-06  (M. Vancoppenolle) LIM 3.0 
    1010   !!             -   ! 2006-08  (G. Madec)  cleaning for surface module 
     11   !!            3.6  ! 2016-01  (C. Rousset) new parameterization for sea ice albedo 
    1112   !!---------------------------------------------------------------------- 
    1213 
     
    2930 
    3031   INTEGER  ::   albd_init = 0      !: control flag for initialization 
    31    REAL(wp) ::   zzero     = 0.e0   ! constant values 
    32    REAL(wp) ::   zone      = 1.e0   !    "       " 
    33  
    34    REAL(wp) ::   c1     = 0.05    ! constants values 
    35    REAL(wp) ::   c2     = 0.10    !    "        " 
    36    REAL(wp) ::   rmue   = 0.40    !  cosine of local solar altitude 
    37  
     32   
     33   REAL(wp) ::   rmue     = 0.40    !  cosine of local solar altitude 
     34   REAL(wp) ::   ralb_oce = 0.066   ! ocean or lead albedo (Pegau and Paulson, Ann. Glac. 2001) 
     35   REAL(wp) ::   c1       = 0.05    ! snow thickness (only for nn_ice_alb=0) 
     36   REAL(wp) ::   c2       = 0.10    !  "        " 
     37   REAL(wp) ::   rcloud   = 0.06    ! cloud effect on albedo (only-for nn_ice_alb=0) 
     38  
    3839   !                             !!* namelist namsbc_alb 
    39    REAL(wp) ::   rn_cloud         !  cloudiness effect on snow or ice albedo (Grenfell & Perovich, 1984) 
    40 #if defined key_lim3 
    41    REAL(wp) ::   rn_albice        !  albedo of melting ice in the arctic and antarctic (Shine & Hendersson-Sellers) 
    42 #else 
    43    REAL(wp) ::   rn_albice        !  albedo of melting ice in the arctic and antarctic (Shine & Hendersson-Sellers) 
    44 #endif 
    45    REAL(wp) ::   rn_alphd         !  coefficients for linear interpolation used to compute 
    46    REAL(wp) ::   rn_alphdi        !  albedo between two extremes values (Pyane, 1972) 
    47    REAL(wp) ::   rn_alphc         !  
     40   INTEGER  ::   nn_ice_alb 
     41   REAL(wp) ::   rn_albice 
    4842 
    4943   !!---------------------------------------------------------------------- 
     
    5953      !!           
    6054      !! ** Purpose :   Computation of the albedo of the snow/ice system  
    61       !!                as well as the ocean one 
    6255      !!        
    63       !! ** Method  : - Computation of the albedo of snow or ice (choose the  
    64       !!                rignt one by a large number of tests 
    65       !!              - Computation of the albedo of the ocean 
    66       !! 
    67       !! References :   Shine and Hendersson-Sellers 1985, JGR, 90(D1), 2243-2250. 
     56      !! ** Method  :   Two schemes are available (from namelist parameter nn_ice_alb) 
     57      !!                  0: the scheme is that of Shine & Henderson-Sellers (JGR 1985) for clear-skies 
     58      !!                  1: the scheme is "home made" (for cloudy skies) and based on Brandt et al. (J. Climate 2005) 
     59      !!                                                                           and Grenfell & Perovich (JGR 2004) 
     60      !!                Description of scheme 1: 
     61      !!                  1) Albedo dependency on ice thickness follows the findings from Brandt et al (2005) 
     62      !!                     which are an update of Allison et al. (JGR 1993) ; Brandt et al. 1999 
     63      !!                     0-5cm  : linear function of ice thickness 
     64      !!                     5-150cm: log    function of ice thickness 
     65      !!                     > 150cm: constant 
     66      !!                  2) Albedo dependency on snow thickness follows the findings from Grenfell & Perovich (2004) 
     67      !!                     i.e. it increases as -EXP(-snw_thick/0.02) during freezing and -EXP(-snw_thick/0.03) during melting 
     68      !!                  3) Albedo dependency on clouds is speculated from measurements of Grenfell and Perovich (2004) 
     69      !!                     i.e. cloudy-clear albedo depend on cloudy albedo following a 2d order polynomial law 
     70      !!                  4) The needed 4 parameters are: dry and melting snow, freezing ice and bare puddled ice 
     71      !! 
     72      !! ** Note    :   The parameterization from Shine & Henderson-Sellers presents several misconstructions: 
     73      !!                  1) ice albedo when ice thick. tends to 0 is different than ocean albedo 
     74      !!                  2) for small ice thick. covered with some snow (<3cm?), albedo is larger  
     75      !!                     under melting conditions than under freezing conditions 
     76      !!                  3) the evolution of ice albedo as a function of ice thickness shows   
     77      !!                     3 sharp inflexion points (at 5cm, 100cm and 150cm) that look highly unrealistic 
     78      !! 
     79      !! References :   Shine & Henderson-Sellers 1985, JGR, 90(D1), 2243-2250. 
     80      !!                Brandt et al. 2005, J. Climate, vol 18 
     81      !!                Grenfell & Perovich 2004, JGR, vol 109  
    6882      !!---------------------------------------------------------------------- 
    6983      REAL(wp), INTENT(in   ), DIMENSION(:,:,:) ::   pt_ice      !  ice surface temperature (Kelvin) 
     
    7387      REAL(wp), INTENT(  out), DIMENSION(:,:,:) ::   pa_ice_os   !  albedo of ice under overcast sky 
    7488      !! 
    75       INTEGER  ::   ji, jj, jl    ! dummy loop indices 
    76       INTEGER  ::   ijpl          ! number of ice categories (3rd dim of ice input arrays) 
    77       REAL(wp) ::   zalbpsnm      ! albedo of ice under clear sky when snow is melting 
    78       REAL(wp) ::   zalbpsnf      ! albedo of ice under clear sky when snow is freezing 
    79       REAL(wp) ::   zalbpsn       ! albedo of snow/ice system when ice is coverd by snow 
    80       REAL(wp) ::   zalbpic       ! albedo of snow/ice system when ice is free of snow 
    81       REAL(wp) ::   zithsn        ! = 1 for hsn >= 0 ( ice is cov. by snow ) ; = 0 otherwise (ice is free of snow) 
    82       REAL(wp) ::   zitmlsn       ! = 1 freezinz snow (pt_ice >=rt0_snow) ; = 0 melting snow (pt_ice<rt0_snow) 
    83       REAL(wp) ::   zihsc1        ! = 1 hsn <= c1 ; = 0 hsn > c1 
    84       REAL(wp) ::   zihsc2        ! = 1 hsn >= c2 ; = 0 hsn < c2 
    85       !! 
    86       REAL(wp), POINTER, DIMENSION(:,:,:) ::   zalbfz    ! = rn_alphdi for freezing ice ; = rn_albice for melting ice 
    87       REAL(wp), POINTER, DIMENSION(:,:,:) ::   zficeth   !  function of ice thickness 
     89      INTEGER  ::   ji, jj, jl         ! dummy loop indices 
     90      INTEGER  ::   ijpl               ! number of ice categories (3rd dim of ice input arrays) 
     91      REAL(wp)            ::   ralb_im, ralb_sf, ralb_sm, ralb_if 
     92      REAL(wp)            ::   zswitch, z1_c1, z1_c2 
     93      REAL(wp)                            ::   zalb_sm, zalb_sf, zalb_st ! albedo of snow melting, freezing, total 
     94      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zalb, zalb_it             ! intermediate variable & albedo of ice (snow free) 
    8895      !!--------------------------------------------------------------------- 
    89        
     96 
    9097      ijpl = SIZE( pt_ice, 3 )                     ! number of ice categories 
    91  
    92       CALL wrk_alloc( jpi,jpj,ijpl, zalbfz, zficeth ) 
     98       
     99      CALL wrk_alloc( jpi,jpj,ijpl, zalb, zalb_it ) 
    93100 
    94101      IF( albd_init == 0 )   CALL albedo_init      ! initialization  
    95102 
    96       !--------------------------- 
    97       !  Computation of  zficeth 
    98       !--------------------------- 
    99       ! ice free of snow and melts 
    100       WHERE     ( ph_snw == 0._wp .AND. pt_ice >= rt0_ice )   ;   zalbfz(:,:,:) = rn_albice 
    101       ELSE WHERE                                              ;   zalbfz(:,:,:) = rn_alphdi 
    102       END  WHERE 
    103  
    104       WHERE     ( 1.5  < ph_ice                     )  ;  zficeth = zalbfz 
    105       ELSE WHERE( 1.0  < ph_ice .AND. ph_ice <= 1.5 )  ;  zficeth = 0.472  + 2.0 * ( zalbfz - 0.472 ) * ( ph_ice - 1.0 ) 
    106       ELSE WHERE( 0.05 < ph_ice .AND. ph_ice <= 1.0 )  ;  zficeth = 0.2467 + 0.7049 * ph_ice              & 
    107          &                                                                 - 0.8608 * ph_ice * ph_ice     & 
    108          &                                                                 + 0.3812 * ph_ice * ph_ice * ph_ice 
    109       ELSE WHERE                                       ;  zficeth = 0.1    + 3.6    * ph_ice 
    110       END WHERE 
    111  
    112 !!gm old code 
    113 !      DO jl = 1, ijpl 
    114 !         DO jj = 1, jpj 
    115 !            DO ji = 1, jpi 
    116 !               IF( ph_ice(ji,jj,jl) > 1.5 ) THEN 
    117 !                  zficeth(ji,jj,jl) = zalbfz(ji,jj,jl) 
    118 !               ELSEIF( ph_ice(ji,jj,jl) > 1.0  .AND. ph_ice(ji,jj,jl) <= 1.5 ) THEN 
    119 !                  zficeth(ji,jj,jl) = 0.472 + 2.0 * ( zalbfz(ji,jj,jl) - 0.472 ) * ( ph_ice(ji,jj,jl) - 1.0 ) 
    120 !               ELSEIF( ph_ice(ji,jj,jl) > 0.05 .AND. ph_ice(ji,jj,jl) <= 1.0 ) THEN 
    121 !                  zficeth(ji,jj,jl) = 0.2467 + 0.7049 * ph_ice(ji,jj,jl)                               & 
    122 !                     &                    - 0.8608 * ph_ice(ji,jj,jl) * ph_ice(ji,jj,jl)                 & 
    123 !                     &                    + 0.3812 * ph_ice(ji,jj,jl) * ph_ice(ji,jj,jl) * ph_ice (ji,jj,jl) 
    124 !               ELSE 
    125 !                  zficeth(ji,jj,jl) = 0.1 + 3.6 * ph_ice(ji,jj,jl)  
    126 !               ENDIF 
    127 !            END DO 
    128 !         END DO 
    129 !      END DO 
    130 !!gm end old code 
    131        
    132       !-----------------------------------------------  
    133       !    Computation of the snow/ice albedo system  
    134       !-------------------------- --------------------- 
    135        
    136       !    Albedo of snow-ice for clear sky. 
    137       !-----------------------------------------------     
    138       DO jl = 1, ijpl 
    139          DO jj = 1, jpj 
    140             DO ji = 1, jpi 
    141                !  Case of ice covered by snow.              
    142                !                                        !  freezing snow         
    143                zihsc1   = 1.0 - MAX( zzero , SIGN( zone , - ( ph_snw(ji,jj,jl) - c1 ) ) ) 
    144                zalbpsnf = ( 1.0 - zihsc1 ) * (  zficeth(ji,jj,jl)                                             & 
    145                   &                           + ph_snw(ji,jj,jl) * ( rn_alphd - zficeth(ji,jj,jl) ) / c1  )   & 
    146                   &     +         zihsc1   * rn_alphd   
    147                !                                        !  melting snow                 
    148                zihsc2   = MAX( zzero , SIGN( zone , ph_snw(ji,jj,jl) - c2 ) ) 
    149                zalbpsnm = ( 1.0 - zihsc2 ) * ( rn_albice + ph_snw(ji,jj,jl) * ( rn_alphc - rn_albice ) / c2 )   & 
    150                   &     +         zihsc2   *   rn_alphc  
    151                ! 
    152                zitmlsn  =  MAX( zzero , SIGN( zone , pt_ice(ji,jj,jl) - rt0_snow ) )    
    153                zalbpsn  =  zitmlsn * zalbpsnm + ( 1.0 - zitmlsn ) * zalbpsnf 
    154              
    155                !  Case of ice free of snow. 
    156                zalbpic  = zficeth(ji,jj,jl)  
    157              
    158                ! albedo of the system    
    159                zithsn   = 1.0 - MAX( zzero , SIGN( zone , - ph_snw(ji,jj,jl) ) ) 
    160                pa_ice_cs(ji,jj,jl) =  zithsn * zalbpsn + ( 1.0 - zithsn ) *  zalbpic 
     103       
     104      SELECT CASE ( nn_ice_alb ) 
     105 
     106      !------------------------------------------ 
     107      !  Shine and Henderson-Sellers (1985) 
     108      !------------------------------------------ 
     109      CASE( 0 ) 
     110        
     111         ralb_sf = 0.80       ! dry snow 
     112         ralb_sm = 0.65       ! melting snow 
     113         ralb_if = 0.72       ! bare frozen ice 
     114         ralb_im = rn_albice  ! bare puddled ice  
     115          
     116         !  Computation of ice albedo (free of snow) 
     117         WHERE     ( ph_snw == 0._wp .AND. pt_ice >= rt0_ice )   ;   zalb(:,:,:) = ralb_im 
     118         ELSE WHERE                                              ;   zalb(:,:,:) = ralb_if 
     119         END  WHERE 
     120       
     121         WHERE     ( 1.5  < ph_ice                     )  ;  zalb_it = zalb 
     122         ELSE WHERE( 1.0  < ph_ice .AND. ph_ice <= 1.5 )  ;  zalb_it = 0.472  + 2.0 * ( zalb - 0.472 ) * ( ph_ice - 1.0 ) 
     123         ELSE WHERE( 0.05 < ph_ice .AND. ph_ice <= 1.0 )  ;  zalb_it = 0.2467 + 0.7049 * ph_ice              & 
     124            &                                                                 - 0.8608 * ph_ice * ph_ice     & 
     125            &                                                                 + 0.3812 * ph_ice * ph_ice * ph_ice 
     126         ELSE WHERE                                       ;  zalb_it = 0.1    + 3.6    * ph_ice 
     127         END WHERE 
     128      
     129         DO jl = 1, ijpl 
     130            DO jj = 1, jpj 
     131               DO ji = 1, jpi 
     132                  ! freezing snow 
     133                  ! no effect of underlying ice layer IF snow thickness > c1. Albedo does not depend on snow thick if > c2 
     134                  !                                        !  freezing snow         
     135                  zswitch   = 1._wp - MAX( 0._wp , SIGN( 1._wp , - ( ph_snw(ji,jj,jl) - c1 ) ) ) 
     136                  zalb_sf   = ( 1._wp - zswitch ) * (  zalb_it(ji,jj,jl)  & 
     137                     &                           + ph_snw(ji,jj,jl) * ( ralb_sf - zalb_it(ji,jj,jl) ) / c1  )   & 
     138                     &        +         zswitch   * ralb_sf   
     139 
     140                  ! melting snow 
     141                  ! no effect of underlying ice layer. Albedo does not depend on snow thick IF > c2 
     142                  zswitch   = MAX( 0._wp , SIGN( 1._wp , ph_snw(ji,jj,jl) - c2 ) ) 
     143                  zalb_sm = ( 1._wp - zswitch ) * ( ralb_im + ph_snw(ji,jj,jl) * ( ralb_sm - ralb_im ) / c2 )   & 
     144                      &     +         zswitch   *   ralb_sm  
     145                  ! 
     146                  ! snow albedo 
     147                  zswitch  =  MAX( 0._wp , SIGN( 1._wp , pt_ice(ji,jj,jl) - rt0_snow ) )    
     148                  zalb_st  =  zswitch * zalb_sm + ( 1._wp - zswitch ) * zalb_sf 
     149                
     150                  ! Ice/snow albedo 
     151                  zswitch   = 1._wp - MAX( 0._wp , SIGN( 1._wp , - ph_snw(ji,jj,jl) ) ) 
     152                  pa_ice_cs(ji,jj,jl) =  zswitch * zalb_st + ( 1._wp - zswitch ) * zalb_it(ji,jj,jl) 
     153                  ! 
     154               END DO 
    161155            END DO 
    162156         END DO 
    163       END DO 
    164        
    165       !    Albedo of snow-ice for overcast sky. 
    166       !----------------------------------------------   
    167       pa_ice_os(:,:,:) = pa_ice_cs(:,:,:) + rn_cloud       ! Oberhuber correction 
    168       ! 
    169       CALL wrk_dealloc( jpi,jpj,ijpl, zalbfz, zficeth ) 
     157 
     158         pa_ice_os(:,:,:) = pa_ice_cs(:,:,:) + rcloud       ! Oberhuber correction for overcast sky 
     159 
     160      !------------------------------------------ 
     161      !  New parameterization (2016) 
     162      !------------------------------------------ 
     163      CASE( 1 )  
     164 
     165         ralb_im = rn_albice  ! bare puddled ice 
     166! compilation of values from literature 
     167         ralb_sf = 0.85      ! dry snow 
     168         ralb_sm = 0.75      ! melting snow 
     169         ralb_if = 0.60      ! bare frozen ice 
     170! Perovich et al 2002 (Sheba) => the only dataset for which all types of ice/snow were retrieved 
     171!         ralb_sf = 0.85       ! dry snow 
     172!         ralb_sm = 0.72       ! melting snow 
     173!         ralb_if = 0.65       ! bare frozen ice 
     174! Brandt et al 2005 (East Antarctica) 
     175!         ralb_sf = 0.87      ! dry snow 
     176!         ralb_sm = 0.82      ! melting snow 
     177!         ralb_if = 0.54      ! bare frozen ice 
     178!  
     179         !  Computation of ice albedo (free of snow) 
     180         z1_c1 = 1. / ( LOG(1.5) - LOG(0.05) )  
     181         z1_c2 = 1. / 0.05 
     182         WHERE     ( ph_snw == 0._wp .AND. pt_ice >= rt0_ice )   ;   zalb = ralb_im 
     183         ELSE WHERE                                              ;   zalb = ralb_if 
     184         END  WHERE 
     185          
     186         WHERE     ( 1.5  < ph_ice                     )  ;  zalb_it = zalb 
     187         ELSE WHERE( 0.05 < ph_ice .AND. ph_ice <= 1.5 )  ;  zalb_it = zalb     + ( 0.18 - zalb     ) * z1_c1 *  & 
     188            &                                                                     ( LOG(1.5) - LOG(ph_ice) ) 
     189         ELSE WHERE                                       ;  zalb_it = ralb_oce + ( 0.18 - ralb_oce ) * z1_c2 * ph_ice 
     190         END WHERE 
     191 
     192         z1_c1 = 1. / 0.02 
     193         z1_c2 = 1. / 0.03 
     194         !  Computation of the snow/ice albedo 
     195         DO jl = 1, ijpl 
     196            DO jj = 1, jpj 
     197               DO ji = 1, jpi 
     198                  zalb_sf = ralb_sf - ( ralb_sf - zalb_it(ji,jj,jl)) * EXP( - ph_snw(ji,jj,jl) * z1_c1 ); 
     199                  zalb_sm = ralb_sm - ( ralb_sm - zalb_it(ji,jj,jl)) * EXP( - ph_snw(ji,jj,jl) * z1_c2 ); 
     200 
     201                   ! snow albedo 
     202                  zswitch = MAX( 0._wp , SIGN( 1._wp , pt_ice(ji,jj,jl) - rt0_snow ) )    
     203                  zalb_st = zswitch * zalb_sm + ( 1._wp - zswitch ) * zalb_sf 
     204 
     205                  ! Ice/snow albedo    
     206                  zswitch             = MAX( 0._wp , SIGN( 1._wp , - ph_snw(ji,jj,jl) ) ) 
     207                  pa_ice_os(ji,jj,jl) = ( 1._wp - zswitch ) * zalb_st + zswitch *  zalb_it(ji,jj,jl) 
     208 
     209              END DO 
     210            END DO 
     211         END DO 
     212         ! Effect of the clouds (2d order polynomial) 
     213         pa_ice_cs = pa_ice_os - ( - 0.1010 * pa_ice_os * pa_ice_os + 0.1933 * pa_ice_os - 0.0148 );  
     214 
     215      END SELECT 
     216       
     217      CALL wrk_dealloc( jpi,jpj,ijpl, zalb, zalb_it ) 
    170218      ! 
    171219   END SUBROUTINE albedo_ice 
     
    181229      REAL(wp), DIMENSION(:,:), INTENT(out) ::   pa_oce_cs   !  albedo of ocean under clear sky 
    182230      !! 
    183       REAL(wp) ::   zcoef   ! local scalar 
    184       !!---------------------------------------------------------------------- 
    185       ! 
    186       zcoef = 0.05 / ( 1.1 * rmue**1.4 + 0.15 )      ! Parameterization of Briegled and Ramanathan, 1982  
    187       pa_oce_cs(:,:) = zcoef                
    188       pa_oce_os(:,:)  = 0.06                         ! Parameterization of Kondratyev, 1969 and Payne, 1972 
     231      REAL(wp) :: zcoef  
     232      !!---------------------------------------------------------------------- 
     233      ! 
     234      zcoef = 0.05 / ( 1.1 * rmue**1.4 + 0.15 )   ! Parameterization of Briegled and Ramanathan, 1982 
     235      pa_oce_cs(:,:) = zcoef  
     236      pa_oce_os(:,:) = 0.06                       ! Parameterization of Kondratyev, 1969 and Payne, 1972 
    189237      ! 
    190238   END SUBROUTINE albedo_oce 
     
    200248      !!---------------------------------------------------------------------- 
    201249      INTEGER  ::   ios                 ! Local integer output status for namelist read 
    202       NAMELIST/namsbc_alb/ rn_cloud, rn_albice, rn_alphd, rn_alphdi, rn_alphc 
     250      NAMELIST/namsbc_alb/ nn_ice_alb, rn_albice  
    203251      !!---------------------------------------------------------------------- 
    204252      ! 
     
    219267         WRITE(numout,*) '~~~~~~~' 
    220268         WRITE(numout,*) '   Namelist namsbc_alb : albedo ' 
    221          WRITE(numout,*) '      correction for snow and ice albedo                  rn_cloud  = ', rn_cloud 
    222          WRITE(numout,*) '      albedo of melting ice in the arctic and antarctic   rn_albice = ', rn_albice 
    223          WRITE(numout,*) '      coefficients for linear                             rn_alphd  = ', rn_alphd 
    224          WRITE(numout,*) '      interpolation used to compute albedo                rn_alphdi = ', rn_alphdi 
    225          WRITE(numout,*) '      between two extremes values (Pyane, 1972)           rn_alphc  = ', rn_alphc 
     269         WRITE(numout,*) '      choose the albedo parameterization                  nn_ice_alb = ', nn_ice_alb 
     270         WRITE(numout,*) '      albedo of bare puddled ice                          rn_albice  = ', rn_albice 
    226271      ENDIF 
    227272      ! 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90

    r5407 r7341  
    8080   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   qemp_oce       !: heat flux of precip and evap over ocean     [W/m2] 
    8181   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   qemp_ice       !: heat flux of precip and evap over ice       [W/m2] 
    82    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   qprec_ice      !: heat flux of precip over ice                [J/m3] 
     82   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   qevap_ice      !: heat flux of evap over ice                  [W/m2] 
     83   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   qprec_ice      !: enthalpy of precip over ice                 [J/m3] 
    8384   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   emp_oce        !: evap - precip over ocean                 [kg/m2/s] 
    8485#endif 
     
    144145#endif 
    145146#if defined key_lim3 
    146          &      evap_ice(jpi,jpj,jpl) , devap_ice(jpi,jpj,jpl) , qprec_ice(jpi,jpj) ,  & 
    147          &      qemp_ice(jpi,jpj)     , qemp_oce(jpi,jpj)      ,                       & 
    148          &      qns_oce (jpi,jpj)     , qsr_oce (jpi,jpj)      , emp_oce (jpi,jpj)  ,  & 
     147         &      evap_ice(jpi,jpj,jpl) , devap_ice(jpi,jpj,jpl) , qprec_ice(jpi,jpj) ,   & 
     148         &      qemp_ice(jpi,jpj)     , qevap_ice(jpi,jpj,jpl) , qemp_oce (jpi,jpj) ,   & 
     149         &      qns_oce (jpi,jpj)     , qsr_oce  (jpi,jpj)     , emp_oce (jpi,jpj)  ,   & 
    149150#endif 
    150151         &      emp_ice(jpi,jpj)      ,  STAT= ierr(1) ) 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_clio.F90

    r5836 r7341  
    668668      qprec_ice(:,:) = rhosn * ( ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic * tmask(:,:,1) - lfus ) 
    669669 
     670      ! --- heat content of evap over ice in W/m2 (to be used in 1D-thermo) --- ! 
     671      DO jl = 1, jpl 
     672         qevap_ice(:,:,jl) = 0._wp ! should be -evap_ice(:,:,jl)*( ( Tice - rt0 ) * cpic * tmask(:,:,1) - lfus ) 
     673                                   ! but then qemp_ice should also include sublimation  
     674      END DO 
     675 
    670676      CALL wrk_dealloc( jpi,jpj, zevap, zsnw )  
    671677#endif 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90

    r6140 r7341  
    206206      IF( MOD( kt - 1, nn_fsbc ) == 0 )   THEN 
    207207         qlw_ice(:,:,1)   = sf(jp_qlw)%fnow(:,:,1)  
    208          qsr_ice(:,:,1)   = sf(jp_qsr)%fnow(:,:,1) 
     208         IF( ln_dm2dc ) THEN ; qsr_ice(:,:,1) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) 
     209         ELSE                ; qsr_ice(:,:,1) =          sf(jp_qsr)%fnow(:,:,1) 
     210         ENDIF 
    209211         tatm_ice(:,:)    = sf(jp_tair)%fnow(:,:,1)          
    210212         qatm_ice(:,:)    = sf(jp_humi)%fnow(:,:,1) 
     
    612614      ! --- evaporation --- ! 
    613615      z1_lsub = 1._wp / Lsub 
    614       evap_ice (:,:,:) = qla_ice (:,:,:) * z1_lsub ! sublimation 
    615       devap_ice(:,:,:) = dqla_ice(:,:,:) * z1_lsub 
    616       zevap    (:,:)   = emp(:,:) + tprecip(:,:)   ! evaporation over ocean 
     616      evap_ice (:,:,:) = rn_efac * qla_ice (:,:,:) * z1_lsub    ! sublimation 
     617      devap_ice(:,:,:) = rn_efac * dqla_ice(:,:,:) * z1_lsub    ! d(sublimation)/dT 
     618      zevap    (:,:)   = rn_efac * ( emp(:,:) + tprecip(:,:) )  ! evaporation over ocean 
    617619 
    618620      ! --- evaporation minus precipitation --- ! 
     
    637639      ! --- heat content of precip over ice in J/m3 (to be used in 1D-thermo) --- ! 
    638640      qprec_ice(:,:) = rhosn * ( ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic * tmask(:,:,1) - lfus ) 
     641 
     642      ! --- heat content of evap over ice in W/m2 (to be used in 1D-thermo) --- ! 
     643      DO jl = 1, jpl 
     644         qevap_ice(:,:,jl) = 0._wp ! should be -evap_ice(:,:,jl)*( ( Tice - rt0 ) * cpic * tmask(:,:,1) ) 
     645                                   ! But we do not have Tice => consider it at 0°C => evap=0  
     646      END DO 
    639647 
    640648      CALL wrk_dealloc( jpi,jpj, zevap, zsnw )  
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90

    r6165 r7341  
    10061006      IF( srcv(jpr_toce)%laction ) THEN                      ! received by sas in case of opa <-> sas coupling 
    10071007         sst_m(:,:) = frcv(jpr_toce)%z3(:,:,1) 
    1008          IF( srcv(jpr_soce)%laction .AND. ln_useCT ) THEN    ! make sure that sst_m is the potential temperature 
     1008         IF( srcv(jpr_soce)%laction .AND. l_useCT ) THEN    ! make sure that sst_m is the potential temperature 
    10091009            sst_m(:,:) = eos_pt_from_ct( sst_m(:,:), sss_m(:,:) ) 
    10101010         ENDIF 
     
    13271327      !!             ***  ROUTINE sbc_cpl_ice_flx  *** 
    13281328      !! 
    1329       !! ** Purpose :   provide the heat and freshwater fluxes of the  
    1330       !!              ocean-ice system. 
     1329      !! ** Purpose :   provide the heat and freshwater fluxes of the ocean-ice system 
    13311330      !! 
    13321331      !! ** Method  :   transform the fields received from the atmosphere into 
    13331332      !!             surface heat and fresh water boundary condition for the  
    13341333      !!             ice-ocean system. The following fields are provided: 
    1335       !!              * total non solar, solar and freshwater fluxes (qns_tot,  
     1334      !!               * total non solar, solar and freshwater fluxes (qns_tot,  
    13361335      !!             qsr_tot and emp_tot) (total means weighted ice-ocean flux) 
    13371336      !!             NB: emp_tot include runoffs and calving. 
    1338       !!              * fluxes over ice (qns_ice, qsr_ice, emp_ice) where 
     1337      !!               * fluxes over ice (qns_ice, qsr_ice, emp_ice) where 
    13391338      !!             emp_ice = sublimation - solid precipitation as liquid 
    13401339      !!             precipitation are re-routed directly to the ocean and  
    1341       !!             runoffs and calving directly enter the ocean. 
    1342       !!              * solid precipitation (sprecip), used to add to qns_tot  
     1340      !!             calving directly enter the ocean (runoffs are read but included in trasbc.F90) 
     1341      !!               * solid precipitation (sprecip), used to add to qns_tot  
    13431342      !!             the heat lost associated to melting solid precipitation 
    13441343      !!             over the ocean fraction. 
    1345       !!       ===>> CAUTION here this changes the net heat flux received from 
    1346       !!             the atmosphere 
    1347       !! 
    1348       !!                  - the fluxes have been separated from the stress as 
    1349       !!                 (a) they are updated at each ice time step compare to 
    1350       !!                 an update at each coupled time step for the stress, and 
    1351       !!                 (b) the conservative computation of the fluxes over the 
    1352       !!                 sea-ice area requires the knowledge of the ice fraction 
    1353       !!                 after the ice advection and before the ice thermodynamics, 
    1354       !!                 so that the stress is updated before the ice dynamics 
    1355       !!                 while the fluxes are updated after it. 
     1344      !!               * heat content of rain, snow and evap can also be provided, 
     1345      !!             otherwise heat flux associated with these mass flux are 
     1346      !!             guessed (qemp_oce, qemp_ice) 
     1347      !! 
     1348      !!             - the fluxes have been separated from the stress as 
     1349      !!               (a) they are updated at each ice time step compare to 
     1350      !!               an update at each coupled time step for the stress, and 
     1351      !!               (b) the conservative computation of the fluxes over the 
     1352      !!               sea-ice area requires the knowledge of the ice fraction 
     1353      !!               after the ice advection and before the ice thermodynamics, 
     1354      !!               so that the stress is updated before the ice dynamics 
     1355      !!               while the fluxes are updated after it. 
     1356      !! 
     1357      !! ** Details 
     1358      !!             qns_tot = pfrld * qns_oce + ( 1 - pfrld ) * qns_ice   => provided 
     1359      !!                     + qemp_oce + qemp_ice                         => recalculated and added up to qns 
     1360      !! 
     1361      !!             qsr_tot = pfrld * qsr_oce + ( 1 - pfrld ) * qsr_ice   => provided 
     1362      !! 
     1363      !!             emp_tot = emp_oce + emp_ice                           => calving is provided and added to emp_tot (and emp_oce) 
     1364      !!                                                                      river runoff (rnf) is provided but not included here 
    13561365      !! 
    13571366      !! ** Action  :   update at each nf_ice time step: 
    13581367      !!                   qns_tot, qsr_tot  non-solar and solar total heat fluxes 
    13591368      !!                   qns_ice, qsr_ice  non-solar and solar heat fluxes over the ice 
    1360       !!                   emp_tot            total evaporation - precipitation(liquid and solid) (-runoff)(-calving) 
    1361       !!                   emp_ice            ice sublimation - solid precipitation over the ice 
    1362       !!                   dqns_ice           d(non-solar heat flux)/d(Temperature) over the ice 
    1363       !!                   sprecip             solid precipitation over the ocean   
     1369      !!                   emp_tot           total evaporation - precipitation(liquid and solid) (-calving) 
     1370      !!                   emp_ice           ice sublimation - solid precipitation over the ice 
     1371      !!                   dqns_ice          d(non-solar heat flux)/d(Temperature) over the ice 
     1372      !!                   sprecip           solid precipitation over the ocean   
    13641373      !!---------------------------------------------------------------------- 
    1365       REAL(wp), INTENT(in   ), DIMENSION(:,:)             ::   p_frld  ! lead fraction            [0 to 1] 
     1374      REAL(wp), INTENT(in   ), DIMENSION(:,:)   ::   p_frld     ! lead fraction                [0 to 1] 
    13661375      ! optional arguments, used only in 'mixed oce-ice' case 
    1367       REAL(wp), INTENT(in   ), DIMENSION(:,:,:), OPTIONAL ::   palbi   ! all skies ice albedo  
    1368       REAL(wp), INTENT(in   ), DIMENSION(:,:  ), OPTIONAL ::   psst    ! sea surface temperature  [Celsius] 
    1369       REAL(wp), INTENT(in   ), DIMENSION(:,:,:), OPTIONAL ::   pist    ! ice surface temperature  [Kelvin] 
    1370       ! 
    1371       INTEGER ::   jl   ! dummy loop index 
    1372       REAL(wp), POINTER, DIMENSION(:,:  ) ::   zcptn, ztmp, zicefr, zmsk 
    1373       REAL(wp), POINTER, DIMENSION(:,:  ) ::   zemp_tot, zemp_ice, zsprecip, ztprecip, zqns_tot, zqsr_tot 
    1374       REAL(wp), POINTER, DIMENSION(:,:,:) ::   zqns_ice, zqsr_ice, zdqns_ice 
    1375       REAL(wp), POINTER, DIMENSION(:,:  ) ::   zevap, zsnw, zqns_oce, zqsr_oce, zqprec_ice, zqemp_oce ! for LIM3 
     1376      REAL(wp), INTENT(in   ), DIMENSION(:,:,:), OPTIONAL ::   palbi      ! all skies ice albedo  
     1377      REAL(wp), INTENT(in   ), DIMENSION(:,:  ), OPTIONAL ::   psst       ! sea surface temperature     [Celsius] 
     1378      REAL(wp), INTENT(in   ), DIMENSION(:,:,:), OPTIONAL ::   pist       ! ice surface temperature     [Kelvin] 
     1379      ! 
     1380      INTEGER ::   jl         ! dummy loop index 
     1381      REAL(wp), POINTER, DIMENSION(:,:  ) ::   zcptn, ztmp, zicefr, zmsk, zsnw 
     1382      REAL(wp), POINTER, DIMENSION(:,:  ) ::   zemp_tot, zemp_ice, zemp_oce, ztprecip, zsprecip, zevap_oce, zevap_ice, zdevap_ice 
     1383      REAL(wp), POINTER, DIMENSION(:,:  ) ::   zqns_tot, zqns_oce, zqsr_tot, zqsr_oce, zqprec_ice, zqemp_oce, zqemp_ice 
     1384      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zqns_ice, zqsr_ice, zdqns_ice, zqevap_ice 
    13761385      !!---------------------------------------------------------------------- 
    13771386      ! 
    1378       IF( nn_timing == 1 )   CALL timing_start('sbc_cpl_ice_flx') 
    1379       ! 
    1380       CALL wrk_alloc( jpi,jpj,       zcptn, ztmp, zicefr, zmsk, zemp_tot, zemp_ice, zsprecip, ztprecip, zqns_tot, zqsr_tot ) 
    1381       CALL wrk_alloc( jpi,jpj,jpl,   zqns_ice, zqsr_ice, zdqns_ice ) 
     1387      IF( nn_timing == 1 )  CALL timing_start('sbc_cpl_ice_flx') 
     1388      ! 
     1389      CALL wrk_alloc( jpi,jpj,     zcptn, ztmp, zicefr, zmsk, zsnw ) 
     1390      CALL wrk_alloc( jpi,jpj,     zemp_tot, zemp_ice, zemp_oce, ztprecip, zsprecip, zevap_oce, zevap_ice, zdevap_ice ) 
     1391      CALL wrk_alloc( jpi,jpj,     zqns_tot, zqns_oce, zqsr_tot, zqsr_oce, zqprec_ice, zqemp_oce, zqemp_ice ) 
     1392      CALL wrk_alloc( jpi,jpj,jpl, zqns_ice, zqsr_ice, zdqns_ice, zqevap_ice ) 
    13821393 
    13831394      IF( ln_mixcpl )   zmsk(:,:) = 1. - xcplmask(:,:,0) 
     
    13861397      ! 
    13871398      !                                                      ! ========================= ! 
    1388       !                                                      !    freshwater budget      !   (emp) 
     1399      !                                                      !    freshwater budget      !   (emp_tot) 
    13891400      !                                                      ! ========================= ! 
    13901401      ! 
    1391       !                                                           ! total Precipitation - total Evaporation (emp_tot) 
    1392       !                                                           ! solid precipitation - sublimation       (emp_ice) 
    1393       !                                                           ! solid Precipitation                     (sprecip) 
    1394       !                                                           ! liquid + solid Precipitation            (tprecip) 
     1402      !                                                           ! solid Precipitation                                (sprecip) 
     1403      !                                                           ! liquid + solid Precipitation                       (tprecip) 
     1404      !                                                           ! total Evaporation - total Precipitation            (emp_tot) 
     1405      !                                                           ! sublimation - solid precipitation (cell average)   (emp_ice) 
    13951406      SELECT CASE( TRIM( sn_rcv_emp%cldes ) ) 
    1396       CASE( 'conservative'  )   ! received fields: jpr_rain, jpr_snow, jpr_ievp, jpr_tevp 
    1397          zsprecip(:,:) = frcv(jpr_snow)%z3(:,:,1)                  ! May need to ensure positive here 
    1398          ztprecip(:,:) = frcv(jpr_rain)%z3(:,:,1) + zsprecip(:,:)  ! May need to ensure positive here 
    1399          zemp_tot(:,:) = frcv(jpr_tevp)%z3(:,:,1) - ztprecip(:,:) 
    1400          zemp_ice(:,:) = frcv(jpr_ievp)%z3(:,:,1) - frcv(jpr_snow)%z3(:,:,1) 
    1401             CALL iom_put( 'rain'         , frcv(jpr_rain)%z3(:,:,1)              )   ! liquid precipitation  
     1407      CASE( 'conservative' )   ! received fields: jpr_rain, jpr_snow, jpr_ievp, jpr_tevp 
     1408         zsprecip(:,:) =   frcv(jpr_snow)%z3(:,:,1)                  ! May need to ensure positive here 
     1409         ztprecip(:,:) =   frcv(jpr_rain)%z3(:,:,1) + zsprecip(:,:)  ! May need to ensure positive here 
     1410         zemp_tot(:,:) =   frcv(jpr_tevp)%z3(:,:,1) - ztprecip(:,:) 
     1411         zemp_ice(:,:) = ( frcv(jpr_ievp)%z3(:,:,1) - frcv(jpr_snow)%z3(:,:,1) ) * zicefr(:,:) 
     1412               CALL iom_put( 'rain'         ,   frcv(jpr_rain)%z3(:,:,1)                                                         )  ! liquid precipitation  
    14021413         IF( iom_use('hflx_rain_cea') )   & 
    1403             CALL iom_put( 'hflx_rain_cea', frcv(jpr_rain)%z3(:,:,1) * zcptn(:,:) )   ! heat flux from liq. precip.  
    1404          IF( iom_use('evap_ao_cea') .OR. iom_use('hflx_evap_cea') )   & 
    1405             ztmp(:,:) = frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:) 
     1414            &  CALL iom_put( 'hflx_rain_cea',   frcv(jpr_rain)%z3(:,:,1) * zcptn(:,:)                                            )  ! heat flux from liq. precip.  
    14061415         IF( iom_use('evap_ao_cea'  ) )   & 
    1407             CALL iom_put( 'evap_ao_cea'  , ztmp                   )   ! ice-free oce evap (cell average) 
     1416            &  CALL iom_put( 'evap_ao_cea'  ,   frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:)                )  ! ice-free oce evap (cell average) 
    14081417         IF( iom_use('hflx_evap_cea') )   & 
    1409             CALL iom_put( 'hflx_evap_cea', ztmp(:,:) * zcptn(:,:) )   ! heat flux from from evap (cell average) 
    1410       CASE( 'oce and ice'   )   ! received fields: jpr_sbpr, jpr_semp, jpr_oemp, jpr_ievp 
     1418            &  CALL iom_put( 'hflx_evap_cea', ( frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:) ) * zcptn(:,:) )  ! heat flux from from evap (cell average) 
     1419      CASE( 'oce and ice' )   ! received fields: jpr_sbpr, jpr_semp, jpr_oemp, jpr_ievp 
    14111420         zemp_tot(:,:) = p_frld(:,:) * frcv(jpr_oemp)%z3(:,:,1) + zicefr(:,:) * frcv(jpr_sbpr)%z3(:,:,1) 
    1412          zemp_ice(:,:) = frcv(jpr_semp)%z3(:,:,1) 
     1421         zemp_ice(:,:) = frcv(jpr_semp)%z3(:,:,1) * zicefr(:,:) 
    14131422         zsprecip(:,:) = frcv(jpr_ievp)%z3(:,:,1) - frcv(jpr_semp)%z3(:,:,1) 
    14141423         ztprecip(:,:) = frcv(jpr_semp)%z3(:,:,1) - frcv(jpr_sbpr)%z3(:,:,1) + zsprecip(:,:) 
    14151424      END SELECT 
    14161425 
    1417       IF( iom_use('subl_ai_cea') )   & 
    1418          CALL iom_put( 'subl_ai_cea', frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:) )   ! Sublimation over sea-ice         (cell average) 
    1419       !    
    1420       !                                                           ! runoffs and calving (put in emp_tot) 
     1426#if defined key_lim3 
     1427      ! zsnw = snow fraction over ice after wind blowing 
     1428      zsnw(:,:) = 0._wp  ;  CALL lim_thd_snwblow( p_frld, zsnw ) 
     1429       
     1430      ! --- evaporation minus precipitation corrected (because of wind blowing on snow) --- ! 
     1431      zemp_ice(:,:) = zemp_ice(:,:) + zsprecip(:,:) * ( zicefr(:,:) - zsnw(:,:) )  ! emp_ice = A * sublimation - zsnw * sprecip 
     1432      zemp_oce(:,:) = zemp_tot(:,:) - zemp_ice(:,:)                                ! emp_oce = emp_tot - emp_ice 
     1433 
     1434      ! --- evaporation over ocean (used later for qemp) --- ! 
     1435      zevap_oce(:,:) = frcv(jpr_tevp)%z3(:,:,1) - frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:) 
     1436 
     1437      ! --- evaporation over ice (kg/m2/s) --- ! 
     1438      zevap_ice(:,:) = frcv(jpr_ievp)%z3(:,:,1) 
     1439      ! since the sensitivity of evap to temperature (devap/dT) is not prescribed by the atmosphere, we set it to 0 
     1440      ! therefore, sublimation is not redistributed over the ice categories in case no subgrid scale fluxes are provided by atm. 
     1441      zdevap_ice(:,:) = 0._wp 
     1442       
     1443      ! --- runoffs (included in emp later on) --- ! 
     1444      IF( srcv(jpr_rnf)%laction )   rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1) 
     1445 
     1446      ! --- calving (put in emp_tot and emp_oce) --- ! 
     1447      IF( srcv(jpr_cal)%laction ) THEN  
     1448         zemp_tot(:,:) = zemp_tot(:,:) - frcv(jpr_cal)%z3(:,:,1) 
     1449         zemp_oce(:,:) = zemp_oce(:,:) - frcv(jpr_cal)%z3(:,:,1) 
     1450         CALL iom_put( 'calving_cea', frcv(jpr_cal)%z3(:,:,1) ) 
     1451      ENDIF 
     1452 
     1453      IF( ln_mixcpl ) THEN 
     1454         emp_tot(:,:) = emp_tot(:,:) * xcplmask(:,:,0) + zemp_tot(:,:) * zmsk(:,:) 
     1455         emp_ice(:,:) = emp_ice(:,:) * xcplmask(:,:,0) + zemp_ice(:,:) * zmsk(:,:) 
     1456         emp_oce(:,:) = emp_oce(:,:) * xcplmask(:,:,0) + zemp_oce(:,:) * zmsk(:,:) 
     1457         sprecip(:,:) = sprecip(:,:) * xcplmask(:,:,0) + zsprecip(:,:) * zmsk(:,:) 
     1458         tprecip(:,:) = tprecip(:,:) * xcplmask(:,:,0) + ztprecip(:,:) * zmsk(:,:) 
     1459         DO jl=1,jpl 
     1460            evap_ice (:,:,jl) = evap_ice (:,:,jl) * xcplmask(:,:,0) + zevap_ice (:,:) * zmsk(:,:) 
     1461            devap_ice(:,:,jl) = devap_ice(:,:,jl) * xcplmask(:,:,0) + zdevap_ice(:,:) * zmsk(:,:) 
     1462         ENDDO 
     1463      ELSE 
     1464         emp_tot(:,:) =         zemp_tot(:,:) 
     1465         emp_ice(:,:) =         zemp_ice(:,:) 
     1466         emp_oce(:,:) =         zemp_oce(:,:)      
     1467         sprecip(:,:) =         zsprecip(:,:) 
     1468         tprecip(:,:) =         ztprecip(:,:) 
     1469         DO jl=1,jpl 
     1470            evap_ice (:,:,jl) = zevap_ice (:,:) 
     1471            devap_ice(:,:,jl) = zdevap_ice(:,:) 
     1472         ENDDO 
     1473      ENDIF 
     1474 
     1475      IF( iom_use('subl_ai_cea') )   CALL iom_put( 'subl_ai_cea', zevap_ice(:,:) * zicefr(:,:)         )  ! Sublimation over sea-ice (cell average) 
     1476                                     CALL iom_put( 'snowpre'    , sprecip(:,:)                         )  ! Snow 
     1477      IF( iom_use('snow_ao_cea') )   CALL iom_put( 'snow_ao_cea', sprecip(:,:) * ( 1._wp - zsnw(:,:) ) )  ! Snow over ice-free ocean  (cell average) 
     1478      IF( iom_use('snow_ai_cea') )   CALL iom_put( 'snow_ai_cea', sprecip(:,:) *           zsnw(:,:)   )  ! Snow over sea-ice         (cell average) 
     1479#else 
     1480      ! runoffs and calving (put in emp_tot) 
    14211481      IF( srcv(jpr_rnf)%laction )   rnf(:,:) = frcv(jpr_rnf)%z3(:,:,1) 
    14221482      IF( srcv(jpr_cal)%laction ) THEN  
     
    14371497      ENDIF 
    14381498 
    1439          CALL iom_put( 'snowpre'    , sprecip                                )   ! Snow 
    1440       IF( iom_use('snow_ao_cea') )   & 
    1441          CALL iom_put( 'snow_ao_cea', sprecip(:,:) * p_frld(:,:)             )   ! Snow        over ice-free ocean  (cell average) 
    1442       IF( iom_use('snow_ai_cea') )   & 
    1443          CALL iom_put( 'snow_ai_cea', sprecip(:,:) * zicefr(:,:)             )   ! Snow        over sea-ice         (cell average) 
     1499      IF( iom_use('subl_ai_cea') )  CALL iom_put( 'subl_ai_cea', frcv(jpr_ievp)%z3(:,:,1) * zicefr(:,:) )  ! Sublimation over sea-ice (cell average) 
     1500                                    CALL iom_put( 'snowpre'    , sprecip(:,:)               )   ! Snow 
     1501      IF( iom_use('snow_ao_cea') )  CALL iom_put( 'snow_ao_cea', sprecip(:,:) * p_frld(:,:) )   ! Snow over ice-free ocean  (cell average) 
     1502      IF( iom_use('snow_ai_cea') )  CALL iom_put( 'snow_ai_cea', sprecip(:,:) * zicefr(:,:) )   ! Snow over sea-ice         (cell average) 
     1503#endif 
    14441504 
    14451505      !                                                      ! ========================= ! 
    14461506      SELECT CASE( TRIM( sn_rcv_qns%cldes ) )                !   non solar heat fluxes   !   (qns) 
    14471507      !                                                      ! ========================= ! 
    1448       CASE( 'oce only' )                                     ! the required field is directly provided 
    1449          zqns_tot(:,:  ) = frcv(jpr_qnsoce)%z3(:,:,1) 
    1450       CASE( 'conservative' )                                      ! the required fields are directly provided 
    1451          zqns_tot(:,:  ) = frcv(jpr_qnsmix)%z3(:,:,1) 
     1508      CASE( 'oce only' )         ! the required field is directly provided 
     1509         zqns_tot(:,:) = frcv(jpr_qnsoce)%z3(:,:,1) 
     1510      CASE( 'conservative' )     ! the required fields are directly provided 
     1511         zqns_tot(:,:) = frcv(jpr_qnsmix)%z3(:,:,1) 
    14521512         IF ( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN 
    14531513            zqns_ice(:,:,1:jpl) = frcv(jpr_qnsice)%z3(:,:,1:jpl) 
    14541514         ELSE 
    1455             ! Set all category values equal for the moment 
    14561515            DO jl=1,jpl 
    1457                zqns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,1) 
     1516               zqns_ice(:,:,jl) = frcv(jpr_qnsice)%z3(:,:,1) ! Set all category values equal 
    14581517            ENDDO 
    14591518         ENDIF 
    1460       CASE( 'oce and ice' )       ! the total flux is computed from ocean and ice fluxes 
    1461          zqns_tot(:,:  ) =  p_frld(:,:) * frcv(jpr_qnsoce)%z3(:,:,1) 
     1519      CASE( 'oce and ice' )      ! the total flux is computed from ocean and ice fluxes 
     1520         zqns_tot(:,:) =  p_frld(:,:) * frcv(jpr_qnsoce)%z3(:,:,1) 
    14621521         IF ( TRIM(sn_rcv_qns%clcat) == 'yes' ) THEN 
    14631522            DO jl=1,jpl 
     
    14661525            ENDDO 
    14671526         ELSE 
    1468             qns_tot(:,:   ) = qns_tot(:,:) + zicefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1) 
     1527            qns_tot(:,:) = qns_tot(:,:) + zicefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1) 
    14691528            DO jl=1,jpl 
    14701529               zqns_tot(:,:   ) = zqns_tot(:,:) + zicefr(:,:) * frcv(jpr_qnsice)%z3(:,:,1) 
     
    14721531            ENDDO 
    14731532         ENDIF 
    1474       CASE( 'mixed oce-ice' )     ! the ice flux is cumputed from the total flux, the SST and ice informations 
     1533      CASE( 'mixed oce-ice' )    ! the ice flux is cumputed from the total flux, the SST and ice informations 
    14751534! ** NEED TO SORT OUT HOW THIS SHOULD WORK IN THE MULTI-CATEGORY CASE - CURRENTLY NOT ALLOWED WHEN INTERFACE INITIALISED ** 
    14761535         zqns_tot(:,:  ) = frcv(jpr_qnsmix)%z3(:,:,1) 
    14771536         zqns_ice(:,:,1) = frcv(jpr_qnsmix)%z3(:,:,1)    & 
    14781537            &            + frcv(jpr_dqnsdt)%z3(:,:,1) * ( pist(:,:,1) - ( (rt0 + psst(:,:  ) ) * p_frld(:,:)   & 
    1479             &                                                   +          pist(:,:,1)  * zicefr(:,:) ) ) 
     1538            &                                           + pist(:,:,1) * zicefr(:,:) ) ) 
    14801539      END SELECT 
    14811540!!gm 
     
    14871546!! similar job should be done for snow and precipitation temperature 
    14881547      !                                      
    1489       IF( srcv(jpr_cal)%laction ) THEN                            ! Iceberg melting  
    1490          ztmp(:,:) = frcv(jpr_cal)%z3(:,:,1) * lfus               ! add the latent heat of iceberg melting  
    1491          zqns_tot(:,:) = zqns_tot(:,:) - ztmp(:,:) 
    1492          IF( iom_use('hflx_cal_cea') )   & 
    1493             CALL iom_put( 'hflx_cal_cea', ztmp + frcv(jpr_cal)%z3(:,:,1) * zcptn(:,:) )   ! heat flux from calving 
    1494       ENDIF 
    1495  
    1496       ztmp(:,:) = p_frld(:,:) * zsprecip(:,:) * lfus 
    1497       IF( iom_use('hflx_snow_cea') )    CALL iom_put( 'hflx_snow_cea', ztmp + sprecip(:,:) * zcptn(:,:) )   ! heat flux from snow (cell average) 
    1498  
    1499 #if defined key_lim3 
    1500       CALL wrk_alloc( jpi,jpj, zevap, zsnw, zqns_oce, zqprec_ice, zqemp_oce )  
    1501  
    1502       ! --- evaporation --- ! 
    1503       ! clem: evap_ice is set to 0 for LIM3 since we still do not know what to do with sublimation 
    1504       ! the problem is: the atm. imposes both mass evaporation and heat removed from the snow/ice 
    1505       !                 but it is incoherent WITH the ice model   
    1506       DO jl=1,jpl 
    1507          evap_ice(:,:,jl) = 0._wp  ! should be: frcv(jpr_ievp)%z3(:,:,1) 
    1508       ENDDO 
    1509       zevap(:,:) = zemp_tot(:,:) + ztprecip(:,:) ! evaporation over ocean 
    1510  
    1511       ! --- evaporation minus precipitation --- ! 
    1512       emp_oce(:,:) = emp_tot(:,:) - emp_ice(:,:) 
    1513  
     1548      IF( srcv(jpr_cal)%laction ) THEN   ! Iceberg melting  
     1549         zqns_tot(:,:) = zqns_tot(:,:) - frcv(jpr_cal)%z3(:,:,1) * lfus  ! add the latent heat of iceberg melting 
     1550                                                                         ! we suppose it melts at 0deg, though it should be temp. of surrounding ocean 
     1551         IF( iom_use('hflx_cal_cea') )   CALL iom_put( 'hflx_cal_cea', - frcv(jpr_cal)%z3(:,:,1) * lfus )   ! heat flux from calving 
     1552      ENDIF 
     1553 
     1554#if defined key_lim3       
    15141555      ! --- non solar flux over ocean --- ! 
    15151556      !         note: p_frld cannot be = 0 since we limit the ice concentration to amax 
     
    15171558      WHERE( p_frld /= 0._wp )  zqns_oce(:,:) = ( zqns_tot(:,:) - SUM( a_i * zqns_ice, dim=3 ) ) / p_frld(:,:) 
    15181559 
    1519       ! --- heat flux associated with emp --- ! 
    1520       zsnw(:,:) = 0._wp 
    1521       CALL lim_thd_snwblow( p_frld, zsnw )  ! snow distribution over ice after wind blowing 
    1522       zqemp_oce(:,:) = -      zevap(:,:)                   * p_frld(:,:)      *   zcptn(:,:)   &      ! evap 
    1523          &             + ( ztprecip(:,:) - zsprecip(:,:) )                    *   zcptn(:,:)   &      ! liquid precip 
    1524          &             +   zsprecip(:,:)                   * ( 1._wp - zsnw ) * ( zcptn(:,:) - lfus ) ! solid precip over ocean 
    1525       qemp_ice(:,:)  = -   frcv(jpr_ievp)%z3(:,:,1)        * zicefr(:,:)      *   zcptn(:,:)   &      ! ice evap 
    1526          &             +   zsprecip(:,:)                   * zsnw             * ( zcptn(:,:) - lfus ) ! solid precip over ice 
    1527  
    1528       ! --- heat content of precip over ice in J/m3 (to be used in 1D-thermo) --- ! 
     1560      ! --- heat flux associated with emp (W/m2) --- ! 
     1561      zqemp_oce(:,:) = -  zevap_oce(:,:)                                      *   zcptn(:,:)   &       ! evap 
     1562         &             + ( ztprecip(:,:) - zsprecip(:,:) )                    *   zcptn(:,:)   &       ! liquid precip 
     1563         &             +   zsprecip(:,:)                   * ( 1._wp - zsnw ) * ( zcptn(:,:) - lfus )  ! solid precip over ocean + snow melting 
     1564!      zqemp_ice(:,:) = -   frcv(jpr_ievp)%z3(:,:,1)        * zicefr(:,:)      *   zcptn(:,:)   &      ! ice evap 
     1565!         &             +   zsprecip(:,:)                   * zsnw             * ( zcptn(:,:) - lfus ) ! solid precip over ice 
     1566      zqemp_ice(:,:) =      zsprecip(:,:)                   * zsnw             * ( zcptn(:,:) - lfus ) ! solid precip over ice (only) 
     1567                                                                                                       ! qevap_ice=0 since we consider Tice=0degC 
     1568       
     1569      ! --- enthalpy of snow precip over ice in J/m3 (to be used in 1D-thermo) --- ! 
    15291570      zqprec_ice(:,:) = rhosn * ( zcptn(:,:) - lfus ) 
    15301571 
    1531       ! --- total non solar flux --- ! 
    1532       zqns_tot(:,:) = zqns_tot(:,:) + qemp_ice(:,:) + zqemp_oce(:,:) 
     1572      ! --- heat content of evap over ice in W/m2 (to be used in 1D-thermo) --- ! 
     1573      DO jl = 1, jpl 
     1574         zqevap_ice(:,:,jl) = 0._wp ! should be -evap * ( ( Tice - rt0 ) * cpic ) but we do not have Tice, so we consider Tice=0degC 
     1575      END DO 
     1576 
     1577      ! --- total non solar flux (including evap/precip) --- ! 
     1578      zqns_tot(:,:) = zqns_tot(:,:) + zqemp_ice(:,:) + zqemp_oce(:,:) 
    15331579 
    15341580      ! --- in case both coupled/forced are active, we must mix values --- !  
     
    15371583         qns_oce(:,:) = qns_oce(:,:) * xcplmask(:,:,0) + zqns_oce(:,:)* zmsk(:,:) 
    15381584         DO jl=1,jpl 
    1539             qns_ice(:,:,jl) = qns_ice(:,:,jl) * xcplmask(:,:,0) +  zqns_ice(:,:,jl)* zmsk(:,:) 
     1585            qns_ice  (:,:,jl) = qns_ice  (:,:,jl) * xcplmask(:,:,0) +  zqns_ice  (:,:,jl)* zmsk(:,:) 
     1586            qevap_ice(:,:,jl) = qevap_ice(:,:,jl) * xcplmask(:,:,0) +  zqevap_ice(:,:,jl)* zmsk(:,:) 
    15401587         ENDDO 
    15411588         qprec_ice(:,:) = qprec_ice(:,:) * xcplmask(:,:,0) + zqprec_ice(:,:)* zmsk(:,:) 
    15421589         qemp_oce (:,:) =  qemp_oce(:,:) * xcplmask(:,:,0) +  zqemp_oce(:,:)* zmsk(:,:) 
    1543 !!clem         evap_ice(:,:) = evap_ice(:,:) * xcplmask(:,:,0) 
     1590         qemp_ice (:,:) =  qemp_ice(:,:) * xcplmask(:,:,0) +  zqemp_ice(:,:)* zmsk(:,:) 
    15441591      ELSE 
    15451592         qns_tot  (:,:  ) = zqns_tot  (:,:  ) 
    15461593         qns_oce  (:,:  ) = zqns_oce  (:,:  ) 
    15471594         qns_ice  (:,:,:) = zqns_ice  (:,:,:) 
    1548          qprec_ice(:,:)   = zqprec_ice(:,:) 
    1549          qemp_oce (:,:)   = zqemp_oce (:,:) 
    1550       ENDIF 
    1551  
    1552       CALL wrk_dealloc( jpi,jpj, zevap, zsnw, zqns_oce, zqprec_ice, zqemp_oce )  
     1595         qevap_ice(:,:,:) = zqevap_ice(:,:,:) 
     1596         qprec_ice(:,:  ) = zqprec_ice(:,:  ) 
     1597         qemp_oce (:,:  ) = zqemp_oce (:,:  ) 
     1598         qemp_ice (:,:  ) = zqemp_ice (:,:  ) 
     1599      ENDIF 
     1600 
     1601      !! clem: we should output qemp_oce and qemp_ice (at least) 
     1602      IF( iom_use('hflx_snow_cea') )   CALL iom_put( 'hflx_snow_cea', sprecip(:,:) * ( zcptn(:,:) - Lfus ) )   ! heat flux from snow (cell average) 
     1603      !! these diags are not outputed yet 
     1604!!      IF( iom_use('hflx_rain_cea') )   CALL iom_put( 'hflx_rain_cea', ( tprecip(:,:) - sprecip(:,:) ) * zcptn(:,:) )   ! heat flux from rain (cell average) 
     1605!!      IF( iom_use('hflx_snow_ao_cea') ) CALL iom_put( 'hflx_snow_ao_cea', sprecip(:,:) * ( zcptn(:,:) - Lfus ) * (1._wp - zsnw(:,:)) ) ! heat flux from snow (cell average) 
     1606!!      IF( iom_use('hflx_snow_ai_cea') ) CALL iom_put( 'hflx_snow_ai_cea', sprecip(:,:) * ( zcptn(:,:) - Lfus ) * zsnw(:,:) ) ! heat flux from snow (cell average) 
     1607 
    15531608#else 
    1554       ! 
    1555       ! clem: this formulation is certainly wrong... but better than it was before... 
     1609      ! clem: this formulation is certainly wrong... but better than it was... 
    15561610      zqns_tot(:,:) = zqns_tot(:,:)                       &            ! zqns_tot update over free ocean with: 
    15571611         &          - ztmp(:,:)                           &            ! remove the latent heat flux of solid precip. melting 
    15581612         &          - (  zemp_tot(:,:)                    &            ! remove the heat content of mass flux (assumed to be at SST) 
    1559          &             - zemp_ice(:,:) * zicefr(:,:)  ) * zcptn(:,:)  
     1613         &             - zemp_ice(:,:) ) * zcptn(:,:)  
    15601614 
    15611615     IF( ln_mixcpl ) THEN 
     
    15691623         qns_ice(:,:,:) = zqns_ice(:,:,:) 
    15701624      ENDIF 
    1571       ! 
    15721625#endif 
     1626 
    15731627      !                                                      ! ========================= ! 
    15741628      SELECT CASE( TRIM( sn_rcv_qsr%cldes ) )                !      solar heat fluxes    !   (qsr) 
     
    16191673 
    16201674#if defined key_lim3 
    1621       CALL wrk_alloc( jpi,jpj, zqsr_oce )  
    16221675      ! --- solar flux over ocean --- ! 
    16231676      !         note: p_frld cannot be = 0 since we limit the ice concentration to amax 
     
    16271680      IF( ln_mixcpl ) THEN   ;   qsr_oce(:,:) = qsr_oce(:,:) * xcplmask(:,:,0) +  zqsr_oce(:,:)* zmsk(:,:) 
    16281681      ELSE                   ;   qsr_oce(:,:) = zqsr_oce(:,:)   ;   ENDIF 
    1629  
    1630       CALL wrk_dealloc( jpi,jpj, zqsr_oce )  
    16311682#endif 
    16321683 
     
    16791730      fr2_i0(:,:) = ( 0.82 * ( 1.0 - cldf_ice ) + 0.65 * cldf_ice ) 
    16801731 
    1681       CALL wrk_dealloc( jpi,jpj,       zcptn, ztmp, zicefr, zmsk, zemp_tot, zemp_ice, zsprecip, ztprecip, zqns_tot, zqsr_tot ) 
    1682       CALL wrk_dealloc( jpi,jpj,jpl,   zqns_ice, zqsr_ice, zdqns_ice ) 
     1732      CALL wrk_dealloc( jpi,jpj,     zcptn, ztmp, zicefr, zmsk, zsnw ) 
     1733      CALL wrk_dealloc( jpi,jpj,     zemp_tot, zemp_ice, zemp_oce, ztprecip, zsprecip, zevap_oce, zevap_ice, zdevap_ice ) 
     1734      CALL wrk_dealloc( jpi,jpj,     zqns_tot, zqns_oce, zqsr_tot, zqsr_oce, zqprec_ice, zqemp_oce, zqemp_ice ) 
     1735      CALL wrk_dealloc( jpi,jpj,jpl, zqns_ice, zqsr_ice, zdqns_ice, zqevap_ice ) 
    16831736      ! 
    16841737      IF( nn_timing == 1 )   CALL timing_stop('sbc_cpl_ice_flx') 
     
    17191772          
    17201773         IF ( nn_components == jp_iam_opa ) THEN 
    1721             ztmp1(:,:) = tsn(:,:,1,jp_tem)   ! send temperature as it is (potential or conservative) -> use of ln_useCT on the received part 
     1774            ztmp1(:,:) = tsn(:,:,1,jp_tem)   ! send temperature as it is (potential or conservative) -> use of l_useCT on the received part 
    17221775         ELSE 
    17231776            ! we must send the surface potential temperature  
    1724             IF( ln_useCT )  THEN    ;   ztmp1(:,:) = eos_pt_from_ct( tsn(:,:,1,jp_tem), tsn(:,:,1,jp_sal) ) 
     1777            IF( l_useCT )  THEN    ;   ztmp1(:,:) = eos_pt_from_ct( tsn(:,:,1,jp_tem), tsn(:,:,1,jp_sal) ) 
    17251778            ELSE                    ;   ztmp1(:,:) = tsn(:,:,1,jp_tem) 
    17261779            ENDIF 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90

    r6140 r7341  
    104104      INTEGER, INTENT(in) ::   kblk    ! type of bulk (=3 CLIO, =4 CORE, =5 COUPLED) 
    105105      !! 
    106       INTEGER  ::   jl                 ! dummy loop index 
     106      INTEGER  ::    jl                 ! dummy loop index 
    107107      REAL(wp), POINTER, DIMENSION(:,:,:)   ::   zalb_os, zalb_cs  ! ice albedo under overcast/clear sky 
    108       REAL(wp), POINTER, DIMENSION(:,:,:)   ::   zalb_ice          ! mean ice albedo (for coupled) 
    109108      REAL(wp), POINTER, DIMENSION(:,:  )   ::   zutau_ice, zvtau_ice  
    110109      !!---------------------------------------------------------------------- 
     
    193192         ! fr1_i0  , fr2_i0   : 1sr & 2nd fraction of qsr penetration in ice             [%] 
    194193         !---------------------------------------------------------------------------------------- 
    195          CALL wrk_alloc( jpi,jpj,jpl, zalb_os, zalb_cs, zalb_ice ) 
     194         CALL wrk_alloc( jpi,jpj,jpl, zalb_os, zalb_cs ) 
    196195         CALL albedo_ice( t_su, ht_i, ht_s, zalb_cs, zalb_os ) ! cloud-sky and overcast-sky ice albedos 
    197196 
     
    199198         CASE( jp_clio )                                       ! CLIO bulk formulation 
    200199            ! In CLIO the cloud fraction is read in the climatology and the all-sky albedo  
    201             ! (zalb_ice) is computed within the bulk routine 
    202             CALL blk_ice_clio_flx( t_su, zalb_cs, zalb_os, zalb_ice ) 
    203             IF( ln_mixcpl      ) CALL sbc_cpl_ice_flx( p_frld=pfrld, palbi=zalb_ice, psst=sst_m, pist=t_su ) 
    204             IF( nn_limflx /= 2 ) CALL ice_lim_flx( t_su, zalb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_limflx ) 
     200            ! (alb_ice) is computed within the bulk routine 
     201                                 CALL blk_ice_clio_flx( t_su, zalb_cs, zalb_os, alb_ice ) 
     202            IF( ln_mixcpl      ) CALL sbc_cpl_ice_flx( p_frld=pfrld, palbi=alb_ice, psst=sst_m, pist=t_su ) 
     203            IF( nn_limflx /= 2 ) CALL ice_lim_flx( t_su, alb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_limflx ) 
    205204         CASE( jp_core )                                       ! CORE bulk formulation 
    206205            ! albedo depends on cloud fraction because of non-linear spectral effects 
    207             zalb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:) 
    208             CALL blk_ice_core_flx( t_su, zalb_ice ) 
    209             IF( ln_mixcpl      ) CALL sbc_cpl_ice_flx( p_frld=pfrld, palbi=zalb_ice, psst=sst_m, pist=t_su ) 
    210             IF( nn_limflx /= 2 ) CALL ice_lim_flx( t_su, zalb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_limflx ) 
     206            alb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:) 
     207                                 CALL blk_ice_core_flx( t_su, alb_ice ) 
     208            IF( ln_mixcpl      ) CALL sbc_cpl_ice_flx( p_frld=pfrld, palbi=alb_ice, psst=sst_m, pist=t_su ) 
     209            IF( nn_limflx /= 2 ) CALL ice_lim_flx( t_su, alb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_limflx ) 
    211210         CASE ( jp_purecpl ) 
    212211            ! albedo depends on cloud fraction because of non-linear spectral effects 
    213             zalb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:) 
    214                                  CALL sbc_cpl_ice_flx( p_frld=pfrld, palbi=zalb_ice, psst=sst_m, pist=t_su ) 
    215             ! clem: evap_ice is forced to 0 in coupled mode for now  
    216             !       but it needs to be changed (along with modif in limthd_dh) once heat flux from evap will be avail. from atm. models 
    217             evap_ice  (:,:,:) = 0._wp   ;   devap_ice (:,:,:) = 0._wp 
    218             IF( nn_limflx == 2 ) CALL ice_lim_flx( t_su, zalb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_limflx ) 
     212            alb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:) 
     213                                 CALL sbc_cpl_ice_flx( p_frld=pfrld, palbi=alb_ice, psst=sst_m, pist=t_su ) 
     214            IF( nn_limflx == 2 ) CALL ice_lim_flx( t_su, alb_ice, qns_ice, qsr_ice, dqns_ice, evap_ice, devap_ice, nn_limflx ) 
    219215         END SELECT 
    220          CALL wrk_dealloc( jpi,jpj,jpl, zalb_os, zalb_cs, zalb_ice ) 
     216         CALL wrk_dealloc( jpi,jpj,jpl, zalb_os, zalb_cs ) 
    221217 
    222218         !----------------------------! 
     
    260256      !! ** purpose :   Allocate all the dynamic arrays of the LIM-3 modules 
    261257      !!---------------------------------------------------------------------- 
    262       INTEGER :: ierr 
     258      INTEGER :: ji, jj, ierr 
    263259      !!---------------------------------------------------------------------- 
    264260      IF(lwp) WRITE(numout,*) 
     
    317313      tn_ice(:,:,:) = t_su(:,:,:)       ! initialisation of surface temp for coupled simu 
    318314      ! 
     315      DO jj = 1, jpj 
     316         DO ji = 1, jpi 
     317            IF( gphit(ji,jj) > 0._wp ) THEN  ;  rn_amax_2d(ji,jj) = rn_amax_n  ! NH 
     318            ELSE                             ;  rn_amax_2d(ji,jj) = rn_amax_s  ! SH 
     319            ENDIF 
     320        ENDDO 
     321      ENDDO  
     322      ! 
    319323      nstart = numit  + nn_fsbc       
    320324      nitrun = nitend - nit000 + 1  
     
    339343      INTEGER  ::   ios                 ! Local integer output status for namelist read 
    340344      NAMELIST/namicerun/ jpl, nlay_i, nlay_s, cn_icerst_in, cn_icerst_indir, cn_icerst_out, cn_icerst_outdir,  & 
    341          &                ln_limdyn, rn_amax, ln_limdiahsb, ln_limdiaout, ln_icectl, iiceprt, jiceprt   
     345         &                ln_limdyn, rn_amax_n, rn_amax_s, ln_limdiahsb, ln_limdiaout, ln_icectl, iiceprt, jiceprt   
    342346      !!------------------------------------------------------------------- 
    343347      !                     
     
    359363         WRITE(numout,*) '   number of snow layers                                   = ', nlay_s 
    360364         WRITE(numout,*) '   switch for ice dynamics (1) or not (0)      ln_limdyn   = ', ln_limdyn 
    361          WRITE(numout,*) '   maximum ice concentration                               = ', rn_amax  
     365         WRITE(numout,*) '   maximum ice concentration for NH                        = ', rn_amax_n  
     366         WRITE(numout,*) '   maximum ice concentration for SH                        = ', rn_amax_s 
    362367         WRITE(numout,*) '   Diagnose heat/salt budget or not          ln_limdiahsb  = ', ln_limdiahsb 
    363368         WRITE(numout,*) '   Output   heat/salt budget or not          ln_limdiaout  = ', ln_limdiaout 
     
    568573      sfx_bog(:,:) = 0._wp   ;   sfx_dyn(:,:) = 0._wp 
    569574      sfx_bom(:,:) = 0._wp   ;   sfx_sum(:,:) = 0._wp 
    570       sfx_res(:,:) = 0._wp 
     575      sfx_res(:,:) = 0._wp   ;   sfx_sub(:,:) = 0._wp 
    571576      ! 
    572577      wfx_snw(:,:) = 0._wp   ;   wfx_ice(:,:) = 0._wp 
     
    584589      hfx_spr(:,:) = 0._wp   ;   hfx_dif(:,:) = 0._wp  
    585590      hfx_err(:,:) = 0._wp   ;   hfx_err_rem(:,:) = 0._wp 
    586       hfx_err_dif(:,:) = 0._wp   ; 
     591      hfx_err_dif(:,:) = 0._wp 
     592      wfx_err_sub(:,:) = 0._wp 
    587593      ! 
    588594      afx_tot(:,:) = 0._wp   ; 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90

    r6351 r7341  
    323323         emp_b (:,:) = emp (:,:) 
    324324         sfx_b (:,:) = sfx (:,:) 
     325         IF ( ln_rnf ) THEN 
     326            rnf_b    (:,:  ) = rnf    (:,:  ) 
     327            rnf_tsc_b(:,:,:) = rnf_tsc(:,:,:) 
     328         ENDIF 
    325329      ENDIF 
    326330      !                                            ! ---------------------------------------- ! 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90

    r6140 r7341  
    109109      ! 
    110110      CALL wrk_alloc( jpi,jpj, ztfrz) 
    111  
    112       !                                            ! ---------------------------------------- ! 
    113       IF( kt /= nit000 ) THEN                      !          Swap of forcing fields          ! 
    114          !                                         ! ---------------------------------------- ! 
    115          rnf_b    (:,:  ) = rnf    (:,:  )               ! Swap the ocean forcing fields except at nit000 
    116          rnf_tsc_b(:,:,:) = rnf_tsc(:,:,:)               ! where before fields are set at the end of the routine 
    117          ! 
    118       ENDIF 
    119  
     111      ! 
    120112      !                                            !-------------------! 
    121113      !                                            !   Update runoff   ! 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssm.F90

    r6140 r7341  
    7070         ssu_m(:,:) = ub(:,:,1) 
    7171         ssv_m(:,:) = vb(:,:,1) 
    72          IF( ln_useCT )  THEN    ;   sst_m(:,:) = eos_pt_from_ct( zts(:,:,jp_tem), zts(:,:,jp_sal) ) 
     72         IF( l_useCT )  THEN    ;   sst_m(:,:) = eos_pt_from_ct( zts(:,:,jp_tem), zts(:,:,jp_sal) ) 
    7373         ELSE                    ;   sst_m(:,:) = zts(:,:,jp_tem) 
    7474         ENDIF 
     
    9292            ssu_m(:,:) = zcoef * ub(:,:,1) 
    9393            ssv_m(:,:) = zcoef * vb(:,:,1) 
    94             IF( ln_useCT )  THEN    ;   sst_m(:,:) = zcoef * eos_pt_from_ct( zts(:,:,jp_tem), zts(:,:,jp_sal) ) 
     94            IF( l_useCT )  THEN    ;   sst_m(:,:) = zcoef * eos_pt_from_ct( zts(:,:,jp_tem), zts(:,:,jp_sal) ) 
    9595            ELSE                    ;   sst_m(:,:) = zcoef * zts(:,:,jp_tem) 
    9696            ENDIF 
     
    120120         ssu_m(:,:) = ssu_m(:,:) + ub(:,:,1) 
    121121         ssv_m(:,:) = ssv_m(:,:) + vb(:,:,1) 
    122          IF( ln_useCT )  THEN    ;   sst_m(:,:) = sst_m(:,:) + eos_pt_from_ct( zts(:,:,jp_tem), zts(:,:,jp_sal) ) 
     122         IF( l_useCT )  THEN    ;   sst_m(:,:) = sst_m(:,:) + eos_pt_from_ct( zts(:,:,jp_tem), zts(:,:,jp_sal) ) 
    123123         ELSE                    ;   sst_m(:,:) = sst_m(:,:) + zts(:,:,jp_tem) 
    124124         ENDIF 
     
    241241         ssu_m(:,:) = ub(:,:,1) 
    242242         ssv_m(:,:) = vb(:,:,1) 
    243          IF( ln_useCT )  THEN    ;   sst_m(:,:) = eos_pt_from_ct( tsn(:,:,1,jp_tem), tsn(:,:,1,jp_sal) ) 
     243         IF( l_useCT )  THEN    ;   sst_m(:,:) = eos_pt_from_ct( tsn(:,:,1,jp_tem), tsn(:,:,1,jp_sal) ) 
    244244         ELSE                    ;   sst_m(:,:) = tsn(:,:,1,jp_tem) 
    245245         ENDIF 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/TRA/eosbn2.F90

    r6140 r7341  
    7575 
    7676   !                               !!** Namelist nameos ** 
    77    INTEGER , PUBLIC ::   nn_eos     ! = 0/1/2 type of eq. of state and Brunt-Vaisala frequ. 
    78    LOGICAL , PUBLIC ::   ln_useCT   ! determine if eos_pt_from_ct is used to compute sst_m 
     77   LOGICAL , PUBLIC ::   ln_TEOS10   ! determine if eos_pt_from_ct is used to compute sst_m 
     78   LOGICAL , PUBLIC ::   ln_EOS80   ! determine if eos_pt_from_ct is used to compute sst_m 
     79   LOGICAL , PUBLIC ::   ln_SEOS   ! determine if eos_pt_from_ct is used to compute sst_m 
     80 
     81   ! Parameters 
     82   LOGICAL , PUBLIC    ::   l_useCT         ! =T in ln_TEOS10=T (i.e. use eos_pt_from_ct to compute sst_m), =F otherwise 
     83   INTEGER , PUBLIC    ::   neos            ! Identifier for equation of state used 
     84 
     85   INTEGER , PARAMETER ::   np_teos10 = -1  ! parameter for using TEOS10 
     86   INTEGER , PARAMETER ::   np_eos80  =  0  ! parameter for using EOS80 
     87   INTEGER , PARAMETER ::   np_seos   = 1   ! parameter for using Simplified Equation of state 
    7988 
    8089   !                               !!!  simplified eos coefficients (default value: Vallis 2006) 
     
    184193      !! ** Purpose :   Compute the in situ density (ratio rho/rau0) from 
    185194      !!       potential temperature and salinity using an equation of state 
    186       !!       defined through the namelist parameter nn_eos. 
     195      !!       selected in the nameos namelist 
    187196      !! 
    188197      !! ** Method  :   prd(t,s,z) = ( rho(t,s,z) - rau0 ) / rau0 
     
    194203      !!                rau0   reference density            kg/m^3 
    195204      !! 
    196       !!     nn_eos = -1 : polynomial TEOS-10 equation of state is used for rho(t,s,z). 
     205      !!     ln_teos10 : polynomial TEOS-10 equation of state is used for rho(t,s,z). 
    197206      !!         Check value: rho = 1028.21993233072 kg/m^3 for z=3000 dbar, ct=3 Celcius, sa=35.5 g/kg 
    198207      !! 
    199       !!     nn_eos =  0 : polynomial EOS-80 equation of state is used for rho(t,s,z). 
     208      !!     ln_eos80 : polynomial EOS-80 equation of state is used for rho(t,s,z). 
    200209      !!         Check value: rho = 1028.35011066567 kg/m^3 for z=3000 dbar, pt=3 Celcius, sp=35.5 psu 
    201210      !! 
    202       !!     nn_eos =  1 : simplified equation of state 
     211      !!     ln_seos : simplified equation of state 
    203212      !!              prd(t,s,z) = ( -a0*(1+lambda/2*(T-T0)+mu*z+nu*(S-S0))*(T-T0) + b0*(S-S0) ) / rau0 
    204213      !!              linear case function of T only: rn_alpha<>0, other coefficients = 0 
     
    224233      IF( nn_timing == 1 )   CALL timing_start('eos-insitu') 
    225234      ! 
    226       SELECT CASE( nn_eos ) 
    227       ! 
    228       CASE( -1, 0 )                !==  polynomial TEOS-10 / EOS-80 ==! 
     235      SELECT CASE( neos ) 
     236      ! 
     237      CASE( np_teos10, np_eos80 )                !==  polynomial TEOS-10 / EOS-80 ==! 
    229238         ! 
    230239         DO jk = 1, jpkm1 
     
    266275         END DO 
    267276         ! 
    268       CASE( 1 )                !==  simplified EOS  ==! 
     277      CASE( np_seos )                !==  simplified EOS  ==! 
    269278         ! 
    270279         DO jk = 1, jpkm1 
     
    300309      !! ** Purpose :   Compute the in situ density (ratio rho/rau0) and the 
    301310      !!      potential volumic mass (Kg/m3) from potential temperature and 
    302       !!      salinity fields using an equation of state defined through the 
    303       !!     namelist parameter nn_eos. 
     311      !!      salinity fields using an equation of state selected in the 
     312      !!     namelist. 
    304313      !! 
    305314      !! ** Action  : - prd  , the in situ density (no units) 
     
    322331      IF( nn_timing == 1 )   CALL timing_start('eos-pot') 
    323332      ! 
    324       SELECT CASE ( nn_eos ) 
    325       ! 
    326       CASE( -1, 0 )                !==  polynomial TEOS-10 / EOS-80 ==! 
     333      SELECT CASE ( neos ) 
     334      ! 
     335      CASE( np_teos10, np_eos80 )                !==  polynomial TEOS-10 / EOS-80 ==! 
    327336         ! 
    328337         ! Stochastic equation of state 
     
    430439         ENDIF 
    431440          
    432       CASE( 1 )                !==  simplified EOS  ==! 
     441      CASE( np_seos )                !==  simplified EOS  ==! 
    433442         ! 
    434443         DO jk = 1, jpkm1 
     
    467476      !! ** Purpose :   Compute the in situ density (ratio rho/rau0) from 
    468477      !!      potential temperature and salinity using an equation of state 
    469       !!      defined through the namelist parameter nn_eos. * 2D field case 
     478      !!      selected in the nameos namelist. * 2D field case 
    470479      !! 
    471480      !! ** Action  : - prd , the in situ density (no units) (unmasked) 
     
    486495      prd(:,:) = 0._wp 
    487496      ! 
    488       SELECT CASE( nn_eos ) 
    489       ! 
    490       CASE( -1, 0 )                !==  polynomial TEOS-10 / EOS-80 ==! 
     497      SELECT CASE( neos ) 
     498      ! 
     499      CASE( np_teos10, np_eos80 )                !==  polynomial TEOS-10 / EOS-80 ==! 
    491500         ! 
    492501         DO jj = 1, jpjm1 
     
    527536         CALL lbc_lnk( prd, 'T', 1. )                    ! Lateral boundary conditions 
    528537         ! 
    529       CASE( 1 )                !==  simplified EOS  ==! 
     538      CASE( np_seos )                !==  simplified EOS  ==! 
    530539         ! 
    531540         DO jj = 1, jpjm1 
     
    576585      IF( nn_timing == 1 )   CALL timing_start('rab_3d') 
    577586      ! 
    578       SELECT CASE ( nn_eos ) 
    579       ! 
    580       CASE( -1, 0 )                !==  polynomial TEOS-10 / EOS-80 ==! 
     587      SELECT CASE ( neos ) 
     588      ! 
     589      CASE( np_teos10, np_eos80 )                !==  polynomial TEOS-10 / EOS-80 ==! 
    581590         ! 
    582591         DO jk = 1, jpkm1 
     
    635644         END DO 
    636645         ! 
    637       CASE( 1 )                  !==  simplified EOS  ==! 
     646      CASE( np_seos )                  !==  simplified EOS  ==! 
    638647         ! 
    639648         DO jk = 1, jpkm1 
     
    657666      CASE DEFAULT 
    658667         IF(lwp) WRITE(numout,cform_err) 
    659          IF(lwp) WRITE(numout,*) '          bad flag value for nn_eos = ', nn_eos 
     668         IF(lwp) WRITE(numout,*) '          bad flag value for neos = ', neos 
    660669         nstop = nstop + 1 
    661670         ! 
     
    668677      ! 
    669678   END SUBROUTINE rab_3d 
     679 
    670680 
    671681   SUBROUTINE rab_2d( pts, pdep, pab ) 
     
    690700      pab(:,:,:) = 0._wp 
    691701      ! 
    692       SELECT CASE ( nn_eos ) 
    693       ! 
    694       CASE( -1, 0 )                !==  polynomial TEOS-10 / EOS-80 ==! 
     702      SELECT CASE ( neos ) 
     703      ! 
     704      CASE( np_teos10, np_eos80 )                !==  polynomial TEOS-10 / EOS-80 ==! 
    695705         ! 
    696706         DO jj = 1, jpjm1 
     
    750760         CALL lbc_lnk( pab(:,:,jp_sal), 'T', 1. )                     
    751761         ! 
    752       CASE( 1 )                  !==  simplified EOS  ==! 
     762      CASE( np_seos )                  !==  simplified EOS  ==! 
    753763         ! 
    754764         DO jj = 1, jpjm1 
     
    773783      CASE DEFAULT 
    774784         IF(lwp) WRITE(numout,cform_err) 
    775          IF(lwp) WRITE(numout,*) '          bad flag value for nn_eos = ', nn_eos 
     785         IF(lwp) WRITE(numout,*) '          bad flag value for neos = ', neos 
    776786         nstop = nstop + 1 
    777787         ! 
     
    806816      pab(:) = 0._wp 
    807817      ! 
    808       SELECT CASE ( nn_eos ) 
    809       ! 
    810       CASE( -1, 0 )                !==  polynomial TEOS-10 / EOS-80 ==! 
     818      SELECT CASE ( neos ) 
     819      ! 
     820      CASE( np_teos10, np_eos80 )      !==  polynomial TEOS-10 / EOS-80 ==! 
    811821         ! 
    812822         ! 
     
    859869         ! 
    860870         ! 
    861       CASE( 1 )                  !==  simplified EOS  ==! 
     871      CASE( np_seos )                  !==  simplified EOS  ==! 
    862872         ! 
    863873         zt    = pts(jp_tem) - 10._wp   ! pot. temperature anomaly (t-T0) 
    864874         zs    = pts(jp_sal) - 35._wp   ! abs. salinity anomaly (s-S0) 
    865          zh    = pdep                    ! depth at the partial step level 
     875         zh    = pdep                   ! depth at the partial step level 
    866876         ! 
    867877         zn  = rn_a0 * ( 1._wp + rn_lambda1*zt + rn_mu1*zh ) + rn_nu*zs 
     
    873883      CASE DEFAULT 
    874884         IF(lwp) WRITE(numout,cform_err) 
    875          IF(lwp) WRITE(numout,*) '          bad flag value for nn_eos = ', nn_eos 
     885         IF(lwp) WRITE(numout,*) '          bad flag value for neos = ', neos 
    876886         nstop = nstop + 1 
    877887         ! 
     
    10051015      REAL(wp), DIMENSION(jpi,jpj), INTENT(out  )           ::   ptf    ! freezing temperature [Celcius] 
    10061016      ! 
    1007       INTEGER  ::   ji, jj   ! dummy loop indices 
    1008       REAL(wp) ::   zt, zs   ! local scalars 
    1009       !!---------------------------------------------------------------------- 
    1010       ! 
    1011       SELECT CASE ( nn_eos ) 
    1012       ! 
    1013       CASE ( -1, 1 )                !==  CT,SA (TEOS-10 formulation) ==! 
    1014          ! 
     1017      INTEGER  ::   ji, jj          ! dummy loop indices 
     1018      REAL(wp) ::   zt, zs, z1_S0   ! local scalars 
     1019      !!---------------------------------------------------------------------- 
     1020      ! 
     1021      SELECT CASE ( neos ) 
     1022      ! 
     1023      CASE ( np_teos10, np_seos )      !==  CT,SA (TEOS-10 and S-EOS formulations) ==! 
     1024         ! 
     1025         z1_S0 = 1._wp / 35.16504_wp 
    10151026         DO jj = 1, jpj 
    10161027            DO ji = 1, jpi 
    1017                zs= SQRT( ABS( psal(ji,jj) ) * r1_S0 )           ! square root salinity 
     1028               zs= SQRT( ABS( psal(ji,jj) ) * z1_S0 )           ! square root salinity 
    10181029               ptf(ji,jj) = ((((1.46873e-03_wp*zs-9.64972e-03_wp)*zs+2.28348e-02_wp)*zs & 
    10191030                  &          - 3.12775e-02_wp)*zs+2.07679e-02_wp)*zs-5.87701e-02_wp 
     
    10241035         IF( PRESENT( pdep ) )   ptf(:,:) = ptf(:,:) - 7.53e-4 * pdep(:,:) 
    10251036         ! 
    1026       CASE ( 0 )                     !==  PT,SP (UNESCO formulation)  ==! 
     1037      CASE ( np_eos80 )                !==  PT,SP (UNESCO formulation)  ==! 
    10271038         ! 
    10281039         ptf(:,:) = ( - 0.0575_wp + 1.710523e-3_wp * SQRT( psal(:,:) )   & 
     
    10331044      CASE DEFAULT 
    10341045         IF(lwp) WRITE(numout,cform_err) 
    1035          IF(lwp) WRITE(numout,*) '          bad flag value for nn_eos = ', nn_eos 
     1046         IF(lwp) WRITE(numout,*) '          bad flag value for neos = ', neos 
    10361047         nstop = nstop + 1 
    10371048         ! 
     
    10391050      ! 
    10401051  END SUBROUTINE eos_fzp_2d 
     1052 
    10411053 
    10421054  SUBROUTINE eos_fzp_0d( psal, ptf, pdep ) 
     
    10591071      !!---------------------------------------------------------------------- 
    10601072      ! 
    1061       SELECT CASE ( nn_eos ) 
    1062       ! 
    1063       CASE ( -1, 1 )                !==  CT,SA (TEOS-10 formulation) ==! 
    1064          ! 
    1065          zs  = SQRT( ABS( psal ) * r1_S0 )           ! square root salinity 
     1073      SELECT CASE ( neos ) 
     1074      ! 
     1075      CASE ( np_teos10, np_seos )      !==  CT,SA (TEOS-10 and S-EOS formulations) ==! 
     1076         ! 
     1077         zs  = SQRT( ABS( psal ) / 35.16504_wp )           ! square root salinity 
    10661078         ptf = ((((1.46873e-03_wp*zs-9.64972e-03_wp)*zs+2.28348e-02_wp)*zs & 
    10671079                  &          - 3.12775e-02_wp)*zs+2.07679e-02_wp)*zs-5.87701e-02_wp 
     
    10701082         IF( PRESENT( pdep ) )   ptf = ptf - 7.53e-4 * pdep 
    10711083         ! 
    1072       CASE ( 0 )                     !==  PT,SP (UNESCO formulation)  ==! 
     1084      CASE ( np_eos80 )                !==  PT,SP (UNESCO formulation)  ==! 
    10731085         ! 
    10741086         ptf = ( - 0.0575_wp + 1.710523e-3_wp * SQRT( psal )   & 
     
    10791091      CASE DEFAULT 
    10801092         IF(lwp) WRITE(numout,cform_err) 
    1081          IF(lwp) WRITE(numout,*) '          bad flag value for nn_eos = ', nn_eos 
     1093         IF(lwp) WRITE(numout,*) '          bad flag value for neos = ', neos 
    10821094         nstop = nstop + 1 
    10831095         ! 
     
    11181130      IF( nn_timing == 1 )   CALL timing_start('eos_pen') 
    11191131      ! 
    1120       SELECT CASE ( nn_eos ) 
    1121       ! 
    1122       CASE( -1, 0 )                !==  polynomial TEOS-10 / EOS-80 ==! 
     1132      SELECT CASE ( neos ) 
     1133      ! 
     1134      CASE( np_teos10, np_eos80 )                !==  polynomial TEOS-10 / EOS-80 ==! 
    11231135         ! 
    11241136         DO jk = 1, jpkm1 
     
    11831195         END DO 
    11841196         ! 
    1185       CASE( 1 )                !==  Vallis (2006) simplified EOS  ==! 
     1197      CASE( np_seos )                !==  Vallis (2006) simplified EOS  ==! 
    11861198         ! 
    11871199         DO jk = 1, jpkm1 
     
    12051217      CASE DEFAULT 
    12061218         IF(lwp) WRITE(numout,cform_err) 
    1207          IF(lwp) WRITE(numout,*) '          bad flag value for nn_eos = ', nn_eos 
     1219         IF(lwp) WRITE(numout,*) '          bad flag value for neos = ', neos 
    12081220         nstop = nstop + 1 
    12091221         ! 
     
    12241236      !!---------------------------------------------------------------------- 
    12251237      INTEGER  ::   ios   ! local integer 
    1226       !! 
    1227       NAMELIST/nameos/ nn_eos, ln_useCT, rn_a0, rn_b0, rn_lambda1, rn_mu1,   & 
     1238      INTEGER  ::   ioptio   ! local integer 
     1239      !! 
     1240      NAMELIST/nameos/ ln_TEOS10, ln_EOS80, ln_SEOS, rn_a0, rn_b0, rn_lambda1, rn_mu1,   & 
    12281241         &                                             rn_lambda2, rn_mu2, rn_nu 
    12291242      !!---------------------------------------------------------------------- 
     
    12451258         WRITE(numout,*) 'eos_init : equation of state' 
    12461259         WRITE(numout,*) '~~~~~~~~' 
    1247          WRITE(numout,*) '          Namelist nameos : set eos parameters' 
    1248          WRITE(numout,*) '             flag for eq. of state and N^2  nn_eos   = ', nn_eos 
    1249          IF( ln_useCT )   THEN 
    1250             WRITE(numout,*) '             model uses Conservative Temperature' 
    1251             WRITE(numout,*) '             Important: model must be initialized with CT and SA fields' 
    1252          ELSE 
    1253             WRITE(numout,*) '             model does not use Conservative Temperature' 
    1254          ENDIF 
     1260         WRITE(numout,*) '   Namelist nameos : Chosen the Equation Of Seawater (EOS)' 
     1261         WRITE(numout,*) '      TEOS-10 : rho=F(Conservative Temperature, Absolute  Salinity, depth)   ln_TEOS10 = ', ln_TEOS10 
     1262         WRITE(numout,*) '      EOS-80  : rho=F(Potential    Temperature, Practical Salinity, depth)   ln_EOS80  = ', ln_EOS80 
     1263         WRITE(numout,*) '      S-EOS   : rho=F(Conservative Temperature, Absolute  Salinity, depth)   ln_SEOS   = ', ln_SEOS 
    12551264      ENDIF 
    1256       ! 
    1257       SELECT CASE( nn_eos )         ! check option 
    1258       ! 
    1259       CASE( -1 )                       !==  polynomial TEOS-10  ==! 
     1265 
     1266      ! Check options for equation of state & set neos based on logical flags 
     1267      ioptio = 0 
     1268      IF( ln_TEOS10 ) THEN   ;   ioptio = ioptio+1   ;   neos = np_teos10   ;   ENDIF 
     1269      IF( ln_EOS80  ) THEN   ;   ioptio = ioptio+1   ;   neos = np_eos80    ;   ENDIF 
     1270      IF( ln_SEOS   ) THEN   ;   ioptio = ioptio+1   ;   neos = np_seos     ;   ENDIF 
     1271      IF( ioptio /= 1 )   CALL ctl_stop("Exactly one equation of state option must be selected") 
     1272      ! 
     1273      SELECT CASE( neos )         ! check option 
     1274      ! 
     1275      CASE( np_teos10 )                       !==  polynomial TEOS-10  ==! 
    12601276         IF(lwp) WRITE(numout,*) 
    12611277         IF(lwp) WRITE(numout,*) '          use of TEOS-10 equation of state (cons. temp. and abs. salinity)' 
     1278         ! 
     1279         l_useCT = .TRUE.                          ! model temperature is Conservative temperature  
    12621280         ! 
    12631281         rdeltaS = 32._wp 
     
    14461464         BPE002 = 1.7269476440e-04_wp 
    14471465         ! 
    1448       CASE( 0 )                        !==  polynomial EOS-80 formulation  ==! 
     1466      CASE( np_eos80 )                        !==  polynomial EOS-80 formulation  ==! 
    14491467         ! 
    14501468         IF(lwp) WRITE(numout,*) 
    14511469         IF(lwp) WRITE(numout,*) '          use of EOS-80 equation of state (pot. temp. and pract. salinity)' 
    14521470         ! 
     1471         l_useCT = .FALSE.                         ! model temperature is Potential temperature 
    14531472         rdeltaS = 20._wp 
    14541473         r1_S0  = 1._wp/40._wp 
     
    16361655         BPE002 = 5.3661089288e-04_wp 
    16371656         ! 
    1638       CASE( 1 )                        !==  Simplified EOS     ==! 
     1657      CASE( np_seos )                        !==  Simplified EOS     ==! 
    16391658         IF(lwp) THEN 
    16401659            WRITE(numout,*) 
     
    16511670            WRITE(numout,*) '               Caution: rn_beta0=0 incompatible with ddm parameterization ' 
    16521671         ENDIF 
    1653          ! 
    1654       CASE DEFAULT                     !==  ERROR in nn_eos  ==! 
    1655          WRITE(ctmp1,*) '          bad flag value for nn_eos = ', nn_eos 
     1672         l_useCT = .TRUE.          ! Use conservative temperature 
     1673         ! 
     1674      CASE DEFAULT                     !==  ERROR in neos  ==! 
     1675         WRITE(ctmp1,*) '          bad flag value for neos = ', neos, '. You should never see this error' 
    16561676         CALL ctl_stop( ctmp1 ) 
    16571677         ! 
     
    16621682      r1_rcp      = 1._wp / rcp 
    16631683      r1_rau0_rcp = 1._wp / rau0_rcp  
     1684      ! 
     1685      IF(lwp) THEN 
     1686         IF( l_useCT )   THEN 
     1687            WRITE(numout,*) '             model uses Conservative Temperature' 
     1688            WRITE(numout,*) '             Important: model must be initialized with CT and SA fields' 
     1689         ELSE 
     1690            WRITE(numout,*) '             model does not use Conservative Temperature' 
     1691         ENDIF 
     1692      ENDIF 
    16641693      ! 
    16651694      IF(lwp) WRITE(numout,*) 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90

    r6140 r7341  
    1111   !!            3.2  !  2009-04  (G. Madec & NEMO team)  
    1212   !!            3.6  !  2012-05  (C. Rousset) store attenuation coef for use in ice model  
     13   !!            3.6  !  2015-12  (O. Aumont, J. Jouanno, C. Ethe) use vertical profile of chlorophyll 
    1314   !!            3.7  !  2015-11  (G. Madec, A. Coward)  remove optimisation for fix volume  
    1415   !!---------------------------------------------------------------------- 
     
    100101      !! Reference  : Jerlov, N. G., 1968 Optical Oceanography, Elsevier, 194pp. 
    101102      !!              Lengaigne et al. 2007, Clim. Dyn., V28, 5, 503-516. 
     103      !!              Morel, A. et Berthon, JF, 1989, Limnol Oceanogr 34(8), 1545-1562 
    102104      !!---------------------------------------------------------------------- 
    103105      INTEGER, INTENT(in) ::   kt     ! ocean time-step 
     
    109111      REAL(wp) ::   zzc0, zzc1, zzc2, zzc3   !    -         - 
    110112      REAL(wp) ::   zz0 , zz1                !    -         - 
     113      REAL(wp) ::   zCb, zCmax, zze, zpsi, zpsimax, zdelpsi, zCtot, zCze 
     114      REAL(wp) ::   zlogc, zlogc2, zlogc3  
    111115      REAL(wp), POINTER, DIMENSION(:,:)   :: zekb, zekg, zekr 
    112116      REAL(wp), POINTER, DIMENSION(:,:,:) :: ze0, ze1, ze2, ze3, zea, ztrdt 
    113       REAL(wp), POINTER, DIMENSION(:,:,:) :: zetot 
     117      REAL(wp), POINTER, DIMENSION(:,:,:) :: zetot, zchl3d 
    114118      !!---------------------------------------------------------------------- 
    115119      ! 
     
    158162         ! 
    159163         CALL wrk_alloc( jpi,jpj,       zekb, zekg, zekr        )  
    160          CALL wrk_alloc( jpi,jpj,jpk,   ze0, ze1, ze2, ze3, zea )  
     164         CALL wrk_alloc( jpi,jpj,jpk,   ze0, ze1, ze2, ze3, zea, zchl3d )  
    161165         ! 
    162166         IF( nqsr == np_RGBc ) THEN          !*  Variable Chlorophyll 
    163167            CALL fld_read( kt, 1, sf_chl )         ! Read Chl data and provides it at the current time step 
    164             DO jj = 2, jpjm1                       ! Separation in R-G-B depending of the surface Chl 
    165                DO ji = fs_2, fs_jpim1 
    166                   zchl = MIN( 10. , MAX( 0.03, sf_chl(1)%fnow(ji,jj,1) ) ) 
    167                   irgb = NINT( 41 + 20.*LOG10(zchl) + 1.e-15 ) 
    168                   zekb(ji,jj) = rkrgb(1,irgb) 
    169                   zekg(ji,jj) = rkrgb(2,irgb) 
    170                   zekr(ji,jj) = rkrgb(3,irgb) 
     168            DO jk = 1, nksr + 1 
     169               DO jj = 2, jpjm1                       ! Separation in R-G-B depending of the surface Chl 
     170                  DO ji = fs_2, fs_jpim1 
     171                     zchl    = sf_chl(1)%fnow(ji,jj,1) 
     172                     zCtot   = 40.6  * zchl**0.459 
     173                     zze     = 568.2 * zCtot**(-0.746) 
     174                     IF( zze > 102. ) zze = 200.0 * zCtot**(-0.293) 
     175                     zpsi    = gdepw_n(ji,jj,jk) / zze 
     176                     ! 
     177                     zlogc   = LOG( zchl ) 
     178                     zlogc2  = zlogc * zlogc 
     179                     zlogc3  = zlogc * zlogc * zlogc 
     180                     zCb     = 0.768 + 0.087 * zlogc - 0.179 * zlogc2 - 0.025 * zlogc3 
     181                     zCmax   = 0.299 - 0.289 * zlogc + 0.579 * zlogc2 
     182                     zpsimax = 0.6   - 0.640 * zlogc + 0.021 * zlogc2 + 0.115 * zlogc3 
     183                     zdelpsi = 0.710 + 0.159 * zlogc + 0.021 * zlogc2 
     184                     zCze    = 1.12  * (zchl)**0.803  
     185                     ! 
     186                     zchl3d(ji,jj,jk) = zCze * ( zCb + zCmax * EXP( -( (zpsi - zpsimax) / zdelpsi )**2 ) ) 
     187                  END DO 
     188                  ! 
    171189               END DO 
    172190            END DO 
    173191         ELSE                                !* constant chrlorophyll 
    174             zchl = 0.05                            ! constant chlorophyll 
    175             !                                      ! Separation in R-G-B depending of the chlorophyll 
    176             irgb = NINT( 41 + 20.*LOG10( zchl ) + 1.e-15 ) 
    177             DO jj = 2, jpjm1 
    178                DO ji = fs_2, fs_jpim1 
    179                   zekb(ji,jj) = rkrgb(1,irgb)                       
    180                   zekg(ji,jj) = rkrgb(2,irgb) 
    181                   zekr(ji,jj) = rkrgb(3,irgb) 
    182                END DO 
    183             END DO 
     192           DO jk = 1, nksr + 1 
     193              zchl3d(:,:,jk) = 0.05  
     194            ENDDO 
    184195         ENDIF 
    185196         ! 
     
    195206         END DO 
    196207         ! 
    197          DO jk = 2, nksr+1                   !* interior equi-partition in R-G-B 
     208         DO jk = 2, nksr+1                   !* interior equi-partition in R-G-B depending of vertical profile of Chl 
     209            DO jj = 2, jpjm1 
     210               DO ji = fs_2, fs_jpim1 
     211                  zchl = MIN( 10. , MAX( 0.03, zchl3d(ji,jj,jk) ) ) 
     212                  irgb = NINT( 41 + 20.*LOG10(zchl) + 1.e-15 ) 
     213                  zekb(ji,jj) = rkrgb(1,irgb) 
     214                  zekg(ji,jj) = rkrgb(2,irgb) 
     215                  zekr(ji,jj) = rkrgb(3,irgb) 
     216               END DO 
     217            END DO 
     218 
    198219            DO jj = 2, jpjm1 
    199220               DO ji = fs_2, fs_jpim1 
     
    220241         ! 
    221242         CALL wrk_dealloc( jpi,jpj,        zekb, zekg, zekr        )  
    222          CALL wrk_dealloc( jpi,jpj,jpk,   ze0, ze1, ze2, ze3, zea )  
     243         CALL wrk_dealloc( jpi,jpj,jpk,   ze0, ze1, ze2, ze3, zea, zchl3d )  
    223244         ! 
    224245      CASE( np_2BD  )            !==  2-bands fluxes  ==! 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90

    r6140 r7341  
    111111         ELSE                                   ! No restart or restart not found: Euler forward time stepping 
    112112            zfact = 1._wp 
     113            sbc_tsc(:,:,:) = 0._wp 
    113114            sbc_tsc_b(:,:,:) = 0._wp 
    114115         ENDIF 
     
    207208         END DO   
    208209      ENDIF 
     210 
     211      IF( iom_use('rnf_x_sst') )   CALL iom_put( "rnf_x_sst", rnf*tsn(:,:,1,jp_tem) )   ! runoff term on sst 
     212      IF( iom_use('rnf_x_sss') )   CALL iom_put( "rnf_x_sss", rnf*tsn(:,:,1,jp_sal) )   ! runoff term on sss 
     213 
    209214      ! 
    210215      !---------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfddm.F90

    r6140 r7341  
    174174                  &                             +  0.15 * zrau(ji,jj)          * zmskd2(ji,jj)  ) 
    175175               ! add to the eddy viscosity coef. previously computed 
     176# if defined key_zdftmx_new 
     177               ! key_zdftmx_new: New internal wave-driven param: use avs value computed by zdftmx 
     178               avs (ji,jj,jk) = avs(ji,jj,jk) + zavfs + zavds 
     179# else 
    176180               avs (ji,jj,jk) = avt(ji,jj,jk) + zavfs + zavds 
     181# endif 
    177182               avt (ji,jj,jk) = avt(ji,jj,jk) + zavft + zavdt 
    178183               avm (ji,jj,jk) = avm(ji,jj,jk) + MAX( zavft + zavdt, zavfs + zavds ) 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfric.F90

    r6140 r7341  
    3131   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)   
    3232 
    33    USE eosbn2, ONLY : nn_eos 
     33   USE eosbn2, ONLY : neos 
    3434 
    3535   IMPLICIT NONE 
     
    175175      !  Compute Ekman depth from wind stress forcing. 
    176176      ! ------------------------------------------------------- 
    177       zflageos = ( 0.5 + SIGN( 0.5, nn_eos - 1. ) ) * rau0 
     177      zflageos = ( 0.5 + SIGN( 0.5, neos - 1. ) ) * rau0 
    178178      DO jj = 2, jpjm1 
    179179            DO ji = fs_2, fs_jpim1 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90

    r6140 r7341  
    323323                  zwlc = zind * rn_lc * zus * SIN( rpi * gdepw_n(ji,jj,jk) / zhlc(ji,jj) ) 
    324324                  !                                           ! TKE Langmuir circulation source term 
    325                   en(ji,jj,jk) = en(ji,jj,jk) + rdt * (1._wp - fr_i(ji,jj) ) * ( zwlc * zwlc * zwlc ) / zhlc(ji,jj) * wmask(ji,jj,jk) * tmask(ji,jj,1) 
     325                  en(ji,jj,jk) = en(ji,jj,jk) + rdt * (1._wp - fr_i(ji,jj) ) * ( zwlc * zwlc * zwlc )   & 
     326                     &                              / zhlc(ji,jj) * wmask(ji,jj,jk) * tmask(ji,jj,1) 
    326327               END DO 
    327328            END DO 
     
    375376            DO ji = fs_2, fs_jpim1   ! vector opt. 
    376377               zcof   = zfact1 * tmask(ji,jj,jk) 
     378# if defined key_zdftmx_new 
     379               ! key_zdftmx_new: New internal wave-driven param: set a minimum value for Kz on TKE (ensure numerical stability) 
     380               zzd_up = zcof * MAX( avm(ji,jj,jk+1) + avm(ji,jj,jk), 2.e-5_wp )   &  ! upper diagonal 
     381                  &          / (  e3t_n(ji,jj,jk  ) * e3w_n(ji,jj,jk  )  ) 
     382               zzd_lw = zcof * MAX( avm(ji,jj,jk) + avm(ji,jj,jk-1), 2.e-5_wp )   &  ! lower diagonal 
     383                  &          / (  e3t_n(ji,jj,jk-1) * e3w_n(ji,jj,jk  )  ) 
     384# else 
    377385               zzd_up = zcof * ( avm  (ji,jj,jk+1) + avm  (ji,jj,jk  ) )   &  ! upper diagonal 
    378386                  &          / ( e3t_n(ji,jj,jk  ) * e3w_n(ji,jj,jk  ) ) 
    379387               zzd_lw = zcof * ( avm  (ji,jj,jk  ) + avm  (ji,jj,jk-1) )   &  ! lower diagonal 
    380388                  &          / ( e3t_n(ji,jj,jk-1) * e3w_n(ji,jj,jk  ) ) 
     389# endif 
    381390               !                                   ! shear prod. at w-point weightened by mask 
    382391               zesh2  =  ( z3du(ji-1,jj,jk) + z3du(ji,jj,jk) ) / MAX( 1._wp , umask(ji-1,jj,jk) + umask(ji,jj,jk) )   & 
     
    732741      ! 
    733742      ri_cri   = 2._wp    / ( 2._wp + rn_ediss / rn_ediff )   ! resulting critical Richardson number 
     743# if defined key_zdftmx_new 
     744      ! key_zdftmx_new: New internal wave-driven param: specified value of rn_emin & rmxl_min are used 
     745      rn_emin  = 1.e-10_wp 
     746      rmxl_min = 1.e-03_wp 
     747      IF(lwp) THEN                  ! Control print 
     748         WRITE(numout,*) 
     749         WRITE(numout,*) 'zdf_tke_init :  New tidal mixing case: force rn_emin = 1.e-10 and rmxl_min = 1.e-3 ' 
     750         WRITE(numout,*) '~~~~~~~~~~~~' 
     751      ENDIF 
     752# else 
    734753      rmxl_min = 1.e-6_wp / ( rn_ediff * SQRT( rn_emin ) )    ! resulting minimum length to recover molecular viscosity 
     754# endif 
    735755      ! 
    736756      IF(lwp) THEN                    !* Control print 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftmx.F90

    r6140 r7341  
    541541   END SUBROUTINE zdf_tmx_init 
    542542 
     543#elif defined key_zdftmx_new 
     544   !!---------------------------------------------------------------------- 
     545   !!   'key_zdftmx_new'               Internal wave-driven vertical mixing 
     546   !!---------------------------------------------------------------------- 
     547   !!   zdf_tmx       : global     momentum & tracer Kz with wave induced Kz 
     548   !!   zdf_tmx_init  : global     momentum & tracer Kz with wave induced Kz 
     549   !!---------------------------------------------------------------------- 
     550   USE oce            ! ocean dynamics and tracers variables 
     551   USE dom_oce        ! ocean space and time domain variables 
     552   USE zdf_oce        ! ocean vertical physics variables 
     553   USE zdfddm         ! ocean vertical physics: double diffusive mixing 
     554   USE lbclnk         ! ocean lateral boundary conditions (or mpp link) 
     555   USE eosbn2         ! ocean equation of state 
     556   USE phycst         ! physical constants 
     557   USE prtctl         ! Print control 
     558   USE in_out_manager ! I/O manager 
     559   USE iom            ! I/O Manager 
     560   USE lib_mpp        ! MPP library 
     561   USE wrk_nemo       ! work arrays 
     562   USE timing         ! Timing 
     563   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)   
     564 
     565   IMPLICIT NONE 
     566   PRIVATE 
     567 
     568   PUBLIC   zdf_tmx         ! called in step module  
     569   PUBLIC   zdf_tmx_init    ! called in nemogcm module  
     570   PUBLIC   zdf_tmx_alloc   ! called in nemogcm module 
     571 
     572   LOGICAL, PUBLIC, PARAMETER ::   lk_zdftmx = .TRUE.    !: wave-driven mixing flag 
     573 
     574   !                       !!* Namelist  namzdf_tmx : internal wave-driven mixing * 
     575   INTEGER  ::  nn_zpyc     ! pycnocline-intensified mixing energy proportional to N (=1) or N^2 (=2) 
     576   LOGICAL  ::  ln_mevar    ! variable (=T) or constant (=F) mixing efficiency 
     577   LOGICAL  ::  ln_tsdiff   ! account for differential T/S wave-driven mixing (=T) or not (=F) 
     578 
     579   REAL(wp) ::  r1_6 = 1._wp / 6._wp 
     580 
     581   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   ebot_tmx     ! power available from high-mode wave breaking (W/m2) 
     582   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   epyc_tmx     ! power available from low-mode, pycnocline-intensified wave breaking (W/m2) 
     583   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   ecri_tmx     ! power available from low-mode, critical slope wave breaking (W/m2) 
     584   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   hbot_tmx     ! WKB decay scale for high-mode energy dissipation (m) 
     585   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   hcri_tmx     ! decay scale for low-mode critical slope dissipation (m) 
     586   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   emix_tmx     ! local energy density available for mixing (W/kg) 
     587   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   bflx_tmx     ! buoyancy flux Kz * N^2 (W/kg) 
     588   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   pcmap_tmx    ! vertically integrated buoyancy flux (W/m2) 
     589   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   zav_ratio    ! S/T diffusivity ratio (only for ln_tsdiff=T) 
     590   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   zav_wave     ! Internal wave-induced diffusivity 
     591 
     592   !! * Substitutions 
     593#  include "zdfddm_substitute.h90" 
     594#  include "vectopt_loop_substitute.h90" 
     595   !!---------------------------------------------------------------------- 
     596   !! NEMO/OPA 4.0 , NEMO Consortium (2016) 
     597   !! $Id$ 
     598   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     599   !!---------------------------------------------------------------------- 
     600CONTAINS 
     601 
     602   INTEGER FUNCTION zdf_tmx_alloc() 
     603      !!---------------------------------------------------------------------- 
     604      !!                ***  FUNCTION zdf_tmx_alloc  *** 
     605      !!---------------------------------------------------------------------- 
     606      ALLOCATE(     ebot_tmx(jpi,jpj),  epyc_tmx(jpi,jpj),  ecri_tmx(jpi,jpj)    ,   & 
     607      &             hbot_tmx(jpi,jpj),  hcri_tmx(jpi,jpj),  emix_tmx(jpi,jpj,jpk),   & 
     608      &         bflx_tmx(jpi,jpj,jpk), pcmap_tmx(jpi,jpj), zav_ratio(jpi,jpj,jpk),   &  
     609      &         zav_wave(jpi,jpj,jpk), STAT=zdf_tmx_alloc     ) 
     610      ! 
     611      IF( lk_mpp             )   CALL mpp_sum ( zdf_tmx_alloc ) 
     612      IF( zdf_tmx_alloc /= 0 )   CALL ctl_warn('zdf_tmx_alloc: failed to allocate arrays') 
     613   END FUNCTION zdf_tmx_alloc 
     614 
     615 
     616   SUBROUTINE zdf_tmx( kt ) 
     617      !!---------------------------------------------------------------------- 
     618      !!                  ***  ROUTINE zdf_tmx  *** 
     619      !!                    
     620      !! ** Purpose :   add to the vertical mixing coefficients the effect of 
     621      !!              breaking internal waves. 
     622      !! 
     623      !! ** Method  : - internal wave-driven vertical mixing is given by: 
     624      !!                  Kz_wave = min(  100 cm2/s, f(  Reb = emix_tmx /( Nu * N^2 )  ) 
     625      !!              where emix_tmx is the 3D space distribution of the wave-breaking  
     626      !!              energy and Nu the molecular kinematic viscosity. 
     627      !!              The function f(Reb) is linear (constant mixing efficiency) 
     628      !!              if the namelist parameter ln_mevar = F and nonlinear if ln_mevar = T. 
     629      !! 
     630      !!              - Compute emix_tmx, the 3D power density that allows to compute 
     631      !!              Reb and therefrom the wave-induced vertical diffusivity. 
     632      !!              This is divided into three components: 
     633      !!                 1. Bottom-intensified low-mode dissipation at critical slopes 
     634      !!                     emix_tmx(z) = ( ecri_tmx / rau0 ) * EXP( -(H-z)/hcri_tmx ) 
     635      !!                                   / ( 1. - EXP( - H/hcri_tmx ) ) * hcri_tmx 
     636      !!              where hcri_tmx is the characteristic length scale of the bottom  
     637      !!              intensification, ecri_tmx a map of available power, and H the ocean depth. 
     638      !!                 2. Pycnocline-intensified low-mode dissipation 
     639      !!                     emix_tmx(z) = ( epyc_tmx / rau0 ) * ( sqrt(rn2(z))^nn_zpyc ) 
     640      !!                                   / SUM( sqrt(rn2(z))^nn_zpyc * e3w(z) ) 
     641      !!              where epyc_tmx is a map of available power, and nn_zpyc 
     642      !!              is the chosen stratification-dependence of the internal wave 
     643      !!              energy dissipation. 
     644      !!                 3. WKB-height dependent high mode dissipation 
     645      !!                     emix_tmx(z) = ( ebot_tmx / rau0 ) * rn2(z) * EXP(-z_wkb(z)/hbot_tmx) 
     646      !!                                   / SUM( rn2(z) * EXP(-z_wkb(z)/hbot_tmx) * e3w(z) ) 
     647      !!              where hbot_tmx is the characteristic length scale of the WKB bottom  
     648      !!              intensification, ebot_tmx is a map of available power, and z_wkb is the 
     649      !!              WKB-stretched height above bottom defined as 
     650      !!                    z_wkb(z) = H * SUM( sqrt(rn2(z'>=z)) * e3w(z'>=z) ) 
     651      !!                                 / SUM( sqrt(rn2(z'))    * e3w(z')    ) 
     652      !! 
     653      !!              - update the model vertical eddy viscosity and diffusivity:  
     654      !!                     avt  = avt  +    av_wave 
     655      !!                     avm  = avm  +    av_wave 
     656      !!                     avmu = avmu + mi(av_wave) 
     657      !!                     avmv = avmv + mj(av_wave) 
     658      !! 
     659      !!              - if namelist parameter ln_tsdiff = T, account for differential mixing: 
     660      !!                     avs  = avt  +    av_wave * diffusivity_ratio(Reb) 
     661      !! 
     662      !! ** Action  : - Define emix_tmx used to compute internal wave-induced mixing 
     663      !!              - avt, avs, avm, avmu, avmv increased by internal wave-driven mixing     
     664      !! 
     665      !! References :  de Lavergne et al. 2015, JPO; 2016, in prep. 
     666      !!---------------------------------------------------------------------- 
     667      INTEGER, INTENT(in) ::   kt   ! ocean time-step  
     668      ! 
     669      INTEGER  ::   ji, jj, jk   ! dummy loop indices 
     670      REAL(wp) ::   ztpc         ! scalar workspace 
     671      REAL(wp), DIMENSION(:,:)  , POINTER ::  zfact     ! Used for vertical structure 
     672      REAL(wp), DIMENSION(:,:)  , POINTER ::  zhdep     ! Ocean depth 
     673      REAL(wp), DIMENSION(:,:,:), POINTER ::  zwkb      ! WKB-stretched height above bottom 
     674      REAL(wp), DIMENSION(:,:,:), POINTER ::  zweight   ! Weight for high mode vertical distribution 
     675      REAL(wp), DIMENSION(:,:,:), POINTER ::  znu_t     ! Molecular kinematic viscosity (T grid) 
     676      REAL(wp), DIMENSION(:,:,:), POINTER ::  znu_w     ! Molecular kinematic viscosity (W grid) 
     677      REAL(wp), DIMENSION(:,:,:), POINTER ::  zReb      ! Turbulence intensity parameter 
     678      !!---------------------------------------------------------------------- 
     679      ! 
     680      IF( nn_timing == 1 )   CALL timing_start('zdf_tmx') 
     681      ! 
     682      CALL wrk_alloc( jpi,jpj,       zfact, zhdep ) 
     683      CALL wrk_alloc( jpi,jpj,jpk,   zwkb, zweight, znu_t, znu_w, zReb ) 
     684 
     685      !                          ! ----------------------------- ! 
     686      !                          !  Internal wave-driven mixing  !  (compute zav_wave) 
     687      !                          ! ----------------------------- ! 
     688      !                              
     689      !                        !* Critical slope mixing: distribute energy over the time-varying ocean depth, 
     690      !                                                 using an exponential decay from the seafloor. 
     691      DO jj = 1, jpj                ! part independent of the level 
     692         DO ji = 1, jpi 
     693            zhdep(ji,jj) = gdepw_0(ji,jj,mbkt(ji,jj)+1)       ! depth of the ocean 
     694            zfact(ji,jj) = rau0 * (  1._wp - EXP( -zhdep(ji,jj) / hcri_tmx(ji,jj) )  ) 
     695            IF( zfact(ji,jj) /= 0 )   zfact(ji,jj) = ecri_tmx(ji,jj) / zfact(ji,jj) 
     696         END DO 
     697      END DO 
     698 
     699      DO jk = 2, jpkm1              ! complete with the level-dependent part 
     700         emix_tmx(:,:,jk) = zfact(:,:) * (  EXP( ( gde3w_n(:,:,jk  ) - zhdep(:,:) ) / hcri_tmx(:,:) )                      & 
     701            &                             - EXP( ( gde3w_n(:,:,jk-1) - zhdep(:,:) ) / hcri_tmx(:,:) )  ) * wmask(:,:,jk)   & 
     702            &                          / ( gde3w_n(:,:,jk) - gde3w_n(:,:,jk-1) ) 
     703      END DO 
     704 
     705      !                        !* Pycnocline-intensified mixing: distribute energy over the time-varying  
     706      !                        !* ocean depth as proportional to sqrt(rn2)^nn_zpyc 
     707 
     708      SELECT CASE ( nn_zpyc ) 
     709 
     710      CASE ( 1 )               ! Dissipation scales as N (recommended) 
     711 
     712         zfact(:,:) = 0._wp 
     713         DO jk = 2, jpkm1              ! part independent of the level 
     714            zfact(:,:) = zfact(:,:) + e3w_n(:,:,jk) * SQRT(  MAX( 0._wp, rn2(:,:,jk) )  ) * wmask(:,:,jk) 
     715         END DO 
     716 
     717         DO jj = 1, jpj 
     718            DO ji = 1, jpi 
     719               IF( zfact(ji,jj) /= 0 )   zfact(ji,jj) = epyc_tmx(ji,jj) / ( rau0 * zfact(ji,jj) ) 
     720            END DO 
     721         END DO 
     722 
     723         DO jk = 2, jpkm1              ! complete with the level-dependent part 
     724            emix_tmx(:,:,jk) = emix_tmx(:,:,jk) + zfact(:,:) * SQRT(  MAX( 0._wp, rn2(:,:,jk) )  ) * wmask(:,:,jk) 
     725         END DO 
     726 
     727      CASE ( 2 )               ! Dissipation scales as N^2 
     728 
     729         zfact(:,:) = 0._wp 
     730         DO jk = 2, jpkm1              ! part independent of the level 
     731            zfact(:,:) = zfact(:,:) + e3w_n(:,:,jk) * MAX( 0._wp, rn2(:,:,jk) ) * wmask(:,:,jk) 
     732         END DO 
     733 
     734         DO jj= 1, jpj 
     735            DO ji = 1, jpi 
     736               IF( zfact(ji,jj) /= 0 )   zfact(ji,jj) = epyc_tmx(ji,jj) / ( rau0 * zfact(ji,jj) ) 
     737            END DO 
     738         END DO 
     739 
     740         DO jk = 2, jpkm1              ! complete with the level-dependent part 
     741            emix_tmx(:,:,jk) = emix_tmx(:,:,jk) + zfact(:,:) * MAX( 0._wp, rn2(:,:,jk) ) * wmask(:,:,jk) 
     742         END DO 
     743 
     744      END SELECT 
     745 
     746      !                        !* WKB-height dependent mixing: distribute energy over the time-varying  
     747      !                        !* ocean depth as proportional to rn2 * exp(-z_wkb/rn_hbot) 
     748       
     749      zwkb(:,:,:) = 0._wp 
     750      zfact(:,:) = 0._wp 
     751      DO jk = 2, jpkm1 
     752         zfact(:,:) = zfact(:,:) + e3w_n(:,:,jk) * SQRT(  MAX( 0._wp, rn2(:,:,jk) )  ) * wmask(:,:,jk) 
     753         zwkb(:,:,jk) = zfact(:,:) 
     754      END DO 
     755 
     756      DO jk = 2, jpkm1 
     757         DO jj = 1, jpj 
     758            DO ji = 1, jpi 
     759               IF( zfact(ji,jj) /= 0 )   zwkb(ji,jj,jk) = zhdep(ji,jj) * ( zfact(ji,jj) - zwkb(ji,jj,jk) )   & 
     760                                            &           * tmask(ji,jj,jk) / zfact(ji,jj) 
     761            END DO 
     762         END DO 
     763      END DO 
     764      zwkb(:,:,1) = zhdep(:,:) * tmask(:,:,1) 
     765 
     766      zweight(:,:,:) = 0._wp 
     767      DO jk = 2, jpkm1 
     768         zweight(:,:,jk) = MAX( 0._wp, rn2(:,:,jk) ) * hbot_tmx(:,:) * wmask(:,:,jk)                    & 
     769            &   * (  EXP( -zwkb(:,:,jk) / hbot_tmx(:,:) ) - EXP( -zwkb(:,:,jk-1) / hbot_tmx(:,:) )  ) 
     770      END DO 
     771 
     772      zfact(:,:) = 0._wp 
     773      DO jk = 2, jpkm1              ! part independent of the level 
     774         zfact(:,:) = zfact(:,:) + zweight(:,:,jk) 
     775      END DO 
     776 
     777      DO jj = 1, jpj 
     778         DO ji = 1, jpi 
     779            IF( zfact(ji,jj) /= 0 )   zfact(ji,jj) = ebot_tmx(ji,jj) / ( rau0 * zfact(ji,jj) ) 
     780         END DO 
     781      END DO 
     782 
     783      DO jk = 2, jpkm1              ! complete with the level-dependent part 
     784         emix_tmx(:,:,jk) = emix_tmx(:,:,jk) + zweight(:,:,jk) * zfact(:,:) * wmask(:,:,jk)   & 
     785            &                                / ( gde3w_n(:,:,jk) - gde3w_n(:,:,jk-1) ) 
     786      END DO 
     787 
     788 
     789      ! Calculate molecular kinematic viscosity 
     790      znu_t(:,:,:) = 1.e-4_wp * (  17.91_wp - 0.53810_wp * tsn(:,:,:,jp_tem) + 0.00694_wp * tsn(:,:,:,jp_tem) * tsn(:,:,:,jp_tem)  & 
     791         &                                  + 0.02305_wp * tsn(:,:,:,jp_sal)  ) * tmask(:,:,:) * r1_rau0 
     792      DO jk = 2, jpkm1 
     793         znu_w(:,:,jk) = 0.5_wp * ( znu_t(:,:,jk-1) + znu_t(:,:,jk) ) * wmask(:,:,jk) 
     794      END DO 
     795 
     796      ! Calculate turbulence intensity parameter Reb 
     797      DO jk = 2, jpkm1 
     798         zReb(:,:,jk) = emix_tmx(:,:,jk) / MAX( 1.e-20_wp, znu_w(:,:,jk) * rn2(:,:,jk) ) 
     799      END DO 
     800 
     801      ! Define internal wave-induced diffusivity 
     802      DO jk = 2, jpkm1 
     803         zav_wave(:,:,jk) = znu_w(:,:,jk) * zReb(:,:,jk) * r1_6   ! This corresponds to a constant mixing efficiency of 1/6 
     804      END DO 
     805 
     806      IF( ln_mevar ) THEN              ! Variable mixing efficiency case : modify zav_wave in the 
     807         DO jk = 2, jpkm1              ! energetic (Reb > 480) and buoyancy-controlled (Reb <10.224 ) regimes 
     808            DO jj = 1, jpj 
     809               DO ji = 1, jpi 
     810                  IF( zReb(ji,jj,jk) > 480.00_wp ) THEN 
     811                     zav_wave(ji,jj,jk) = 3.6515_wp * znu_w(ji,jj,jk) * SQRT( zReb(ji,jj,jk) ) 
     812                  ELSEIF( zReb(ji,jj,jk) < 10.224_wp ) THEN 
     813                     zav_wave(ji,jj,jk) = 0.052125_wp * znu_w(ji,jj,jk) * zReb(ji,jj,jk) * SQRT( zReb(ji,jj,jk) ) 
     814                  ENDIF 
     815               END DO 
     816            END DO 
     817         END DO 
     818      ENDIF 
     819 
     820      DO jk = 2, jpkm1                 ! Bound diffusivity by molecular value and 100 cm2/s 
     821         zav_wave(:,:,jk) = MIN(  MAX( 1.4e-7_wp, zav_wave(:,:,jk) ), 1.e-2_wp  ) * wmask(:,:,jk) 
     822      END DO 
     823 
     824      IF( kt == nit000 ) THEN        !* Control print at first time-step: diagnose the energy consumed by zav_wave 
     825         ztpc = 0._wp 
     826         DO jk = 2, jpkm1 
     827            DO jj = 1, jpj 
     828               DO ji = 1, jpi 
     829                  ztpc = ztpc + e3w_n(ji,jj,jk) * e1e2t(ji,jj)   & 
     830                     &         * MAX( 0._wp, rn2(ji,jj,jk) ) * zav_wave(ji,jj,jk) * wmask(ji,jj,jk) * tmask_i(ji,jj) 
     831               END DO 
     832            END DO 
     833         END DO 
     834         IF( lk_mpp )   CALL mpp_sum( ztpc ) 
     835         ztpc = rau0 * ztpc ! Global integral of rauo * Kz * N^2 = power contributing to mixing  
     836  
     837         IF(lwp) THEN 
     838            WRITE(numout,*) 
     839            WRITE(numout,*) 'zdf_tmx : Internal wave-driven mixing (tmx)' 
     840            WRITE(numout,*) '~~~~~~~ ' 
     841            WRITE(numout,*) 
     842            WRITE(numout,*) '      Total power consumption by av_wave: ztpc =  ', ztpc * 1.e-12_wp, 'TW' 
     843         ENDIF 
     844      ENDIF 
     845 
     846      !                          ! ----------------------- ! 
     847      !                          !   Update  mixing coefs  !                           
     848      !                          ! ----------------------- ! 
     849      !       
     850      IF( ln_tsdiff ) THEN          !* Option for differential mixing of salinity and temperature 
     851         DO jk = 2, jpkm1              ! Calculate S/T diffusivity ratio as a function of Reb 
     852            DO jj = 1, jpj 
     853               DO ji = 1, jpi 
     854                  zav_ratio(ji,jj,jk) = ( 0.505_wp + 0.495_wp *                                                                  & 
     855                      &   TANH(    0.92_wp * (   LOG10(  MAX( 1.e-20_wp, zReb(ji,jj,jk) * 5._wp * r1_6 )  ) - 0.60_wp   )    )   & 
     856                      &                 ) * wmask(ji,jj,jk) 
     857               END DO 
     858            END DO 
     859         END DO 
     860         CALL iom_put( "av_ratio", zav_ratio ) 
     861         DO jk = 2, jpkm1           !* update momentum & tracer diffusivity with wave-driven mixing 
     862            fsavs(:,:,jk) = avt(:,:,jk) + zav_wave(:,:,jk) * zav_ratio(:,:,jk) 
     863            avt  (:,:,jk) = avt(:,:,jk) + zav_wave(:,:,jk) 
     864            avm  (:,:,jk) = avm(:,:,jk) + zav_wave(:,:,jk) 
     865         END DO 
     866         ! 
     867      ELSE                          !* update momentum & tracer diffusivity with wave-driven mixing 
     868         DO jk = 2, jpkm1 
     869            fsavs(:,:,jk) = avt(:,:,jk) + zav_wave(:,:,jk) 
     870            avt  (:,:,jk) = avt(:,:,jk) + zav_wave(:,:,jk) 
     871            avm  (:,:,jk) = avm(:,:,jk) + zav_wave(:,:,jk) 
     872         END DO 
     873      ENDIF 
     874 
     875      DO jk = 2, jpkm1              !* update momentum diffusivity at wu and wv points 
     876         DO jj = 2, jpjm1 
     877            DO ji = fs_2, fs_jpim1  ! vector opt. 
     878               avmu(ji,jj,jk) = avmu(ji,jj,jk) + 0.5_wp * ( zav_wave(ji,jj,jk) + zav_wave(ji+1,jj  ,jk) ) * wumask(ji,jj,jk) 
     879               avmv(ji,jj,jk) = avmv(ji,jj,jk) + 0.5_wp * ( zav_wave(ji,jj,jk) + zav_wave(ji  ,jj+1,jk) ) * wvmask(ji,jj,jk) 
     880            END DO 
     881         END DO 
     882      END DO 
     883      CALL lbc_lnk( avmu, 'U', 1. )   ;   CALL lbc_lnk( avmv, 'V', 1. )      ! lateral boundary condition 
     884 
     885      !                             !* output internal wave-driven mixing coefficient 
     886      CALL iom_put( "av_wave", zav_wave ) 
     887                                    !* output useful diagnostics: N^2, Kz * N^2 (bflx_tmx),  
     888                                    !  vertical integral of rau0 * Kz * N^2 (pcmap_tmx), energy density (emix_tmx) 
     889      IF( iom_use("bflx_tmx") .OR. iom_use("pcmap_tmx") ) THEN 
     890         bflx_tmx(:,:,:) = MAX( 0._wp, rn2(:,:,:) ) * zav_wave(:,:,:) 
     891         pcmap_tmx(:,:) = 0._wp 
     892         DO jk = 2, jpkm1 
     893            pcmap_tmx(:,:) = pcmap_tmx(:,:) + e3w_n(:,:,jk) * bflx_tmx(:,:,jk) * wmask(:,:,jk) 
     894         END DO 
     895         pcmap_tmx(:,:) = rau0 * pcmap_tmx(:,:) 
     896         CALL iom_put( "bflx_tmx", bflx_tmx ) 
     897         CALL iom_put( "pcmap_tmx", pcmap_tmx ) 
     898      ENDIF 
     899      CALL iom_put( "bn2", rn2 ) 
     900      CALL iom_put( "emix_tmx", emix_tmx ) 
     901       
     902      CALL wrk_dealloc( jpi,jpj,       zfact, zhdep ) 
     903      CALL wrk_dealloc( jpi,jpj,jpk,   zwkb, zweight, znu_t, znu_w, zReb ) 
     904 
     905      IF(ln_ctl)   CALL prt_ctl(tab3d_1=zav_wave , clinfo1=' tmx - av_wave: ', tab3d_2=avt, clinfo2=' avt: ', ovlap=1, kdim=jpk) 
     906      ! 
     907      IF( nn_timing == 1 )   CALL timing_stop('zdf_tmx') 
     908      ! 
     909   END SUBROUTINE zdf_tmx 
     910 
     911 
     912   SUBROUTINE zdf_tmx_init 
     913      !!---------------------------------------------------------------------- 
     914      !!                  ***  ROUTINE zdf_tmx_init  *** 
     915      !!                      
     916      !! ** Purpose :   Initialization of the wave-driven vertical mixing, reading 
     917      !!              of input power maps and decay length scales in netcdf files. 
     918      !! 
     919      !! ** Method  : - Read the namzdf_tmx namelist and check the parameters 
     920      !! 
     921      !!              - Read the input data in NetCDF files : 
     922      !!              power available from high-mode wave breaking (mixing_power_bot.nc) 
     923      !!              power available from pycnocline-intensified wave-breaking (mixing_power_pyc.nc) 
     924      !!              power available from critical slope wave-breaking (mixing_power_cri.nc) 
     925      !!              WKB decay scale for high-mode wave-breaking (decay_scale_bot.nc) 
     926      !!              decay scale for critical slope wave-breaking (decay_scale_cri.nc) 
     927      !! 
     928      !! ** input   : - Namlist namzdf_tmx 
     929      !!              - NetCDF files : mixing_power_bot.nc, mixing_power_pyc.nc, mixing_power_cri.nc, 
     930      !!              decay_scale_bot.nc decay_scale_cri.nc 
     931      !! 
     932      !! ** Action  : - Increase by 1 the nstop flag is setting problem encounter 
     933      !!              - Define ebot_tmx, epyc_tmx, ecri_tmx, hbot_tmx, hcri_tmx 
     934      !! 
     935      !! References : de Lavergne et al. 2015, JPO; 2016, in prep. 
     936      !!          
     937      !!---------------------------------------------------------------------- 
     938      INTEGER  ::   ji, jj, jk   ! dummy loop indices 
     939      INTEGER  ::   inum         ! local integer 
     940      INTEGER  ::   ios 
     941      REAL(wp) ::   zbot, zpyc, zcri   ! local scalars 
     942      !! 
     943      NAMELIST/namzdf_tmx_new/ nn_zpyc, ln_mevar, ln_tsdiff 
     944      !!---------------------------------------------------------------------- 
     945      ! 
     946      IF( nn_timing == 1 )  CALL timing_start('zdf_tmx_init') 
     947      ! 
     948      REWIND( numnam_ref )              ! Namelist namzdf_tmx in reference namelist : Wave-driven mixing 
     949      READ  ( numnam_ref, namzdf_tmx_new, IOSTAT = ios, ERR = 901) 
     950901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_tmx in reference namelist', lwp ) 
     951      ! 
     952      REWIND( numnam_cfg )              ! Namelist namzdf_tmx in configuration namelist : Wave-driven mixing 
     953      READ  ( numnam_cfg, namzdf_tmx_new, IOSTAT = ios, ERR = 902 ) 
     954902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_tmx in configuration namelist', lwp ) 
     955      IF(lwm) WRITE ( numond, namzdf_tmx_new ) 
     956      ! 
     957      IF(lwp) THEN                  ! Control print 
     958         WRITE(numout,*) 
     959         WRITE(numout,*) 'zdf_tmx_init : internal wave-driven mixing' 
     960         WRITE(numout,*) '~~~~~~~~~~~~' 
     961         WRITE(numout,*) '   Namelist namzdf_tmx_new : set wave-driven mixing parameters' 
     962         WRITE(numout,*) '      Pycnocline-intensified diss. scales as N (=1) or N^2 (=2) = ', nn_zpyc 
     963         WRITE(numout,*) '      Variable (T) or constant (F) mixing efficiency            = ', ln_mevar 
     964         WRITE(numout,*) '      Differential internal wave-driven mixing (T) or not (F)   = ', ln_tsdiff 
     965      ENDIF 
     966       
     967      ! The new wave-driven mixing parameterization elevates avt and avm in the interior, and 
     968      ! ensures that avt remains larger than its molecular value (=1.4e-7). Therefore, avtb should  
     969      ! be set here to a very small value, and avmb to its (uniform) molecular value (=1.4e-6). 
     970      avmb(:) = 1.4e-6_wp        ! viscous molecular value 
     971      avtb(:) = 1.e-10_wp        ! very small diffusive minimum (background avt is specified in zdf_tmx)     
     972      avtb_2d(:,:) = 1.e0_wp     ! uniform  
     973      IF(lwp) THEN                  ! Control print 
     974         WRITE(numout,*) 
     975         WRITE(numout,*) '   Force the background value applied to avm & avt in TKE to be everywhere ',   & 
     976            &               'the viscous molecular value & a very small diffusive value, resp.' 
     977      ENDIF 
     978       
     979      IF( .NOT.lk_zdfddm )   CALL ctl_stop( 'STOP', 'zdf_tmx_init_new : key_zdftmx_new requires key_zdfddm' ) 
     980       
     981      !                             ! allocate tmx arrays 
     982      IF( zdf_tmx_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'zdf_tmx_init : unable to allocate tmx arrays' ) 
     983      ! 
     984      !                             ! read necessary fields 
     985      CALL iom_open('mixing_power_bot',inum)       ! energy flux for high-mode wave breaking [W/m2] 
     986      CALL iom_get  (inum, jpdom_data, 'field', ebot_tmx, 1 )  
     987      CALL iom_close(inum) 
     988      ! 
     989      CALL iom_open('mixing_power_pyc',inum)       ! energy flux for pynocline-intensified wave breaking [W/m2] 
     990      CALL iom_get  (inum, jpdom_data, 'field', epyc_tmx, 1 ) 
     991      CALL iom_close(inum) 
     992      ! 
     993      CALL iom_open('mixing_power_cri',inum)       ! energy flux for critical slope wave breaking [W/m2] 
     994      CALL iom_get  (inum, jpdom_data, 'field', ecri_tmx, 1 ) 
     995      CALL iom_close(inum) 
     996      ! 
     997      CALL iom_open('decay_scale_bot',inum)        ! spatially variable decay scale for high-mode wave breaking [m] 
     998      CALL iom_get  (inum, jpdom_data, 'field', hbot_tmx, 1 ) 
     999      CALL iom_close(inum) 
     1000      ! 
     1001      CALL iom_open('decay_scale_cri',inum)        ! spatially variable decay scale for critical slope wave breaking [m] 
     1002      CALL iom_get  (inum, jpdom_data, 'field', hcri_tmx, 1 ) 
     1003      CALL iom_close(inum) 
     1004 
     1005      ebot_tmx(:,:) = ebot_tmx(:,:) * ssmask(:,:) 
     1006      epyc_tmx(:,:) = epyc_tmx(:,:) * ssmask(:,:) 
     1007      ecri_tmx(:,:) = ecri_tmx(:,:) * ssmask(:,:) 
     1008 
     1009      ! Set once for all to zero the first and last vertical levels of appropriate variables 
     1010      emix_tmx (:,:, 1 ) = 0._wp 
     1011      emix_tmx (:,:,jpk) = 0._wp 
     1012      zav_ratio(:,:, 1 ) = 0._wp 
     1013      zav_ratio(:,:,jpk) = 0._wp 
     1014      zav_wave (:,:, 1 ) = 0._wp 
     1015      zav_wave (:,:,jpk) = 0._wp 
     1016 
     1017      zbot = glob_sum( e1e2t(:,:) * ebot_tmx(:,:) ) 
     1018      zpyc = glob_sum( e1e2t(:,:) * epyc_tmx(:,:) ) 
     1019      zcri = glob_sum( e1e2t(:,:) * ecri_tmx(:,:) ) 
     1020      IF(lwp) THEN 
     1021         WRITE(numout,*) '      High-mode wave-breaking energy:             ', zbot * 1.e-12_wp, 'TW' 
     1022         WRITE(numout,*) '      Pycnocline-intensifed wave-breaking energy: ', zpyc * 1.e-12_wp, 'TW' 
     1023         WRITE(numout,*) '      Critical slope wave-breaking energy:        ', zcri * 1.e-12_wp, 'TW' 
     1024      ENDIF 
     1025      ! 
     1026      IF( nn_timing == 1 )  CALL timing_stop('zdf_tmx_init') 
     1027      ! 
     1028   END SUBROUTINE zdf_tmx_init 
     1029 
    5431030#else 
    5441031   !!---------------------------------------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/step.F90

    r6381 r7341  
    112112      ! Update stochastic parameters and random T/S fluctuations 
    113113      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    114                          CALL sto_par( kstp )          ! Stochastic parameters 
     114      IF( ln_sto_eos ) CALL sto_par( kstp )          ! Stochastic parameters 
     115      IF( ln_sto_eos ) CALL sto_pts( tsn  )          ! Random T/S fluctuations 
    115116 
    116117      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
     
    154155      ! 
    155156      IF( l_ldfslp ) THEN                             ! slope of lateral mixing 
    156 !!gm : why this here ???? 
    157          IF(ln_sto_eos ) CALL sto_pts( tsn )          ! Random T/S fluctuations 
    158 !!gm 
    159157                         CALL eos( tsb, rhd, gdept_0(:,:,:) )               ! before in situ density 
    160158 
     
    183181      IF(.NOT.ln_linssh )   CALL dom_vvl_sf_nxt( kstp )  ! after vertical scale factors  
    184182                            CALL wzv           ( kstp )  ! now cross-level velocity  
    185 !!gm : why also here ???? 
    186       IF( ln_sto_eos    )   CALL sto_pts( tsn )                             ! Random T/S fluctuations 
    187 !!gm 
    188183                            CALL eos    ( tsn, rhd, rhop, gdept_n(:,:,:) )  ! now in situ density for hpg computation 
    189184                             
     
    306301!!jc: That would be better, but see comment above 
    307302!! 
    308       IF( lrst_oce   )   CALL rst_write     ( kstp )  ! write output ocean restart file 
     303      IF( lrst_oce         )   CALL rst_write    ( kstp )   ! write output ocean restart file 
     304      IF( ln_sto_eos       )   CALL sto_rst_write( kstp )   ! write restart file for stochastic parameters 
    309305 
    310306#if defined key_agrif 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/OPA_SRC/timing.F90

    • Property svn:executable deleted
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zche.F90

    r6291 r7341  
    3131   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sio3eq   ! chemistry of Si 
    3232   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   fekeq    ! chemistry of Fe 
    33    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,: ::   chemc    ! Solubilities of O2 and CO2 
     33   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   chemc    ! Solubilities of O2 and CO2 
    3434   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   chemo2   ! Solubilities of O2 and CO2 
     35   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tempis   ! In situ temperature 
    3536 
    3637   REAL(wp), PUBLIC ::   atcox  = 0.20946         ! units atm 
     
    3940   REAL(wp) ::   o2atm  = 1. / ( 1000. * 0.20946 )   
    4041 
    41    REAL(wp) ::   akcc1  = -171.9065       ! coeff. for apparent solubility equilibrium 
    42    REAL(wp) ::   akcc2  =   -0.077993     ! Millero et al. 1995 from Mucci 1983 
    43    REAL(wp) ::   akcc3  = 2839.319         
    44    REAL(wp) ::   akcc4  =   71.595         
    45    REAL(wp) ::   akcc5  =   -0.77712       
    46    REAL(wp) ::   akcc6  =    0.00284263    
    47    REAL(wp) ::   akcc7  =  178.34         
    48    REAL(wp) ::   akcc8  =   -0.07711      
    49    REAL(wp) ::   akcc9  =    0.0041249    
    50  
    51    REAL(wp) ::   rgas   = 83.143         ! universal gas constants 
     42   REAL(wp) ::   rgas   = 83.14472       ! universal gas constants 
    5243   REAL(wp) ::   oxyco  = 1. / 22.4144   ! converts from liters of an ideal gas to moles 
    5344 
    5445   REAL(wp) ::   bor1   = 0.00023        ! borat constants 
    5546   REAL(wp) ::   bor2   = 1. / 10.82 
    56  
    57    REAL(wp) ::   ca0    = -162.8301      ! WEISS & PRICE 1980, units mol/(kg atm) 
    58    REAL(wp) ::   ca1    =  218.2968 
    59    REAL(wp) ::   ca2    =   90.9241 
    60    REAL(wp) ::   ca3    =   -1.47696 
    61    REAL(wp) ::   ca4    =    0.025695 
    62    REAL(wp) ::   ca5    =   -0.025225 
    63    REAL(wp) ::   ca6    =    0.0049867 
    64  
    65    REAL(wp) ::   c10    = -3670.7        ! Coeff. for 1. dissoc. of carbonic acid (Edmond and Gieskes, 1970)    
    66    REAL(wp) ::   c11    =    62.008      
    67    REAL(wp) ::   c12    =    -9.7944     
    68    REAL(wp) ::   c13    =     0.0118      
    69    REAL(wp) ::   c14    =    -0.000116 
    70  
    71    REAL(wp) ::   c20    = -1394.7       ! coeff. for 2. dissoc. of carbonic acid (Millero, 1995)    
    72    REAL(wp) ::   c21    =    -4.777    
    73    REAL(wp) ::   c22    =     0.0184    
    74    REAL(wp) ::   c23    =    -0.000118 
    7547 
    7648   REAL(wp) ::   st1    =      0.14     ! constants for calculate concentrations for sulfate 
     
    144116      REAL(wp) ::   ztgg , ztgg2, ztgg3 , ztgg4 , ztgg5 
    145117      REAL(wp) ::   zpres, ztc  , zcl   , zcpexp, zoxy  , zcpexp2 
    146       REAL(wp) ::   zsqrt, ztr  , zlogt , zcek1 
    147       REAL(wp) ::   zis  , zis2 , zsal15, zisqrt 
     118      REAL(wp) ::   zsqrt, ztr  , zlogt , zcek1, zc1, zplat 
     119      REAL(wp) ::   zis  , zis2 , zsal15, zisqrt, za1  , za2 
    148120      REAL(wp) ::   zckb , zck1 , zck2  , zckw  , zak1 , zak2  , zakb , zaksp0, zakw 
    149121      REAL(wp) ::   zst  , zft  , zcks  , zckf  , zaksp1 
     
    151123      ! 
    152124      IF( nn_timing == 1 )  CALL timing_start('p4z_che') 
     125      ! 
     126      ! Computations of chemical constants require in situ temperature 
     127      ! Here a quite simple formulation is used to convert  
     128      ! potential temperature to in situ temperature. The errors is less than  
     129      ! 0.04°C relative to an exact computation 
     130      ! --------------------------------------------------------------------- 
     131      DO jk = 1, jpk 
     132         DO jj = 1, jpj 
     133            DO ji = 1, jpi 
     134               zpres = gdept_n(ji,jj,jk) / 1000. 
     135               za1 = 0.04 * ( 1.0 + 0.185 * tsn(ji,jj,jk,jp_tem) + 0.035 * (tsn(ji,jj,jk,jp_sal) - 35.0) ) 
     136               za2 = 0.0075 * ( 1.0 - tsn(ji,jj,jk,jp_tem) / 30.0 ) 
     137               tempis(ji,jj,jk) = tsn(ji,jj,jk,jp_tem) - za1 * zpres + za2 * zpres**2 
     138            END DO 
     139         END DO 
     140      END DO 
    153141      ! 
    154142      ! CHEMICAL CONSTANTS - SURFACE LAYER 
     
    157145         DO ji = 1, jpi 
    158146            !                             ! SET ABSOLUTE TEMPERATURE 
    159             ztkel = tsn(ji,jj,1,jp_tem) + 273.15 
     147            ztkel = tempis(ji,jj,1) + 273.15 
    160148            zt    = ztkel * 0.01 
    161149            zt2   = zt * zt 
     
    165153            !                             ! LN(K0) OF SOLUBILITY OF CO2 (EQ. 12, WEISS, 1980) 
    166154            !                             !     AND FOR THE ATMOSPHERE FOR NON IDEAL GAS 
    167             zcek1 = ca0 + ca1 / zt + ca2 * zlogt + ca3 * zt2 + zsal * ( ca4 + ca5 * zt + ca6 * zt2 ) 
     155            zcek1 = 9345.17/ztkel - 60.2409 + 23.3585 * LOG(zt) + zsal*(0.023517 - 0.00023656*ztkel    & 
     156            &       + 0.0047036e-4*ztkel**2) 
    168157            !                             ! SET SOLUBILITIES OF O2 AND CO2  
    169             chemc(ji,jj) = EXP( zcek1 ) * 1.e-6 * rhop(ji,jj,1) / 1000.  ! mol/(L uatm) 
     158            chemc(ji,jj,1) = EXP( zcek1 ) * 1.e-6 * rhop(ji,jj,1) / 1000. ! mol/(kg uatm) 
     159            chemc(ji,jj,2) = -1636.75 + 12.0408*ztkel - 0.0327957*ztkel**2 + 0.0000316528*ztkel**3 
     160            chemc(ji,jj,3) = 57.7 - 0.118*ztkel 
    170161            ! 
    171162         END DO 
     
    177168         DO jj = 1, jpj 
    178169            DO ji = 1, jpi 
    179               ztkel = tsn(ji,jj,jk,jp_tem) + 273.15 
     170              ztkel = tempis(ji,jj,jk) + 273.15 
    180171              zsal  = tsn(ji,jj,jk,jp_sal) + ( 1.- tmask(ji,jj,jk) ) * 35. 
    181172              zsal2 = zsal * zsal 
    182               ztgg  = LOG( ( 298.15 - tsn(ji,jj,jk,jp_tem) ) / ztkel )  ! Set the GORDON & GARCIA scaled temperature 
     173              ztgg  = LOG( ( 298.15 - tempis(ji,jj,jk) ) / ztkel )  ! Set the GORDON & GARCIA scaled temperature 
    183174              ztgg2 = ztgg  * ztgg 
    184175              ztgg3 = ztgg2 * ztgg 
     
    200191            DO ji = 1, jpi 
    201192 
    202                ! SET PRESSION 
    203                zpres   = 1.025e-1 * gdept_n(ji,jj,jk) 
     193               ! SET PRESSION ACCORDING TO SAUNDER (1980) 
     194               zplat   = SIN ( ABS(gphit(ji,jj)*3.141592654/180.) ) 
     195               zc1 = 5.92E-3 + zplat**2 * 5.25E-3 
     196               zpres = ((1-zc1)-SQRT(((1-zc1)**2)-(8.84E-6*gdept_n(ji,jj,jk)))) / 4.42E-6 
     197               zpres = zpres / 10.0 
    204198 
    205199               ! SET ABSOLUTE TEMPERATURE 
    206                ztkel   = tsn(ji,jj,jk,jp_tem) + 273.15 
     200               ztkel   = tempis(ji,jj,jk) + 273.15 
    207201               zsal    = tsn(ji,jj,jk,jp_sal) + ( 1.-tmask(ji,jj,jk) ) * 35. 
    208202               zsqrt  = SQRT( zsal ) 
     
    213207               zis2   = zis * zis 
    214208               zisqrt = SQRT( zis ) 
    215                ztc     = tsn(ji,jj,jk,jp_tem) + ( 1.- tmask(ji,jj,jk) ) * 20. 
     209               ztc     = tempis(ji,jj,jk) + ( 1.- tmask(ji,jj,jk) ) * 20. 
    216210 
    217211               ! CHLORINITY (WOOSTER ET AL., 1969) 
     
    246240 
    247241 
    248                zck1    = c10 * ztr + c11 + c12 * zlogt + c13 * zsal + c14 * zsal * zsal 
    249                zck2    = c20 * ztr + c21 + c22 * zsal   + c23 * zsal**2 
     242               ! DISSOCIATION COEFFICIENT FOR CARBONATE ACCORDING TO  
     243               ! MEHRBACH (1973) REFIT BY MILLERO (1995), seawater scale 
     244               zck1    = -1.0*(3633.86*ztr - 61.2172 + 9.6777*zlogt  & 
     245                  - 0.011555*zsal + 0.0001152*zsal*zsal) 
     246               zck2    = -1.0*(471.78*ztr + 25.9290 - 3.16967*zlogt      & 
     247                  - 0.01781*zsal + 0.0001122*zsal*zsal) 
    250248 
    251249               ! PKW (H2O) (DICKSON AND RILEY, 1979) 
     
    256254               ! APPARENT SOLUBILITY PRODUCT K'SP OF CALCITE IN SEAWATER 
    257255               !       (S=27-43, T=2-25 DEG C) at pres =0 (atmos. pressure) (MUCCI 1983) 
    258                zaksp0  = akcc1 + akcc2 * ztkel + akcc3 * ztr + akcc4 * LOG10( ztkel )   & 
    259                   &   + ( akcc5 + akcc6 * ztkel + akcc7 * ztr ) * zsqrt + akcc8 * zsal + akcc9 * zsal15 
     256               zaksp0  = -171.9065 -0.077993*ztkel + 2839.319*ztr + 71.595*LOG10( ztkel )   & 
     257                  &      + (-0.77712 + 0.00284263*ztkel + 178.34*ztr) * zsqrt  & 
     258                  &      - 0.07711*zsal + 0.0041249*zsal15 
    260259 
    261260               ! K1, K2 OF CARBONIC ACID, KB OF BORIC ACID, KW (H2O) (LIT.?) 
     
    327326      !!                     ***  ROUTINE p4z_che_alloc  *** 
    328327      !!---------------------------------------------------------------------- 
    329       ALLOCATE( sio3eq(jpi,jpj,jpk), fekeq(jpi,jpj,jpk), chemc(jpi,jpj), chemo2(jpi,jpj,jpk),   & 
    330       &         STAT=p4z_che_alloc ) 
     328      ALLOCATE( sio3eq(jpi,jpj,jpk), fekeq(jpi,jpj,jpk), chemc(jpi,jpj,3), chemo2(jpi,jpj,jpk),   & 
     329      &         tempis(jpi,jpj,jpk), STAT=p4z_che_alloc ) 
    331330      ! 
    332331      IF( p4z_che_alloc /= 0 )   CALL ctl_warn('p4z_che_alloc : failed to allocate arrays.') 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zflx.F90

    r6291 r7341  
    8484      REAL(wp) ::   ztc, ztc2, ztc3, ztc4, zws, zkgwan 
    8585      REAL(wp) ::   zfld, zflu, zfld16, zflu16, zfact 
     86      REAL(wp) ::   zvapsw, zsal, zfco2, zxc2, xCO2approx, ztkel, zfugcoeff 
    8687      REAL(wp) ::   zph, zah2, zbot, zdic, zalk, zsch_o2, zalka, zsch_co2 
    8788      REAL(wp) ::   zyr_dec, zdco2dt 
    8889      CHARACTER (len=25) :: charout 
    89       REAL(wp), POINTER, DIMENSION(:,:) :: zkgco2, zkgo2, zh2co3, zoflx, zw2d  
     90      REAL(wp), POINTER, DIMENSION(:,:) :: zkgco2, zkgo2, zh2co3, zoflx, zw2d, zpco2atm  
    9091      !!--------------------------------------------------------------------- 
    9192      ! 
    9293      IF( nn_timing == 1 )  CALL timing_start('p4z_flx') 
    9394      ! 
    94       CALL wrk_alloc( jpi, jpj, zkgco2, zkgo2, zh2co3, zoflx ) 
     95      CALL wrk_alloc( jpi, jpj, zkgco2, zkgo2, zh2co3, zoflx, zpco2atm ) 
    9596      ! 
    9697 
     
    177178      DO jj = 1, jpj 
    178179         DO ji = 1, jpi 
     180            ztkel     = tsn(ji,jj,1,jp_tem) + 273.15 
     181            zsal      = tsn(ji,jj,1,jp_sal) + ( 1.- tmask(ji,jj,1) ) * 35. 
     182            zvapsw    = EXP(24.4543 - 67.4509*(100.0/ztkel) - 4.8489*LOG(ztkel/100) - 0.000544*zsal) 
     183            zpco2atm(ji,jj) = satmco2(ji,jj) * ( patm(ji,jj) - zvapsw ) 
     184            zxc2      = ( 1.0 - zpco2atm(ji,jj) * 1E-6 )**2 
     185            zfugcoeff = EXP( patm(ji,jj) * (chemc(ji,jj,2) + 2.0 * zxc2 * chemc(ji,jj,3) )   & 
     186            &           / ( 82.05736 * ztkel )) 
     187            zfco2 = zpco2atm(ji,jj) * zfugcoeff 
     188 
    179189            ! Compute CO2 flux for the sea and air 
    180             zfld = satmco2(ji,jj) * patm(ji,jj) * tmask(ji,jj,1) * chemc(ji,jj) * zkgco2(ji,jj)   ! (mol/L) * (m/s) 
    181             zflu = zh2co3(ji,jj) * tmask(ji,jj,1) * zkgco2(ji,jj)                                   ! (mol/L) (m/s) ? 
     190            zfld = zfco2 * chemc(ji,jj,1) * zkgco2(ji,jj)  ! (mol/L) * (m/s) 
     191            zflu = zh2co3(ji,jj) * zkgco2(ji,jj)                                   ! (mol/L) (m/s) ? 
    182192            oce_co2(ji,jj) = ( zfld - zflu ) * rfact2 * e1e2t(ji,jj) * tmask(ji,jj,1) * 1000. 
    183193            ! compute the trend 
    184             tra(ji,jj,1,jpdic) = tra(ji,jj,1,jpdic) + ( zfld - zflu ) * rfact2 / e3t_n(ji,jj,1) 
     194            tra(ji,jj,1,jpdic) = tra(ji,jj,1,jpdic) + ( zfld - zflu ) * rfact2 / e3t_n(ji,jj,1) * tmask(ji,jj,1) 
    185195 
    186196            ! Compute O2 flux  
    187             zfld16 = patm(ji,jj) * chemo2(ji,jj,1) * tmask(ji,jj,1) * zkgo2(ji,jj)          ! (mol/L) * (m/s) 
    188             zflu16 = trb(ji,jj,1,jpoxy) * tmask(ji,jj,1) * zkgo2(ji,jj) 
    189             zoflx(ji,jj) = zfld16 - zflu16 
     197            zfld16 = patm(ji,jj) * chemo2(ji,jj,1) * zkgo2(ji,jj)          ! (mol/L) * (m/s) 
     198            zflu16 = trb(ji,jj,1,jpoxy) * zkgo2(ji,jj) 
     199            zoflx(ji,jj) = ( zfld16 - zflu16 ) * tmask(ji,jj,1) 
    190200            tra(ji,jj,1,jpoxy) = tra(ji,jj,1,jpoxy) + zoflx(ji,jj) * rfact2 / e3t_n(ji,jj,1) 
    191201         END DO 
     
    218228         ENDIF 
    219229         IF( iom_use( "Dpco2" ) ) THEN 
    220            zw2d(:,:) = ( satmco2(:,:) * patm(:,:) - zh2co3(:,:) / ( chemc(:,:) + rtrn ) ) * tmask(:,:,1) 
     230           zw2d(:,:) = ( zpco2atm(:,:) - zh2co3(:,:) / ( chemc(:,:,1) + rtrn ) ) * tmask(:,:,1) 
    221231           CALL iom_put( "Dpco2" ,  zw2d ) 
    222232         ENDIF 
     
    234244            trc2d(:,:,jp_pcs0_2d + 1) = zoflx(:,:) * 1000 * tmask(:,:,1)  
    235245            trc2d(:,:,jp_pcs0_2d + 2) = zkgco2(:,:) * tmask(:,:,1)  
    236             trc2d(:,:,jp_pcs0_2d + 3) = ( satmco2(:,:) * patm(:,:) - zh2co3(:,:) / ( chemc(:,:) + rtrn ) ) * tmask(:,:,1)  
    237          ENDIF 
    238       ENDIF 
    239       ! 
    240       CALL wrk_dealloc( jpi, jpj, zkgco2, zkgo2, zh2co3, zoflx ) 
     246            trc2d(:,:,jp_pcs0_2d + 3) = ( zpco2atm(:,:) - zh2co3(:,:) / ( chemc(:,:,1) + rtrn ) ) * tmask(:,:,1)  
     247         ENDIF 
     248      ENDIF 
     249      ! 
     250      CALL wrk_dealloc( jpi, jpj, zkgco2, zkgo2, zh2co3, zoflx, zpco2atm ) 
    241251      ! 
    242252      IF( nn_timing == 1 )  CALL timing_stop('p4z_flx') 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlim.F90

    r5836 r7341  
    4444   REAL(wp), PUBLIC ::  xkdoc       !:  2nd half-sat. of DOC remineralization   
    4545   REAL(wp), PUBLIC ::  concbfe     !:  Fe half saturation for bacteria  
     46   REAL(wp), PUBLIC ::  oxymin      !:  half saturation constant for anoxia 
    4647   REAL(wp), PUBLIC ::  qnfelim     !:  optimal Fe quota for nanophyto 
    4748   REAL(wp), PUBLIC ::  qdfelim     !:  optimal Fe quota for diatoms 
     
    186187      END DO 
    187188      ! 
     189      DO jk = 1, jpkm1 
     190         DO jj = 1, jpj 
     191            DO ji = 1, jpi 
     192               ! denitrification factor computed from O2 levels 
     193               nitrfac(ji,jj,jk) = MAX(  0.e0, 0.4 * ( 6.e-6  - trb(ji,jj,jk,jpoxy) )    & 
     194                  &                                / ( oxymin + trb(ji,jj,jk,jpoxy) )  ) 
     195               nitrfac(ji,jj,jk) = MIN( 1., nitrfac(ji,jj,jk) ) 
     196            END DO 
     197         END DO 
     198      END DO 
    188199      ! 
    189200      IF( lk_iomput .AND. knt == nrdttrc ) THEN        ! save output diagnostics 
     
    215226      NAMELIST/nampislim/ concnno3, concdno3, concnnh4, concdnh4, concnfer, concdfer, concbfe,   & 
    216227         &                concbno3, concbnh4, xsizedia, xsizephy, xsizern, xsizerd,          &  
    217          &                xksi1, xksi2, xkdoc, qnfelim, qdfelim, caco3r 
     228         &                xksi1, xksi2, xkdoc, qnfelim, qdfelim, caco3r, oxymin 
    218229      INTEGER :: ios                 ! Local integer output status for namelist read 
    219230 
     
    248259         WRITE(numout,*) '    Minimum size criteria for nanophyto      xsizephy  = ', xsizephy 
    249260         WRITE(numout,*) '    Fe half saturation for bacteria          concbfe   = ', concbfe 
     261         WRITE(numout,*) '    halk saturation constant for anoxia       oxymin   =' , oxymin 
    250262         WRITE(numout,*) '    optimal Fe quota for nano.               qnfelim   = ', qnfelim 
    251263         WRITE(numout,*) '    Optimal Fe quota for diatoms             qdfelim   = ', qdfelim 
    252264      ENDIF 
    253  
     265      ! 
     266      nitrfac (:,:,:) = 0._wp 
     267      ! 
    254268   END SUBROUTINE p4z_lim_init 
    255269 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlys.F90

    r6291 r7341  
    6565      REAL(wp) ::   zomegaca, zexcess, zexcess0 
    6666      CHARACTER (len=25) :: charout 
    67       REAL(wp), POINTER, DIMENSION(:,:,:) :: zco3, zcaldiss    
     67      REAL(wp), POINTER, DIMENSION(:,:,:) :: zco3, zco3sat, zcaldiss    
    6868      !!--------------------------------------------------------------------- 
    6969      ! 
    7070      IF( nn_timing == 1 )  CALL timing_start('p4z_lys') 
    7171      ! 
    72       CALL wrk_alloc( jpi, jpj, jpk, zco3, zcaldiss ) 
     72      CALL wrk_alloc( jpi, jpj, jpk, zco3, zco3sat, zcaldiss ) 
    7373      ! 
    7474      zco3    (:,:,:) = 0. 
     
    117117               zcalcon  = calcon * ( tsn(ji,jj,jk,jp_sal) / 35._wp ) 
    118118               zfact    = rhop(ji,jj,jk) / 1000._wp 
    119                zomegaca = ( zcalcon * zco3(ji,jj,jk) * zfact ) / aksp(ji,jj,jk)  
     119               zomegaca = ( zcalcon * zco3(ji,jj,jk) ) / ( aksp(ji,jj,jk) * zfact + rtrn ) 
     120               zco3sat(ji,jj,jk) = aksp(ji,jj,jk) * zfact / ( zcalcon + rtrn ) 
    120121 
    121122               ! SET DEGREE OF UNDER-/SUPERSATURATION 
     
    146147      IF( lk_iomput .AND. knt == nrdttrc ) THEN 
    147148         IF( iom_use( "PH"     ) ) CALL iom_put( "PH"    , -1. * LOG10( hi(:,:,:) )          * tmask(:,:,:) ) 
    148          IF( iom_use( "CO3"    ) ) CALL iom_put( "CO3"   , zco3(:,:,:) * 1.e+3               * tmask(:,:,:) ) 
    149          IF( iom_use( "CO3sat" ) ) CALL iom_put( "CO3sat", aksp(:,:,:) * 1.e+3 / calcon      * tmask(:,:,:) ) 
    150          IF( iom_use( "DCAL"   ) ) CALL iom_put( "DCAL"  , zcaldiss(:,:,:) * 1.e+3 * rfact2r   * tmask(:,:,:) ) 
     149         IF( iom_use( "CO3"    ) ) CALL iom_put( "CO3"   , zco3(:,:,:)    * 1.e+3            * tmask(:,:,:) ) 
     150         IF( iom_use( "CO3sat" ) ) CALL iom_put( "CO3sat", zco3sat(:,:,:) * 1.e+3            * tmask(:,:,:) ) 
     151         IF( iom_use( "DCAL"   ) ) CALL iom_put( "DCAL"  , zcaldiss(:,:,:) * 1.e+3 * rfact2r * tmask(:,:,:) ) 
    151152      ELSE 
    152153         IF( ln_diatrc ) THEN 
    153154            trc3d(:,:,:,jp_pcs0_3d    ) = -1. * LOG10( hi(:,:,:) ) * tmask(:,:,:) 
    154155            trc3d(:,:,:,jp_pcs0_3d + 1) = zco3(:,:,:)              * tmask(:,:,:) 
    155             trc3d(:,:,:,jp_pcs0_3d + 2) = aksp(:,:,:) / calcon     * tmask(:,:,:) 
     156            trc3d(:,:,:,jp_pcs0_3d + 2) = zco3sat(:,:,:)           * tmask(:,:,:) 
    156157         ENDIF 
    157158      ENDIF 
     
    163164      ENDIF 
    164165      ! 
    165       CALL wrk_dealloc( jpi, jpj, jpk, zco3, zcaldiss ) 
     166      CALL wrk_dealloc( jpi, jpj, jpk, zco3, zco3sat, zcaldiss ) 
    166167      ! 
    167168      IF( nn_timing == 1 )  CALL timing_stop('p4z_lys') 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zopt.F90

    r6140 r7341  
    7474      REAL(wp) ::   zchl 
    7575      REAL(wp) ::   zc0 , zc1 , zc2, zc3, z1_dep 
    76       REAL(wp), POINTER, DIMENSION(:,:  ) :: zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4, zqsr100 
     76      REAL(wp), POINTER, DIMENSION(:,:  ) :: zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4 
     77      REAL(wp), POINTER, DIMENSION(:,:  ) :: zqsr100, zqsr_corr 
    7778      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpar, ze0, ze1, ze2, ze3 
    7879      !!--------------------------------------------------------------------- 
     
    8182      ! 
    8283      ! Allocate temporary workspace 
    83       CALL wrk_alloc( jpi, jpj,      zqsr100, zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4 ) 
    84       CALL wrk_alloc( jpi, jpj, jpk, zpar, ze0, ze1, ze2, ze3 ) 
     84      CALL wrk_alloc( jpi, jpj,      zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4 ) 
     85      CALL wrk_alloc( jpi, jpj,      zqsr100, zqsr_corr ) 
     86      CALL wrk_alloc( jpi, jpj, jpk, zpar   , ze0, ze1, ze2, ze3 ) 
    8587 
    8688      IF( knt == 1 .AND. ln_varpar ) CALL p4z_opt_sbc( kt ) 
     
    108110      !                                        !  -------------------------------------- 
    109111      IF( l_trcdm2dc ) THEN                     !  diurnal cycle 
    110          ! 1% of qsr to compute euphotic layer 
    111          zqsr100(:,:) = 0.01 * qsr_mean(:,:)     !  daily mean qsr 
    112          ! 
    113          CALL p4z_opt_par( kt, qsr_mean, ze1, ze2, ze3 )  
     112         ! 
     113         zqsr_corr(:,:) = qsr_mean(:,:) / ( 1. - fr_i(:,:) + rtrn ) 
     114         ! 
     115         CALL p4z_opt_par( kt, zqsr_corr, ze1, ze2, ze3, pqsr100 = zqsr100 )  
    114116         ! 
    115117         DO jk = 1, nksrp       
     
    119121         END DO 
    120122         ! 
    121          CALL p4z_opt_par( kt, qsr, ze1, ze2, ze3 )  
     123         zqsr_corr(:,:) = qsr(:,:) / ( 1. - fr_i(:,:) + rtrn ) 
     124         ! 
     125         CALL p4z_opt_par( kt, zqsr_corr, ze1, ze2, ze3 )  
    122126         ! 
    123127         DO jk = 1, nksrp       
     
    126130         ! 
    127131      ELSE 
    128          ! 1% of qsr to compute euphotic layer 
    129          zqsr100(:,:) = 0.01 * qsr(:,:) 
    130          ! 
    131          CALL p4z_opt_par( kt, qsr, ze1, ze2, ze3 )  
     132         ! 
     133         zqsr_corr(:,:) = qsr(:,:) / ( 1. - fr_i(:,:) + rtrn ) 
     134         ! 
     135         CALL p4z_opt_par( kt, zqsr_corr, ze1, ze2, ze3, pqsr100 = zqsr100 )  
    132136         ! 
    133137         DO jk = 1, nksrp       
     
    157161         DO jj = 1, jpj 
    158162           DO ji = 1, jpi 
    159               IF( etot_ndcy(ji,jj,jk) * tmask(ji,jj,jk) >= 0.43 * zqsr100(ji,jj) )  THEN 
     163              IF( etot_ndcy(ji,jj,jk) * tmask(ji,jj,jk) >= zqsr100(ji,jj) )  THEN 
    160164                 neln(ji,jj) = jk+1                    ! Euphotic level : 1rst T-level strictly below Euphotic layer 
    161165                 !                                     ! nb: ensure the compatibility with nmld_trc definition in trd_mld_trc_zint 
     
    218222      ENDIF 
    219223      ! 
    220       CALL wrk_dealloc( jpi, jpj,      zqsr100, zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4 ) 
    221       CALL wrk_dealloc( jpi, jpj, jpk, zpar,  ze0, ze1, ze2, ze3 ) 
     224      CALL wrk_dealloc( jpi, jpj,      zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4 ) 
     225      CALL wrk_dealloc( jpi, jpj,      zqsr100, zqsr_corr ) 
     226      CALL wrk_dealloc( jpi, jpj, jpk, zpar   ,  ze0, ze1, ze2, ze3 ) 
    222227      ! 
    223228      IF( nn_timing == 1 )  CALL timing_stop('p4z_opt') 
     
    225230   END SUBROUTINE p4z_opt 
    226231 
    227    SUBROUTINE p4z_opt_par( kt, pqsr, pe1, pe2, pe3, pe0 )  
     232   SUBROUTINE p4z_opt_par( kt, pqsr, pe1, pe2, pe3, pe0, pqsr100 )  
    228233      !!---------------------------------------------------------------------- 
    229234      !!                  ***  routine p4z_opt_par  *** 
     
    238243      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout)           ::  pe1 , pe2 , pe3   !  PAR ( R-G-B) 
    239244      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout), OPTIONAL ::  pe0   
     245      REAL(wp), DIMENSION(jpi,jpj)    , INTENT(out)  , OPTIONAL  ::  pqsr100   
    240246      !! * local variables 
    241247      INTEGER    ::   ji, jj, jk     ! dummy loop indices 
     
    247253      ELSE                  ;  zqsr(:,:) = xparsw         * pqsr(:,:) 
    248254      ENDIF 
    249       ! 
     255       
     256      !  Light at the euphotic depth  
     257      IF( PRESENT( pqsr100 ) )  pqsr100(:,:) = 0.01 * 3. * zqsr(:,:) 
     258 
    250259      IF( PRESENT( pe0 ) ) THEN     !  W-level 
    251260         ! 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zprod.F90

    r6140 r7341  
    133133                  zval = MAX( 1., zstrn(ji,jj) ) 
    134134                  zval = 1.5 * zval / ( 12. + zval ) 
    135                   zprbio(ji,jj,jk) = prmax(ji,jj,jk) * zval 
     135                  zprbio(ji,jj,jk) = prmax(ji,jj,jk) * zval * ( 1. - fr_i(ji,jj) ) 
    136136                  zprdia(ji,jj,jk) = zprbio(ji,jj,jk) 
    137137               ENDIF 
     
    279279                  zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * zmixdiat(ji,jj) 
    280280               ENDIF 
     281               zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * ( 1. - fr_i(ji,jj) ) 
     282               zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * ( 1. - fr_i(ji,jj) ) 
    281283            END DO 
    282284         END DO 
     
    315317      END DO 
    316318 
    317       IF( ln_newprod ) THEN 
    318          DO jk = 1, jpkm1 
    319             DO jj = 1, jpj 
    320                DO ji = 1, jpi 
    321                   IF( gdepw_n(ji,jj,jk+1) <= hmld(ji,jj) ) THEN 
    322                      zprnch(ji,jj,jk) = zprnch(ji,jj,jk) * zmixnano(ji,jj) 
    323                      zprdch(ji,jj,jk) = zprdch(ji,jj,jk) * zmixdiat(ji,jj) 
    324                   ENDIF 
    325                   IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN 
    326                      !  production terms for nanophyto. ( chlorophyll ) 
    327                      znanotot = enano(ji,jj,jk) * zstrn(ji,jj) 
    328                      zprod    = rday * zprorca(ji,jj,jk) * zprnch(ji,jj,jk) * xlimphy(ji,jj,jk) 
    329                      zprochln(ji,jj,jk) = chlcmin * 12. * zprorca (ji,jj,jk) 
    330                      zprochln(ji,jj,jk) = zprochln(ji,jj,jk) + (chlcnm-chlcmin) * 12. * zprod / & 
    331                                         & (  zpislopead(ji,jj,jk) * znanotot +rtrn) 
    332                      !  production terms for diatomees ( chlorophyll ) 
    333                      zdiattot = ediat(ji,jj,jk) * zstrn(ji,jj) 
    334                      zprod = rday * zprorcad(ji,jj,jk) * zprdch(ji,jj,jk) * xlimdia(ji,jj,jk) 
    335                      zprochld(ji,jj,jk) = chlcmin * 12. * zprorcad(ji,jj,jk) 
    336                      zprochld(ji,jj,jk) = zprochld(ji,jj,jk) + (chlcdm-chlcmin) * 12. * zprod / & 
    337                                         & ( zpislopead2(ji,jj,jk) * zdiattot +rtrn ) 
    338                   ENDIF 
    339                END DO 
    340             END DO 
    341          END DO 
    342       ELSE 
    343          DO jk = 1, jpkm1 
    344             DO jj = 1, jpj 
    345                DO ji = 1, jpi 
    346                   IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN 
    347                      !  production terms for nanophyto. ( chlorophyll ) 
    348                      znanotot = enano(ji,jj,jk) 
    349                      zprod = rday * zprorca(ji,jj,jk) * zprnch(ji,jj,jk) * trb(ji,jj,jk,jpphy) * xlimphy(ji,jj,jk) 
    350                      zprochln(ji,jj,jk) = chlcmin * 12. * zprorca (ji,jj,jk) 
    351                      zprochln(ji,jj,jk) = zprochln(ji,jj,jk) + (chlcnm-chlcmin) * 144. * zprod            & 
    352                      &                    / ( zpislopead(ji,jj,jk) * trb(ji,jj,jk,jpnch) * znanotot +rtrn ) 
    353                      !  production terms for diatomees ( chlorophyll ) 
    354                      zdiattot = ediat(ji,jj,jk) 
    355                      zprod = rday * zprorcad(ji,jj,jk) * zprdch(ji,jj,jk) * trb(ji,jj,jk,jpdia) * xlimdia(ji,jj,jk) 
    356                      zprochld(ji,jj,jk) = chlcmin * 12. * zprorcad(ji,jj,jk) 
    357                      zprochld(ji,jj,jk) = zprochld(ji,jj,jk) + (chlcdm-chlcmin) * 144. * zprod             & 
    358                      &                    / ( zpislopead2(ji,jj,jk) * trb(ji,jj,jk,jpdch) * zdiattot +rtrn ) 
    359                   ENDIF 
    360                END DO 
    361             END DO 
    362          END DO 
    363       ENDIF 
     319      DO jk = 1, jpkm1 
     320         DO jj = 1, jpj 
     321            DO ji = 1, jpi 
     322               IF( gdepw_n(ji,jj,jk+1) <= hmld(ji,jj) ) THEN 
     323                  zprnch(ji,jj,jk) = zprnch(ji,jj,jk) * zmixnano(ji,jj) 
     324                  zprdch(ji,jj,jk) = zprdch(ji,jj,jk) * zmixdiat(ji,jj) 
     325               ENDIF 
     326               IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN 
     327                  !  production terms for nanophyto. ( chlorophyll ) 
     328                  znanotot = enano(ji,jj,jk) * zstrn(ji,jj) 
     329                  zprod    = rday * zprorca(ji,jj,jk) * zprnch(ji,jj,jk) * xlimphy(ji,jj,jk) 
     330                  zprochln(ji,jj,jk) = chlcmin * 12. * zprorca (ji,jj,jk) 
     331                  zprochln(ji,jj,jk) = zprochln(ji,jj,jk) + (chlcnm-chlcmin) * 12. * zprod / & 
     332                                     & (  zpislopead(ji,jj,jk) * znanotot +rtrn) 
     333                  !  production terms for diatomees ( chlorophyll ) 
     334                  zdiattot = ediat(ji,jj,jk) * zstrn(ji,jj) 
     335                  zprod = rday * zprorcad(ji,jj,jk) * zprdch(ji,jj,jk) * xlimdia(ji,jj,jk) 
     336                  zprochld(ji,jj,jk) = chlcmin * 12. * zprorcad(ji,jj,jk) 
     337                  zprochld(ji,jj,jk) = zprochld(ji,jj,jk) + (chlcdm-chlcmin) * 12. * zprod / & 
     338                                     & ( zpislopead2(ji,jj,jk) * zdiattot +rtrn ) 
     339               ENDIF 
     340            END DO 
     341         END DO 
     342      END DO 
    364343 
    365344      !   Update the arrays TRA which contain the biological sources and sinks 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zrem.F90

    r6140 r7341  
    4444   REAL(wp), PUBLIC ::  xsiremlab  !: fast remineralisation rate of POC  
    4545   REAL(wp), PUBLIC ::  xsilab     !: fraction of labile biogenic silica  
    46    REAL(wp), PUBLIC ::  oxymin     !: halk saturation constant for anoxia  
    4746 
    4847 
     
    109108                  zdepprod(ji,jj,jk) = zdepmin**0.273 
    110109               ENDIF 
    111             END DO 
    112          END DO 
    113       END DO 
    114  
    115       DO jk = 1, jpkm1 
    116          DO jj = 1, jpj 
    117             DO ji = 1, jpi 
    118                ! denitrification factor computed from O2 levels 
    119                nitrfac(ji,jj,jk) = MAX(  0.e0, 0.4 * ( 6.e-6  - trb(ji,jj,jk,jpoxy) )    & 
    120                   &                                / ( oxymin + trb(ji,jj,jk,jpoxy) )  ) 
    121                nitrfac(ji,jj,jk) = MIN( 1., nitrfac(ji,jj,jk) ) 
    122110            END DO 
    123111         END DO 
     
    355343      !! 
    356344      !!---------------------------------------------------------------------- 
    357       NAMELIST/nampisrem/ xremik, xremip, nitrif, xsirem, xsiremlab, xsilab,   & 
    358       &                   oxymin 
     345      NAMELIST/nampisrem/ xremik, xremip, nitrif, xsirem, xsiremlab, xsilab 
    359346      INTEGER :: ios                 ! Local integer output status for namelist read 
    360347 
     
    378365         WRITE(numout,*) '    fraction of labile biogenic silica        xsilab    =', xsilab 
    379366         WRITE(numout,*) '    NH4 nitrification rate                    nitrif    =', nitrif 
    380          WRITE(numout,*) '    halk saturation constant for anoxia       oxymin    =', oxymin 
    381367      ENDIF 
    382368      ! 
    383       nitrfac (:,:,:) = 0._wp 
    384369      denitr  (:,:,:) = 0._wp 
    385370      denitnh4(:,:,:) = 0._wp 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsbc.F90

    r6140 r7341  
    155155      IF( ln_ndepo ) THEN 
    156156         IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_ndep > 1 ) ) THEN 
    157             CALL fld_read( kt, 1, sf_ndepo ) 
    158             DO jj = 1, jpj 
    159                DO ji = 1, jpi 
    160                   nitdep(ji,jj) = sf_ndepo(1)%fnow(ji,jj,1) / rno3 / ( 14E6 * ryyss * e3t_n(ji,jj,1) + rtrn ) 
    161                END DO 
    162             END DO 
     157             zcoef = rno3 * 14E6 * ryyss 
     158             CALL fld_read( kt, 1, sf_ndepo ) 
     159             nitdep(:,:) = sf_ndepo(1)%fnow(:,:,1) / zcoef / e3t_n(:,:,1)  
     160         ENDIF 
     161         IF( .NOT.ln_linssh ) THEN 
     162           zcoef = rno3 * 14E6 * ryyss 
     163           nitdep(:,:) = sf_ndepo(1)%fnow(:,:,1) / zcoef / e3t_n(:,:,1)  
    163164         ENDIF 
    164165      ENDIF 
     
    461462         ironsed(:,:,jpk) = 0._wp 
    462463         DO jk = 1, jpkm1 
    463             ironsed(:,:,jk) = sedfeinput * zcmask(:,:,jk) / ( e3t_n(:,:,jk) * rday ) 
     464            ironsed(:,:,jk) = sedfeinput * zcmask(:,:,jk) / ( e3t_0(:,:,jk) * rday ) 
    464465         END DO 
    465466         DEALLOCATE( zcmask) 
     
    479480         CALL iom_close( numhydro ) 
    480481         ! 
    481          hydrofe(:,:,:) = ( hydrofe(:,:,:) * hratio ) / ( cvol(:,:,:) * ryyss + rtrn ) / 1000._wp 
     482         DO jk = 1, jpk 
     483            hydrofe(:,:,jk) = ( hydrofe(:,:,jk) * hratio ) / ( e1e2t(:,:) * e3t_0(:,:,jk) * ryyss + rtrn ) / 1000._wp 
     484         ENDDO 
    482485         ! 
    483486      ENDIF 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsms.F90

    r6140 r7341  
    131131         ! 
    132132         CALL p4z_bio( kt, jnt )   ! Biology 
    133          CALL p4z_sed( kt, jnt )   ! Sedimentation 
    134133         CALL p4z_lys( kt, jnt )   ! Compute CaCO3 saturation 
     134         CALL p4z_sed( kt, jnt )   ! Surface and Bottom boundary conditions 
    135135         CALL p4z_flx( kt, jnt )   ! Compute surface fluxes 
    136136         ! 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90

    r6309 r7341  
    3838   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   restotr   ! restoring coeff. on tracers (s-1) 
    3939 
    40    INTEGER, PARAMETER           ::   npncts   = 5        ! number of closed sea 
     40   INTEGER, PARAMETER           ::   npncts   = 8        ! number of closed sea 
    4141   INTEGER, DIMENSION(npncts)   ::   nctsi1, nctsj1      ! south-west closed sea limits (i,j) 
    4242   INTEGER, DIMENSION(npncts)   ::   nctsi2, nctsj2      ! north-east closed sea limits (i,j) 
     
    104104               ! 
    105105               jl = n_trc_index(jn)  
    106                CALL trc_dta( kt, sf_trcdta(jl) )   ! read tracer data at nit000 
    107                ztrcdta(:,:,:) = sf_trcdta(jl)%fnow(:,:,:) * tmask(:,:,:) * rf_trfac(jl) 
     106               CALL trc_dta( kt, sf_trcdta(jl), rf_trfac(jl), ztrcdta )   ! read tracer data at nit000 
    108107               ! 
    109108               SELECT CASE ( nn_zdmp_tr ) 
     
    181180      !!---------------------------------------------------------------------- 
    182181      ! 
    183       IF( nn_timing == 1 )  CALL timing_start('trc_dmp_init') 
     182      IF( nn_timing == 1 )  CALL timing_start('trc_dmp_ini') 
    184183      ! 
    185184      REWIND( numnat_ref )              ! Namelist namtrc_dmp in reference namelist : Passive tracers newtonian damping 
     
    200199         WRITE(numout,*) '      Restoration coeff file    cn_resto_tr = ', cn_resto_tr 
    201200      ENDIF 
     201      !                          ! Allocate arrays 
     202      IF( trc_dmp_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'trc_dmp_ini: unable to allocate arrays' ) 
    202203      ! 
    203204      IF( lzoom .AND. .NOT.lk_c1d )   nn_zdmp_tr = 0           ! restoring to climatology at closed north or south boundaries 
     
    239240      !!                nctsi2(), nctsj2() : north-east Closed sea limits (i,j) 
    240241      !!---------------------------------------------------------------------- 
    241       INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
    242       ! 
    243       INTEGER ::   ji , jj, jk, jn, jl, jc   ! dummy loop indicesa 
    244       INTEGER ::   isrow                     ! local index 
    245       !!---------------------------------------------------------------------- 
    246       ! 
     242      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index 
     243      ! 
     244      INTEGER :: ji , jj, jk, jn, jl, jc                    ! dummy loop indicesa 
     245      INTEGER :: isrow                                      ! local index 
     246      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta       ! 3D  workspace 
     247 
     248      !!---------------------------------------------------------------------- 
     249 
    247250      IF( kt == nit000 ) THEN 
    248251         ! initial values 
     
    262265            ! 
    263266                                                        ! Caspian Sea 
    264             nctsi1(1)   = 332  ; nctsj1(1)   = 243 - isrow 
    265             nctsi2(1)   = 344  ; nctsj2(1)   = 275 - isrow 
     267            nctsi1(1)   = 333  ; nctsj1(1)   = 243 - isrow 
     268            nctsi2(1)   = 342  ; nctsj2(1)   = 274 - isrow 
     269            !                                           ! Lake Superior 
     270            nctsi1(2)   = 198  ; nctsj1(2)   = 258 - isrow 
     271            nctsi2(2)   = 204  ; nctsj2(2)   = 262 - isrow 
     272            !                                           ! Lake Michigan 
     273            nctsi1(3)   = 201  ; nctsj1(3)   = 250 - isrow 
     274            nctsi2(3)   = 203  ; nctsj2(3)   = 256 - isrow 
     275            !                                           ! Lake Huron 
     276            nctsi1(4)   = 204  ; nctsj1(4)   = 252 - isrow 
     277            nctsi2(4)   = 209  ; nctsj2(4)   = 256 - isrow 
     278            !                                           ! Lake Erie 
     279            nctsi1(5)   = 206  ; nctsj1(5)   = 249 - isrow 
     280            nctsi2(5)   = 209  ; nctsj2(5)   = 251 - isrow 
     281            !                                           ! Lake Ontario 
     282            nctsi1(6)   = 210  ; nctsj1(6)   = 252 - isrow 
     283            nctsi2(6)   = 212  ; nctsj2(6)   = 252 - isrow 
     284            !                                           ! Victoria Lake 
     285            nctsi1(7)   = 321  ; nctsj1(7)   = 180 - isrow 
     286            nctsi2(7)   = 322  ; nctsj2(7)   = 189 - isrow 
     287            !                                           ! Baltic Sea 
     288            nctsi1(8)   = 297  ; nctsj1(8)   = 270 - isrow 
     289            nctsi2(8)   = 308  ; nctsj2(8)   = 293 - isrow 
    266290            !                                         
    267291            !                                           ! ======================= 
     
    332356         IF(lwp)  WRITE(numout,*) 
    333357         ! 
     358         CALL wrk_alloc( jpi, jpj, jpk, ztrcdta )   ! Memory allocation 
     359         ! 
    334360         DO jn = 1, jptra 
    335361            IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file 
    336362                jl = n_trc_index(jn) 
    337                 CALL trc_dta( kt, sf_trcdta(jl) )   ! read tracer data at nit000 
     363                CALL trc_dta( kt, sf_trcdta(jl), rf_trfac(jl), ztrcdta )   ! read tracer data at nit000 
    338364                DO jc = 1, npncts 
    339365                   DO jk = 1, jpkm1 
    340366                      DO jj = nctsj1(jc), nctsj2(jc) 
    341367                         DO ji = nctsi1(jc), nctsi2(jc) 
    342                             trn(ji,jj,jk,jn) = sf_trcdta(jl)%fnow(ji,jj,jk) * tmask(ji,jj,jk) * rf_trfac(jl) 
     368                            trn(ji,jj,jk,jn) = ztrcdta(ji,jj,jk) 
    343369                            trb(ji,jj,jk,jn) = trn(ji,jj,jk,jn) 
    344370                         ENDDO 
     
    348374             ENDIF 
    349375          ENDDO 
    350          ! 
     376          CALL wrk_dealloc( jpi, jpj, jpk, ztrcdta ) 
    351377      ENDIF 
    352378      ! 
    353379   END SUBROUTINE trc_dmp_clo 
    354380 
     381  
    355382#else 
    356383   !!---------------------------------------------------------------------- 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcldf.F90

    r6140 r7341  
    4040   REAL(wp), PUBLIC ::   rn_ahtrc_0          !:   laplacian diffusivity coefficient for passive tracer [m2/s] 
    4141   REAL(wp), PUBLIC ::   rn_bhtrc_0          !: bilaplacian      -          --     -       -   [m4/s] 
     42   REAL(wp), PUBLIC ::   rn_fact_lap         !: Enhanced zonal diffusivity coefficent in the equatorial domain 
    4243   ! 
    4344   !                      !!: ** lateral mixing namelist (nam_trcldf) ** 
     
    6465      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
    6566      ! 
    66       INTEGER            :: jn 
     67      INTEGER            :: ji, jj, jk, jn 
     68      REAL(wp)           :: zdep 
    6769      CHARACTER (len=22) :: charout 
    6870      REAL(wp), POINTER, DIMENSION(:,:,:)   ::   zahu, zahv 
     
    7678         ztrtrd(:,:,:,:)  = tra(:,:,:,:) 
    7779      ENDIF 
    78       ! 
    79       !                                        !* set the lateral diffusivity coef. for passive tracer       
     80      !                                  !* set the lateral diffusivity coef. for passive tracer       
    8081      CALL wrk_alloc( jpi,jpj,jpk,   zahu, zahv ) 
    81       zahu(:,:,:) = rldf * ahtu(:,:,:) 
     82      zahu(:,:,:) = rldf * ahtu(:,:,:)  
    8283      zahv(:,:,:) = rldf * ahtv(:,:,:) 
    83  
     84      !                                  !* Enhanced zonal diffusivity coefficent in the equatorial domain 
     85      DO jk= 1, jpk 
     86         DO jj = 1, jpj 
     87            DO ji = 1, jpi 
     88               IF( gdept_n(ji,jj,jk) > 200. .AND. gphit(ji,jj) < 5. .AND. gphit(ji,jj) > -5. ) THEN 
     89                  zdep = MAX( gdept_n(ji,jj,jk) - 1000., 0. ) / 1000. 
     90                  zahu(ji,jj,jk) = zahu(ji,jj,jk) * MAX( 1., rn_fact_lap * EXP( -zdep ) ) 
     91               ENDIF 
     92            END DO 
     93         END DO 
     94      END DO 
     95      ! 
    8496      SELECT CASE ( nldf )                     !* compute lateral mixing trend and add it to the general trend 
    8597      ! 
     
    136148      NAMELIST/namtrc_ldf/ ln_trcldf_lap, ln_trcldf_blp,                                  & 
    137149         &                 ln_trcldf_lev, ln_trcldf_hor, ln_trcldf_iso, ln_trcldf_triad,  & 
    138          &                 rn_ahtrc_0   , rn_bhtrc_0 
     150         &                 rn_ahtrc_0   , rn_bhtrc_0, rn_fact_lap   
    139151      !!---------------------------------------------------------------------- 
    140152      ! 
     
    164176         WRITE(numout,*) '           laplacian                 rn_ahtrc_0      = ', rn_ahtrc_0 
    165177         WRITE(numout,*) '         bilaplacian                 rn_bhtrc_0      = ', rn_bhtrc_0 
     178         WRITE(numout,*) '      enhanced zonal diffusivity     rn_fact_lap     = ', rn_fact_lap 
     179 
    166180      ENDIF 
    167181      !       
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90

    r6309 r7341  
    100100         IF(lwp) WRITE(numout,*) '~~~~~~~ ' 
    101101 
    102          IF( ln_rsttr .AND.    &                     ! Restart: read in restart  file 
     102         IF( ln_rsttr .AND. .NOT.ln_top_euler .AND.   &                     ! Restart: read in restart  file 
    103103            iom_varid( numrtr, 'sbc_'//TRIM(ctrcnm(1))//'_b', ldstop = .FALSE. ) > 0 ) THEN 
    104104            IF(lwp) WRITE(numout,*) '          nittrc000-nn_dttrc surface tracer content forcing fields red in the restart file' 
     
    187187      !                                           Write in the tracer restar  file 
    188188      !                                          ******************************* 
    189       IF( lrst_trc ) THEN 
     189      IF( lrst_trc .AND. .NOT.ln_top_euler ) THEN 
    190190         IF(lwp) WRITE(numout,*) 
    191191         IF(lwp) WRITE(numout,*) 'sbc : ocean surface tracer content forcing fields written in tracer restart file ',   & 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/trcdta.F90

    r6309 r7341  
    123123               ENDIF 
    124124               WRITE(numout,*) ' ' 
    125                WRITE(numout,'(a, i3,3a,e11.3)') ' Read IC file for tracer number :', & 
     125               WRITE(numout,'(a, i4,3a,e11.3)') ' Read IC file for tracer number :', & 
    126126               &            jn, ', name : ', TRIM(clndta), ', Multiplicative Scaling factor : ', zfact 
    127127            ENDIF 
     
    159159 
    160160 
    161    SUBROUTINE trc_dta( kt, sf_dta ) 
     161   SUBROUTINE trc_dta( kt, sf_trcdta, ptrfac, ptrc) 
    162162      !!---------------------------------------------------------------------- 
    163163      !!                   ***  ROUTINE trc_dta  *** 
     
    169169      !!              - ln_trcdmp=F: deallocates the data structure as they are not used 
    170170      !! 
    171       !! ** Action  :   sf_dta   passive tracer data on medl mesh and interpolated at time-step kt 
    172       !!---------------------------------------------------------------------- 
    173       INTEGER                     , INTENT(in ) ::   kt     ! ocean time-step 
    174       TYPE(FLD), DIMENSION(1)   , INTENT(inout) ::   sf_dta     ! array of information on the field to read 
     171      !! ** Action  :   sf_trcdta   passive tracer data on medl mesh and interpolated at time-step kt 
     172      !!---------------------------------------------------------------------- 
     173      INTEGER                     , INTENT(in   ) ::   kt     ! ocean time-step 
     174      TYPE(FLD), DIMENSION(1)     , INTENT(inout) ::   sf_trcdta     ! array of information on the field to read 
     175      REAL(wp)                    , INTENT(in   ) ::   ptrfac  ! multiplication factor 
     176      REAL(wp), DIMENSION(jpi,jpj,jpk), OPTIONAL  , INTENT(out  ) ::   ptrc 
    175177      ! 
    176178      INTEGER ::   ji, jj, jk, jl, jkk, ik    ! dummy loop indices 
    177179      REAL(wp)::   zl, zi 
    178180      REAL(wp), DIMENSION(jpk) ::  ztp                ! 1D workspace 
     181      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta   ! 3D  workspace 
    179182      CHARACTER(len=100) :: clndta 
    180183      !!---------------------------------------------------------------------- 
     
    184187      IF( nb_trcdta > 0 ) THEN 
    185188         ! 
    186          CALL fld_read( kt, 1, sf_dta )      !==   read data at kt time step   ==! 
     189         CALL wrk_alloc( jpi, jpj, jpk, ztrcdta )    ! Memory allocation 
     190         ! 
     191         CALL fld_read( kt, 1, sf_trcdta )      !==   read data at kt time step   ==! 
     192         ztrcdta(:,:,:) = sf_trcdta(1)%fnow(:,:,:) * tmask(:,:,:)    ! Mask 
    187193         ! 
    188194         IF( ln_sco ) THEN                   !==   s- or mixed s-zps-coordinate   ==! 
     
    192198               WRITE(numout,*) 'trc_dta: interpolates passive tracer data onto the s- or mixed s-z-coordinate mesh' 
    193199            ENDIF 
    194             ! 
    195                DO jj = 1, jpj                         ! vertical interpolation of T & S 
    196                   DO ji = 1, jpi 
    197                      DO jk = 1, jpk                        ! determines the intepolated T-S profiles at each (i,j) points 
    198                         zl = gdept_n(ji,jj,jk) 
    199                         IF(     zl < gdept_1d(1  ) ) THEN         ! above the first level of data 
    200                            ztp(jk) =  sf_dta(1)%fnow(ji,jj,1) 
    201                         ELSEIF( zl > gdept_1d(jpk) ) THEN         ! below the last level of data 
    202                            ztp(jk) =  sf_dta(1)%fnow(ji,jj,jpkm1) 
    203                         ELSE                                      ! inbetween : vertical interpolation between jkk & jkk+1 
    204                            DO jkk = 1, jpkm1                                  ! when  gdept(jkk) < zl < gdept(jkk+1) 
    205                               IF( (zl-gdept_1d(jkk)) * (zl-gdept_1d(jkk+1)) <= 0._wp ) THEN 
    206                                  zi = ( zl - gdept_1d(jkk) ) / (gdept_1d(jkk+1)-gdept_1d(jkk)) 
    207                                  ztp(jk) = sf_dta(1)%fnow(ji,jj,jkk) + ( sf_dta(1)%fnow(ji,jj,jkk+1) - & 
    208                                            sf_dta(1)%fnow(ji,jj,jkk) ) * zi  
    209                               ENDIF 
    210                            END DO 
    211                         ENDIF 
    212                      END DO 
    213                      DO jk = 1, jpkm1 
    214                         sf_dta(1)%fnow(ji,jj,jk) = ztp(jk) * tmask(ji,jj,jk)     ! mask required for mixed zps-s-coord 
    215                      END DO 
    216                      sf_dta(1)%fnow(ji,jj,jpk) = 0._wp 
     200            DO jj = 1, jpj                         ! vertical interpolation of T & S 
     201               DO ji = 1, jpi 
     202                  DO jk = 1, jpk                        ! determines the intepolated T-S profiles at each (i,j) points 
     203                     zl = gdept_n(ji,jj,jk) 
     204                     IF(     zl < gdept_1d(1  ) ) THEN         ! above the first level of data 
     205                        ztp(jk) = ztrcdta(ji,jj,1) 
     206                     ELSEIF( zl > gdept_1d(jpk) ) THEN         ! below the last level of data 
     207                        ztp(jk) =  ztrcdta(ji,jj,jpkm1) 
     208                     ELSE                                      ! inbetween : vertical interpolation between jkk & jkk+1 
     209                        DO jkk = 1, jpkm1                                  ! when  gdept(jkk) < zl < gdept(jkk+1) 
     210                           IF( (zl-gdept_1d(jkk)) * (zl-gdept_1d(jkk+1)) <= 0._wp ) THEN 
     211                              zi = ( zl - gdept_1d(jkk) ) / (gdept_1d(jkk+1)-gdept_1d(jkk)) 
     212                              ztp(jk) = ztrcdta(ji,jj,jkk) + ( ztrcdta(ji,jj,jkk+1) - & 
     213                                        ztrcdta(ji,jj,jkk) ) * zi  
     214                           ENDIF 
     215                        END DO 
     216                     ENDIF 
    217217                  END DO 
    218                END DO 
     218                  DO jk = 1, jpkm1 
     219                    ztrcdta(ji,jj,jk) = ztp(jk) * tmask(ji,jj,jk)     ! mask required for mixed zps-s-coord 
     220                  END DO 
     221                  ztrcdta(ji,jj,jpk) = 0._wp 
     222                END DO 
     223            END DO 
    219224            !  
    220225         ELSE                                !==   z- or zps- coordinate   ==! 
    221             !                              
    222                sf_dta(1)%fnow(:,:,:) = sf_dta(1)%fnow(:,:,:) * tmask(:,:,:)    ! Mask 
    223                ! 
    224                IF( ln_zps ) THEN                      ! zps-coordinate (partial steps) interpolation at the last ocean level 
    225                   DO jj = 1, jpj 
    226                      DO ji = 1, jpi 
    227                         ik = mbkt(ji,jj)  
    228                         IF( ik > 1 ) THEN 
    229                            zl = ( gdept_1d(ik) - gdept_n(ji,jj,ik) ) / ( gdept_1d(ik) - gdept_1d(ik-1) ) 
    230                            sf_dta(1)%fnow(ji,jj,ik) = (1.-zl) * sf_dta(1)%fnow(ji,jj,ik) + zl * sf_dta(1)%fnow(ji,jj,ik-1) 
    231                         ENDIF 
    232                      END DO 
     226            ! 
     227            IF( ln_zps ) THEN                      ! zps-coordinate (partial steps) interpolation at the last ocean level 
     228               DO jj = 1, jpj 
     229                  DO ji = 1, jpi 
     230                     ik = mbkt(ji,jj)  
     231                     IF( ik > 1 ) THEN 
     232                        zl = ( gdept_1d(ik) - gdept_n(ji,jj,ik) ) / ( gdept_1d(ik) - gdept_1d(ik-1) ) 
     233                        ztrcdta(ji,jj,ik) = (1.-zl) * ztrcdta(ji,jj,ik) + zl * ztrcdta(ji,jj,ik-1) 
     234                     ENDIF 
     235                     ik = mikt(ji,jj) 
     236                     IF( ik > 1 ) THEN 
     237                        zl = ( gdept_n(ji,jj,ik) - gdept_1d(ik) ) / ( gdept_1d(ik+1) - gdept_1d(ik) ) 
     238                        ztrcdta(ji,jj,ik) = (1.-zl) * ztrcdta(ji,jj,ik) + zl * ztrcdta(ji,jj,ik+1) 
     239                     ENDIF 
    233240                  END DO 
    234                ENDIF 
     241              END DO 
     242            ENDIF 
    235243            ! 
    236244         ENDIF 
    237245         ! 
     246         ! Add multiplicative factor 
     247         ztrcdta(:,:,:) = ztrcdta(:,:,:) * ptrfac 
     248         ! 
     249         ! Data structure for trc_ini (and BFMv5.1 coupling) 
     250         IF( .NOT. PRESENT(ptrc) ) sf_trcdta(1)%fnow(:,:,:) = ztrcdta(:,:,:) 
     251         ! 
     252         ! Data structure for trc_dmp 
     253         IF( PRESENT(ptrc) )  ptrc(:,:,:) = ztrcdta(:,:,:) 
     254         ! 
     255         CALL wrk_dealloc( jpi, jpj, jpk, ztrcdta ) 
     256         ! 
    238257      ENDIF 
    239258      ! 
     
    241260      ! 
    242261   END SUBROUTINE trc_dta 
    243     
     262 
    244263#else 
    245264   !!---------------------------------------------------------------------- 
     
    247266   !!---------------------------------------------------------------------- 
    248267CONTAINS 
    249    SUBROUTINE trc_dta( kt, sf_dta, zrf_trfac )        ! Empty routine 
     268   SUBROUTINE trc_dta( kt, sf_trcdta, ptrfac, ptrc)        ! Empty routine 
    250269      WRITE(*,*) 'trc_dta: You should not have seen this print! error?', kt 
    251270   END SUBROUTINE trc_dta 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/trcini.F90

    r6309 r7341  
    203203      USE trcdta          ! initialisation from files 
    204204      ! 
    205       INTEGER ::   jk, jn, jl    ! dummy loop indices 
     205      INTEGER :: jn, jl   ! dummy loop indices 
    206206      !!---------------------------------------------------------------------- 
    207207      ! 
     
    220220        IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping 
    221221            ! 
    222            DO jn = 1, jptra 
     222            DO jn = 1, jptra 
    223223               IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file 
    224224                  jl = n_trc_index(jn)  
    225                   CALL trc_dta( nit000, sf_trcdta(jl) )   ! read tracer data at nit000 
    226                   trn(:,:,:,jn) = sf_trcdta(jl)%fnow(:,:,:) * tmask(:,:,:) * rf_trfac(jl) 
     225                  CALL trc_dta( nit000, sf_trcdta(jl), rf_trfac(jl) )   ! read tracer data at nit000 
     226                  trn(:,:,:,jn) = sf_trcdta(jl)%fnow(:,:,:)  
    227227                  ! 
    228228                  IF( .NOT.ln_trcdmp .AND. .NOT.ln_trcdmp_clo ) THEN      !== deallocate data structure   ==! 
  • branches/2016/dev_NOC_2016/NEMOGCM/NEMO/TOP_SRC/trcstp.F90

    r6140 r7341  
    3232   REAL(wp), DIMENSION(:,:,:), SAVE, ALLOCATABLE ::   qsr_arr ! save qsr during TOP time-step 
    3333   REAL(wp) :: rdt_sampl 
    34    INTEGER  :: nb_rec_per_days 
    35    INTEGER  :: isecfst, iseclast 
     34   INTEGER  :: nb_rec_per_day 
     35   REAL(wp) :: rsecfst, rseclast 
    3636   LOGICAL  :: llnew 
    3737 
     
    108108      END DO 
    109109      IF( lwp ) WRITE(numstr,9300) kt,  ztrai / areatot 
    110 9300  FORMAT(i10,e18.10) 
     1109300  FORMAT(i10,D23.16) 
    111111      ! 
    112112      IF( nn_timing == 1 )   CALL timing_stop('trc_stp') 
    113113      ! 
    114114   END SUBROUTINE trc_stp 
    115  
    116115 
    117116   SUBROUTINE trc_mean_qsr( kt ) 
     
    122121      !!               of diurnal cycle 
    123122      !! 
    124       !! ** Method  : store in TOP the qsr every hour ( or every time-step the latter  
     123      !! ** Method  : store in TOP the qsr every hour ( or every time-step if the latter  
    125124      !!              is greater than 1 hour ) and then, compute the  mean with  
    126125      !!              a moving average over 24 hours.  
     
    129128      INTEGER, INTENT(in) ::   kt 
    130129      INTEGER  :: jn 
    131       !!---------------------------------------------------------------------- 
    132       ! 
     130      REAL(wp) :: zkt 
     131      CHARACTER(len=1)               ::   cl1                      ! 1 character 
     132      CHARACTER(len=2)               ::   cl2                      ! 2 characters 
     133 
    133134      IF( kt == nittrc000 ) THEN 
    134135         IF( ln_cpl )  THEN   
    135             rdt_sampl = 86400. / ncpl_qsr_freq 
    136             nb_rec_per_days = ncpl_qsr_freq 
     136            rdt_sampl = rday / ncpl_qsr_freq 
     137            nb_rec_per_day = ncpl_qsr_freq 
    137138         ELSE   
    138             rdt_sampl = MAX( 3600., rdt * nn_dttrc ) 
    139             nb_rec_per_days = INT( 86400 / rdt_sampl ) 
     139            rdt_sampl = MAX( 3600., rdttrc ) 
     140            nb_rec_per_day = INT( rday / rdt_sampl ) 
    140141         ENDIF 
    141142         ! 
    142143         IF( lwp ) THEN 
    143144            WRITE(numout,*)  
    144             WRITE(numout,*) ' Sampling frequency dt = ', rdt_sampl, 's','   Number of sampling per day  nrec = ', nb_rec_per_days 
     145            WRITE(numout,*) ' Sampling frequency dt = ', rdt_sampl, 's','   Number of sampling per day  nrec = ', nb_rec_per_day 
    145146            WRITE(numout,*)  
    146147         ENDIF 
    147148         ! 
    148          ALLOCATE( qsr_arr(jpi,jpj,nb_rec_per_days ) ) 
    149          DO jn = 1, nb_rec_per_days 
    150             qsr_arr(:,:,jn) = qsr(:,:) 
     149         ALLOCATE( qsr_arr(jpi,jpj,nb_rec_per_day ) ) 
     150         ! 
     151         !                                            !* Restart: read in restart file 
     152         IF( ln_rsttr .AND. iom_varid( numrtr, 'qsr_mean' , ldstop = .FALSE. ) > 0 .AND. & 
     153                            iom_varid( numrtr, 'qsr_arr_1', ldstop = .FALSE. ) > 0 .AND. & 
     154                            iom_varid( numrtr, 'ktdcy'    , ldstop = .FALSE. ) > 0 ) THEN  
     155            CALL iom_get( numrtr, 'ktdcy', zkt )   !  A mean of qsr 
     156            rsecfst = INT( zkt ) * rdttrc 
     157            IF(lwp) WRITE(numout,*) 'trc_qsr_mean:   qsr_mean read in the restart file at time-step rsecfst =', rsecfst, ' s ' 
     158            CALL iom_get( numrtr, jpdom_autoglo, 'qsr_mean', qsr_mean )   !  A mean of qsr 
     159            DO jn = 1, nb_rec_per_day  
     160             IF( jn <= 9 )  THEN 
     161               WRITE(cl1,'(i1)') jn 
     162               CALL iom_get( numrtr, jpdom_autoglo, 'qsr_arr_'//cl1, qsr_arr(:,:,jn) )   !  A mean of qsr 
     163             ELSE 
     164               WRITE(cl2,'(i2.2)') jn 
     165               CALL iom_get( numrtr, jpdom_autoglo, 'qsr_arr_'//cl2, qsr_arr(:,:,jn) )   !  A mean of qsr 
     166             ENDIF 
     167           ENDDO 
     168         ELSE                                         !* no restart: set from nit000 values 
     169            IF(lwp) WRITE(numout,*) 'trc_qsr_mean:   qsr_mean set to nit000 values' 
     170            rsecfst  = kt * rdttrc 
     171            ! 
     172            qsr_mean(:,:) = qsr(:,:) 
     173            DO jn = 1, nb_rec_per_day 
     174               qsr_arr(:,:,jn) = qsr_mean(:,:) 
     175            ENDDO 
     176         ENDIF 
     177         ! 
     178      ENDIF 
     179      ! 
     180      rseclast = kt * rdttrc 
     181      ! 
     182      llnew   = ( rseclast - rsecfst ) .ge.  rdt_sampl    !   new shortwave to store 
     183      IF( llnew ) THEN 
     184          IF( lwp ) WRITE(numout,*) ' New shortwave to sample for TOP at time kt = ', kt, & 
     185             &                      ' time = ', rseclast/3600.,'hours ' 
     186          rsecfst = rseclast 
     187          DO jn = 1, nb_rec_per_day - 1 
     188             qsr_arr(:,:,jn) = qsr_arr(:,:,jn+1) 
     189          ENDDO 
     190          qsr_arr (:,:,nb_rec_per_day) = qsr(:,:) 
     191          qsr_mean(:,:                ) = SUM( qsr_arr(:,:,:), 3 ) / nb_rec_per_day 
     192      ENDIF 
     193      ! 
     194      IF( lrst_trc ) THEN    !* Write the mean of qsr in restart file  
     195         IF(lwp) WRITE(numout,*) 
     196         IF(lwp) WRITE(numout,*) 'trc_mean_qsr : write qsr_mean in restart file  kt =', kt 
     197         IF(lwp) WRITE(numout,*) '~~~~~~~' 
     198         zkt = REAL( kt, wp ) 
     199         CALL iom_rstput( kt, nitrst, numrtw, 'ktdcy', zkt ) 
     200          DO jn = 1, nb_rec_per_day  
     201             IF( jn <= 9 )  THEN 
     202               WRITE(cl1,'(i1)') jn 
     203               CALL iom_rstput( kt, nitrst, numrtw, 'qsr_arr_'//cl1, qsr_arr(:,:,jn) ) 
     204             ELSE 
     205               WRITE(cl2,'(i2.2)') jn 
     206               CALL iom_rstput( kt, nitrst, numrtw, 'qsr_arr_'//cl2, qsr_arr(:,:,jn) ) 
     207             ENDIF 
    151208         ENDDO 
    152          qsr_mean(:,:) = qsr(:,:) 
    153          ! 
    154          isecfst  = nsec_year + nsec1jan000   !   number of seconds between Jan. 1st 00h of nit000 year and the middle of time step 
    155          iseclast = isecfst 
    156          ! 
    157       ENDIF 
    158       ! 
    159       iseclast = nsec_year + nsec1jan000 
    160       llnew   = ( iseclast - isecfst )  > INT( rdt_sampl )   !   new shortwave to store 
    161       IF( kt /= nittrc000 .AND. llnew ) THEN 
    162           IF( lwp ) WRITE(numout,*) ' New shortwave to sample for TOP at time kt = ', kt, & 
    163              &                      ' time = ', (iseclast+rdt*nn_dttrc/2.)/3600.,'hours ' 
    164           isecfst = iseclast 
    165           DO jn = 1, nb_rec_per_days - 1 
    166              qsr_arr(:,:,jn) = qsr_arr(:,:,jn+1) 
    167           END DO 
    168           qsr_arr (:,:,nb_rec_per_days) = qsr(:,:) 
    169           qsr_mean(:,:                ) = SUM( qsr_arr(:,:,:), 3 ) / nb_rec_per_days 
     209         CALL iom_rstput( kt, nitrst, numrtw, 'qsr_mean', qsr_mean(:,:) ) 
    170210      ENDIF 
    171211      ! 
  • branches/2016/dev_NOC_2016/NEMOGCM/SETTE/BATCH_TEMPLATE/batch-ifort_athena_xios

    r6140 r7341  
    2727# export MPIRUN="mpirun -n $OCEANCORES" 
    2828 
    29 module load  INTEL/intel_xe_2013 NETCDF/netcdf-4.3_parallel_shared NETCDF/parallel-netcdf-1.3.1 HDF5/hdf5-1.8.11_parallel_shared 
     29module load  INTEL/intel_xe_2013 NETCDF/netcdf-4.3_parallel NETCDF/parallel-netcdf-1.3.1 HDF5/hdf5-1.8.11_parallel 
    3030export MPIRUN="mpirun.lsf" 
    3131 
  • branches/2016/dev_NOC_2016/NEMOGCM/SETTE/sette.sh

    r6140 r7341  
    123123# Directory to run the tests 
    124124SETTE_DIR=$(cd $(dirname "$0"); pwd) 
    125 MAIN_DIR=${SETTE_DIR%/SETTE} 
     125MAIN_DIR=$(dirname $SETTE_DIR) 
    126126CONFIG_DIR=${MAIN_DIR}/CONFIG 
    127127TOOLS_DIR=${MAIN_DIR}/TOOLS 
  • branches/2016/dev_NOC_2016/NEMOGCM/TOOLS/MISCELLANEOUS/icb_pp.py

    r4990 r7341  
    5555if procnum < 1: 
    5656   print('Need some files to collate! procnum = ',procnum) 
    57    sys.exit() 
     57   sys.exit(11) 
    5858 
    5959icu = [] 
  • branches/2016/dev_NOC_2016/NEMOGCM/TOOLS/MPP_PREP/src/mpp_optimiz_zoom_nc.f90

    r2143 r7341  
    258258                 ijlb=ijdom(jni2,jnj2) 
    259259              ENDIF 
     260 
     261              ! Check wet points over the entire domain to preserve the MPI communication stencil 
    260262              isurf=0 
    261               DO jj=1+jprecj,ippdj(jni2,jnj2)-jprecj 
    262                  DO  ji=1+jpreci,ippdi(jni2,jnj2)-jpreci 
     263              DO jj=1,ippdj(jni2,jnj2) 
     264                 DO  ji=1,ippdi(jni2,jnj2) 
    263265                    IF(zmask(ji+iilb-1,jj+ijlb-1).EQ.1.) isurf=isurf+1 
    264266                 END DO 
    265267              END DO 
     268 
    266269              IF(isurf.EQ.0) THEN 
    267270                 ivide=ivide+1 
  • branches/2016/dev_NOC_2016/NEMOGCM/TOOLS/MPP_PREP/src/mppopt_showproc_nc.f90

    r2143 r7341  
    289289                 ijlb=ijdom(jni2,jnj2) 
    290290              ENDIF 
     291 
     292              ! Check wet points over the entire domain to preserve the MPI communication stencil 
    291293              isurf=0 
    292  
    293               DO jj=1+jprecj,ippdj(jni2,jnj2)-jprecj 
    294                  DO  ji=1+jpreci,ippdi(jni2,jnj2)-jpreci 
     294              DO jj=1,ippdj(jni2,jnj2) 
     295                 DO  ji=1,ippdi(jni2,jnj2) 
    295296                    IF(zmask(ji+iilb-1,jj+ijlb-1).EQ.1.) isurf=isurf+1 
    296297                 END DO 
    297298              END DO 
     299 
    298300              IF(isurf.EQ.0) THEN 
    299301                 ivide=ivide+1 
  • branches/2016/dev_NOC_2016/NEMOGCM/TOOLS/NESTING/agulhas

    r5656 r7341  
    4141    N  = 31 
    4242    ldbletanh   = .FALSE. 
    43     ppa2        = 0.0 
     43    pa2         = 0.0 
    4444    ppkth2      = 0.0 
    4545    ppacr2      = 0.0 
  • branches/2016/dev_NOC_2016/NEMOGCM/TOOLS/NESTING/src/agrif_types.f90

    r5656 r7341  
    7676  NAMELIST /nesting/imin,imax,jmin,jmax,rho,rhot,bathy_update,updated_parent_file       
    7777  ! 
    78   NAMELIST /vertical_grid/ppkth,ppacr,ppdzmin,pphmax,psur,pa0,pa1,N,ldbletanh,ppa2,ppkth2,ppacr2 
     78  NAMELIST /vertical_grid/ppkth,ppacr,ppdzmin,pphmax,psur,pa0,pa1,N,ldbletanh,pa2,ppkth2,ppacr2 
    7979  !  
    8080  NAMELIST /partial_cells/partial_steps,parent_bathy_meter,parent_batmet_name,e3zps_min,e3zps_rat       
  • branches/2016/dev_NOC_2016/NEMOGCM/TOOLS/REBUILD_NEMO/icb_combrest.py

    r6140 r7341  
     1import os 
    12from netCDF4 import Dataset 
    23from argparse import ArgumentParser 
     
    6364if procnum < 1: 
    6465   print('Need some files to collate! procnum = ',procnum) 
    65    sys.exit() 
     66   sys.exit(11) 
    6667 
    6768icu = [] 
     
    7980 except: 
    8081   print 'Error: unable to open input file: ' + pathstart+nn+'.nc' 
    81    sys.exit() 
     82   sys.exit(12) 
    8283 for d in fw.dimensions : 
    8384  if d == 'n' : 
     
    151152    print 'Error accessing output file: ' + pathout 
    152153    print 'Check it is a writable location.' 
    153     sys.exit() 
     154    sys.exit(13) 
    154155else : 
     156  # Copy 2D variables across to output file from input file. This step avoids problems if rebuild_nemo  
     157  # has created an "n" dimension in the prototype rebuilt file (ie. if there are icebergs on the zeroth  
     158  # processor).  
    155159  try: 
    156     fo = Dataset(pathout, 'r+', format='NETCDF4') 
     160    os.rename(pathout,pathout.replace('.nc','_WORK.nc')) 
     161  except OSError: 
     162    print 'Error: unable to move icebergs restart file: '+pathout 
     163    sys.exit(14) 
     164  # 
     165  try: 
     166    fi = Dataset(pathout.replace('.nc','_WORK.nc'), 'r') 
    157167  except: 
    158     print 'Error accessing output file: ' + pathout 
    159     print 'Check it exists and is writable.' 
    160     print 'Or run adding the -O option to create an output file which will' 
    161     print 'contain the iceberg state data only.' 
    162     sys.exit() 
     168    print 'Error: unable to open icebergs restart file: '+pathout.replace('.nc','_WORK.nc') 
     169    sys.exit(15) 
     170  fo = Dataset(pathout, 'w') 
     171  for dim in ['x','y','c','k']: 
     172    indim = fi.dimensions[dim] 
     173    fo.createDimension(dim, len(indim)) 
     174  for var in ['kount','calving','calving_hflx','stored_ice','stored_heat']: 
     175    invar = fi.variables[var] 
     176    fo.createVariable(var, invar.datatype, invar.dimensions) 
     177    fo.variables[var][:] = invar[:] 
     178    if "long_name" in invar.ncattrs(): 
     179        fo.variables[var].long_name = invar.long_name 
     180    if "units" in invar.ncattrs(): 
     181        fo.variables[var].units = invar.units 
     182  os.remove(pathout.replace('.nc','_WORK.nc')) 
    163183# 
    164184add_k = 1 
     
    166186  if d == 'n' : 
    167187    print 'Error: dimension n already exists in output file' 
    168     sys.exit() 
     188    sys.exit(16) 
    169189  if d == 'k' : 
    170190    add_k = 0 
  • branches/2016/dev_NOC_2016/NEMOGCM/TOOLS/REBUILD_NEMO/src/rebuild_nemo.f90

    r3025 r7341  
    200200      WRITE(numerr,*) 'Attribute DOMAIN_number_total is : ', ndomain_file 
    201201      WRITE(numerr,*) 'Number of files specified in namelist is: ', ndomain 
    202       STOP 
     202      STOP 9 
    203203   ENDIF 
    204204   
     
    268268      WRITE(numerr,*) 'Attribute DOMAIN_local_sizes is : ', local_sizes 
    269269      WRITE(numerr,*) 'Dimensions to be rebuilt are of size : ', outdimlens(rebuild_dims(1)), outdimlens(rebuild_dims(2))  
    270       STOP 
     270      STOP 9 
    271271   ENDIF 
    272272 
     
    384384            SELECT CASE( xtype ) 
    385385               CASE( NF90_BYTE ) 
     386                  globaldata_0d_i1 = 0 
    386387                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_0d_i1 ) ) 
    387388               CASE( NF90_SHORT ) 
     389                  globaldata_0d_i2 = 0 
    388390                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_0d_i2 ) ) 
    389391               CASE( NF90_INT ) 
     392                  globaldata_0d_i4 = 0 
    390393                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_0d_i4 ) ) 
    391394               CASE( NF90_FLOAT ) 
     395                  globaldata_0d_sp = 0. 
    392396                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_0d_sp ) ) 
    393397               CASE( NF90_DOUBLE ) 
     398                  globaldata_0d_dp = 0. 
    394399                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_0d_dp ) ) 
    395400               CASE DEFAULT 
    396401                  WRITE(numerr,*) 'Unknown nf90 type: ', xtype 
    397                   STOP 
     402                  STOP 9 
    398403            END SELECT 
    399404 
     
    403408               CASE( NF90_BYTE ) 
    404409                  ALLOCATE(globaldata_1d_i1(indimlens(dimids(1)))) 
     410                  globaldata_1d_i1(:) = 0 
    405411                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_1d_i1 ) ) 
    406412               CASE( NF90_SHORT ) 
    407413                  ALLOCATE(globaldata_1d_i2(indimlens(dimids(1)))) 
     414                  globaldata_1d_i2(:) = 0 
    408415                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_1d_i2 ) ) 
    409416               CASE( NF90_INT ) 
    410417                  ALLOCATE(globaldata_1d_i4(indimlens(dimids(1)))) 
     418                  globaldata_1d_i4(:) = 0 
    411419                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_1d_i4 ) ) 
    412420               CASE( NF90_FLOAT ) 
    413421                  ALLOCATE(globaldata_1d_sp(indimlens(dimids(1)))) 
     422                  globaldata_1d_sp(:) = 0. 
    414423                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_1d_sp ) ) 
    415424               CASE( NF90_DOUBLE ) 
    416425                  ALLOCATE(globaldata_1d_dp(indimlens(dimids(1)))) 
     426                  globaldata_1d_dp(:) = 0. 
    417427                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_1d_dp ) ) 
    418428               CASE DEFAULT 
    419429                  WRITE(numerr,*) 'Unknown nf90 type: ', xtype 
    420                   STOP 
     430                  STOP 9 
    421431            END SELECT 
    422432 
     
    426436               CASE( NF90_BYTE ) 
    427437                  ALLOCATE(globaldata_2d_i1(indimlens(dimids(1)),indimlens(dimids(2)))) 
     438                  globaldata_2d_i1(:,:) = 0 
    428439                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_2d_i1 ) ) 
    429440               CASE( NF90_SHORT ) 
    430441                  ALLOCATE(globaldata_2d_i2(indimlens(dimids(1)),indimlens(dimids(2)))) 
     442                  globaldata_2d_i2(:,:) = 0 
    431443                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_2d_i2 ) ) 
    432444               CASE( NF90_INT ) 
    433445                  ALLOCATE(globaldata_2d_i4(indimlens(dimids(1)),indimlens(dimids(2)))) 
     446                  globaldata_2d_i4(:,:) = 0 
    434447                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_2d_i4 ) ) 
    435448               CASE( NF90_FLOAT ) 
    436449                  ALLOCATE(globaldata_2d_sp(indimlens(dimids(1)),indimlens(dimids(2)))) 
     450                  globaldata_2d_sp(:,:) = 0. 
    437451                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_2d_sp ) ) 
    438452               CASE( NF90_DOUBLE ) 
    439453                  ALLOCATE(globaldata_2d_dp(indimlens(dimids(1)),indimlens(dimids(2)))) 
     454                  globaldata_2d_dp(:,:) = 0. 
    440455                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_2d_dp ) ) 
    441456               CASE DEFAULT 
    442457                  WRITE(numerr,*) 'Unknown nf90 type: ', xtype 
    443                   STOP 
     458                  STOP 9 
    444459            END SELECT 
    445460 
     
    450465                  ALLOCATE(globaldata_3d_i1(indimlens(dimids(1)),indimlens(dimids(2)),       & 
    451466                     &                      indimlens(dimids(3)))) 
     467                  globaldata_3d_i1(:,:,:) = 0 
    452468                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_3d_i1 ) ) 
    453469               CASE( NF90_SHORT ) 
    454470                  ALLOCATE(globaldata_3d_i2(indimlens(dimids(1)),indimlens(dimids(2)),       & 
    455471                     &                      indimlens(dimids(3)))) 
     472                  globaldata_3d_i2(:,:,:) = 0 
    456473                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_3d_i2 ) ) 
    457474               CASE( NF90_INT ) 
    458475                  ALLOCATE(globaldata_3d_i4(indimlens(dimids(1)),indimlens(dimids(2)),       & 
    459476                     &                      indimlens(dimids(3)))) 
     477                  globaldata_3d_i4(:,:,:) = 0 
    460478                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_3d_i4 ) ) 
    461479               CASE( NF90_FLOAT ) 
    462480                  ALLOCATE(globaldata_3d_sp(indimlens(dimids(1)),indimlens(dimids(2)),       & 
    463481                     &                      indimlens(dimids(3)))) 
     482                  globaldata_3d_sp(:,:,:) = 0. 
    464483                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_3d_sp ) ) 
    465484               CASE( NF90_DOUBLE ) 
    466485                  ALLOCATE(globaldata_3d_dp(indimlens(dimids(1)),indimlens(dimids(2)),       & 
    467486                     &                      indimlens(dimids(3)))) 
     487                  globaldata_3d_dp(:,:,:) = 0. 
    468488                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_3d_dp ) ) 
    469489               CASE DEFAULT 
    470490                  WRITE(numerr,*) 'Unknown nf90 type: ', xtype 
    471                   STOP 
     491                  STOP 9 
    472492            END SELECT 
    473493 
     
    478498                  ALLOCATE(globaldata_4d_i1(indimlens(dimids(1)),indimlens(dimids(2)),       & 
    479499                     &                      indimlens(dimids(3)),ntchunk)) 
     500                  globaldata_4d_i1(:,:,:,:) = 0 
    480501                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_4d_i1, start=(/1,1,1,nt/) ) ) 
    481502               CASE( NF90_SHORT ) 
    482503                  ALLOCATE(globaldata_4d_i2(indimlens(dimids(1)),indimlens(dimids(2)),       & 
    483504                     &                      indimlens(dimids(3)),ntchunk)) 
     505                  globaldata_4d_i2(:,:,:,:) = 0 
    484506                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_4d_i2, start=(/1,1,1,nt/) ) ) 
    485507               CASE( NF90_INT ) 
    486508                  ALLOCATE(globaldata_4d_i4(indimlens(dimids(1)),indimlens(dimids(2)),       & 
    487509                     &                      indimlens(dimids(3)),ntchunk)) 
     510                  globaldata_4d_i4(:,:,:,:) = 0 
    488511                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_4d_i4, start=(/1,1,1,nt/) ) ) 
    489512               CASE( NF90_FLOAT ) 
    490513                  ALLOCATE(globaldata_4d_sp(indimlens(dimids(1)),indimlens(dimids(2)),       & 
    491514                     &                      indimlens(dimids(3)),ntchunk)) 
     515                  globaldata_4d_sp(:,:,:,:) = 0. 
    492516                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_4d_sp, start=(/1,1,1,nt/) ) ) 
    493517               CASE( NF90_DOUBLE ) 
    494518                  ALLOCATE(globaldata_4d_dp(indimlens(dimids(1)),indimlens(dimids(2)),       & 
    495519                     &                      indimlens(dimids(3)),ntchunk)) 
     520                  globaldata_4d_dp(:,:,:,:) = 0. 
    496521                  CALL check_nf90( nf90_get_var( ncid, jv, globaldata_4d_dp, start=(/1,1,1,nt/) ) ) 
    497522               CASE DEFAULT 
    498523                  WRITE(numerr,*) 'Unknown nf90 type: ', xtype 
    499                   STOP 
     524                  STOP 9 
    500525            END SELECT 
    501526 
     
    517542               CASE( NF90_BYTE ) 
    518543                  ALLOCATE(globaldata_1d_i1(outdimlens(dimids(1)))) 
     544                  globaldata_1d_i1(:) = 0 
    519545               CASE( NF90_SHORT ) 
    520546                  ALLOCATE(globaldata_1d_i2(outdimlens(dimids(1)))) 
     547                  globaldata_1d_i2(:) = 0 
    521548               CASE( NF90_INT ) 
    522549                  ALLOCATE(globaldata_1d_i4(outdimlens(dimids(1)))) 
     550                  globaldata_1d_i4(:) = 0 
    523551               CASE( NF90_FLOAT ) 
    524552                  ALLOCATE(globaldata_1d_sp(outdimlens(dimids(1)))) 
     553                  globaldata_1d_sp(:) = 0. 
    525554               CASE( NF90_DOUBLE ) 
    526555                  ALLOCATE(globaldata_1d_dp(outdimlens(dimids(1)))) 
     556                  globaldata_1d_dp(:) = 0. 
    527557               CASE DEFAULT 
    528558                  WRITE(numerr,*) 'Unknown nf90 type: ', xtype 
    529                   STOP 
     559                  STOP 9 
    530560            END SELECT 
    531561 
     
    535565               CASE( NF90_BYTE ) 
    536566                  ALLOCATE(globaldata_2d_i1(outdimlens(dimids(1)),outdimlens(dimids(2)))) 
     567                  globaldata_2d_i1(:,:) = 0 
    537568               CASE( NF90_SHORT ) 
    538569                  ALLOCATE(globaldata_2d_i2(outdimlens(dimids(1)),outdimlens(dimids(2)))) 
     570                  globaldata_2d_i2(:,:) = 0 
    539571               CASE( NF90_INT ) 
    540572                  ALLOCATE(globaldata_2d_i4(outdimlens(dimids(1)),outdimlens(dimids(2)))) 
     573                  globaldata_2d_i4(:,:) = 0 
    541574               CASE( NF90_FLOAT ) 
    542575                  ALLOCATE(globaldata_2d_sp(outdimlens(dimids(1)),outdimlens(dimids(2)))) 
     576                  globaldata_2d_sp(:,:) = 0. 
    543577               CASE( NF90_DOUBLE ) 
    544578                  ALLOCATE(globaldata_2d_dp(outdimlens(dimids(1)),outdimlens(dimids(2)))) 
     579                  globaldata_2d_dp(:,:) = 0. 
    545580               CASE DEFAULT 
    546581                  WRITE(numerr,*) 'Unknown nf90 type: ', xtype 
    547                   STOP 
     582                  STOP 9 
    548583            END SELECT 
    549584 
     
    554589                  ALLOCATE(globaldata_3d_i1(outdimlens(dimids(1)),outdimlens(dimids(2)),     & 
    555590                     &                      outdimlens(dimids(3)))) 
     591                  globaldata_3d_i1(:,:,:) = 0 
    556592               CASE( NF90_SHORT ) 
    557593                  ALLOCATE(globaldata_3d_i2(outdimlens(dimids(1)),outdimlens(dimids(2)),     & 
    558594                     &                      outdimlens(dimids(3)))) 
     595                  globaldata_3d_i2(:,:,:) = 0 
    559596               CASE( NF90_INT ) 
    560597                  ALLOCATE(globaldata_3d_i4(outdimlens(dimids(1)),outdimlens(dimids(2)),     & 
    561598                     &                      outdimlens(dimids(3)))) 
     599                  globaldata_3d_i4(:,:,:) = 0 
    562600               CASE( NF90_FLOAT ) 
    563601                  ALLOCATE(globaldata_3d_sp(outdimlens(dimids(1)),outdimlens(dimids(2)),     & 
    564602                     &                      outdimlens(dimids(3)))) 
     603                  globaldata_3d_sp(:,:,:) = 0. 
    565604               CASE( NF90_DOUBLE ) 
    566605                  ALLOCATE(globaldata_3d_dp(outdimlens(dimids(1)),outdimlens(dimids(2)),     & 
    567606                     &                      outdimlens(dimids(3)))) 
     607                  globaldata_3d_dp(:,:,:) = 0. 
    568608               CASE DEFAULT 
    569609                  WRITE(numerr,*) 'Unknown nf90 type: ', xtype 
    570                   STOP 
     610                  STOP 9 
    571611            END SELECT 
    572612 
     
    577617                  ALLOCATE(globaldata_4d_i1(outdimlens(dimids(1)),outdimlens(dimids(2)),     & 
    578618                     &                      outdimlens(dimids(3)),ntchunk)) 
     619                   globaldata_4d_i1(:,:,:,:) = 0 
    579620               CASE( NF90_SHORT ) 
    580621                  ALLOCATE(globaldata_4d_i2(outdimlens(dimids(1)),outdimlens(dimids(2)),     & 
    581622                     &                      outdimlens(dimids(3)),ntchunk)) 
     623                  globaldata_4d_i2(:,:,:,:) = 0 
    582624               CASE( NF90_INT ) 
    583625                  ALLOCATE(globaldata_4d_i4(outdimlens(dimids(1)),outdimlens(dimids(2)),     & 
    584626                     &                      outdimlens(dimids(3)),ntchunk)) 
     627                  globaldata_4d_i4(:,:,:,:) = 0 
    585628               CASE( NF90_FLOAT ) 
    586629                  ALLOCATE(globaldata_4d_sp(outdimlens(dimids(1)),outdimlens(dimids(2)),     & 
    587630                     &                      outdimlens(dimids(3)),ntchunk)) 
     631                  globaldata_4d_sp(:,:,:,:) = 0. 
    588632               CASE( NF90_DOUBLE ) 
    589633                  ALLOCATE(globaldata_4d_dp(outdimlens(dimids(1)),outdimlens(dimids(2)),     & 
    590634                     &                      outdimlens(dimids(3)),ntchunk)) 
     635                  globaldata_4d_dp(:,:,:,:) = 0. 
    591636               CASE DEFAULT 
    592637                  WRITE(numerr,*) 'Unknown nf90 type: ', xtype 
    593                   STOP 
     638                  STOP 9 
    594639            END SELECT 
    595640         ELSE 
    596641            WRITE(numerr,*) 'ERROR! : A netcdf variable has more than 4 dimensions which is not taken into account' 
    597             STOP 
     642            STOP 9 
    598643         ENDIF 
    599644 
     
    9671012            IF( nthreads == 1 .AND. istop /= nf90_noerr )  THEN 
    9681013               WRITE(numerr,*) '*** NEMO rebuild failed! ***' 
    969                STOP 
     1014               STOP 9 
    9701015            ENDIF 
    9711016         
     
    9761021         IF( istop /= nf90_noerr )  THEN 
    9771022            WRITE(numerr,*) '*** NEMO rebuild failed! ***' 
    978             STOP 
     1023            STOP 9 
    9791024         ENDIF 
    9801025 
     
    10501095            CASE DEFAULT    
    10511096               WRITE(numerr,*) 'Unknown nf90 type: ', xtype 
    1052                STOP 
     1097               STOP 9 
    10531098         END SELECT      
    10541099                       
     
    10731118            CASE DEFAULT    
    10741119               WRITE(numerr,*) 'Unknown nf90 type: ', xtype 
    1075                STOP 
     1120               STOP 9 
    10761121         END SELECT      
    10771122     
     
    10961141            CASE DEFAULT    
    10971142               WRITE(numerr,*) 'Unknown nf90 type: ', xtype 
    1098                STOP 
     1143               STOP 9 
    10991144         END SELECT      
    11001145     
     
    11461191            WRITE(numerr,*) "*** NEMO rebuild failed ***" 
    11471192            WRITE(numerr,*) 
    1148             STOP 
     1193            STOP 9 
    11491194         ENDIF 
    11501195      ENDIF 
Note: See TracChangeset for help on using the changeset viewer.