From e7a2ecd8eba25128f52d8838b72fc071b1b9ef53 Mon Sep 17 00:00:00 2001
From: Quentin Rodier <quentin.rodier@meteo.fr>
Date: Mon, 20 Feb 2023 17:59:51 +0100
Subject: [PATCH] Quentin 20/02/2023: remove _phy routines from io_field_write
 and budget and move back budget and mode_io_field_write to their original
 folders

---
 .../SURCOUCHE/src}/mode_io_field_write.f90    | 77 -------------------
 .../aux/mode_budget.f90 => MNH/budget.f90}    | 38 +--------
 2 files changed, 3 insertions(+), 112 deletions(-)
 rename src/{PHYEX/aux => LIB/SURCOUCHE/src}/mode_io_field_write.f90 (98%)
 rename src/{PHYEX/aux/mode_budget.f90 => MNH/budget.f90} (88%)

diff --git a/src/PHYEX/aux/mode_io_field_write.f90 b/src/LIB/SURCOUCHE/src/mode_io_field_write.f90
similarity index 98%
rename from src/PHYEX/aux/mode_io_field_write.f90
rename to src/LIB/SURCOUCHE/src/mode_io_field_write.f90
index e513093ca..19429c121 100644
--- a/src/PHYEX/aux/mode_io_field_write.f90
+++ b/src/LIB/SURCOUCHE/src/mode_io_field_write.f90
@@ -44,7 +44,6 @@ MODULE MODE_IO_FIELD_WRITE
   PRIVATE
 
   public :: IO_Field_write, IO_Field_write_box, IO_Field_write_lb
-  public :: IO_Field_write_phy
   public :: IO_Fieldlist_write, IO_Field_user_write
   public :: IO_Header_write, IO_Field_create
 
@@ -71,10 +70,6 @@ MODULE MODE_IO_FIELD_WRITE
                       IO_Field_write_byfield_T0,IO_Field_write_byfield_T1
   END INTERFACE
 
-  INTERFACE IO_Field_write_phy
-     MODULE PROCEDURE IO_Field_write_phy_byfield_X2, IO_Field_write_phy_byfield_X1
-  END INTERFACE
-
   INTERFACE IO_Field_write_box
      MODULE PROCEDURE IO_Field_write_box_byfield_X2, IO_Field_write_box_byfield_X3, &
                       IO_Field_write_box_byfield_X4, IO_Field_write_box_byfield_X5
@@ -625,78 +620,6 @@ end subroutine IO_Ndimlist_reduce
     !
   END SUBROUTINE IO_Field_write_byname_X1
 
-  SUBROUTINE IO_Field_write_phy_byfield_X2(D, TPFILE, TPFIELD, PFIELD, KRESP, koffset )
-    USE MODD_DIMPHYEX, ONLY: DIMPHYEX_t
-    !
-    IMPLICIT NONE
-    !
-    !*      0.1   Declarations of arguments
-    !
-    TYPE(DIMPHYEX_t),                     INTENT(IN)  :: D
-    TYPE(TFILEDATA),                      INTENT(IN)  :: TPFILE
-    TYPE(TFIELDMETADATA),                 INTENT(IN)  :: TPFIELD
-    REAL,DIMENSION(D%NIJT,D%NKT),TARGET,  INTENT(IN)  :: PFIELD   ! array containing the data field
-    INTEGER,                    OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
-    integer, dimension(3),      optional, intent(in)  :: koffset
-    !
-    CALL IO_Field_write_phy_unpack2D(D,TPFILE, TPFIELD, PFIELD, KRESP, koffset )
-    !
-  END SUBROUTINE IO_Field_write_phy_byfield_X2
-!
-  SUBROUTINE IO_Field_write_phy_unpack2D(D, TPFILE, TPFIELD, PFIELD, KRESP, koffset )
-    USE MODD_DIMPHYEX, ONLY: DIMPHYEX_t
-    !
-    IMPLICIT NONE
-    !
-    !*      0.1   Declarations of arguments
-    !
-    TYPE(DIMPHYEX_t),                     INTENT(IN)  :: D
-    TYPE(TFILEDATA),                      INTENT(IN)  :: TPFILE
-    TYPE(TFIELDMETADATA),                 INTENT(IN)  :: TPFIELD
-    REAL,DIMENSION(D%NIT,D%NJT,D%NKT),TARGET,  INTENT(IN)  :: PFIELD   ! array containing the data field
-    INTEGER,                    OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
-    integer, dimension(3),      optional, intent(in)  :: koffset
-    !
-    CALL IO_Field_write_byfield_X3(TPFILE, TPFIELD, PFIELD, KRESP, koffset )
-    !
-  END SUBROUTINE IO_Field_write_phy_unpack2D
-!
-  SUBROUTINE IO_Field_write_phy_byfield_X1(D, TPFILE, TPFIELD, PFIELD, KRESP, koffset )
-    USE MODD_DIMPHYEX, ONLY: DIMPHYEX_t
-    !
-    IMPLICIT NONE
-    !
-    !*      0.1   Declarations of arguments
-    !
-    TYPE(DIMPHYEX_t),                     INTENT(IN)  :: D
-    TYPE(TFILEDATA),                      INTENT(IN)  :: TPFILE
-    TYPE(TFIELDMETADATA),                 INTENT(IN)  :: TPFIELD
-    REAL,DIMENSION(D%NIJT),TARGET,  INTENT(IN)  :: PFIELD   ! array containing the data field
-    INTEGER,                    OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
-    integer, dimension(3),      optional, intent(in)  :: koffset
-    !
-    CALL IO_Field_write_phy_unpack1D(D,TPFILE, TPFIELD, PFIELD, KRESP, koffset )
-    !
-  END SUBROUTINE IO_Field_write_phy_byfield_X1
-!
-  SUBROUTINE IO_Field_write_phy_unpack1D(D, TPFILE, TPFIELD, PFIELD, KRESP, koffset )
-    USE MODD_DIMPHYEX, ONLY: DIMPHYEX_t
-    !
-    IMPLICIT NONE
-    !
-    !*      0.1   Declarations of arguments
-    !
-    TYPE(DIMPHYEX_t),                     INTENT(IN)  :: D
-    TYPE(TFILEDATA),                      INTENT(IN)  :: TPFILE
-    TYPE(TFIELDMETADATA),                 INTENT(IN)  :: TPFIELD
-    REAL,DIMENSION(D%NIT,D%NJT),TARGET,  INTENT(IN)  :: PFIELD   ! array containing the data field
-    INTEGER,                    OPTIONAL, INTENT(OUT) :: KRESP    ! return-code
-    integer, dimension(3),      optional, intent(in)  :: koffset
-    !
-    CALL IO_Field_write_byfield_X2(TPFILE, TPFIELD, PFIELD, KRESP, koffset )
-    !
-  END SUBROUTINE IO_Field_write_phy_unpack1D
-
   SUBROUTINE IO_Field_write_byfield_X1( TPFILE, TPFIELD, PFIELD, KRESP, koffset )
     USE MODD_IO,               ONLY: GSMONOPROC, ISP
     !
diff --git a/src/PHYEX/aux/mode_budget.f90 b/src/MNH/budget.f90
similarity index 88%
rename from src/PHYEX/aux/mode_budget.f90
rename to src/MNH/budget.f90
index 89aad3a6e..96091c176 100644
--- a/src/PHYEX/aux/mode_budget.f90
+++ b/src/MNH/budget.f90
@@ -26,46 +26,14 @@ implicit none
 
 private
 
-public :: Budget_store_init,Budget_store_init_phy
-public :: Budget_store_end, Budget_store_end_phy
-public :: Budget_store_add, Budget_store_add_phy
+public :: Budget_store_init
+public :: Budget_store_end
+public :: Budget_store_add
 
 real :: ztime1, ztime2
 
 contains
 
-subroutine Budget_store_init_phy(D, tpbudget, hsource, pvars)
-  USE MODD_DIMPHYEX, ONLY: DIMPHYEX_t
-  TYPE(DIMPHYEX_t),       INTENT(IN)    :: D
-  type(tbudgetdata),      intent(inout) :: tpbudget ! Budget datastructure
-  character(len=*),       intent(in)    :: hsource  ! Name of the source term
-  real, dimension(D%NIT,D%NJT,D%NKT), intent(in)    :: pvars    ! Current value to be stored
-!
-  call Budget_store_init(tpbudget, hsource, pvars)
-!
-end subroutine Budget_store_init_phy
-!
-subroutine Budget_store_end_phy(D, tpbudget, hsource, pvars)
-  USE MODD_DIMPHYEX, ONLY: DIMPHYEX_t
-  TYPE(DIMPHYEX_t),       INTENT(IN)    :: D
-  type(tbudgetdata),      intent(inout) :: tpbudget ! Budget datastructure
-  character(len=*),       intent(in)    :: hsource  ! Name of the source term
-  real, dimension(D%NIT,D%NJT,D%NKT), intent(in)    :: pvars    ! Current value to be stored
-!
-  call Budget_store_end(tpbudget, hsource, pvars)
-!
-end subroutine Budget_store_end_phy
-!
-subroutine Budget_store_add_phy(D, tpbudget, hsource, pvars)
-  USE MODD_DIMPHYEX, ONLY: DIMPHYEX_t
-  TYPE(DIMPHYEX_t),       INTENT(IN)    :: D
-  type(tbudgetdata),      intent(inout) :: tpbudget ! Budget datastructure
-  character(len=*),       intent(in)    :: hsource  ! Name of the source term
-  real, dimension(D%NIT,D%NJT,D%NKT), intent(in)    :: pvars    ! Current value to be stored
-!
-  call Budget_store_add(tpbudget, hsource, pvars)
-!
-end subroutine Budget_store_add_phy
 !
 subroutine Budget_store_init( tpbudget, hsource, pvars )
   use modd_les, only: lles_call
-- 
GitLab