From 87b829f9bfd7b956b3135bb00603e3273e892872 Mon Sep 17 00:00:00 2001
From: Thierry Fouquet <thierry.fouquet@edf.fr>
Date: Tue, 14 Jan 2025 17:27:41 +0100
Subject: [PATCH] [VnV] Add a test for tel2tom in 2d coupling in t3d/tomawac
 coupling with wind

---
 .../Coupling_Wind/f3d_3Dcoupling_diff_2.slf   |  3 +
 .../fom_3Dcouplittoral_diff_2.slf             |  3 +
 .../Coupling_Wind/t3d_tel2tom_different_2.cas | 68 +++++++++++++++
 .../tom_3Dcouplittoral_diff_2.cas             | 66 ++++++++++++++
 .../tomawac/Coupling_Wind/vnv_3d_coupling.py  | 86 ++++++++++++++++---
 5 files changed, 212 insertions(+), 14 deletions(-)
 create mode 100644 examples/tomawac/Coupling_Wind/f3d_3Dcoupling_diff_2.slf
 create mode 100644 examples/tomawac/Coupling_Wind/fom_3Dcouplittoral_diff_2.slf
 create mode 100644 examples/tomawac/Coupling_Wind/t3d_tel2tom_different_2.cas
 create mode 100644 examples/tomawac/Coupling_Wind/tom_3Dcouplittoral_diff_2.cas

diff --git a/examples/tomawac/Coupling_Wind/f3d_3Dcoupling_diff_2.slf b/examples/tomawac/Coupling_Wind/f3d_3Dcoupling_diff_2.slf
new file mode 100644
index 0000000000..63cd397f8e
--- /dev/null
+++ b/examples/tomawac/Coupling_Wind/f3d_3Dcoupling_diff_2.slf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:44fc970ac7f85f4ac3faebcf8627992bf1b897c22120f52353e5627d0bc609b6
+size 2350424
diff --git a/examples/tomawac/Coupling_Wind/fom_3Dcouplittoral_diff_2.slf b/examples/tomawac/Coupling_Wind/fom_3Dcouplittoral_diff_2.slf
new file mode 100644
index 0000000000..055528573b
--- /dev/null
+++ b/examples/tomawac/Coupling_Wind/fom_3Dcouplittoral_diff_2.slf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:eb9ad4347722e8622c1598a5bfb2cd2f458219be1d05155bba376fdbe5245136
+size 371732
diff --git a/examples/tomawac/Coupling_Wind/t3d_tel2tom_different_2.cas b/examples/tomawac/Coupling_Wind/t3d_tel2tom_different_2.cas
new file mode 100644
index 0000000000..2653f53ad4
--- /dev/null
+++ b/examples/tomawac/Coupling_Wind/t3d_tel2tom_different_2.cas
@@ -0,0 +1,68 @@
+TITLE = 'TELEMAC 3D : COUPLAGE TOMAWAC'
+/
+/----------------------------------------------------------------------/
+/     GENERAL OPTIONS
+/----------------------------------------------------------------------/
+/ COUPLING WITH TOMAWAC                                                /
+/----------------------------------------------------------------------/
+WAVE DRIVEN CURRENTS = YES
+COUPLING WITH = 'TOMAWAC2'
+COUPLING PERIOD FOR TOMAWAC = 1
+TOMAWAC STEERING FILE = 'tom_3Dcouplittoral_diff_2.cas'
+BOUNDARY CONDITIONS FILE : geo_t3d_littoral.cli
+GEOMETRY FILE          : geo_t3d_tel2tom_diff.slf
+3D RESULT FILE : r3d_3Dcoupling_diff_2.slf
+2D RESULT FILE : r2d_3Dcoupling_diff_2.slf
+/
+/----------------------------------------------------------------------/
+/     OPTIONS GENERALES
+/----------------------------------------------------------------------/
+NUMBER OF TIME STEPS : 100
+TIME STEP           : 10.
+LISTING PRINTOUT PERIOD : 10
+GRAPHIC PRINTOUT PERIOD : 10
+VARIABLES FOR 2D GRAPHIC PRINTOUTS : X,Y
+VARIABLES FOR 3D GRAPHIC PRINTOUTS : Z,U,V,W
+NUMBER OF HORIZONTAL LEVELS = 5
+INITIAL CONDITIONS : 'CONSTANT ELEVATION'
+INITIAL ELEVATION : 0.
+PRESCRIBED ELEVATIONS : 0.;0.;0.
+PRESCRIBED VELOCITIES : 0.;0.;0.
+MASS-BALANCE = YES
+TIDAL FLATS = YES
+NON-HYDROSTATIC VERSION = NO
+/-------------------------
+/  CONVECTION-DIFFUSION-PROPAGATION
+/-------------------------
+SOLVER FOR DIFFUSION OF VELOCITIES = 1
+MAXIMUM NUMBER OF ITERATIONS FOR DIFFUSION OF VELOCITIES = 200
+ACCURACY FOR DIFFUSION OF VELOCITIES = 1.D-9
+/
+SOLVER FOR PROPAGATION = 7
+MAXIMUM NUMBER OF ITERATIONS FOR PROPAGATION = 200
+ACCURACY FOR PROPAGATION = 1.D-9
+/ diminuer si pas stable, jusqu'à 0
+FREE SURFACE GRADIENT COMPATIBILITY = 0.9
+/
+MATRIX STORAGE = 3
+
+MASS-LUMPING FOR DEPTH = 1.0
+IMPLICITATION FOR DEPTH = 0.6
+IMPLICITATION FOR VELOCITIES = 1.0
+HORIZONTAL TURBULENCE MODEL = 4
+/ This choice of vertical turbulence is chosen to be simple
+/ but not recommanded for use.
+VERTICAL TURBULENCE MODEL = 1
+
+/----------------------------/
+/     SOURCE TERMS
+/----------------------------/
+LAW OF BOTTOM FRICTION = 5
+FRICTION COEFFICIENT FOR THE BOTTOM = 0.001D0
+
+WIND                          : YES
+ASCII ATMOSPHERIC DATA FILE     = 'fo1_wind'
+OPTION FOR WIND                              = 2
+/
+/ DEFAULT VALUE UNTIL V8P5 KEPT FOR NON REGRESSION
+TREATMENT OF NEGATIVE DEPTHS = 1
diff --git a/examples/tomawac/Coupling_Wind/tom_3Dcouplittoral_diff_2.cas b/examples/tomawac/Coupling_Wind/tom_3Dcouplittoral_diff_2.cas
new file mode 100644
index 0000000000..37ae0fe1de
--- /dev/null
+++ b/examples/tomawac/Coupling_Wind/tom_3Dcouplittoral_diff_2.cas
@@ -0,0 +1,66 @@
+DEBUGGER = 0
+/********************************************************************
+/             STEERING FILE
+/             TOMAWAC
+/
+/********************************************************************
+/--------------------------------------------------------------------
+/     FILES
+/--------------------------------------------------------------------
+GEOMETRY FILE = 'geo_tom_tom2tel_diff.slf'
+BOUNDARY CONDITIONS FILE = 'geo_tom_different.cli'
+2D RESULTS FILE = 'tom_3Dcouplittoral_diff_2.slf'
+/--------------------------------------------------------------------
+/ INPUTS - OUTPUTS
+/--------------------------------------------------------------------
+TITLE = 'LITTORAL'
+PERIOD FOR GRAPHIC PRINTOUTS = 10
+VARIABLES FOR 2D GRAPHIC PRINTOUTS =
+HM0,DMOY,TPR5,ZF,WD,FX,FY,UX,UY,VX,VY
+PERIOD FOR LISTING PRINTOUTS = 10
+/--------------------------------------------------------------------
+/ DISCRETISATION
+/--------------------------------------------------------------------
+MINIMAL FREQUENCY = 0.05
+FREQUENTIAL RATIO = 1.1007
+NUMBER OF FREQUENCIES = 12
+NUMBER OF DIRECTIONS = 12
+TIME STEP = 10.
+NUMBER OF TIME STEP = 100
+/--------------------------------------------------------------------
+/ INITIAL CONDITIONS
+/--------------------------------------------------------------------
+INITIAL STILL WATER LEVEL = 10.
+TYPE OF INITIAL DIRECTIONAL SPECTRUM = 6
+INITIAL SIGNIFICANT WAVE HEIGHT = 1.
+INITIAL PEAK FREQUENCY = 0.125
+INITIAL PEAK FACTOR = 3.3
+INITIAL ANGULAR DISTRIBUTION FUNCTION = 1
+INITIAL WEIGHTING FACTOR FOR ADF = 1.0
+INITIAL MAIN DIRECTION 1 = 30.
+INITIAL DIRECTIONAL SPREAD 1 = 3
+/--------------------------------------------------------------------
+/ BOUNDARY CONDITIONS
+/--------------------------------------------------------------------
+TYPE OF BOUNDARY DIRECTIONAL SPECTRUM = 6
+BOUNDARY SIGNIFICANT WAVE HEIGHT = 1.
+BOUNDARY PEAK FREQUENCY = 0.125
+BOUNDARY PEAK FACTOR = 3.3
+BOUNDARY MAIN DIRECTION 1 = 30.
+BOUNDARY DIRECTIONAL SPREAD 1 = 3.
+/--------------------------------------------------------------------
+/ OPTIONS
+/--------------------------------------------------------------------
+MINIMUM WATER DEPTH = 0.05
+INFINITE DEPTH = NO
+CONSIDERATION OF SOURCE TERMS = YES
+CONSIDERATION OF A WIND = YES
+WIND GENERATION = 1
+WHITE CAPPING DISSIPATION = 1
+LINEAR WAVE GROWTH = 1
+STATIONARY WIND = FALSE
+BOTTOM FRICTION DISSIPATION = 1
+/===========DEFERLEMENT
+NUMBER OF BREAKING TIME STEPS = 5
+/=========== 1 : Battjes et Janssen (1978)
+DEPTH-INDUCED BREAKING DISSIPATION = 1
diff --git a/examples/tomawac/Coupling_Wind/vnv_3d_coupling.py b/examples/tomawac/Coupling_Wind/vnv_3d_coupling.py
index bb8177e927..01b1897e26 100644
--- a/examples/tomawac/Coupling_Wind/vnv_3d_coupling.py
+++ b/examples/tomawac/Coupling_Wind/vnv_3d_coupling.py
@@ -58,13 +58,13 @@ class VnvStudy(AbstractVnvStudy):
                        cas=cas)
         del cas
 
-        # tel2tom T3D+TOM scalar mode 2D coupling same mesh
+        # tel2tom T3D+TOM scalar mode 3D coupling same mesh
         self.add_study('vnv_5',
                        'telemac3d',
                        't3d_tel2tom_same.cas')
 
 
-        # teltotom T3D+TOM parallel mode 2D coupling same mesh
+        # teltotom T3D+TOM parallel mode 3D coupling same mesh
         cas = TelemacCas('t3d_tel2tom_same.cas', get_dico('telemac3d'))
         cas.set('PARALLEL PROCESSORS', 4)
 
@@ -74,13 +74,12 @@ class VnvStudy(AbstractVnvStudy):
                        cas=cas)
         del cas
 
-        # tel2tom T3D+TOM scalar mode 2D coupling mesh different
+        # tel2tom T3D+TOM scalar mode 3D coupling mesh different
         self.add_study('vnv_7',
                        'telemac3d',
                        't3d_tel2tom_different.cas')
 
-
-        # tel2tom T3D+TOM parallel mode 2D coupling mesh different
+        # tel2tom T3D+TOM parallel mode 3D coupling mesh different
         cas = TelemacCas('t3d_tel2tom_different.cas', get_dico('telemac3d'))
         cas.set('PARALLEL PROCESSORS', 4)
 
@@ -90,37 +89,53 @@ class VnvStudy(AbstractVnvStudy):
                        cas=cas)
         del cas
 
+        # tel2tom T3D+TOM scalar mode 2D coupling mesh different
+        self.add_study('vnv_9',
+                       'telemac3d',
+                       't3d_tel2tom_different_2.cas')
+
+        # tel2tom T3D+TOM parallel mode 2D coupling mesh different
+        cas = TelemacCas('t3d_tel2tom_different_2.cas', get_dico('telemac3d'))
+        cas.set('PARALLEL PROCESSORS', 4)
+
+        self.add_study('vnv_10',
+                       'telemac3d',
+                       't3d_tel2tom_different_2_par.cas',
+                       cas=cas)
+        del cas
+        
+
     def _check_results(self):
         """
         Post-treatment processes
         """
 
-        # Comparison with the last time frame of the reference file.
+        # Comparison with the last time frame of the reference file. 2D coupling with T3D
         self.check_epsilons('vnv_1:T3DRES',
                             'f3d_littoral.slf',
                             eps=[1e-8, 1e-8, 1e-8, 1e-8])
 
-        # Comparison with the last time frame of the reference file.
+        # Comparison with the last time frame of the reference file. 2D coupling with T3D
         self.check_epsilons('vnv_2:T3DRES',
                             'f3d_littoral.slf',
                             eps=[1e-8, 1e-8, 1e-8, 1e-8])
 
-        # Comparison between sequential and parallel run.
+        # Comparison between sequential and parallel run. 2D coupling with T3D
         self.check_epsilons('vnv_1:T3DRES',
                             'vnv_2:T3DRES',
                             eps=[1e-8, 1e-8, 1e-8, 1e-8])
 
-        # Comparison with the last time frame of the reference file.
+        # Comparison with the last time frame of the reference file. 2D coupling with T3D
         self.check_epsilons('vnv_1:WACRES',
                             'fom_littoral3D.slf',
                             eps=[1e-8])
 
-        # Comparison with the last time frame of the reference file.
+        # Comparison with the last time frame of the reference file. 2D coupling with T3D
         self.check_epsilons('vnv_2:WACRES',
                             'fom_littoral3D.slf',
                             eps=[1e-8])
 
-        # Comparison between sequential and parallel run.
+        # Comparison between sequential and parallel run. 2D coupling with T3D
         self.check_epsilons('vnv_1:WACRES',
                             'vnv_2:WACRES',
                             eps=[1e-8])
@@ -140,37 +155,43 @@ class VnvStudy(AbstractVnvStudy):
                             'vnv_4:T3DRES',
                             eps=[2e-7])
 
-        # NEW COUPLING Comparison between sequential and parallel for WAC.
+        # 3D COUPLING Comparison between sequential and parallel for WAC.
         self.check_epsilons('vnv_3:WACRES',
                             'vnv_4:WACRES',
                             eps=[1e-8])
 
         # Comparison with the last time frame of the reference file.
+        # tel2tom same with tomawacT3D2
         self.check_epsilons('vnv_5:T3DRES',
                             'f3d_3Dcoupling.slf',
                             eps=[6e-8, 5e-7, 1e-7, 1e-7, 1e-8, 1e-8, 1e-8])
 
         # Comparison with the last time frame of the reference file.
+        # tel2tom same with tomawacT3D2
         self.check_epsilons('vnv_6:T3DRES',
                             'f3d_3Dcoupling.slf',
                             eps=[6e-8, 5e-7, 1e-7, 1e-7, 1e-8, 1e-8, 1e-8])
 
         # Comparison between sequential and parallel run.
+        # tel2tom same with tomawacT3D2
         self.check_epsilons('vnv_5:T3DRES',
                             'vnv_6:T3DRES',
                             eps=[1e-8])
 
         # Comparison with the last time frame of the reference file.
+        # tel2tom same with tomawacT3D2
         self.check_epsilons('vnv_5:WACRES',
                             'fom_3Dcoupling.slf',
                             eps=[8e-6])
 
         # Comparison with the last time frame of the reference file.
+        # tel2tom same with tomawacT3D2
         self.check_epsilons('vnv_6:WACRES',
                             'fom_3Dcoupling.slf',
                             eps=[8e-6])
 
         # Comparison between sequential and parallel run.
+        # tel2tom same with tomawacT3D2
         self.check_epsilons('vnv_5:WACRES',
                             'vnv_6:WACRES',
                             eps=[1e-8])
@@ -186,25 +207,64 @@ class VnvStudy(AbstractVnvStudy):
                             eps=[5e-7])
 
         # Comparison between sequential and parallel run.
+        # tel2tom different with tomawacT3D2
         self.check_epsilons('vnv_7:T3DRES',
                             'vnv_8:T3DRES',
                             eps=[1e-8])
 
         # Comparison with the last time frame of the reference file.
+        # tel2tom different with tomawacT3D2
         self.check_epsilons('vnv_7:WACRES',
                             'fom_3Dcouplittoral_diff.slf',
                             eps=[2e-6])
 
         # Comparison with the last time frame of the reference file.
+        # tel2tom different with tomawacT3D2
         self.check_epsilons('vnv_8:WACRES',
                             'fom_3Dcouplittoral_diff.slf',
                             eps=[2e-6])
 
         # Comparison between sequential and parallel run.
+        # tel2tom different with tomawacT3D2
         self.check_epsilons('vnv_7:WACRES',
                             'vnv_8:WACRES',
                             eps=[1e-8])
 
+        # Comparison with the last time frame of the reference file.
+        # tel2tom different with tomawac2
+        self.check_epsilons('vnv_9:T3DRES',
+                            'f3d_3Dcoupling_diff_2.slf',
+                            eps=[5e-7])
+
+        # Comparison with the last time frame of the reference file.
+        # tel2tom with tomawac2
+        self.check_epsilons('vnv_10:T3DRES',
+                            'f3d_3Dcoupling_diff_2.slf',
+                            eps=[5e-7])
+
+        # Comparison between sequential and parallel run.
+        # tel2tom different with tomawac2
+        self.check_epsilons('vnv_9:T3DRES',
+                            'vnv_10:T3DRES',
+                            eps=[3e-7])
+
+        # Comparison with the last time frame of the reference file.
+        # tel2tom different with tomawac2
+        self.check_epsilons('vnv_9:WACRES',
+                            'fom_3Dcouplittoral_diff_2.slf',
+                            eps=[2e-6])
+
+        # Comparison with the last time frame of the reference file.
+        # tel2tom different with tomawac2
+        self.check_epsilons('vnv_10:WACRES',
+                            'fom_3Dcouplittoral_diff_2.slf',
+                            eps=[2e-6])
+
+        # Comparison between sequential and parallel run.
+        # tel2tom different with tomawac2
+        self.check_epsilons('vnv_9:WACRES',
+                            'vnv_10:WACRES',
+                            eps=[1e-8])
 
 
     def _post(self):
@@ -232,7 +292,6 @@ class VnvStudy(AbstractVnvStudy):
                    fig_size=(12, 7),
                    fig_name='img/hm0_3dlittoral')
 
-
         # Plotting WAVE HEIGHT HM0 at -1
         vnv_plot2d('WAVE HEIGHT HM0',
                    res_vnv_3_wacres,
@@ -243,7 +302,6 @@ class VnvStudy(AbstractVnvStudy):
                    fig_size=(12, 7),
                    fig_name='img/hm0_3dcoupling')
 
-
         res_vnv_1_wacres.close()
         res_vnv_1_t3dres.close()
         res_vnv_3_t3dres.close()
-- 
GitLab