From 7deca9d70954a03820b26236c8421b2c397cdd83 Mon Sep 17 00:00:00 2001
From: Christian Ethe <christian.ethe@ipsl.fr>
Date: Mon, 27 Jun 2022 15:02:18 +0000
Subject: [PATCH] Resolve "Bug in calcite conservation in PISCES"

---
 cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_top_cfg | 4 ++--
 cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_top_cfg | 4 ++--
 src/TOP/PISCES/P4Z/p4zsed.F90                 | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_top_cfg b/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_top_cfg
index 55f9f177c..14d9a89e2 100644
--- a/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_top_cfg
+++ b/cfgs/ORCA2_ICE_PISCES/EXPREF/namelist_top_cfg
@@ -113,8 +113,8 @@
    sn_trcsbc(7)  = 'dust.orca.new'   ,       -1          , 'dustsi'      ,  .true.      , .true. , 'yearly'  , ''       , ''    , ''
    sn_trcsbc(14) = 'dust.orca.new'   ,       -1          , 'dustfer'     ,  .true.      , .true. , 'yearly'  , ''       , ''    , ''
    sn_trcsbc(23) = 'ndeposition.orca',      -12          , 'ndep'        ,  .false.     , .true. , 'yearly'  , ''       , ''    , ''
-   rn_trsfac(5)  = 7.9258065e-02    !  (  0.021 / 31. * 117 )
-   rn_trsfac(7)  = 3.1316726e-01    !  ( 8.8   / 28.1 )
+   rn_trsfac(5)  = 3.774194e-02     !  (  1E-3 / 31. * 117 )
+   rn_trsfac(7)  = 9.572954e-03     !  ( 8.8   / 28.1 )
    rn_trsfac(14) = 6.2667860e-04    !  (  0.035 / 55.85 )
    rn_trsfac(23) = 5.2232143e-01    !  ( From kgN m-2 s-1 to molC l-1 ====> zfact = 7.3125/14 )
    rn_sbc_time   = 1.               !  Time scaling factor for SBC and CBC data (seconds in a day)
diff --git a/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_top_cfg b/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_top_cfg
index 55f9f177c..14d9a89e2 100644
--- a/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_top_cfg
+++ b/cfgs/ORCA2_OFF_PISCES/EXPREF/namelist_top_cfg
@@ -113,8 +113,8 @@
    sn_trcsbc(7)  = 'dust.orca.new'   ,       -1          , 'dustsi'      ,  .true.      , .true. , 'yearly'  , ''       , ''    , ''
    sn_trcsbc(14) = 'dust.orca.new'   ,       -1          , 'dustfer'     ,  .true.      , .true. , 'yearly'  , ''       , ''    , ''
    sn_trcsbc(23) = 'ndeposition.orca',      -12          , 'ndep'        ,  .false.     , .true. , 'yearly'  , ''       , ''    , ''
-   rn_trsfac(5)  = 7.9258065e-02    !  (  0.021 / 31. * 117 )
-   rn_trsfac(7)  = 3.1316726e-01    !  ( 8.8   / 28.1 )
+   rn_trsfac(5)  = 3.774194e-02     !  (  1E-3 / 31. * 117 )
+   rn_trsfac(7)  = 9.572954e-03     !  ( 8.8   / 28.1 )
    rn_trsfac(14) = 6.2667860e-04    !  (  0.035 / 55.85 )
    rn_trsfac(23) = 5.2232143e-01    !  ( From kgN m-2 s-1 to molC l-1 ====> zfact = 7.3125/14 )
    rn_sbc_time   = 1.               !  Time scaling factor for SBC and CBC data (seconds in a day)
diff --git a/src/TOP/PISCES/P4Z/p4zsed.F90 b/src/TOP/PISCES/P4Z/p4zsed.F90
index 80e1e3fb0..23aa6ec77 100644
--- a/src/TOP/PISCES/P4Z/p4zsed.F90
+++ b/src/TOP/PISCES/P4Z/p4zsed.F90
@@ -149,8 +149,8 @@ CONTAINS
             zcaloss = tr(ji,jj,ikt,jpcal,Kbb) * zwsc
             tr(ji,jj,ikt,jpsil,Krhs) = tr(ji,jj,ikt,jpsil,Krhs) + zsiloss * zrivsil 
             !
-            zfactcal = MIN( excess(ji,jj,ikt), 0.2 )
-            zfactcal = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) )
+            zfactcal = MAX(-0.1, MIN( excess(ji,jj,ikt), 0.2 ) )
+            zfactcal = 0.3 + 0.7 * MIN( 1., (0.1 + zfactcal) / ( 0.5 - zfactcal ) )
             zrivalk  = sedcalfrac * zfactcal
             tr(ji,jj,ikt,jptal,Krhs) =  tr(ji,jj,ikt,jptal,Krhs) + zcaloss * zrivalk * 2.0
             tr(ji,jj,ikt,jpdic,Krhs) =  tr(ji,jj,ikt,jpdic,Krhs) + zcaloss * zrivalk
@@ -363,7 +363,7 @@ CONTAINS
       r1_rday  = 1. / rday
       !
       sedsilfrac = 0.03     ! percentage of silica loss in the sediments
-      sedcalfrac = 0.6      ! percentage of calcite loss in the sediments
+      sedcalfrac = 0.99     ! percentage of calcite loss in the sediments
       !
       lk_sed = ln_sediment .AND. ln_sed_2way 
       !
-- 
GitLab