Index: NEMO/branches/2019/dev_r12072_MERGE_OPTION2_2019/cfgs/SHARED/field_def_nemo-oce.xml
===================================================================
--- NEMO/branches/2019/dev_r12072_MERGE_OPTION2_2019/cfgs/SHARED/field_def_nemo-oce.xml	(revision 12172)
+++ NEMO/branches/2019/dev_r12072_MERGE_OPTION2_2019/cfgs/SHARED/field_def_nemo-oce.xml	(revision 12184)
@@ -1,4 +1,76 @@
 <?xml version="1.0"?> 
     <!-- $id$ -->
+
+    <field_definition level="1" prec="4" operation="average" enabled=".TRUE." default_value="1.e20" > <!-- time step automaticaly defined -->
+
+    <!--
+       =====================================================================================================
+       =                                   Configurable diagnostics                                        =
+       =====================================================================================================
+      -->
+
+    <field_group id="diamlr_fields">
+
+    <!--
+       =====================================================================================================
+                         Configuration of multiple-linear-regression analysis (diamlr)
+       =====================================================================================================
+       
+       This field group configures diamlr for tidal harmonic analysis of field
+       ssh: in addition to a regressor for fitting the mean value (diamlr_r101),
+       it includes the regressors for the analysis of the tidal constituents
+       that are available in the tidal-forcing implementation (see
+       ./src/OCE/SBC/tide.h90).
+
+      -->
+
+      <!-- Time -->
+      <field id="diamlr_time" grid_ref="diamlr_grid_T_2D" prec="8" />
+
+      <!-- Regressors for tidal harmonic analysis -->
+      <field id="diamlr_r001"  field_ref="diamlr_time" expr="sin( __TDE_M2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:M2"   />
+      <field id="diamlr_r002"  field_ref="diamlr_time" expr="cos( __TDE_M2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:M2"   />
+      <field id="diamlr_r003"  field_ref="diamlr_time" expr="sin( __TDE_N2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:N2"   />
+      <field id="diamlr_r004"  field_ref="diamlr_time" expr="cos( __TDE_N2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:N2"   />
+      <field id="diamlr_r005"  field_ref="diamlr_time" expr="sin( __TDE_2N2_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:2N2"  />
+      <field id="diamlr_r006"  field_ref="diamlr_time" expr="cos( __TDE_2N2_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:2N2"  />
+      <field id="diamlr_r007"  field_ref="diamlr_time" expr="sin( __TDE_S2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:S2"   />
+      <field id="diamlr_r008"  field_ref="diamlr_time" expr="cos( __TDE_S2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:S2"   />
+      <field id="diamlr_r009"  field_ref="diamlr_time" expr="sin( __TDE_K2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:K2"   />
+      <field id="diamlr_r010"  field_ref="diamlr_time" expr="cos( __TDE_K2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:K2"   />
+      <field id="diamlr_r011"  field_ref="diamlr_time" expr="sin( __TDE_K1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:K1"   />
+      <field id="diamlr_r012"  field_ref="diamlr_time" expr="cos( __TDE_K1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:K1"   />
+      <field id="diamlr_r013"  field_ref="diamlr_time" expr="sin( __TDE_O1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:O1"   />
+      <field id="diamlr_r014"  field_ref="diamlr_time" expr="cos( __TDE_O1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:O1"   />
+      <field id="diamlr_r015"  field_ref="diamlr_time" expr="sin( __TDE_Q1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:Q1"   />
+      <field id="diamlr_r016"  field_ref="diamlr_time" expr="cos( __TDE_Q1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:Q1"   />
+      <field id="diamlr_r017"  field_ref="diamlr_time" expr="sin( __TDE_P1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:P1"   />
+      <field id="diamlr_r018"  field_ref="diamlr_time" expr="cos( __TDE_P1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:P1"   />
+      <field id="diamlr_r019"  field_ref="diamlr_time" expr="sin( __TDE_M4_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:M4"   />
+      <field id="diamlr_r020"  field_ref="diamlr_time" expr="cos( __TDE_M4_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:M4"   />
+      <field id="diamlr_r021"  field_ref="diamlr_time" expr="sin( __TDE_Mf_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:Mf"   />
+      <field id="diamlr_r022"  field_ref="diamlr_time" expr="cos( __TDE_Mf_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:Mf"   />
+      <field id="diamlr_r023"  field_ref="diamlr_time" expr="sin( __TDE_Mm_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:Mm"   />
+      <field id="diamlr_r024"  field_ref="diamlr_time" expr="cos( __TDE_Mm_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:Mm"   />
+      <field id="diamlr_r025"  field_ref="diamlr_time" expr="sin( __TDE_Msqm_omega__ * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:Msqm" />
+      <field id="diamlr_r026"  field_ref="diamlr_time" expr="cos( __TDE_Msqm_omega__ * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:Msqm" />
+      <field id="diamlr_r027"  field_ref="diamlr_time" expr="sin( __TDE_Mtm_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:Mtm"  />
+      <field id="diamlr_r028"  field_ref="diamlr_time" expr="cos( __TDE_Mtm_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:Mtm"  />
+      <field id="diamlr_r029"  field_ref="diamlr_time" expr="sin( __TDE_S1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:S1"   />
+      <field id="diamlr_r030"  field_ref="diamlr_time" expr="cos( __TDE_S1_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:S1"   />
+      <field id="diamlr_r031"  field_ref="diamlr_time" expr="sin( __TDE_MU2_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:MU2"  />
+      <field id="diamlr_r032"  field_ref="diamlr_time" expr="cos( __TDE_MU2_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:MU2"  />
+      <field id="diamlr_r033"  field_ref="diamlr_time" expr="sin( __TDE_NU2_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:NU2"  />
+      <field id="diamlr_r034"  field_ref="diamlr_time" expr="cos( __TDE_NU2_omega__  * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:NU2"  />
+      <field id="diamlr_r035"  field_ref="diamlr_time" expr="sin( __TDE_L2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:L2"   />
+      <field id="diamlr_r036"  field_ref="diamlr_time" expr="cos( __TDE_L2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:L2"   />
+      <field id="diamlr_r037"  field_ref="diamlr_time" expr="sin( __TDE_T2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:sin:T2"   />
+      <field id="diamlr_r038"  field_ref="diamlr_time" expr="cos( __TDE_T2_omega__   * diamlr_time )" enabled=".TRUE."  comment="harmonic:cos:T2"   />
+      <field id="diamlr_r101"  field_ref="diamlr_time" expr="diamlr_time^0.0"                         enabled=".TRUE."  comment="mean"              />
+
+      <!-- Fields selected for regression analysis -->
+      <field id="diamlr_f001" field_ref="ssh" enabled=".TRUE." />
+
+    </field_group>
     
     <!-- 
@@ -8,5 +80,24 @@
 ============================================================================================================
     -->
-    <field_definition level="1" prec="4" operation="average" enabled=".TRUE." default_value="1.e20" > <!-- time step automaticaly defined -->
+
+    <field_group id="diadetide_fields">
+
+    <!--
+       =====================================================================================================
+                 Weight fields for the computation of daily detided model diagnostics (diadetide)
+       =====================================================================================================
+
+       -->
+
+      <field id="diadetide_weight" grid_ref="diadetide_grid_T_2D" enabled=".TRUE." />
+      <field id="diadetide_weight_grid_T_2D" field_ref="diadetide_weight" grid_ref="diadetide_grid_T_2D" enabled=".TRUE." > this </field>
+      <field id="diadetide_weight_grid_U_2D" field_ref="diadetide_weight" grid_ref="diadetide_grid_U_2D" enabled=".TRUE." > this </field>
+      <field id="diadetide_weight_grid_V_2D" field_ref="diadetide_weight" grid_ref="diadetide_grid_V_2D" enabled=".TRUE." > this </field>
+      <field id="diadetide_weight_grid_T_3D" field_ref="diadetide_weight" grid_ref="diadetide_grid_2D_to_grid_T_3D" enabled=".TRUE." > this </field>
+      <field id="diadetide_weight_grid_U_3D" field_ref="diadetide_weight" grid_ref="diadetide_grid_2D_to_grid_U_3D" enabled=".TRUE." > this </field>
+      <field id="diadetide_weight_grid_V_3D" field_ref="diadetide_weight" grid_ref="diadetide_grid_2D_to_grid_V_3D" enabled=".TRUE." > this </field>
+      <field id="diadetide_weight_grid_W_3D" field_ref="diadetide_weight" grid_ref="diadetide_grid_2D_to_grid_W_3D" enabled=".TRUE." > this </field>
+
+    </field_group>
 
     <!-- 
@@ -138,77 +229,25 @@
 
       <field_group id="Tides_T" grid_ref="grid_T_2D" operation="once" >
-        <!-- tidal composante -->
-        <field id="M2x"          long_name="M2 Elevation harmonic real part "                             unit="m"        />
-        <field id="M2y"          long_name="M2 Elevation harmonic imaginary part"                         unit="m"        />
-        <field id="S2x"          long_name="S2 Elevation harmonic real part "                             unit="m"        />
-        <field id="S2y"          long_name="S2 Elevation harmonic imaginary part"                         unit="m"        />
-        <field id="N2x"          long_name="N2 Elevation harmonic real part "                             unit="m"        />
-        <field id="N2y"          long_name="N2 Elevation harmonic imaginary part"                         unit="m"        />
-        <field id="K1x"          long_name="K1 Elevation harmonic real part "                             unit="m"        />
-        <field id="K1y"          long_name="K1 Elevation harmonic imaginary part"                         unit="m"        />
-        <field id="O1x"          long_name="O1 Elevation harmonic real part "                             unit="m"        />
-        <field id="O1y"          long_name="O1 Elevation harmonic imaginary part"                         unit="m"        />
-        <field id="Q1x"          long_name="Q1 Elevation harmonic real part "                             unit="m"        />
-        <field id="Q1y"          long_name="Q1 Elevation harmonic imaginary part"                         unit="m"        />
-        <field id="M4x"          long_name="M4 Elevation harmonic real part "                             unit="m"        />
-        <field id="M4y"          long_name="M4 Elevation harmonic imaginary part"                         unit="m"        />
-        <field id="K2x"          long_name="K2 Elevation harmonic real part "                             unit="m"        />
-        <field id="K2y"          long_name="K2 Elevation harmonic imaginary part"                         unit="m"        />
-        <field id="P1x"          long_name="P1 Elevation harmonic real part "                             unit="m"        />
-        <field id="P1y"          long_name="P1 Elevation harmonic imaginary part"                         unit="m"        />
-        <field id="Mfx"          long_name="Mf Elevation harmonic real part "                             unit="m"        />
-        <field id="Mfy"          long_name="Mf Elevation harmonic imaginary part"                         unit="m"        />
-        <field id="Mmx"          long_name="Mm Elevation harmonic real part "                             unit="m"        />
-        <field id="Mmy"          long_name="Mm Elevation harmonic imaginary part"                         unit="m"        />
-      </field_group>
-	 
-      <field_group id="Tides_U" grid_ref="grid_U_2D" operation="once" >
-        <field id="M2x_u"        long_name="M2 current barotrope along i-axis harmonic real part "        unit="m/s"      />
-        <field id="M2y_u"        long_name="M2 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="S2x_u"        long_name="S2 current barotrope along i-axis harmonic real part "        unit="m/s"      />
-        <field id="S2y_u"        long_name="S2 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="N2x_u"        long_name="N2 current barotrope along i-axis harmonic real part "        unit="m/s"      />
-        <field id="N2y_u"        long_name="N2 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="K1x_u"        long_name="K1 current barotrope along i-axis harmonic real part "        unit="m/s"      />
-        <field id="K1y_u"        long_name="K1 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="O1x_u"        long_name="O1 current barotrope along i-axis harmonic real part "        unit="m/s"      />
-        <field id="O1y_u"        long_name="O1 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="Q1x_u"        long_name="Q1 current barotrope along i-axis harmonic real part "        unit="m/s"      />
-        <field id="Q1y_u"        long_name="Q1 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="M4x_u"        long_name="M4 current barotrope along i-axis harmonic real part "        unit="m/s"      />
-        <field id="M4y_u"        long_name="M4 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="K2x_u"        long_name="K2 current barotrope along i-axis harmonic real part "        unit="m/s"      />
-        <field id="K2y_u"        long_name="K2 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="P1x_u"        long_name="P1 current barotrope along i-axis harmonic real part "        unit="m/s"      />
-        <field id="P1y_u"        long_name="P1 current barotrope along i-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="Mfx_u"        long_name="Mf current barotrope along i-axis harmonic real part "        unit="m/s"      />
-        <field id="Mfy_u"        long_name="Mf current barotrope along i-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="Mmx_u"        long_name="Mm current barotrope along i-axis harmonic real part "        unit="m/s"      />
-        <field id="Mmy_u"        long_name="Mm current barotrope along i-axis harmonic imaginary part "   unit="m/s"      />
-      </field_group>
-	 
-      <field_group id="Tides_V" grid_ref="grid_V_2D" operation="once" >
-        <field id="M2x_v"        long_name="M2 current barotrope along j-axis harmonic real part "        unit="m/s"      />
-        <field id="M2y_v"        long_name="M2 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="S2x_v"        long_name="S2 current barotrope along j-axis harmonic real part "        unit="m/s"      />
-        <field id="S2y_v"        long_name="S2 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="N2x_v"        long_name="N2 current barotrope along j-axis harmonic real part "        unit="m/s"      />
-        <field id="N2y_v"        long_name="N2 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="K1x_v"        long_name="K1 current barotrope along j-axis harmonic real part "        unit="m/s"      />
-        <field id="K1y_v"        long_name="K1 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="O1x_v"        long_name="O1 current barotrope along j-axis harmonic real part "        unit="m/s"      />
-        <field id="O1y_v"        long_name="O1 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="Q1x_v"        long_name="Q1 current barotrope along j-axis harmonic real part "        unit="m/s"      />
-        <field id="Q1y_v"        long_name="Q1 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="M4x_v"        long_name="M4 current barotrope along j-axis harmonic real part "        unit="m/s"      />
-        <field id="M4y_v"        long_name="M4 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="K2x_v"        long_name="K2 current barotrope along j-axis harmonic real part "        unit="m/s"      />
-        <field id="K2y_v"        long_name="K2 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="P1x_v"        long_name="P1 current barotrope along j-axis harmonic real part "        unit="m/s"      />
-        <field id="P1y_v"        long_name="P1 current barotrope along j-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="Mfx_v"        long_name="Mf current barotrope along j-axis harmonic real part "        unit="m/s"      />
-        <field id="Mfy_v"        long_name="Mf current barotrope along j-axis harmonic imaginary part "   unit="m/s"      />
-        <field id="Mmx_v"        long_name="Mm current barotrope along j-axis harmonic real part "        unit="m/s"      />
-        <field id="Mmy_v"        long_name="Mm current barotrope along j-axis harmonic imaginary part "   unit="m/s"      />	 
+        <!-- Tidal potential -->
+        <field id="tide_pot"      long_name="Total tidal potential" unit="m" />
+        <field id="tide_pot_M2"   long_name="M2 tidal potential"    unit="m" />
+        <field id="tide_pot_N2"   long_name="N2 tidal potential"    unit="m" />
+        <field id="tide_pot_2N2"  long_name="2N2 tidal potential"   unit="m" />
+        <field id="tide_pot_S2"   long_name="S2 tidal potential"    unit="m" />
+        <field id="tide_pot_K2"   long_name="K2 tidal potential"    unit="m" />
+        <field id="tide_pot_K1"   long_name="K1 tidal potential"    unit="m" />
+        <field id="tide_pot_O1"   long_name="O1 tidal potential"    unit="m" />
+        <field id="tide_pot_Q1"   long_name="Q1 tidal potential"    unit="m" />
+        <field id="tide_pot_P1"   long_name="P1 tidal potential"    unit="m" />
+        <field id="tide_pot_M4"   long_name="M4 tidal potential"    unit="m" />
+        <field id="tide_pot_Mf"   long_name="Mf tidal potential"    unit="m" />
+        <field id="tide_pot_Mm"   long_name="Mm tidal potential"    unit="m" />
+        <field id="tide_pot_Msqm" long_name="Msqm tidal potential"  unit="m" />
+        <field id="tide_pot_Mtm"  long_name="Mtm tidal potential"   unit="m" />
+        <field id="tide_pot_S1"   long_name="S1 tidal potential"    unit="m" />
+        <field id="tide_pot_MU2"  long_name="MU2 tidal potential"   unit="m" />
+        <field id="tide_pot_NU2"  long_name="NU2 tidal potential"   unit="m" />
+        <field id="tide_pot_L2"   long_name="L2 tidal potential"    unit="m" />
+        <field id="tide_pot_T2"   long_name="T2 tidal potential"    unit="m" />
       </field_group>
 
