Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Showing
with 185 additions and 505 deletions
......@@ -55,8 +55,6 @@ CONTAINS
!! add this trend now to the general trend of tracer (ta,sa,tr(:,:,:,:,Krhs)):
!! tr(:,:,:,:,Krhs) = tr(:,:,:,:,Krhs) + dz(tr(:,:,:,:,Kmm) ww)
!!
!! IF 'key_diabio' is defined, the now vertical advection
!! trend of passive tracers is saved for futher diagnostics.
!!---------------------------------------------------------------------
INTEGER, INTENT( in ) :: kt ! ocean time-step index
INTEGER, INTENT( in ) :: Kmm, Krhs ! time level indices
......
......@@ -291,7 +291,7 @@ CONTAINS
ENDIF
END IF
ll_bc = ( ln_trcbc .AND. lltrcbc ) .OR. ln_hydrofe .OR. ln_ironsed .OR. ln_ironice
ll_bc = ( ln_trcbc .AND. lltrcbc ) .OR. ln_hydrofe .OR. ln_ironsed .OR. ln_ironice .OR. ln_sediment
ll_dust = ln_trc_sbc(jpfer) .OR. ln_trc_sbc(jppo4) .OR. ln_trc_sbc(jpsil) .OR. ln_sediment
ll_ndepo = ln_trc_sbc(jpno3) .OR. ln_trc_sbc(jpnh4)
ll_river = ln_trc_cbc(jpno3)
......
......@@ -177,7 +177,7 @@ CONTAINS
zdiffdn = exp( -ABS(log(1.67 * sizen(ji,jj,jk) / (5.0 * sized(ji,jj,jk) + rtrn )) )**2 / zsigma**2 )
ztmp1 = xpref2n * zcompaph * ( zcompaph + zdiffdn * zcompadi ) / ( 1.0 + zdiffdn )
ztmp2 = xpref2c * zcompapoc**2
ztmp3 = xpref2d * zcompadi * ( zdiffdn * zcompadi + zcompaph ) / ( 1.0 + zdiffdn )
ztmp3 = xpref2d * zcompadi * ( zcompadi + zdiffdn * zcompaph ) / ( 1.0 + zdiffdn )
ztmp4 = xpref2z * zcompaz**2
ztmptot = ztmp1 + ztmp2 + ztmp3 + ztmp4 + rtrn
ztmp1 = ztmp1 / ztmptot
......
......@@ -118,7 +118,7 @@ CONTAINS
!
zflx = ( tr(ji,jj,ikt,jpgoc,Kbb) * zwsbio4(ji,jj) &
& + tr(ji,jj,ikt,jppoc,Kbb) * zwsbio3(ji,jj) ) * 1E6
zbureff = 0.013 + 0.53 * zflx**2 / ( 7.0 + zflx )**2 * MIN(gdepw(ji,jj,ikt+1,Kmm) / 1000.00, 1.0)
zbureff(ji,jj) = 0.013 + 0.53 * zflx**2 / ( 7.0 + zflx )**2 * MIN(gdepw(ji,jj,ikt+1,Kmm) / 1000.00, 1.0)
ENDIF
END_2D
!
......
......@@ -196,7 +196,7 @@ CONTAINS
ztmp1 = xpref2n * zcompaph * ( zcompaph + zdiffdn * zcompadi ) / (1.0 + zdiffdn)
ztmp2 = xpref2m * zcompames**2
ztmp3 = xpref2c * zcompapoc**2
ztmp4 = xpref2d * zcompadi * ( zdiffdn * zcompadi + zcompaph ) / (1.0 + zdiffdn)
ztmp4 = xpref2d * zcompadi * ( zcompadi + zdiffdn * zcompaph ) / (1.0 + zdiffdn)
ztmp5 = xpref2z * zcompaz**2
ztmptot = ztmp1 + ztmp2 + ztmp3 + ztmp4 + ztmp5 + rtrn
ztmp1 = ztmp1 / ztmptot
......
***************
Oceanic tracers
***************
.. todo::
.. contents::
:local:
TOP (Tracers in the Ocean Paradigm) is the NEMO hardwired interface toward
biogeochemical models and provide the physical constraints/boundaries for oceanic tracers.
It consists of a modular framework to handle multiple ocean tracers,
including also a variety of built-in modules.
This component of the NEMO framework allows one to exploit available modules (see below) and
further develop a range of applications, spanning from the implementation of a dye passive tracer to
evaluate dispersion processes (by means of MY_TRC), track water masses age (AGE module),
assess the ocean interior penetration of persistent chemical compounds
(e.g., gases like CFC or even PCBs), up to the full set of equations involving
marine biogeochemical cycles.
Structure
=========
TOP interface has the following location in the source code :file:`./src/TOP` and
the following modules are available:
:file:`TRP`
Interface to NEMO physical core for computing tracers transport
:file:`CFC`
Inert carbon tracers (CFC11,CFC12,SF6)
:file:`C14`
Radiocarbon passive tracer
:file:`AGE`
Water age tracking
:file:`MY_TRC`
Template for creation of new modules and external BGC models coupling
:file:`PISCES`
Built in BGC model. See :cite:`gmd-8-2465-2015` for a throughout description.
The usage of TOP is activated
*i)* by including in the configuration definition the component ``TOP`` and
*ii)* by adding the macro ``key_top`` in the configuration CPP file
(see for more details :forge:`"Learn more about the model" <wiki/Users>`).
As an example, the user can refer to already available configurations in the code,
``GYRE_PISCES`` being the NEMO biogeochemical demonstrator and
``GYRE_BFM`` to see the required configuration elements to couple with an external biogeochemical model
(see also Section 4) .
Note that, since version 4.0,
TOP interface core functionalities are activated by means of logical keys and
all submodules preprocessing macros from previous versions were removed.
Here below the list of preprocessing keys that applies to the TOP interface (beside ``key_top``):
``key_xios``
use XIOS I/O
``key_agrif``
enable AGRIF coupling
``key_trdtrc`` & ``key_trdmxl_trc``
trend computation for tracers
Synthetic Workflow
==================
A synthetic description of the TOP interface workflow is given below to
summarize the steps involved in the computation of biogeochemical and physical trends and
their time integration and outputs,
by reporting also the principal Fortran subroutine herein involved.
Model initialization (:file:`./src/OCE/nemogcm.F90`)
----------------------------------------------------
Call to ``trc_init`` subroutine (:file:`./src/TOP/trcini.F90`) to initialize TOP.
.. literalinclude:: ../../../src/TOP/trcini.F90
:language: fortran
:lines: 41-86
:emphasize-lines: 21,30-32,38-40
:caption: ``trc_init`` subroutine
Time marching procedure (:file:`./src/OCE/step.F90`)
----------------------------------------------------
Call to ``trc_stp`` subroutine (:file:`./src/TOP/trcstp.F90`) to compute/update passive tracers.
.. literalinclude:: ../../../src/TOP/trcstp.F90
:language: fortran
:lines: 46-125
:emphasize-lines: 42,55-57
:caption: ``trc_stp`` subroutine
BGC trends computation for each submodule (:file:`./src/TOP/trcsms.F90`)
------------------------------------------------------------------------
.. literalinclude:: ../../../src/TOP/trcsms.F90
:language: fortran
:lines: 21
:caption: :file:`trcsms` snippet
Physical trends computation (:file:`./src/TOP/TRP/trctrp.F90`)
--------------------------------------------------------------
.. literalinclude:: ../../../src/TOP/TRP/trctrp.F90
:language: fortran
:lines: 46-95
:emphasize-lines: 17,21,29,33-35
:caption: ``trc_trp`` subroutine
Namelists walkthrough
=====================
:file:`namelist_top`
--------------------
Here below are listed the features/options of the TOP interface accessible through
the :file:`namelist_top_ref` and modifiable by means of :file:`namelist_top_cfg`
(as for NEMO physical ones).
Note that ``##`` is used to refer to a number in an array field.
.. literalinclude:: ../../namelists/namtrc_run
:language: fortran
.. literalinclude:: ../../namelists/namtrc
:language: fortran
.. literalinclude:: ../../namelists/namtrc_dta
:language: fortran
.. literalinclude:: ../../namelists/namtrc_adv
:language: fortran
.. literalinclude:: ../../namelists/namtrc_ldf
:language: fortran
.. literalinclude:: ../../namelists/namtrc_rad
:language: fortran
.. literalinclude:: ../../namelists/namtrc_snk
:language: fortran
.. literalinclude:: ../../namelists/namtrc_dmp
:language: fortran
.. literalinclude:: ../../namelists/namtrc_ice
:language: fortran
.. literalinclude:: ../../namelists/namtrc_trd
:language: fortran
.. literalinclude:: ../../namelists/namtrc_bc
:language: fortran
.. literalinclude:: ../../namelists/namtrc_bdy
:language: fortran
.. literalinclude:: ../../namelists/namage
:language: fortran
Two main types of data structure are used within TOP interface
to initialize tracer properties (1) and
to provide related initial and boundary conditions (2).
1. TOP tracers initialization: ``sn_tracer`` (``&namtrc``)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Beside providing name and metadata for tracers,
here are also defined the use of initial (``sn_tracer%llinit``) and
boundary (``sn_tracer%llsbc, sn_tracer%llcbc, sn_tracer%llobc``) conditions.
In the following, an example of the full structure definition is given for
two idealized tracers both with initial conditions given,
while the first has only surface boundary forcing and
the second both surface and coastal forcings:
.. code-block:: fortran
! ! name ! title of the field ! units ! initial data ! sbc ! cbc ! obc !
sn_tracer(1) = 'TRC1' , 'Tracer 1 Concentration ', ' - ' , .true. , .true., .false., .true.
sn_tracer(2) = 'TRC2 ' , 'Tracer 2 Concentration ', ' - ' , .true. , .true., .true. , .false.
As tracers in BGC models are increasingly growing,
the same structure can be written also in a more compact and readable way:
.. code-block:: fortran
! ! name ! title of the field ! units ! initial data !
sn_tracer(1) = 'TRC1' , 'Tracer 1 Concentration ', ' - ' , .true.
sn_tracer(2) = 'TRC2 ' , 'Tracer 2 Concentration ', ' - ' , .true.
! sbc
sn_tracer(1)%llsbc = .true.
sn_tracer(2)%llsbc = .true.
! cbc
sn_tracer(2)%llcbc = .true.
The data structure is internally initialized by code with dummy names and
all initialization/forcing logical fields set to ``.false.`` .
2. Structures to read input initial and boundary conditions: ``&namtrc_dta`` (``sn_trcdta``), ``&namtrc_bc`` (``sn_trcsbc`` / ``sn_trccbc`` / ``sn_trcobc``)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The overall data structure (Fortran type) is based on the general one defined for NEMO core in the SBC component
(see details in ``SBC`` Chapter of :doc:`Reference Manual <cite>` on Input Data specification).
Input fields are prescribed within ``&namtrc_dta`` (with ``sn_trcdta`` structure),
while Boundary Conditions are applied to the model by means of ``&namtrc_bc``,
with dedicated structure fields for surface (``sn_trcsbc``), riverine (``sn_trccbc``), and
lateral open (``sn_trcobc``) boundaries.
The following example illustrates the data structure in the case of initial condition for
a single tracer contained in the file named :file:`tracer_1_data.nc`
(``.nc`` is implicitly assumed in namelist filename),
with a doubled initial value, and located in the :file:`usr/work/model/inputdata` folder:
.. code-block:: fortran
! ! file name ! frequency (hours) ! variable ! time interp. ! clim ! 'yearly'/ ! weights ! rotation ! land/sea mask !
! ! ! (if <0 months) ! name ! (logical) ! (T/F) ! 'monthly' ! filename ! pairing ! filename !
sn_trcdta(1) = 'tracer_1_data' , -12 , 'TRC1' , .false. , .true. , 'yearly' , '' , '' , ''
rf_trfac(1) = 2.0
cn_dir = 'usr/work/model/inputdata/'
Note that, the Lateral Open Boundaries conditions are applied on
the segments defined for the physical core of NEMO
(see ``BDY`` description in the :doc:`Reference Manual <cite>`).
:file:`namelist_trc`
--------------------
Here below the description of :file:`namelist_trc_ref` used to handle Carbon tracers modules,
namely CFC and C14.
.. literalinclude:: ../../../cfgs/SHARED/namelist_trc_ref
:language: fortran
:lines: 7,17,26,34
:caption: :file:`namelist_trc_ref` snippet
``MY_TRC`` interface for coupling external BGC models
=====================================================
The generalized interface is pivoted on MY_TRC module that contains template files to
build the coupling between
NEMO and any external BGC model.
The call to MY_TRC is activated by setting ``ln_my_trc = .true.`` (in ``&namtrc``)
The following 6 fortran files are available in MY_TRC with the specific purposes here described.
:file:`par_my_trc.F90`
This module allows to define additional arrays and public variables to
be used within the MY_TRC interface
:file:`trcini_my_trc.F90`
Here are initialized user defined namelists and
the call to the external BGC model initialization procedures to populate general tracer array
(``trn`` and ``trb``).
Here are also likely to be defined support arrays related to system metrics that
could be needed by the BGC model.
:file:`trcnam_my_trc.F90`
This routine is called at the beginning of ``trcini_my_trc`` and
should contain the initialization of additional namelists for the BGC model or user-defined code.
:file:`trcsms_my_trc.F90`
The routine performs the call to Boundary Conditions and its main purpose is to
contain the Source-Minus-Sinks terms due to the biogeochemical processes of the external model.
Be aware that lateral boundary conditions are applied in trcnxt routine.
.. warning::
The routines to compute the light penetration along the water column and
the tracer vertical sinking should be defined/called in here,
as generalized modules are still missing in the code.
:file:`trcice_my_trc.F90`
Here it is possible to prescribe the tracers concentrations in the sea-ice that
will be used as boundary conditions when ice melting occurs (``nn_ice_tr = 1`` in ``&namtrc_ice``).
See e.g. the correspondent PISCES subroutine.
:file:`trcwri_my_trc.F90`
This routine performs the output of the model tracers (only those defined in ``&namtrc``) using
IOM module (see chapter “Output and Diagnostics” in the :doc:`Reference Manual <cite>`).
It is possible to place here the output of additional variables produced by the model,
if not done elsewhere in the code, using the call to ``iom_put``.
Coupling an external BGC model using NEMO framework
===================================================
The coupling with an external BGC model through the NEMO compilation framework can be achieved in
different ways according to the degree of coding complexity of the Biogeochemical model, like e.g.,
the whole code is made only by one file or
it has multiple modules and interfaces spread across several subfolders.
Beside the 6 core files of MY_TRC module, let’s assume an external BGC model named *MYBGC* and
constituted by a rather essential coding structure, likely few Fortran files.
The new coupled configuration name is *NEMO_MYBGC*.
The best solution is to have all files (the modified ``MY_TRC`` routines and the BGC model ones)
placed in a unique folder with root ``MYBGCPATH`` and
to use the makenemo external readdressing of ``MY_SRC`` folder.
The coupled configuration listed in :file:`work_cfgs.txt` will look like
::
NEMO_MYBGC OCE TOP
and the related ``cpp_MYBGC.fcm`` content will be
.. code-block:: perl
bld::tool::fppkeys key_xios key_top
the compilation with :file:`makenemo` will be executed through the following syntax
.. code-block:: console
$ makenemo -n 'NEMO_MYBGC' -m '<arch_my_machine>' -j 8 -e '<MYBGCPATH>'
The makenemo feature ``-e`` was introduced to
readdress at compilation time the standard MY_SRC folder (usually found in NEMO configurations) with
a user defined external one.
The compilation of more articulated BGC model code & infrastructure,
like in the case of BFM (|BFM man|_), requires some additional features.
As before, let’s assume a coupled configuration name *NEMO_MYBGC*,
but in this case MYBGC model root becomes :file:`MYBGC` path that
contains 4 different subfolders for biogeochemistry,
named :file:`initialization`, :file:`pelagic`, and :file:`benthic`,
and a separate one named :file:`nemo_coupling` including the modified `MY_SRC` routines.
The latter folder containing the modified NEMO coupling interface will be still linked using
the makenemo ``-e`` option.
In order to include the BGC model subfolders in the compilation of NEMO code,
it will be necessary to extend the configuration :file:`cpp_NEMO_MYBGC.fcm` file to include the specific paths of :file:`MYBGC` folders, as in the following example
.. code-block:: perl
bld::tool::fppkeys key_xios key_top
src::MYBGC::initialization <MYBGCPATH>/initialization
src::MYBGC::pelagic <MYBGCPATH>/pelagic
src::MYBGC::benthic <MYBGCPATH>/benthic
bld::pp::MYBGC 1
bld::tool::fppflags::MYBGC %FPPFLAGS
bld::tool::fppkeys %bld::tool::fppkeys MYBGC_MACROS
where *MYBGC_MACROS* is the space delimited list of macros used in *MYBGC* model for
selecting/excluding specific parts of the code.
The BGC model code will be preprocessed in the configuration :file:`BLD` folder as for NEMO,
but with an independent path, like :file:`NEMO_MYBGC/BLD/MYBGC/<subforlders>`.
The compilation will be performed similarly to in the previous case with the following
.. code-block:: console
$ makenemo -n 'NEMO_MYBGC' -m '<arch_my_machine>' -j 8 -e '<MYBGCPATH>/nemo_coupling'
.. note::
The additional lines specific for the BGC model source and build paths can be written into
a separate file, e.g. named :file:`MYBGC.fcm`,
and then simply included in the :file:`cpp_NEMO_MYBGC.fcm` as follow
.. code-block:: perl
bld::tool::fppkeys key_xios key_top
inc <MYBGCPATH>/MYBGC.fcm
This will enable a more portable compilation structure for all MYBGC related configurations.
.. warning::
The coupling interface contained in :file:`nemo_coupling` cannot be added using the FCM syntax,
as the same files already exists in NEMO and they are overridden only with
the readdressing of MY_SRC contents to avoid compilation conflicts due to duplicate routines.
All modifications illustrated above, can be easily implemented using shell or python scripting
to edit the NEMO configuration :file:`CPP.fcm` file and
to create the BGC model specific FCM compilation file with code paths.
.. |BFM man| replace:: BFM-NEMO coupling manual
......@@ -55,11 +55,6 @@ CONTAINS
!
IF( ln_timing ) CALL timing_start('trc_bbl')
!
IF( .NOT. l_offline ) THEN
CALL bbl( kt, nittrc000, 'TRC', Kbb, Kmm ) ! Online coupling with dynamics : Computation of bbl coef and bbl transport
l_bbl = .FALSE. ! Offline coupling with dynamics : Read bbl coef and bbl transport from input files
ENDIF
IF( l_trdtrc ) THEN
ALLOCATE( ztrtrd(jpi,jpj,jpk,jptra) ) ! temporary save of trends
ztrtrd(:,:,:,:) = ptr(:,:,:,:,Krhs)
......
......@@ -28,7 +28,7 @@ MODULE trcrad
PUBLIC trc_rad_ini
LOGICAL , PUBLIC :: ln_trcrad !: flag to artificially correct negative concentrations
REAL(wp), DIMENSION(:,:), ALLOCATABLE:: gainmass
REAL(wp), DIMENSION(:), ALLOCATABLE:: gainmass
!! * Substitutions
# include "do_loop_substitute.h90"
......@@ -109,8 +109,8 @@ CONTAINS
ENDIF
ENDIF
!
ALLOCATE( gainmass(jptra,2) )
gainmass(:,:) = 0.
ALLOCATE( gainmass(jptra) )
gainmass(:) = 0.
!
END SUBROUTINE trc_rad_ini
......@@ -176,7 +176,7 @@ CONTAINS
zcoef = 1. + ztrneg(ji,jj,jn) / ztrpos(ji,jj,jn) ! ztrpos > 0 as ptr > 0
ptr(ji,jj,jk,jn,itime) = ptr(ji,jj,jk,jn,itime) * zcoef
IF( zcoef < 0. ) THEN ! if the compensation exceed the positive value
gainmass(jn,1) = gainmass(jn,1) - ptr(ji,jj,jk,jn,itime) * cvol(ji,jj,jk) ! we are adding mass...
gainmass(jn) = gainmass(jn) - ptr(ji,jj,jk,jn,itime) * cvol(ji,jj,jk) ! we are adding mass...
ptr(ji,jj,jk,jn,itime) = 0. ! limit the compensation to keep positive value
ENDIF
ENDIF
......@@ -192,12 +192,12 @@ CONTAINS
END DO
IF( kt == nitend ) THEN
CALL mpp_sum( 'trcrad', gainmass(:,1) )
CALL mpp_sum( 'trcrad', gainmass(:) )
DO jn = jp_sms0, jp_sms1
IF( gainmass(jn,1) > 0. ) THEN
IF( gainmass(jn) > 0. ) THEN
ztotmass = glob_sum( 'trcrad', ptr(:,:,:,jn,itime) * cvol(:,:,:) )
IF(lwp) WRITE(numout, '(a, i2, a, D23.16, a, D23.16)') 'trcrad ptrb, traceur ', jn &
& , ' total mass : ', ztotmass, ', mass gain : ', gainmass(jn,1)
IF(lwp) WRITE(numout, '(a, i2, a, D23.16, a, D23.16)') 'trcrad ptrb, tracer ', jn &
& , ' total mass : ', ztotmass, ', mass gain : ', gainmass(jn)
END IF
END DO
ENDIF
......
......@@ -5,7 +5,6 @@ MODULE trdmxl_trc
!!======================================================================
!! History : 9.0 ! 06-08 (C. Deltel) Original code (from trdmxl.F90)
!! ! 07-04 (C. Deltel) Bug fix : add trcrad trends
!! ! 07-06 (C. Deltel) key_gyre : do not call lbc_lnk
!!----------------------------------------------------------------------
#if defined key_top && defined key_trdmxl_trc
!!----------------------------------------------------------------------
......
......@@ -131,6 +131,7 @@ MODULE trc
CHARACTER(len=20), PUBLIC, DIMENSION(jp_bdy) :: cn_trc_dflt ! Default OBC condition for all tracers
CHARACTER(len=20), PUBLIC, DIMENSION(jp_bdy) :: cn_trc ! Choice of boundary condition for tracers
INTEGER, PUBLIC, DIMENSION(jp_bdy) :: nn_trcdmp_bdy !: =T Tracer damping
LOGICAL, PUBLIC, DIMENSION(jp_bdy) :: ln_zintobc !: =T obc data requires a vertical interpolation
!
! Vertical axis used in the sediment module
REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: profsed
......
......@@ -35,9 +35,9 @@ MODULE trcbc
TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:) :: sf_trccbc ! structure of data input CBC (file informations, fields read)
REAL(wp) , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:) :: rf_trofac ! multiplicative factor for OBCtracer values
#if defined key_agrif
TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:) :: sf_trcobc ! structure of data input OBC (file informations, fields read)
TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:,:) :: sf_trcobc ! structure of data input OBC (file informations, fields read)
#else
TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:), TARGET :: sf_trcobc
TYPE(FLD), SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:,:), TARGET :: sf_trcobc
#endif
#if defined key_top
......@@ -71,20 +71,22 @@ CONTAINS
INTEGER :: ierr0, ierr1, ierr2, ierr3 ! temporary integers
INTEGER :: ios ! Local integer output status for namelist read
INTEGER :: nblen, igrd ! support arrays for BDY
CHARACTER(len=100) :: clndta, clntrc
CHARACTER(len=10) :: clnbdy
!
CHARACTER(len=100) :: cn_dir_sbc, cn_dir_cbc, cn_dir_obc
TYPE(FLD_N), ALLOCATABLE, DIMENSION(:) :: slf_i ! local array of namelist informations on the fields to read
TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trcobc ! open
TYPE(FLD_N), DIMENSION(jp_bdy) :: sn_trcobc ! open
TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trcsbc ! surface
TYPE(FLD_N), DIMENSION(jpmaxtrc) :: sn_trccbc ! coastal
REAL(wp) , DIMENSION(jpmaxtrc) :: rn_trofac ! multiplicative factor for tracer values
REAL(wp) , DIMENSION(jpmaxtrc) :: rn_trsfac ! multiplicative factor for tracer values
REAL(wp) , DIMENSION(jpmaxtrc) :: rn_trcfac ! multiplicative factor for tracer values
CHARACTER(len=lca), DIMENSION(jpmaxtrc) :: cn_tronam ! tracer- to variable-name translation
!!
NAMELIST/namtrc_bc/ cn_dir_obc, sn_trcobc, rn_trofac, cn_dir_sbc, sn_trcsbc, rn_trsfac, &
& cn_dir_cbc, sn_trccbc, rn_trcfac, ln_rnf_ctl, rn_sbc_time, rn_cbc_time
NAMELIST/namtrc_bdy/ cn_trc_dflt, cn_trc, nn_trcdmp_bdy
NAMELIST/namtrc_bc/ cn_dir_obc, sn_trcobc, rn_trofac, cn_tronam, &
& cn_dir_sbc, sn_trcsbc, rn_trsfac, &
& cn_dir_cbc, sn_trccbc, rn_trcfac, &
& ln_rnf_ctl, rn_sbc_time, rn_cbc_time
!!----------------------------------------------------------------------
!
IF( lwp ) THEN
......@@ -106,6 +108,10 @@ CONTAINS
ENDIF
nb_trcobc = 0
n_trc_indobc(:) = 0
rn_trofac(:) = 1._wp
DO jn = 1, ntrc
cn_tronam(jn) = TRIM( ctrcnm(jn) ) ! Default variable name of open-boundary input data
END DO
!
ALLOCATE( n_trc_indsbc(ntrc), STAT=ierr0 )
IF( ierr0 > 0 ) THEN
......@@ -113,6 +119,7 @@ CONTAINS
ENDIF
nb_trcsbc = 0
n_trc_indsbc(:) = 0
rn_trsfac(:) = 1._wp
!
ALLOCATE( n_trc_indcbc(ntrc), STAT=ierr0 )
IF( ierr0 > 0 ) THEN
......@@ -120,6 +127,7 @@ CONTAINS
ENDIF
nb_trccbc = 0
n_trc_indcbc(:) = 0
rn_trcfac(:) = 1._wp
!
! Read Boundary Conditions Namelists
READ ( numnat_ref, namtrc_bc, IOSTAT = ios, ERR = 901)
......@@ -128,37 +136,8 @@ CONTAINS
902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namtrc_bc in configuration namelist' )
IF(lwm) WRITE ( numont, namtrc_bc )
IF ( ln_bdy ) THEN
READ ( numnat_ref, namtrc_bdy, IOSTAT = ios, ERR = 903)
903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in reference namelist' )
! make sur that all elements of the namelist variables have a default definition from namelist_ref
cn_trc (2:jp_bdy) = cn_trc (1)
cn_trc_dflt(2:jp_bdy) = cn_trc_dflt(1)
READ ( numnat_cfg, namtrc_bdy, IOSTAT = ios, ERR = 904 )
904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in configuration namelist' )
IF(lwm) WRITE ( numont, namtrc_bdy )
! setup up preliminary informations for BDY structure
DO jn = 1, ntrc
DO ib = 1, nb_bdy
! Set type of obc in BDY data structure (around here we may plug user override of obc type from nml)
IF ( ln_trc_obc(jn) ) THEN ; trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc (ib) )
ELSE ; trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc_dflt(ib) )
ENDIF
! set damping use in BDY data structure
trcdta_bdy(jn,ib)%dmp = .false.
IF(nn_trcdmp_bdy(ib) == 1 .AND. ln_trc_obc(jn) ) trcdta_bdy(jn,ib)%dmp = .true.
IF(nn_trcdmp_bdy(ib) == 2 ) trcdta_bdy(jn,ib)%dmp = .true.
IF(trcdta_bdy(jn,ib)%cn_obc == 'frs' .AND. nn_trcdmp_bdy(ib) /= 0 ) &
& CALL ctl_stop( 'trc_bc_ini: Use FRS OR relaxation' )
IF( .NOT.( 0 <= nn_trcdmp_bdy(ib) .AND. nn_trcdmp_bdy(ib) <= 2 ) ) &
& CALL ctl_stop( 'trc_bc_ini: Not a valid option for nn_trcdmp_bdy. Allowed: 0,1,2.' )
END DO
END DO
ELSE
! Force all tracers OBC to false if bdy not used
ln_trc_obc = .false.
ENDIF
! Disable passive-tracer OBC data input if BDY is inactive
IF( .NOT. ln_bdy ) ln_trc_obc(:) = .FALSE.
! compose BC data indexes
DO jn = 1, ntrc
......@@ -174,6 +153,7 @@ CONTAINS
END DO
! Print summmary of Boundary Conditions
IF( .NOT.ln_rnf .OR. .NOT.ln_linssh ) ln_rnf_ctl = .FALSE.
IF( lwp ) THEN
WRITE(numout,*)
WRITE(numout,'(a,i3)') ' Total tracers to be initialized with SURFACE BCs data:', nb_trcsbc
......@@ -194,67 +174,49 @@ CONTAINS
END DO
ENDIF
WRITE(numout,'(2a)') ' COASTAL BC data repository : ', TRIM(cn_dir_cbc)
IF( .NOT.ln_rnf .OR. .NOT.ln_linssh ) ln_rnf_ctl = .FALSE.
IF( ln_rnf_ctl ) WRITE(numout,'(a)') &
& ' -> Remove runoff dilution effect on tracers with absent river load (ln_rnf_ctl = .TRUE.)'
WRITE(numout,*)
WRITE(numout,'(a,i3)') ' Total tracers to be initialized with OPEN BCs data:', nb_trcobc
IF( ln_bdy .AND. nb_trcobc > 0 ) THEN
WRITE(numout,*) ' #trc NAME Boundary Mult.Fact. OBC Settings'
IF( nb_trcobc > 0 ) THEN
WRITE(numout,*) ' #trc NAME Boundary Mult.Fact. '
DO jn = 1, ntrc
IF ( ln_trc_obc(jn) ) WRITE(numout, 9001) jn, TRIM( sn_trcobc(jn)%clvar ), 'OBC', rn_trofac(jn), &
& (trcdta_bdy(jn,ib)%cn_obc,ib=1,nb_bdy)
IF ( .NOT. ln_trc_obc(jn) ) WRITE(numout, 9002) jn, 'Set data to IC and use default condition' , &
& (trcdta_bdy(jn,ib)%cn_obc,ib=1,nb_bdy)
END DO
WRITE(numout,*) ' '
DO ib = 1, nb_bdy
IF(nn_trcdmp_bdy(ib) == 0) WRITE(numout,9003) ' Boundary ', ib, &
& ' -> NO damping of tracers'
IF(nn_trcdmp_bdy(ib) == 1) WRITE(numout,9003) ' Boundary ', ib, &
& ' -> damping ONLY for tracers with external data provided'
IF(nn_trcdmp_bdy(ib) == 2) WRITE(numout,9003) ' Boundary ', ib, &
& ' -> damping of ALL tracers'
IF(nn_trcdmp_bdy(ib) > 0) THEN
WRITE(numout,9003) ' USE damping parameters from nambdy for boundary ', ib,' : '
WRITE(numout,'(a,f10.2,a)') ' - Inflow damping time scale : ',rn_time_dmp (ib),' days'
WRITE(numout,'(a,f10.2,a)') ' - Outflow damping time scale : ',rn_time_dmp_out(ib),' days'
ENDIF
IF ( ln_trc_obc(jn) ) WRITE(numout, 9001) jn, TRIM( cn_tronam(jn) ), 'OBC', rn_trofac(jn)
END DO
ENDIF
!
WRITE(numout,'(2a)') ' OPEN BC data repository : ', TRIM(cn_dir_obc)
ENDIF
9001 FORMAT(2x,i5, 3x, a15, 3x, a5, 6x, e11.3, 4x, 10a13)
9002 FORMAT(2x,i5, 3x, a41, 3x, 10a13)
9003 FORMAT(a, i5, a)
!
!
! OPEN Lateral boundary conditions
IF( ln_bdy .AND. nb_trcobc > 0 ) THEN
ALLOCATE ( sf_trcobc(nb_trcobc), rf_trofac(nb_trcobc), STAT=ierr1 )
ALLOCATE ( sf_trcobc(nb_trcobc, nb_bdy), rf_trofac(nb_trcobc), STAT=ierr1 )
IF( ierr1 > 0 ) THEN
CALL ctl_stop( 'trc_bc_ini: unable to allocate sf_trcobc structure' ) ; RETURN
ENDIF
!
igrd = 1 ! Everything is at T-points here
!
DO jn = 1, ntrc
DO ib = 1, nb_bdy
DO ib = 1, nb_bdy
write(clnbdy,'(i2)') ib
DO jn = 1, ntrc
!
nblen = idx_bdy(ib)%nblen(igrd)
!
IF( ln_trc_obc(jn) ) THEN !* Initialise from external data *!
jl = n_trc_indobc(jn)
slf_i(jl) = sn_trcobc(jn)
slf_i(jl) = sn_trcobc(ib)
slf_i(jl)%clvar = TRIM(cn_tronam(jn))
rf_trofac(jl) = rn_trofac(jn)
ALLOCATE( sf_trcobc(jl)%fnow(nblen,1,jpk) , STAT=ierr2 )
IF( sn_trcobc(jn)%ln_tint ) ALLOCATE( sf_trcobc(jl)%fdta(nblen,1,jpk,2) , STAT=ierr3 )
ALLOCATE( sf_trcobc(jl,ib)%fnow(nblen,1,jpk) , STAT=ierr2 )
IF( sn_trcobc(ib)%ln_tint ) ALLOCATE( sf_trcobc(jl,ib)%fdta(nblen,1,jpk,2) , STAT=ierr3 )
IF( ierr2 + ierr3 > 0 ) THEN
CALL ctl_stop( 'trc_bc_ini : unable to allocate passive tracer OBC data arrays' ) ; RETURN
ENDIF
trcdta_bdy(jn,ib)%trc => sf_trcobc(jl)%fnow(:,1,:)
trcdta_bdy(jn,ib)%trc => sf_trcobc(jl,ib)%fnow(:,1,:)
trcdta_bdy(jn,ib)%rn_fac = rf_trofac(jl)
ELSE !* Initialise obc arrays from initial conditions *!
ALLOCATE ( trcdta_bdy(jn,ib)%trc(nblen,jpk) )
......@@ -268,14 +230,18 @@ CONTAINS
trcdta_bdy(jn,ib)%rn_fac = 1._wp
ENDIF
END DO
!
CALL fld_fill( sf_trcobc(:,ib), slf_i, cn_dir_obc, 'trc_bc_ini', 'Passive tracer OBC data at boundary '//TRIM(clnbdy), 'namtrc_bc' )
END DO
!
CALL fld_fill( sf_trcobc, slf_i, cn_dir_obc, 'trc_bc_ini', 'Passive tracer OBC data', 'namtrc_bc' )
DO jn = 1, ntrc ! define imap pointer, must be done after the call to fld_fill
DO ib = 1, nb_bdy
IF( ln_trc_obc(jn) ) THEN !* Initialise from external data *!
jl = n_trc_indobc(jn)
sf_trcobc(jl)%imap => idx_bdy(ib)%nbmap(1:idx_bdy(ib)%nblen(igrd),igrd)
sf_trcobc(jl,ib)%imap => idx_bdy(ib)%nbmap(1:idx_bdy(ib)%nblen(igrd),igrd)
sf_trcobc(jl,ib)%igrd = igrd
sf_trcobc(jl,ib)%ibdy = ib
sf_trcobc(jl,ib)%lzint = ln_zintobc(ib) ! vertical interpolation
ENDIF
END DO
END DO
......@@ -353,8 +319,9 @@ CONTAINS
INTEGER , INTENT(in), OPTIONAL :: jit ! subcycle time-step index (for timesplitting option)
REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr ! passive tracers and RHS of tracer equation
!!
INTEGER :: ji, jj, jk, jn, jl ! Loop index
INTEGER :: ji, jj, jk, jn, jl, ib ! Loop index
REAL(wp) :: zfact, zrnf
LOGICAL :: lwriter
!!---------------------------------------------------------------------
!
IF( ln_timing ) CALL timing_start('trc_bc')
......@@ -365,24 +332,29 @@ CONTAINS
WRITE(numout,*) '~~~~~~~ '
ENDIF
lwriter = .FALSE.
IF( kt - nit000 <= 20 .OR. nitend - kt <= 20 ) lwriter = lwp
! 1. Update Boundary conditions data
IF( PRESENT(jit) ) THEN
!
! BDY: use pt_offset=0.5 as applied at the end of the step and fldread is referenced at the middle of the step
IF( nb_trcobc > 0 ) THEN
if (lwp) write(numout,'(a,i5,a,i10)') ' reading OBC data for ', nb_trcobc ,' variable(s) at step ', kt
CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc, kit=jit, pt_offset = 0.5_wp )
DO ib = 1, nb_bdy
if (lwriter) write(numout,'(a,i3,a,i10)') ' reading OBC data for segment ', ib ,' at step ', kt
CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc(:,ib), kit=jit, pt_offset = 0.5_wp )
ENDDO
ENDIF
!
! SURFACE boundary conditions
IF( nb_trcsbc > 0 ) THEN
if (lwp) write(numout,'(a,i5,a,i10)') ' reading SBC data for ', nb_trcsbc ,' variable(s) at step ', kt
if (lwriter) write(numout,'(a,i5,a,i10)') ' reading SBC data for ', nb_trcsbc ,' variable(s) at step ', kt
CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcsbc, kit=jit)
ENDIF
!
! COASTAL boundary conditions
IF( nb_trccbc > 0 ) THEN
if (lwp) write(numout,'(a,i5,a,i10)') ' reading CBC data for ', nb_trccbc ,' variable(s) at step ', kt
if (lwriter) write(numout,'(a,i5,a,i10)') ' reading CBC data for ', nb_trccbc ,' variable(s) at step ', kt
CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trccbc, kit=jit)
ENDIF
!
......@@ -390,19 +362,21 @@ CONTAINS
!
! BDY: use pt_offset=0.5 as applied at the end of the step and fldread is referenced at the middle of the step
IF( nb_trcobc > 0 ) THEN
if (lwp) write(numout,'(a,i5,a,i10)') ' reading OBC data for ', nb_trcobc ,' variable(s) at step ', kt
CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc, pt_offset = 0.5_wp )
DO ib = 1, nb_bdy
if (lwriter) write(numout,'(a,i3,a,i10)') ' reading OBC data for segment ', ib ,' at step ', kt
CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcobc(:,ib), pt_offset = 0.5_wp )
ENDDO
ENDIF
!
! SURFACE boundary conditions
IF( nb_trcsbc > 0 ) THEN
if (lwp) write(numout,'(a,i5,a,i10)') ' reading SBC data for ', nb_trcsbc ,' variable(s) at step ', kt
if (lwriter) write(numout,'(a,i5,a,i10)') ' reading SBC data for ', nb_trcsbc ,' variable(s) at step ', kt
CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trcsbc )
ENDIF
!
! COASTAL boundary conditions
IF( nb_trccbc > 0 ) THEN
if (lwp) write(numout,'(a,i5,a,i10)') ' reading CBC data for ', nb_trccbc ,' variable(s) at step ', kt
if (lwriter) write(numout,'(a,i5,a,i10)') ' reading CBC data for ', nb_trccbc ,' variable(s) at step ', kt
CALL fld_read( kt=kt, kn_fsbc=1, sd=sf_trccbc )
ENDIF
!
......
......@@ -26,6 +26,7 @@ MODULE trcbdy
IMPLICIT NONE
PRIVATE
PUBLIC trc_bdy_ini ! routine called in trcini.F90
PUBLIC trc_bdy ! routine called in trcnxt.F90
PUBLIC trc_bdy_dmp ! routine called in trcstp.F90
......@@ -36,6 +37,90 @@ MODULE trcbdy
!!----------------------------------------------------------------------
CONTAINS
SUBROUTINE trc_bdy_ini( ntrc )
!!----------------------------------------------------------------------
!! *** ROUTINE trc_bdy_ini ***
!!
!! ** Purpose : initialisation of the passive-tracer open boundary
!! conditions
!!
!! ** Action : reading in of the namtrc_bdy namelist
!!
!!----------------------------------------------------------------------
INTEGER, INTENT(in) :: ntrc ! number of tracers
!!
INTEGER :: jn, ib ! loop indices
INTEGER :: ios ! namelist input status
!!
NAMELIST/namtrc_bdy/ cn_trc_dflt, cn_trc, nn_trcdmp_bdy, ln_zintobc
!!----------------------------------------------------------------------
!
IF(lwp) THEN
WRITE(numout,*)
WRITE(numout,*) 'trc_bdy_ini : passive-tracer open boundary conditions'
WRITE(numout,*) '~~~~~~~~~~~'
END IF
!
READ( numnat_ref, namtrc_bdy, IOSTAT = ios, ERR = 903 )
903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in reference namelist' )
! make sure that all elements of the namelist variables have a default definition from namelist_top_ref
cn_trc (2:jp_bdy) = cn_trc (1)
cn_trc_dflt (2:jp_bdy) = cn_trc_dflt (1)
nn_trcdmp_bdy(2:jp_bdy) = nn_trcdmp_bdy(1)
READ( numnat_cfg, namtrc_bdy, IOSTAT = ios, ERR = 904 )
904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namtrc_bdy in configuration namelist' )
IF(lwm) WRITE ( numont, namtrc_bdy )
! setup up preliminary information for BDY structure
DO jn = 1, ntrc
DO ib = 1, nb_bdy
! set type of obc in BDY data structure
IF ( ln_trc_obc(jn) ) THEN
trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc (ib) )
ELSE
trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc_dflt(ib) )
ENDIF
! set damping use in BDY data structure
trcdta_bdy(jn,ib)%dmp = .FALSE.
IF(nn_trcdmp_bdy(ib) == 1 .AND. ln_trc_obc(jn) ) trcdta_bdy(jn,ib)%dmp = .TRUE.
IF(nn_trcdmp_bdy(ib) == 2 ) trcdta_bdy(jn,ib)%dmp = .TRUE.
IF(trcdta_bdy(jn,ib)%cn_obc == 'frs' .AND. nn_trcdmp_bdy(ib) /= 0 ) &
& CALL ctl_stop( 'trc_bc_ini: use FRS OR relaxation' )
IF( .NOT. ( 0 <= nn_trcdmp_bdy(ib) .AND. nn_trcdmp_bdy(ib) <= 2 ) ) &
& CALL ctl_stop( 'trc_bc_ini: not a valid option for nn_trcdmp_bdy (0, 1, or 2)' )
END DO
END DO
!
IF(lwp) THEN
WRITE(numout,*) ' #trc NAME Boundary Mult.Fact. OBC Settings'
DO jn = 1, ntrc
IF ( ln_trc_obc(jn) ) WRITE(numout, 9001) jn, TRIM(ctrcnm(jn)), 'OBC', &
& (trcdta_bdy(jn,ib)%cn_obc,ib=1,nb_bdy)
IF ( .NOT. ln_trc_obc(jn) ) WRITE(numout, 9002) jn, TRIM(ctrcnm(jn)), 'Boundary data from IC', &
& (trcdta_bdy(jn,ib)%cn_obc,ib=1,nb_bdy)
END DO
WRITE(numout,*) ' '
DO ib = 1, nb_bdy
IF(nn_trcdmp_bdy(ib) == 0) WRITE(numout,9003) ' Boundary ', ib, &
& ' -> NO damping of tracers'
IF(nn_trcdmp_bdy(ib) == 1) WRITE(numout,9003) ' Boundary ', ib, &
& ' -> damping ONLY for tracers with external data provided'
IF(nn_trcdmp_bdy(ib) == 2) WRITE(numout,9003) ' Boundary ', ib, &
& ' -> damping of ALL tracers'
IF(nn_trcdmp_bdy(ib) > 0) THEN
WRITE(numout,9003) ' USE damping parameters from nambdy for boundary ', ib,' : '
WRITE(numout,'(a,f10.2,a)') ' - Inflow damping time scale : ',rn_time_dmp (ib),' days'
WRITE(numout,'(a,f10.2,a)') ' - Outflow damping time scale : ',rn_time_dmp_out(ib),' days'
ENDIF
END DO
!
WRITE(numout,*) ' '
WRITE(numout,*) ' Vertical interpolation on segment(s) : ', (ln_zintobc(ib),ib=1,nb_bdy)
END IF
9001 FORMAT(2x, i5, 3x, a15, 3x, a5, 21x, 10a13)
9002 FORMAT(2x, i5, 3x, a15, 3x, a22, 4x, 10a13)
9003 FORMAT(a, i5, a)
END SUBROUTINE trc_bdy_ini
SUBROUTINE trc_bdy( kt, Kbb, Kmm, Krhs )
!!----------------------------------------------------------------------
!! *** SUBROUTINE trc_bdy ***
......
......@@ -26,6 +26,7 @@ MODULE trcini
USE trcice ! tracers in sea ice
USE trcbc ! generalized Boundary Conditions
USE trcais ! tracers from Antartic Ice Sheet
USE trcbdy ! passive-tracer open boundary conditions
IMPLICIT NONE
PRIVATE
......@@ -265,7 +266,8 @@ CONTAINS
!
tr(:,:,:,:,Kaa) = 0._wp
!
IF( ln_trcbc .AND. lltrcbc ) THEN
IF( ln_bdy ) CALL trc_bdy_ini( jptra )
IF( ln_trcbc .AND. lltrcbc ) THEN
CALL trc_bc_ini ( jptra, Kmm ) ! set tracers Boundary Conditions
CALL trc_bc ( nit000, Kmm, tr, Kaa ) ! tracers: surface and lateral Boundary Conditions
ENDIF
......
......@@ -361,7 +361,7 @@ CONTAINS
ENDIF
!
DO jk = 1, jpk
zvol(:,:,jk) = e1e2t(:,:) * e3t(:,:,jk,Krhs) * tmask(:,:,jk)
zvol(:,:,jk) = e1e2t(:,:) * e3t(:,:,jk,Kmm) * tmask(:,:,jk)
END DO
!
DO jn = 1, jptra
......
......@@ -58,15 +58,18 @@ CONTAINS
INTEGER, INTENT( in ) :: Kbb, Kmm, Krhs, Kaa ! time level indices
!
INTEGER :: jk, jn ! dummy loop indices
INTEGER :: ibb ! local time-level index
REAL(wp):: ztrai ! local scalar
LOGICAL :: ll_trcstat ! local logical
LOGICAL :: ll_trcstat, ll_trcpis ! local logical
CHARACTER (len=25) :: charout !
!!-------------------------------------------------------------------
!
IF( ln_timing ) CALL timing_start('trc_stp')
!
ibb = Kbb ! default "before" time-level index
IF( l_1st_euler .OR. ln_top_euler ) THEN ! at nittrc000
rDt_trc = rn_Dt ! = rn_Dt (use or restarting with Euler time stepping)
ibb = Kmm ! time-level index used to substitute the "before" with the "now" time level
ELSEIF( kt <= nittrc000 + 1 ) THEN ! at nittrc000 or nittrc000+1
rDt_trc = 2. * rn_Dt ! = 2 rn_Dt (leapfrog)
ENDIF
......@@ -81,9 +84,14 @@ CONTAINS
DO jk = 1, jpk
cvol(:,:,jk) = e1e2t(:,:) * e3t(:,:,jk,Kmm) * tmask(:,:,jk)
END DO
IF ( ll_trcstat .OR. kt == nitrst .OR. ( ln_check_mass .AND. kt == nitend ) &
& .OR. iom_use( "pno3tot" ) .OR. iom_use( "ppo4tot" ) .OR. iom_use( "psiltot" ) &
& .OR. iom_use( "palktot" ) .OR. iom_use( "pfertot" ) ) &
IF( ln_pisces ) THEN
IF ( iom_use( "pno3tot" ) .OR. iom_use( "ppo4tot" ) .OR. iom_use( "psiltot" ) &
& .OR. iom_use( "palktot" ) .OR. iom_use( "pfertot" ) ) &
& ll_trcpis = .TRUE.
ELSE
ll_trcpis = .FALSE.
ENDIF
IF ( ll_trcstat .OR. kt == nitrst .OR. ( ln_check_mass .AND. kt == nitend ) .OR. ll_trcpis ) &
& areatot = glob_sum( 'trcstp', cvol(:,:,:) )
ENDIF
!
......@@ -100,9 +108,9 @@ CONTAINS
CALL trc_rst_opn ( kt ) ! Open tracer restart file
IF( lrst_trc ) CALL trc_rst_cal ( kt, 'WRITE' ) ! calendar
CALL trc_wri ( kt, Kmm ) ! output of passive tracers with iom I/O manager
CALL trc_sms ( kt, Kbb, Kmm, Krhs ) ! tracers: sinks and sources
CALL trc_sms ( kt, ibb, Kmm, Krhs ) ! tracers: sinks and sources
#if ! defined key_sed_off
CALL trc_trp ( kt, Kbb, Kmm, Krhs, Kaa ) ! transport of passive tracers
CALL trc_trp ( kt, ibb, Kmm, Krhs, Kaa ) ! transport of passive tracers
#endif
!
! Note passive tracers have been time-filtered in trc_trp but the time level
......@@ -124,7 +132,7 @@ CONTAINS
tr(:,:,:,:,Kmm) = tr(:,:,:,:,Kaa)
ENDIF
!
IF( lrst_trc ) CALL trc_rst_wri( kt, Kmm, Kaa, Kbb ) ! write tracer restart file
IF( lrst_trc ) CALL trc_rst_wri( kt, Kmm, Kaa, ibb ) ! write tracer restart file
!
IF (ll_trcstat) THEN
ztrai = 0._wp ! content of all tracers
......
......@@ -128,7 +128,9 @@
ln_dynvor_ens = .true. ! energy conserving scheme
ln_dynvor_mix = .false. ! mixed scheme
ln_dynvor_een = .false. ! energy & enstrophy scheme
nn_een_e3f = 0 ! e3f = masked averaging of e3t divided by 4 (=0) or by the sum of mask (=1)
!
nn_e3f_typ = 0 ! type of e3f (EEN, ENE, ENS, MIX only) =0 e3f = mi(mj(e3t))/4
! ! =1 e3f = mi(mj(e3t))/mi(mj( tmask))
/
!-----------------------------------------------------------------------
&namdyn_hpg ! Hydrostatic pressure gradient option
......
......@@ -128,7 +128,9 @@
ln_dynvor_ens = .false. ! energy conserving scheme
ln_dynvor_mix = .false. ! mixed scheme
ln_dynvor_een = .true. ! energy & enstrophy scheme
nn_een_e3f = 0 ! e3f = masked averaging of e3t divided by 4 (=0) or by the sum of mask (=1)
!
nn_e3f_typ = 0 ! type of e3f (EEN, ENE, ENS, MIX only) =0 e3f = mi(mj(e3t))/4
! ! =1 e3f = mi(mj(e3t))/mi(mj( tmask))
/
!-----------------------------------------------------------------------
&namdyn_hpg ! Hydrostatic pressure gradient option
......
......@@ -128,7 +128,9 @@
ln_dynvor_ens = .false. ! energy conserving scheme
ln_dynvor_mix = .false. ! mixed scheme
ln_dynvor_een = .true. ! energy & enstrophy scheme
nn_een_e3f = 0 ! e3f = masked averaging of e3t divided by 4 (=0) or by the sum of mask (=1)
!
nn_e3f_typ = 0 ! type of e3f (EEN, ENE, ENS, MIX only) =0 e3f = mi(mj(e3t))/4
! ! =1 e3f = mi(mj(e3t))/mi(mj( tmask))
/
!-----------------------------------------------------------------------
&namdyn_hpg ! Hydrostatic pressure gradient option
......
......@@ -128,7 +128,9 @@
ln_dynvor_ens = .false. ! energy conserving scheme
ln_dynvor_mix = .false. ! mixed scheme
ln_dynvor_een = .false. ! energy & enstrophy scheme
nn_een_e3f = 0 ! e3f = masked averaging of e3t divided by 4 (=0) or by the sum of mask (=1)
!
nn_e3f_typ = 0 ! type of e3f (EEN, ENE, ENS, MIX only) =0 e3f = mi(mj(e3t))/4
! ! =1 e3f = mi(mj(e3t))/mi(mj( tmask))
/
!-----------------------------------------------------------------------
&namdyn_hpg ! Hydrostatic pressure gradient option
......
......@@ -128,7 +128,9 @@
ln_dynvor_ens = .true. ! energy conserving scheme
ln_dynvor_mix = .false. ! mixed scheme
ln_dynvor_een = .false. ! energy & enstrophy scheme
nn_een_e3f = 0 ! e3f = masked averaging of e3t divided by 4 (=0) or by the sum of mask (=1)
!
nn_e3f_typ = 0 ! type of e3f (EEN, ENE, ENS, MIX only) =0 e3f = mi(mj(e3t))/4
! ! =1 e3f = mi(mj(e3t))/mi(mj( tmask))
/
!-----------------------------------------------------------------------
&namdyn_hpg ! Hydrostatic pressure gradient option
......