Index: /ICOSA_LMDZ/src/phydev/interface_icosa_lmdz.f90
===================================================================
--- /ICOSA_LMDZ/src/phydev/interface_icosa_lmdz.f90	(revision 4854)
+++ /ICOSA_LMDZ/src/phydev/interface_icosa_lmdz.f90	(revision 4855)
@@ -131,4 +131,5 @@
 !$OMP PARALLEL
     CALL initialize_physics_omp
+    CALL param_gravity_wave
 !$OMP END PARALLEL            
 
Index: /ICOSA_LMDZ/src/phylmd/icolmdz_etat0.f90
===================================================================
--- /ICOSA_LMDZ/src/phylmd/icolmdz_etat0.f90	(revision 4855)
+++ /ICOSA_LMDZ/src/phylmd/icolmdz_etat0.f90	(revision 4855)
@@ -0,0 +1,205 @@
+MODULE icolmdz_etat0
+
+
+CONTAINS
+
+  SUBROUTINE init_etat0
+      USE xios_mod
+      USE omp_para
+      USE getin_mod, ONLY: getin
+      IMPLICIT NONE
+      CHARACTER(LEN=256) :: etat0_lmdz
+
+      ! @getin_doc etat0_database_type realm=initial type=String default=`legacy`
+      !  When `etat0=="database"`, selects type of external file(s) from which initial state is read. Valid values :
+      !  * `legacy` : reads from XIOS group `read_files_legacy`, see `xml/context_dynamico.xml`
+      !  * `ERA5_forcing` : reads from XIOS group `read_files_ERA5_forcing`, see `xml/context_dynamico.xml`
+
+      etat0_lmdz = "legacy"
+      CALL getin("etat0_lmdz", etat0_lmdz)
+
+      IF (is_omp_master) THEN
+         CALL xios_set_fieldgroup_attr("read_fields", enabled=.TRUE.)
+         IF (TRIM(etat0_lmdz) == "legacy") THEN
+            CALL xios_set_filegroup_attr("read_files_legacy", enabled=.TRUE.)
+            CALL xios_set_field_attr("relief_db", field_ref="relief_db_legacy")
+            CALL xios_set_field_attr("ps_db", field_ref="ps_db_legacy")
+            CALL xios_set_field_attr("z_db", field_ref="z_db_legacy")
+            CALL xios_set_field_attr("ts_db", field_ref="ts_db_legacy")
+            CALL xios_set_field_attr("u_db", field_ref="u_db_legacy")
+            CALL xios_set_field_attr("v_db", field_ref="v_db_legacy")
+            CALL xios_set_field_attr("temp_db", field_ref="temp_db_legacy")
+            CALL xios_set_field_attr("q_db", field_ref="q_db_legacy")
+         ELSE IF (TRIM(etat0_lmdz) == "ERA5_forcing") THEN
+            CALL xios_set_filegroup_attr("read_files_ERA5_forcing", enabled=.TRUE.)
+            CALL xios_set_field_attr("relief_db", field_ref="relief_db_forcing")
+            CALL xios_set_field_attr("ps_db", field_ref="ps_db_forcing")
+            CALL xios_set_field_attr("z_db", field_ref="z_db_forcing")
+            CALL xios_set_field_attr("ts_db", field_ref="ts_db_forcing")
+            CALL xios_set_field_attr("u_db", field_ref="u_db_forcing")
+            CALL xios_set_field_attr("v_db", field_ref="v_db_forcing")
+            CALL xios_set_field_attr("temp_db", field_ref="temp_db_forcing")
+            CALL xios_set_field_attr("q_db", field_ref="q_db_forcing")
+         ELSE
+        PRINT*,"Bad selector for variable <etat0_lmdz> ",TRIM(etat0_lmdz), " option are <legacy> (default), <ERA5_forcing>"
+            STOP
+         END IF
+      END IF
+   END SUBROUTINE init_etat0
+
+
+   SUBROUTINE etat0(f_ps, f_phis, f_theta_rhodz, f_u, f_q)
+      USE icosa
+      USE restart_mod
+      USE wind_mod
+      USE write_field_mod
+      USE time_mod
+      USE transfert_mod
+      USE xios_mod
+      USE write_field_mod
+      USE vertical_remap_mod
+      USE theta2theta_rhodz_mod
+      USE qsat_mod
+      USE pression_mod
+      USE omp_para
+      USE tracer_icosa_mod
+      IMPLICIT NONE
+      TYPE(t_field), POINTER :: f_ps(:)
+      TYPE(t_field), POINTER :: f_phis(:)
+      TYPE(t_field), POINTER :: f_theta_rhodz(:)
+      TYPE(t_field), POINTER :: f_u(:)
+      TYPE(t_field), POINTER :: f_q(:)
+
+      TYPE(t_field), POINTER, SAVE :: f_ulon_reg(:)
+      TYPE(t_field), POINTER, SAVE :: f_ulat_reg(:)
+      TYPE(t_field), POINTER, SAVE :: f_temp_reg(:)
+      TYPE(t_field), POINTER, SAVE :: f_q_reg(:)
+
+      TYPE(t_field), POINTER, SAVE :: f_ts(:)
+      TYPE(t_field), POINTER, SAVE :: f_z(:)
+      TYPE(t_field), POINTER, SAVE :: f_ulon(:)
+      TYPE(t_field), POINTER, SAVE :: f_ulat(:)
+      TYPE(t_field), POINTER, SAVE :: f_temp(:)
+      TYPE(t_field), POINTER, SAVE :: f_q1(:)
+      TYPE(t_field), POINTER, SAVE :: f_qsat(:)
+      TYPE(t_field), POINTER, SAVE :: f_p(:)
+      INTEGER :: nb_level
+      REAL, ALLOCATABLE:: levels(:)
+      INTEGER :: ind
+
+      CALL xios_read_field("relief_db", f_phis)
+
+      CALL writeField("relief_out", f_phis, once=.TRUE.)
+
+      IF (is_omp_level_master) THEN
+         DO ind = 1, ndomain
+            IF (.NOT. assigned_domain(ind)) CYCLE
+            f_phis(ind)%rval2d(:) = f_phis(ind)%rval2d(:)*g
+         END DO
+      END IF
+!$OMP BARRIER
+
+      IF (is_omp_master) CALL xios_get_axis_attr("lev_ecdyn", n_glo=nb_level)
+      CALL bcast_omp(nb_level)
+      ALLOCATE (levels(nb_level))
+
+      IF (is_omp_master) CALL xios_get_axis_attr("lev_ecdyn", value=levels)
+      CALL bcast_omp(levels)
+
+      levels = levels*100  ! hectoPascal -> Pascal
+
+      CALL allocate_field(f_ts, field_t, type_real, name="ts")
+      CALL allocate_field(f_z, field_t, type_real, name="z")
+      CALL allocate_field(f_ulon_reg, field_t, type_real, nb_level)
+      CALL allocate_field(f_ulat_reg, field_t, type_real, nb_level)
+      CALL allocate_field(f_temp_reg, field_t, type_real, nb_level)
+      CALL allocate_field(f_q_reg, field_t, type_real, nb_level)
+
+      CALL allocate_field(f_q1, field_t, type_real, llm)
+      CALL allocate_field(f_qsat, field_t, type_real, llm)
+      CALL allocate_field(f_p, field_t, type_real, llm + 1)
+      CALL allocate_field(f_temp, field_t, type_real, llm)
+      CALL allocate_field(f_ulon, field_t, type_real, llm)
+      CALL allocate_field(f_ulat, field_t, type_real, llm)
+
+      CALL xios_read_field("z_db", f_z)
+      CALL xios_read_field("ps_db", f_ps)
+      CALL xios_read_field("ts_db", f_ts)
+      CALL writeField("ps_out", f_ps)
+
+!$OMP BARRIER
+
+!    CALL writeField("phis_out",f_phis,once=.TRUE.)
+!    CALL writeField("ts_out",f_ts,once=.TRUE.)
+
+! make correction to ps due to relief at higher resolution
+! difference with LMDZ : tsol is taken from ECDYN.NC and not from ECPHY
+      IF (is_omp_level_master) THEN
+         DO ind = 1, ndomain
+            IF (.NOT. assigned_domain(ind)) CYCLE
+            f_ps(ind)%rval2d(:) = f_ps(ind)%rval2d(:)*(1.+(f_z(ind)%rval2d(:) - f_phis(ind)%rval2d(:))/287.0/f_ts(ind)%rval2d(:))
+         END DO
+      END IF
+!$OMP BARRIER
+      CALL transfert_request(f_ps, req_i0)
+      CALL writeField("ps_out", f_ps)
+
+      CALL xios_read_field("temp_db", f_temp_reg)
+      CALL vertical_remap(levels, f_temp_reg, f_ps, f_temp)
+      CALL transfert_request(f_temp, req_i0)
+      CALL temperature2theta_rhodz(f_ps, f_temp, f_theta_rhodz)
+
+      CALL xios_read_field("u_db", f_ulon_reg)
+      CALL vertical_remap(levels, f_ulon_reg, f_ps, f_ulon)
+      CALL xios_read_field("v_db", f_ulat_reg)
+      CALL vertical_remap(levels, f_ulat_reg, f_ps, f_ulat)
+      CALL transfert_request(f_ulat, req_i0)
+      CALL transfert_request(f_ulon, req_i0)
+      CALL ulonlat2un(f_ulon, f_ulat, f_u)
+
+      CALL xios_read_field("q_db", f_q_reg)
+      CALL vertical_remap(levels, f_q_reg, f_ps, f_q1)
+
+      CALL pression(f_ps, f_p)
+! difference with LMDZ : for qsat, pressure at mid layer is computed as a mean value pmid=(p(l)+p(l+1))/2
+      CALL qsat(f_temp, f_p, f_qsat)
+      CALL transfert_request(f_qsat, req_i0)
+
+      DO ind = 1, ndomain
+         IF (.NOT. assigned_domain(ind)) CYCLE
+
+         IF (tracers(2)%has_default_init_value) THEN
+            f_q(ind)%rval4d(:, :, 2) = tracers(2)%default_init_value
+         ELSE
+            f_q(ind)%rval4d(:, :, 2) = 1e-6
+         END IF
+         f_q(ind)%rval4d(:, :, 1) = f_q1(ind)%rval3d(:, :)*f_qsat(ind)%rval3d(:, :)*0.01
+         WHERE (f_q(ind)%rval4d(:, :, 1) < 0) f_q(ind)%rval4d(:, :, 1) = 0
+      END DO
+
+      tracers(1)%already_initialized = .TRUE.
+      tracers(2)%already_initialized = .TRUE.
+
+      CALL writeField("tempdb_out", f_temp_reg)
+      CALL writeField("temp_out", f_temp)
+
+      CALL deallocate_field(f_ts)
+      CALL deallocate_field(f_z)
+      CALL deallocate_field(f_ulon_reg)
+      CALL deallocate_field(f_ulat_reg)
+      CALL deallocate_field(f_temp_reg)
+      CALL deallocate_field(f_q_reg)
+
+      CALL deallocate_field(f_q1)
+      CALL deallocate_field(f_qsat)
+      CALL deallocate_field(f_p)
+      CALL deallocate_field(f_temp)
+      CALL deallocate_field(f_ulon)
+      CALL deallocate_field(f_ulat)
+
+   END SUBROUTINE etat0
+
+
+
+
+END MODULE icolmdz_etat0
Index: /ICOSA_LMDZ/src/phylmd/icolmdz_param_gravity_wave.f90
===================================================================
--- /ICOSA_LMDZ/src/phylmd/icolmdz_param_gravity_wave.f90	(revision 4855)
+++ /ICOSA_LMDZ/src/phylmd/icolmdz_param_gravity_wave.f90	(revision 4855)
@@ -0,0 +1,593 @@
+MODULE icolmdz_param_gravity_wave
+  
+   INTEGER, PARAMETER :: gw_legacy=1
+   INTEGER, PARAMETER :: gw_sso=2
+   INTEGER,SAVE       :: gw_method
+   !$OMP THREADPRIVATE(gw_method)
+
+CONTAINS
+  
+  SUBROUTINE init_param_gravity_wave
+  USE getin_mod
+  USE xios_mod
+  IMPLICIT NONE
+    CHARACTER(LEN=255) :: param_gw_method
+    LOGICAL :: create_etat0_limit
+
+    create_etat0_limit = .FALSE.
+    CALL getin('create_etat0_limit', create_etat0_limit)
+    IF (.NOT. create_etat0_limit) RETURN
+
+    param_gw_method='legacy'
+    CALL getin('param_gw_method', param_gw_method)
+    SELECT CASE (TRIM(param_gw_method))
+      CASE ('legacy')
+        gw_method = gw_legacy
+      CASE ('sso')
+        gw_method = gw_sso
+      CASE default
+         PRINT *, 'Bad selector for param_gw_method : <', TRIM(param_gw_method), &
+            ' > options are <legacy>, <sso>'
+         STOP
+    END SELECT    
+
+    SELECT CASE (gw_method)
+      CASE (gw_legacy)
+      !$OMP MASTER
+        CALL xios_set_file_attr("relief_gw",enabled=.TRUE.)
+        CALL xios_set_fieldgroup_attr("gw_read_access",read_access=.TRUE.)
+      !$OMP END MASTER
+      CASE (gw_sso)
+      !$OMP MASTER
+        CALL xios_set_file_attr("orography",enabled=.TRUE.)
+        CALL xios_set_fieldgroup_attr("gwsso_read_access",read_access=.TRUE.)
+      !$OMP END MASTER
+    END SELECT  
+
+  END SUBROUTINE init_param_gravity_wave
+
+  SUBROUTINE param_gravity_wave
+  USE getin_mod
+  IMPLICIT NONE
+   LOGICAL :: create_etat0_limit
+
+    create_etat0_limit = .FALSE.
+    CALL getin('create_etat0_limit', create_etat0_limit)
+    IF (.NOT. create_etat0_limit) RETURN
+      
+    SELECT CASE (gw_method)
+      CASE (gw_legacy)
+        CALL param_gravity_wave_legacy
+      CASE (gw_sso)
+        CALL param_gravity_wave_sso
+    END SELECT
+
+  END SUBROUTINE param_gravity_wave
+
+  SUBROUTINE param_gravity_wave_sso
+    ! from dynamico
+  USE icosa
+  USE xios_mod
+  USE mpipara
+  USE earth_const
+  USE transfert_mod
+  ! from lmdz physic
+  USE create_etat0_unstruct_mod, ONLY : init_param_gw_phy => init_param_gw
+  USE dimphy, ONLY : klon
+  !from icosa_lmdz
+  USE distrib_icosa_lmdz_mod
+  IMPLICIT NONE
+    TYPE(t_field), POINTER, SAVE :: f_zmea(:), f_zpic(:), f_zval(:), f_zstd(:), f_zsig(:), f_zgam(:), f_zthe(:) 
+     REAL, ALLOCATABLE :: zmea_phy(:), zpic_phy(:), zval_phy(:), zstd_phy(:), zsig_phy(:), zgam_phy(:), zthe_phy(:) 
+
+    CALL allocate_field(f_zmea, field_t, type_real)
+    CALL allocate_field(f_zpic, field_t, type_real)
+    CALL allocate_field(f_zval, field_t, type_real)
+    CALL allocate_field(f_zstd, field_t, type_real)
+    CALL allocate_field(f_zsig, field_t, type_real)
+    CALL allocate_field(f_zgam, field_t, type_real)
+    CALL allocate_field(f_zthe, field_t, type_real)
+
+    CALL xios_read_field("zmea_sso",f_zmea)
+    CALL transfert_request(f_zmea, req_i0)
+    CALL transfert_request(f_zmea, req_i1)
+
+    CALL xios_read_field("zstd_sso",f_zstd)
+    CALL transfert_request(f_zstd, req_i0)
+    CALL transfert_request(f_zstd, req_i1)
+
+    CALL xios_read_field("zsig_sso",f_zsig)
+    CALL transfert_request(f_zsig, req_i0)
+    CALL transfert_request(f_zsig, req_i1)
+
+    CALL xios_read_field("zgam_sso",f_zgam)
+    CALL transfert_request(f_zgam, req_i0)
+    CALL transfert_request(f_zgam, req_i1)
+
+    CALL xios_read_field("zthe_sso",f_zthe)
+    CALL transfert_request(f_zthe, req_i0)
+    CALL transfert_request(f_zthe, req_i1)
+
+    ALLOCATE(zmea_phy(klon), zpic_phy(klon), zval_phy(klon), zstd_phy(klon), zsig_phy(klon), zgam_phy(klon), zthe_phy(klon))
+    CALL transfer_icosa_to_lmdz(f_zmea  , zmea_phy)
+    CALL transfer_icosa_to_lmdz(f_zstd  , zstd_phy)
+    CALL transfer_icosa_to_lmdz(f_zsig  , zsig_phy)
+    CALL transfer_icosa_to_lmdz(f_zgam  , zgam_phy)
+    CALL transfer_icosa_to_lmdz(f_zthe  , zthe_phy)
+    zpic_phy(:) = zmea_phy(:) + zstd_phy(:)
+    zval_phy(:) = MAX(zmea_phy(:) - zstd_phy(:), 0.) 
+    CALL init_param_gw_phy(zmea_phy, zpic_phy, zval_phy, zstd_phy, zsig_phy, zgam_phy, zthe_phy)
+
+  END SUBROUTINE param_gravity_wave_sso
+
+  SUBROUTINE param_gravity_wave_legacy
+  ! from dynamico
+  USE icosa
+  USE xios_mod
+  USE mpipara
+  USE earth_const
+  USE transfert_mod
+  ! from lmdz physic
+  USE create_etat0_unstruct_mod, ONLY : init_param_gw_phy => init_param_gw
+  USE dimphy, ONLY : klon
+  !from icosa_lmdz
+  USE distrib_icosa_lmdz_mod
+  IMPLICIT NONE
+    INTEGER :: ibegin, jbegin, ni, nj, ni_glo,nj_glo
+    REAL, ALLOCATABLE :: z(:,:)
+    REAL, ALLOCATABLE :: lon1d(:), lon2d_in(:,:), lon2d_out(:,:)
+    REAL, ALLOCATABLE :: lat1d(:), lat2d_in(:,:), lat2d_out(:,:)
+    REAL,ALLOCATABLE :: delta_x(:), delta_y(:)
+    REAL, ALLOCATABLE :: mask_in(:,:)
+    REAL, ALLOCATABLE :: zmea_in(:,:), zpic_in(:,:), zval_in(:,:), ztz_in(:,:), zytzy_in(:,:), zxtzx_in(:,:), zxtzy_in(:,:)
+
+    TYPE(t_field), POINTER, SAVE :: f_mask(:), f_zmea(:), f_zpic(:), f_zval(:), f_ztz(:), f_zytzy(:), f_zxtzx(:), f_zxtzy(:)
+    TYPE(t_field), POINTER, SAVE :: f_zstd(:), f_zsig(:), f_zgam(:), f_zthe(:) 
+    REAL(rstd),POINTER :: mask(:), zmea(:), zpic(:), zval(:), ztz(:), zytzy(:), zxtzx(:), zxtzy(:), zstd(:), zsig(:), zgam(:), zthe(:) 
+    REAL, ALLOCATABLE :: zmea_phy(:), zpic_phy(:), zval_phy(:), zstd_phy(:), zsig_phy(:), zgam_phy(:), zthe_phy(:) 
+
+    INTEGER :: i, j, ind
+
+    CALL allocate_field(f_mask, field_t, type_real)
+    CALL allocate_field(f_zmea, field_t, type_real)
+    CALL allocate_field(f_zpic, field_t, type_real)
+    CALL allocate_field(f_zval, field_t, type_real)
+    CALL allocate_field(f_ztz, field_t, type_real)
+    CALL allocate_field(f_zytzy, field_t, type_real)
+    CALL allocate_field(f_zxtzx, field_t, type_real)
+    CALL allocate_field(f_zxtzy, field_t, type_real)
+    CALL allocate_field(f_zstd, field_t, type_real)
+    CALL allocate_field(f_zsig, field_t, type_real)
+    CALL allocate_field(f_zgam, field_t, type_real)
+    CALL allocate_field(f_zthe, field_t, type_real)
+
+!$OMP MASTER
+    CALL xios_get_domain_attr("domain_relief_gw",ibegin=ibegin, ni=ni, ni_glo=ni_glo, jbegin=jbegin, nj=nj,  nj_glo=nj_glo)
+    PRINT*, ni,nj,ni_glo,nj_glo
+    
+    ALLOCATE( lon1d(ni), lat1d(nj))
+    CALL xios_get_domain_attr("domain_relief_gw",lonvalue_1d=lon1d, latvalue_1d=lat1d)
+       
+    ALLOCATE(z(0:ni+1,0:nj+1))
+    CALL xios_recv_field("relief_exp", z)
+
+    ALLOCATE(lon2d_in(ni,nj), lat2d_in(ni,nj) )
+    ALLOCATE(lon2d_out(0:ni+1,0:nj+1), lat2d_out(0:ni+1,0:nj+1) )
+    
+    DO i=1,ni
+     lon2d_in(i,:) = lon1d(i)
+    END DO
+
+    DO j=1,nj
+     lat2d_in(:,j) = lat1d(j)
+    END DO
+
+    CALL xios_send_field("lon2d_in", lon2d_in)
+    CALL xios_recv_field("lon2d_out", lon2d_out)
+    CALL xios_send_field("lat2d_in", lat2d_in)
+    CALL xios_recv_field("lat2d_out", lat2d_out)
+   
+    ALLOCATE(delta_x(nj))
+    ALLOCATE(delta_y(nj))
+    
+    delta_y(:) = Pi*radius / nj_glo  !! difference with  lmdz reference : delta_y=2*Pi*radius/nj_glo ??
+    
+    DO j=1,nj
+      delta_x(j) = 2*Pi*radius / ni_glo * cos( lat2d_out(1,j) * pi / 180.)
+    ENDDO
+    
+    !north pole
+    IF (jbegin==0) THEN
+      z(:,0) = z(:,1)
+      delta_y(1) = delta_y(1)*0.5
+    ENDIF
+    
+    !south pole
+    IF (jbegin+nj==nj_glo) THEN
+      z(:,nj+1) = z(:,nj)
+      delta_y(nj) = delta_y(nj)*0.5
+    ENDIF
+    
+    ALLOCATE(mask_in(ni,nj))
+    ALLOCATE(zmea_in(ni,nj), zpic_in(ni,nj), zval_in(ni,nj), ztz_in(ni,nj), zytzy_in(ni,nj), zxtzx_in(ni,nj), zxtzy_in(ni,nj) )
+    
+    mask_in(:,:)=0
+    DO j=1,nj
+      DO i=1,ni
+        IF ( z(i,j)>1. ) mask_in(i,j) = 1.
+        zmea_in(i,j)  = z(i,j)
+        zpic_in(i,j)  = z(i,j)
+        zval_in(i,j)  = z(i,j)
+        ztz_in(i,j)   = z(i,j)*z(i,j)
+        zytzy_in(i,j) = (z(i,j+1)-z(i,j-1))**2/(2*delta_y(j))**2
+        zxtzx_in(i,j) = (z(i+1,j)-z(i-1,j))**2/(2*delta_x(j))**2
+        zxtzy_in(i,j) = (z(i,j+1)-z(i,j-1)) / (2*delta_y(j)) *(z(i+1,j)-z(i-1,j)) / (2*delta_x(j))
+      ENDDO
+    ENDDO
+
+    CALL xios_send_field("mask_in",mask_in)
+    CALL xios_send_field("zmea_in",zmea_in)
+    CALL xios_send_field("zpic_in",zpic_in)
+    CALL xios_send_field("zval_in",zval_in)
+    CALL xios_send_field("ztz_in",ztz_in)
+    CALL xios_send_field("zytzy_in",zytzy_in)
+    CALL xios_send_field("zxtzx_in",zxtzx_in)
+    CALL xios_send_field("zxtzy_in",zxtzy_in)
+    
+    !! only for test, to compare projection on ico grid Vs lmdz_reg grid
+    !! CALL compute_regular_param
+
+    !$OMP END MASTER
+    
+    CALL xios_read_field("mask_out", f_mask)
+    CALL transfert_request(f_mask, req_i0)
+    CALL transfert_request(f_mask, req_i1)
+
+    CALL xios_read_field("zmea_out",f_zmea)
+    CALL transfert_request(f_zmea, req_i0)
+    CALL transfert_request(f_zmea, req_i1)
+
+    CALL xios_read_field("zpic_out",f_zpic)
+    CALL transfert_request(f_zpic, req_i0)
+    CALL transfert_request(f_zpic, req_i1)
+
+    CALL xios_read_field("zval_out",f_zval)
+    CALL transfert_request(f_zval, req_i0)
+    CALL transfert_request(f_zval, req_i1)
+
+    CALL xios_read_field("ztz_out", f_ztz)
+    CALL transfert_request(f_ztz, req_i0)
+    CALL transfert_request(f_ztz, req_i1)
+
+    CALL xios_read_field("zytzy_out", f_zytzy)
+    CALL transfert_request(f_zytzy, req_i0)
+    CALL transfert_request(f_zytzy, req_i1)
+
+    CALL xios_read_field("zxtzx_out", f_zxtzx)
+    CALL transfert_request(f_zxtzx, req_i0)
+    CALL transfert_request(f_zxtzx, req_i1)
+
+    CALL xios_read_field("zxtzy_out", f_zxtzy)
+    CALL transfert_request(f_zxtzy, req_i0)
+    CALL transfert_request(f_zxtzy, req_i1)
+
+   !$OMP BARRIER
+   !$OMP MASTER
+
+   !! compute zstd
+
+    DO ind=1,ndomain
+      CALL swap_dimensions(ind)
+      CALL swap_geometry(ind)
+      zmea =f_zmea(ind)
+      zstd = f_zstd(ind)
+      ztz  = f_ztz(ind)
+      CALL compute_zstd(zmea, ztz, zstd)
+    ENDDO
+
+   !! smmothing ?
+
+    DO ind=1,ndomain
+      CALL swap_dimensions(ind)
+      CALL swap_geometry(ind)
+      
+      zmea=f_zmea(ind)
+      zpic=f_zpic(ind)
+      zval=f_zval(ind)
+      zstd=f_zstd(ind)
+      zytzy=f_zytzy(ind)
+      zxtzx=f_zxtzx(ind)
+      zxtzy=f_zxtzy(ind)
+ 
+      CALL compute_smoothing(zmea) 
+      CALL compute_smoothing(zpic) 
+      CALL compute_smoothing(zval) 
+      CALL compute_smoothing(zstd) 
+      CALL compute_smoothing(zytzy) 
+      CALL compute_smoothing(zxtzx) 
+      CALL compute_smoothing(zxtzy) 
+ 
+    ENDDO
+
+    !! SLOPE, ANISOTROPY AND THETA ANGLE
+    
+    DO ind=1,ndomain
+      CALL swap_dimensions(ind)
+      CALL swap_geometry(ind)
+
+      zytzy=f_zytzy(ind)
+      zxtzx=f_zxtzx(ind)
+      zxtzy=f_zxtzy(ind)
+      zsig=f_zsig(ind)
+      zgam=f_zgam(ind)
+      zthe=f_zthe(ind) 
+      CALL compute_sigma_gamma_theta(zxtzx, zytzy, zxtzy, zsig, zgam, zthe) 
+   
+    ENDDO
+
+    !! apply mask
+    
+    DO ind=1,ndomain
+      CALL swap_dimensions(ind)
+      CALL swap_geometry(ind)
+
+      mask=f_mask(ind)
+      zmea=f_zmea(ind)
+      zpic=f_zpic(ind)
+      zval=f_zval(ind)
+      zstd=f_zstd(ind)
+      zsig=f_zsig(ind)
+      zgam=f_zgam(ind)
+      zthe=f_zthe(ind) 
+
+      CALL compute_masking(mask, zmea, zpic, zval, zstd, zsig, zgam, zthe) 
+
+    ENDDO
+
+!$OMP END MASTER
+!$OMP BARRIER
+  
+  !! for debugging
+  !!  CALL xios_write_field("zmask", f_mask)
+  !!  CALL xios_write_field("zmea", f_zmea)
+  !!  CALL xios_write_field("zpic", f_zpic)
+  !!  CALL xios_write_field("zval", f_zval)
+  !!  CALL xios_write_field("zsig", f_zsig)
+  !!  CALL xios_write_field("zgam", f_zgam)
+  !!  CALL xios_write_field("zthe", f_zthe)
+    
+    ALLOCATE(zmea_phy(klon), zpic_phy(klon), zval_phy(klon), zstd_phy(klon), zsig_phy(klon), zgam_phy(klon), zthe_phy(klon))
+    CALL transfer_icosa_to_lmdz(f_zmea  , zmea_phy)
+    CALL transfer_icosa_to_lmdz(f_zpic  , zpic_phy)
+    CALL transfer_icosa_to_lmdz(f_zval  , zval_phy)
+    CALL transfer_icosa_to_lmdz(f_zstd  , zstd_phy)
+    CALL transfer_icosa_to_lmdz(f_zsig  , zsig_phy)
+    CALL transfer_icosa_to_lmdz(f_zgam  , zgam_phy)
+    CALL transfer_icosa_to_lmdz(f_zthe  , zthe_phy)
+    CALL init_param_gw_phy(zmea_phy, zpic_phy, zval_phy, zstd_phy, zsig_phy, zgam_phy, zthe_phy)
+
+  END SUBROUTINE param_gravity_wave_legacy
+
+  SUBROUTINE compute_smoothing(X)
+  USE icosa
+  IMPLICIT NONE
+    REAL(rstd),INTENT(INOUT)  :: X(iim*jjm)
+    REAL(rstd)                :: tmp(iim*jjm)
+    INTEGER :: i,j,ij
+
+    DO j=jj_begin,jj_end
+      DO i=ii_begin,ii_end
+        ij=(j-1)*iim+i
+        tmp(ij) = (X(ij) + (X(ij+t_right) + X(ij+t_rup) + X(ij+t_lup) + X(ij+t_left) + X(ij+t_ldown) + X(ij+t_rdown))/3.)/3. 
+      ENDDO
+    ENDDO
+  
+    DO j=jj_begin,jj_end
+      DO i=ii_begin,ii_end
+        ij=(j-1)*iim+i
+        X(ij) = tmp(ij) 
+      ENDDO
+    ENDDO
+  
+  END SUBROUTINE
+
+  SUBROUTINE compute_zstd(zmea, ztz, zstd)
+  USE icosa
+  IMPLICIT NONE
+    REAL(rstd),INTENT(IN)   :: zmea(iim*jjm)
+    REAL(rstd),INTENT(IN)   :: ztz(iim*jjm)
+    REAL(rstd),INTENT(OUT) :: zstd(iim*jjm)
+
+    INTEGER :: i,j,ij
+
+    DO j=jj_begin,jj_end
+      DO i=ii_begin,ii_end
+        ij=(j-1)*iim+i
+        zstd(ij) = ztz(ij) - zmea(ij)*zmea(ij)
+        IF (zstd(ij)<0) zstd(ij)=0
+        zstd(ij)=SQRT(zstd(ij))
+      ENDDO
+    ENDDO
+  
+  END SUBROUTINE compute_zstd
+
+
+  SUBROUTINE compute_sigma_gamma_theta(zxtzx, zytzy, zxtzy, zsig, zgam, zthe)
+  USE icosa
+  IMPLICIT NONE
+    REAL(rstd),INTENT(IN)   :: zxtzx(iim*jjm)
+    REAL(rstd),INTENT(IN)   :: zytzy(iim*jjm)
+    REAL(rstd),INTENT(IN)   :: zxtzy(iim*jjm)
+    REAL(rstd),INTENT(OUT)  :: zsig(iim*jjm)
+    REAL(rstd),INTENT(OUT)  :: zgam(iim*jjm)
+    REAL(rstd),INTENT(OUT)  :: zthe(iim*jjm)
+    
+    REAL(rstd) :: xk,xl,xm,xp,xq,xw
+
+    INTEGER :: i,j,ij
+
+    DO j=jj_begin,jj_end
+      DO i=ii_begin,ii_end
+      
+        ij=(j-1)*iim+i
+        xk=(zxtzx(ij)+zytzy(ij))/2.
+        xl=(zxtzx(ij)-zytzy(ij))/2.
+        xm=zxtzy(ij)
+        xp=xk-SQRT(xl**2+xm**2)
+        xq=xk+SQRT(xl**2+xm**2)
+        xw=1.e-8
+        IF(xp<=xw) xp=0.
+        IF(xq<=xw) xq=xw
+        IF(ABS(xm)<=xw) xm=xw*SIGN(1.,xm)
+        
+        !--- SLOPE, ANISOTROPY AND THETA ANGLE
+      
+        zsig(ij)=SQRT(xq)
+        zgam(ij)=xp/xq
+        zthe(ij)=90.*ATAN2(xm,xl)/Pi
+
+      ENDDO
+    ENDDO
+
+  END SUBROUTINE compute_sigma_gamma_theta
+
+  SUBROUTINE compute_masking(mask, zmea, zpic, zval, zstd, zsig, zgam, zthe) 
+  USE icosa
+  IMPLICIT NONE
+    REAL(rstd),INTENT(IN)   :: mask(iim*jjm)
+    REAL(rstd),INTENT(OUT)   :: zmea(iim*jjm)
+    REAL(rstd),INTENT(OUT)   :: zpic(iim*jjm)
+    REAL(rstd),INTENT(OUT)   :: zval(iim*jjm)
+    REAL(rstd),INTENT(OUT)   :: zstd(iim*jjm)
+    REAL(rstd),INTENT(OUT)   :: zsig(iim*jjm)
+    REAL(rstd),INTENT(OUT)   :: zgam(iim*jjm)
+    REAL(rstd),INTENT(OUT)   :: zthe(iim*jjm)
+    
+
+    INTEGER :: i,j,ij
+
+    DO j=jj_begin,jj_end
+      DO i=ii_begin,ii_end
+        ij=(j-1)*iim+i
+        IF (mask(ij)<0.1) THEN
+          zmea(ij)=0.
+          zpic(ij)=0.
+          zval(ij)=0.
+          zstd(ij)=0.
+          zsig(ij)=0.
+          zgam(ij)=0.
+          zthe(ij)=0.
+        ENDIF
+      ENDDO
+    ENDDO
+  
+  END SUBROUTINE compute_masking
+
+  SUBROUTINE compute_regular_param
+  USE xios_mod
+  USE icosa
+  IMPLICIT NONE
+    REAL, ALLOCATABLE :: mask(:,:) , zmea(:,:), zpic(:,:), zval(:,:), ztz(:,:), zstd(:,:)
+    REAL, ALLOCATABLE :: zytzy(:,:) , zxtzx(:,:), zxtzy(:,:), zsig(:,:) , zgam(:,:), zthe(:,:)
+    REAL :: xk, xl, xm, xp, xq, xw
+    INTEGER :: ni, nj, ibegin, jbegin, ni_glo, nj_glo
+    INTEGER :: i,j
+
+    CALL xios_get_domain_attr("regular_gw",ibegin=ibegin, ni=ni, ni_glo=ni_glo, jbegin=jbegin, nj=nj,  nj_glo=nj_glo)
+
+    ALLOCATE(mask(0:ni+1,0:nj+1), zmea(0:ni+1,0:nj+1), zpic(0:ni+1,0:nj+1), zval(0:ni+1,0:nj+1), ztz(0:ni+1,0:nj+1))
+    ALLOCATE(zstd(0:ni+1,0:nj+1), zytzy(0:ni+1,0:nj+1), zxtzx(0:ni+1,0:nj+1), zxtzy(0:ni+1,0:nj+1))
+    ALLOCATE(zsig(0:ni+1,0:nj+1), zgam(0:ni+1,0:nj+1), zthe(0:ni+1,0:nj+1))
+
+    CALL xios_recv_field("mask_reg_exp",mask)
+    CALL xios_recv_field("zmea_reg_exp",zmea)
+    CALL xios_recv_field("zpic_reg_exp",zpic)
+    CALL xios_recv_field("zval_reg_exp",zval)
+    CALL xios_recv_field("ztz_reg_exp",ztz)
+    CALL xios_recv_field("zytzy_reg_exp",zytzy)
+    CALL xios_recv_field("zxtzx_reg_exp",zxtzx)
+    CALL xios_recv_field("zxtzy_reg_exp",zxtzy)
+    
+    DO j=0,nj+1
+      DO i=0, ni+1
+        zstd(i,j) = ztz(i,j)-zmea(i,j)*zmea(i,j)
+      ENDDO
+    ENDDO
+
+    ! smoothing
+    CALL smoothing_regular(ni,nj, zmea)
+    CALL smoothing_regular(ni,nj, zpic)
+    CALL smoothing_regular(ni,nj, zval)
+    CALL smoothing_regular(ni,nj, zstd)
+    CALL smoothing_regular(ni,nj, zytzy)
+    CALL smoothing_regular(ni,nj, zxtzx)
+    CALL smoothing_regular(ni,nj, zxtzy)
+
+    DO j=1,nj
+      DO i=1, ni
+        xk=(zxtzx(i,j)+zytzy(i,j))/2.
+        xl=(zxtzx(i,j)-zytzy(i,j))/2.
+        xm=zxtzy(i,j)
+        xp=xk-SQRT(xl**2+xm**2)
+        xq=xk+SQRT(xl**2+xm**2)
+        xw=1.e-8
+        IF(xp<=xw) xp=0.
+        IF(xq<=xw) xq=xw
+        IF(ABS(xm)<=xw) xm=xw*SIGN(1.,xm)
+        
+        !--- SLOPE, ANISOTROPY AND THETA ANGLE
+      
+        zsig(i,j)=SQRT(xq)
+        zgam(i,j)=xp/xq
+        zthe(i,j)=90.*ATAN2(xm,xl)/Pi
+      ENDDO
+    ENDDO
+
+    DO j=1,nj
+      DO i=1,ni
+        IF (mask(i,j)<0.1) THEN
+          zmea(i,j)=0.
+          zpic(i,j)=0.
+          zval(i,j)=0.
+          zstd(i,j)=0.
+          zsig(i,j)=0.
+          zgam(i,j)=0.
+          zthe(i,j)=0.
+        ENDIF
+      ENDDO
+    ENDDO
+
+    CALL xios_send_field("zmask_regout", mask(1:ni,1:nj))
+    CALL xios_send_field("zmea_regout", zmea(1:ni,1:nj))
+    CALL xios_send_field("zpic_regout", zpic(1:ni,1:nj))
+    CALL xios_send_field("zval_regout", zval(1:ni,1:nj))
+    CALL xios_send_field("zsig_regout", zsig(1:ni,1:nj))
+    CALL xios_send_field("zgam_regout", zgam(1:ni,1:nj))
+    CALL xios_send_field("zthe_regout", zthe(1:ni,1:nj))
+
+  END SUBROUTINE compute_regular_param
+
+  SUBROUTINE smoothing_regular(ni,nj,var)
+  IMPLICIT NONE
+    INTEGER, INTENT(IN) :: ni, nj
+    REAL, INTENT(INOUT) :: var(0:ni+1,0:nj+1)
+    REAL :: tmp(0:ni+1,0:nj+1)
+    INTEGER :: i,j
+
+    DO j=1,nj
+      DO i=1,ni
+        tmp(i,j) = (var(i,j) + 0.5*(var(i+1,j) + var(i-1,j) + var(i,j+1) +var(i,j-1))              &
+                             + 0.25*(var(i+1,j+1) + var(i-1,j+1) + var(i+1,j-1) + var(i-1,j-1)))/4.
+      ENDDO
+    ENDDO
+    
+    DO j=1,nj
+      DO i=1,ni
+        var(i,j)=tmp(i,j)
+      ENDDO
+    ENDDO
+
+  END SUBROUTINE smoothing_regular
+
+
+END MODULE icolmdz_param_gravity_wave
Index: /ICOSA_LMDZ/src/phylmd/interface_icosa_lmdz.F90
===================================================================
--- /ICOSA_LMDZ/src/phylmd/interface_icosa_lmdz.F90	(revision 4854)
+++ /ICOSA_LMDZ/src/phylmd/interface_icosa_lmdz.F90	(revision 4855)
@@ -1,3 +1,3 @@
-MODULE interface_icosa_lmdz_mod
+MODULE interface_icosa_lmdz_mod 
 
   USE field_mod, ONLY: t_field
@@ -38,4 +38,16 @@
 CONTAINS
 
+  SUBROUTINE pre_initialize_physics
+  USE etat0_plugin_mod
+  USE icolmdz_etat0
+  USE icolmdz_param_gravity_wave, ONLY: init_param_gravity_wave
+  IMPLICIT NONE
+  !$OMP PARALLEL
+    init_etat0_plugin => init_etat0
+    etat0_plugin => etat0
+    CALL init_param_gravity_wave
+  !$OMP END PARALLEL
+  END SUBROUTINE pre_initialize_physics
+
   SUBROUTINE initialize_physics
   USE distrib_icosa_lmdz_mod, ONLY : init_distrib_icosa_lmdz, transfer_icosa_to_lmdz
@@ -57,4 +69,5 @@
   USE physics_distribution_mod, ONLY : init_physics_distribution
   USE infotrac_phy, ONLY: init_infotrac_phy
+  USE icolmdz_param_gravity_wave, ONLY: param_gravity_wave
 
    
@@ -178,10 +191,8 @@
 !$OMP PARALLEL
     CALL initialize_physics_omp
+    CALL param_gravity_wave
 !$OMP END PARALLEL            
 
     CALL xios_set_context    
-
-
-     
 
   END SUBROUTINE initialize_physics
@@ -525,4 +536,5 @@
   USE geometry_mod, ONLY : cell_area
   USE physiq_mod, ONLY: physiq
+  USE icolmdz_param_gravity_wave, ONLY: param_gravity_wave
   IMPLICIT NONE
   
@@ -627,4 +639,6 @@
       ALLOCATE(dps_phy(klon_omp))
 !$OMP BARRIER
+      
+!      CALL param_gravity_wave
     ENDIF
 
Index: /ICOSA_LMDZ/src/wrapper.f90
===================================================================
--- /ICOSA_LMDZ/src/wrapper.f90	(revision 4854)
+++ /ICOSA_LMDZ/src/wrapper.f90	(revision 4855)
@@ -1,2 +1,10 @@
+SUBROUTINE pre_initialize_external_physics
+  USE interface_icosa_lmdz_mod, ONLY: pre_initialize_physics
+  IMPLICIT NONE
+  
+    CALL pre_initialize_physics  
+
+END SUBROUTINE pre_initialize_external_physics
+
 SUBROUTINE initialize_external_physics
   USE interface_icosa_lmdz_mod, ONLY: initialize_physics
Index: /ICOSA_LMDZ/xml/icosa_lmdz.xml
===================================================================
--- /ICOSA_LMDZ/xml/icosa_lmdz.xml	(revision 4855)
+++ /ICOSA_LMDZ/xml/icosa_lmdz.xml	(revision 4855)
@@ -0,0 +1,3 @@
+<context_group>
+  <context id="icosagcm" src="./param_gw.xml" />
+</context_group>
Index: /ICOSA_LMDZ/xml/param_gw.xml
===================================================================
--- /ICOSA_LMDZ/xml/param_gw.xml	(revision 4855)
+++ /ICOSA_LMDZ/xml/param_gw.xml	(revision 4855)
@@ -0,0 +1,175 @@
+<context id="icosagcm" >
+
+   <file_definition>    
+ 
+     <file id="relief_gw" name="Relief" type="one_file" mode="read" output_freq="100y" enabled="false" >
+        <field id="relief_gw" freq_offset="0ts" name="RELIEF" domain_ref="domain_relief_gw" operation="instant" />
+     </file>
+  
+
+     <file id="orography" name="orography" mode="read" output_freq="100y" enabled="false">
+
+         <field_group domain_ref="domain_orography" operation="instant" freq_offset="0ts"> 
+            <field id="zmea_sso_read" name="phi" />
+            <field id="zstd_sso_read" name="mu" />
+            <field id="zsig_sso_read" name="sigma" />
+            <field id="zgam_sso_read" name="gama" />
+            <field id="zthe_sso_read" name="theta" />
+         </field_group >
+
+     </file>
+
+
+    <!--  needed only for test and debugging
+     
+    <file name="param_gw_reg" type="one_file" output_freq="1ts" >
+       <field id="zmask_regout" name="zmask" domain_ref="regular_gw" operation="instant"  prec="8"/>
+       <field id="zmea_regout"  name="zmea" domain_ref="regular_gw" operation="instant"  prec="8"/>
+       <field id="zpic_regout"  name="zpic" domain_ref="regular_gw" operation="instant"  prec="8"/>
+       <field id="zval_regout"  name="zval" domain_ref="regular_gw" operation="instant"  prec="8"/>
+       <field id="zsig_regout"  name="zsig" domain_ref="regular_gw" operation="instant"  prec="8"/>
+       <field id="zgam_regout"  name="zgam" domain_ref="regular_gw" operation="instant"  prec="8"/>
+       <field id="zthe_regout"  name="zthe" domain_ref="regular_gw" operation="instant"  prec="8"/>
+     </file>     
+     
+    <file name="test_gw" type="one_file" output_freq="1ts" >
+       <field field_ref="zmea_out" name="zmea" operation="instant" prec="8"/>
+       <field field_ref="zpic_out" name="zpic" operation="instant"  prec="8"/>
+       <field field_ref="zval_out" name="zval" operation="instant"  prec="8"/>
+       <field field_ref="ztz_out" name="ztz" operation="instant"  prec="8"/>
+       <field field_ref="zxtzx_out" name="zxtzx" operation="instant"  prec="8"/>
+       <field field_ref="zytzy_out" name="zytzy" operation="instant"  prec="8"/>
+       <field field_ref="zxtzy_out" name="zxtzy" operation="instant"  prec="8"/>
+     </file>
+
+     <file name="test_gw_orig" type="one_file" output_freq="1ts" >
+       <field field_ref="zxtzx_in" name="zxtzx" operation="instant"  prec="8"/>
+       <field field_ref="zytzy_in" name="zytzy" operation="instant"  prec="8"/>
+       <field field_ref="zxtzy_in" name="zxtzy" operation="instant"  prec="8"/>
+     </file>
+     
+     <file name="param_gw" type="one_file" output_freq="1ts" >
+       <field id="zmask" domain_ref="i" operation="instant"  prec="8"/>
+       <field id="zmea" domain_ref="i" operation="instant"  prec="8"/>
+       <field id="zpic" domain_ref="i" operation="instant"  prec="8"/>
+       <field id="zval" domain_ref="i" operation="instant"  prec="8"/>
+       <field id="zsig" domain_ref="i" operation="instant"  prec="8"/>
+       <field id="zgam" domain_ref="i" operation="instant"  prec="8"/>
+       <field id="zthe" domain_ref="i" operation="instant"  prec="8"/>
+     </file>       
+     
+     <file name="lmdz_mesh" type="one_file" mode="read" output_freq="1ts" >
+       <field id="dummy" name="phis" domain_ref="regular_gw" operation="instant"  prec="8"/>
+     </file>       
+
+    -->
+
+   </file_definition>
+
+
+   <domain_definition>
+
+      <domain id="domain_relief_gw" type="rectilinear" >
+        <generate_rectilinear_domain />
+      </domain>
+      
+      <domain id="domain_relief_expand" domain_ref="domain_relief_gw">
+	 <expand_domain type="edge" i_periodic="true" j_periodic="true" />
+      </domain>
+      
+      <domain id="from_relief_gw" domain_ref="i">
+        <interpolate_domain order="1" />
+      </domain>
+      
+      <domain id="regular_gw" type="rectilinear" >
+        <generate_rectilinear_domain/>
+      </domain>
+
+      <domain id="regular_gw_interp" domain_ref="regular_gw" >
+        <interpolate_domain order="1" />
+      </domain>
+
+      <domain id="regular_gw_exp" domain_ref="regular_gw_interp" >
+        <expand_domain type="edge" i_periodic="true" j_periodic="true" />
+      </domain>
+        
+      <domain id="domain_orography" type="rectilinear" >
+        <generate_rectilinear_domain /> 
+      </domain>  
+
+      <domain id="from_orography" domain_ref="i">
+        <interpolate_domain order="1" write_weight="true" mode="read_or_compute"/>
+      </domain>
+
+   </domain_definition>
+
+   <field_definition>
+   
+     <field id="lon2d_in" domain_ref="domain_relief_gw" />
+     <field id="lat2d_in" domain_ref="domain_relief_gw" />
+     <field id="mask_in"  domain_ref="domain_relief_gw" />
+     <field id="zmea_in"  domain_ref="domain_relief_gw" />
+     <field id="zpic_in" domain_ref="domain_relief_gw" > exp(this/20.) </field>
+     <field id="zpic_tmp" field_ref="zpic_in"  domain_ref="from_relief_gw" /> 
+     <field id="zval_in" domain_ref="domain_relief_gw" > exp(-this/20.) </field>
+     <field id="zval_tmp" field_ref="zval_in"  domain_ref="from_relief_gw" /> 
+     <field id="ztz_in" domain_ref="domain_relief_gw" />
+     <field id="zytzy_in" domain_ref="domain_relief_gw" />
+     <field id="zxtzx_in" domain_ref="domain_relief_gw" />
+     <field id="zxtzy_in" domain_ref="domain_relief_gw" />
+
+
+     <field_group id="gw_read_access" read_access="false" >
+       <field id="relief_exp" field_ref="relief_gw" domain_ref="domain_relief_expand" />
+       <field id="lon2d_out" field_ref="lon2d_in" domain_ref="domain_relief_expand" />
+       <field id="lat2d_out" field_ref="lat2d_in" domain_ref="domain_relief_expand" />
+       <field id="mask_out" field_ref="mask_in" domain_ref="from_relief_gw" />
+       <field id="zmea_out" field_ref="zmea_in" domain_ref="from_relief_gw" />
+       <field id="zpic_out" field_ref="zpic_tmp" > log(this)*20. </field>
+       <field id="zval_out" field_ref="zval_tmp" > -log(this)*20. </field>
+       <field id="ztz_out" field_ref="ztz_in" domain_ref="from_relief_gw" />
+       <field id="zytzy_out" field_ref="zytzy_in" domain_ref="from_relief_gw" />
+       <field id="zxtzx_out" field_ref="zxtzx_in" domain_ref="from_relief_gw" />
+       <field id="zxtzy_out" field_ref="zxtzy_in" domain_ref="from_relief_gw" />
+     </field_group>
+
+
+     <field_group id="gwsso_read_access" read_access="false" >
+       <field id="zmea_sso"  field_ref="zmea_sso_read" domain_ref="from_orography" />
+       <field id="zstd_sso"  field_ref="zstd_sso_read" domain_ref="from_orography" />
+       <field id="zsig_sso" field_ref="zsig_sso_read" domain_ref="from_orography" />
+       <field id="zgam_sso"  field_ref="zgam_sso_read" domain_ref="from_orography" />
+       <field id="zthe_sso"  field_ref="zthe_sso_read" domain_ref="from_orography" />
+    </field_group>
+     
+     <!-- for test and debugging (projection onto regular lonlat grid for comparison)
+     
+     <field id="mask_reg" field_ref="mask_in" domain_ref="regular_gw_interp" read_access="true"/>
+     <field id="mask_reg_exp" field_ref="mask_reg" domain_ref="regular_gw_exp" read_access="true"/>
+
+     <field id="zmea_reg" field_ref="zmea_in" domain_ref="regular_gw_interp"/>
+     <field id="zmea_reg_exp" field_ref="zmea_reg" domain_ref="regular_gw_exp" read_access="true"/>
+
+     <field id="zpic_reg" field_ref="zpic_in" domain_ref="regular_gw_interp"/>
+     <field id="zpic_reg_exp" field_ref="zpic_reg" domain_ref="regular_gw_exp" read_access="true"> log(this)*20. </field>
+
+     <field id="zval_reg" field_ref="zval_in" domain_ref="regular_gw_interp"/>
+     <field id="zval_reg_exp" field_ref="zval_reg" domain_ref="regular_gw_exp" read_access="true"> -log(this)*20. </field>
+
+     <field id="ztz_reg" field_ref="ztz_in" domain_ref="regular_gw_interp"/>
+     <field id="ztz_reg_exp" field_ref="ztz_reg" domain_ref="regular_gw_exp" read_access="true"/>
+
+     <field id="zytzy_reg" field_ref="zytzy_in" domain_ref="regular_gw_interp"/>
+     <field id="zytzy_reg_exp" field_ref="zytzy_reg" domain_ref="regular_gw_exp" read_access="true"/>
+
+     <field id="zxtzx_reg" field_ref="zxtzx_in" domain_ref="regular_gw_interp"/>
+     <field id="zxtzx_reg_exp" field_ref="zxtzx_reg" domain_ref="regular_gw_exp" read_access="true"/>
+
+     <field id="zxtzy_reg" field_ref="zxtzy_in" domain_ref="regular_gw_interp"/>
+     <field id="zxtzy_reg_exp" field_ref="zxtzy_reg" domain_ref="regular_gw_exp" read_access="true"/>
+    
+     -->
+     
+   </field_definition>
+   
+</context>
