Commit 8c4c6240 authored by ymeur's avatar ymeur
Browse files

Improve nudging

1) A new guided option is available to output forcing file that can be reused for a newt nudged cglobal or LAM configuration. It is activated using guided_type flag :
guided_type = nudging_forcing

in this case, new run.def parameters are available to control output frequency and output area :
nudging_freq : output frequency in second
nudging_lon_start : longitude starting zone in degree (default=-180)
nudging_lon_end   : longitude end zone in degree (default=180)
nudging_lon_delta : longitude resolution ind degree (default=1.)
nudging_lat_start : latitude starting zone in degree (default=-180)
nudging_lat_end   : latitude end zone in degree (default=180)
nudging_lat_delta : latitude starting zone in degree (default=-180)

2) improve nudging, and merge nudging functionality when using forcing file coming from previous dynamico simulation or ERA5 reanalysis

YM
parent 69af1434
Pipeline #183575 failed with stages
in 9 minutes and 3 seconds
......@@ -9,6 +9,7 @@ CONTAINS
SUBROUTINE pre_init_guided
USE icosa
USE nudging_mod, ONLY : pre_init_guided_nudging => pre_init_guided
USE nudging_forcing_mod, ONLY : pre_init_guided_nudging_forcing => pre_init_guided
IMPLICIT NONE
guided_type='none'
......@@ -22,8 +23,11 @@ CONTAINS
CASE ('nudging')
CALL pre_init_guided_nudging
CASE ('nudging_forcing')
CALL pre_init_guided_nudging_forcing
CASE DEFAULT
PRINT*,"Bad selector for varaible guided_type >",TRIM(guided_type),"> option are <none>, <dcmip1>, <nudging>"
PRINT*,"Bad selector for varaible guided_type >",TRIM(guided_type),"> option are <none>, <dcmip1>, <nudging>, <nudging_forcing>"
STOP
END SELECT
......@@ -34,6 +38,7 @@ CONTAINS
USE icosa
USE guided_ncar_mod, ONLY : init_guided_ncar => init_guided
USE nudging_mod, ONLY : init_guided_nudging => init_guided
USE nudging_forcing_mod, ONLY : init_guided_nudging_forcing => init_guided
IMPLICIT NONE
guided_type='none'
......@@ -48,8 +53,11 @@ CONTAINS
CASE ('nudging')
CALL init_guided_nudging
CASE ('nudging_forcing')
CALL init_guided_nudging_forcing
CASE DEFAULT
PRINT*,"Bad selector for varaible guided_type >",TRIM(guided_type),"> option are <none>, <dcmip1>, <nudging>"
PRINT*,"Bad selector for varaible guided_type >",TRIM(guided_type),"> option are <none>, <dcmip1>, <nudging>, <nudging_forcing>"
STOP
END SELECT
......@@ -60,6 +68,7 @@ CONTAINS
USE icosa
USE guided_ncar_mod, ONLY : guided_ncar => guided
USE nudging_mod, ONLY : guided_nudging => guided
USE nudging_forcing_mod, ONLY : guided_nudging_forcing => guided
IMPLICIT NONE
REAL(rstd), INTENT(IN):: tt
TYPE(t_field),POINTER :: f_ps(:)
......@@ -74,8 +83,10 @@ CONTAINS
CALL guided_ncar(tt, f_ps, f_theta_rhodz, f_u, f_q)
CASE ('nudging')
CALL guided_nudging(tt, f_ps, f_mass, f_theta_rhodz, f_u, f_q)
CASE ('nudging_forcing')
CALL guided_nudging_forcing(tt, f_ps, f_mass, f_theta_rhodz, f_u, f_q)
CASE DEFAULT
PRINT*,"Bad selector for varaible guided_type >",TRIM(guided_type),"> option are <none>, <dcmip1>, <nudging>"
PRINT*,"Bad selector for varaible guided_type >",TRIM(guided_type),"> option are <none>, <dcmip1>, <nudging>, <nudging_forcing>"
STOP
END SELECT
......
......@@ -170,9 +170,11 @@ CONTAINS
ELSE
! vertical remapping is done in XIOS workflow
IF (is_omp_master) CALL xios_set_axis_attr("from_nudged",axis_ref="nudged_vert_interp_src_dest")
IF (is_omp_master) CALL xios_set_axis_attr("from_nudged0",axis_ref="nudged_vert_interp_src_dest")
IF (is_omp_master) CALL xios_set_axis_attr("from_nudged0",axis_ref="nudged_vert_interp_src_dest0")
IF (is_omp_master) CALL xios_set_field_attr("p_nudged_horiz_interp",read_access=.TRUE.)
IF (is_omp_master) CALL xios_set_field_attr("p_nudged_horiz_interp0",read_access=.TRUE.)
IF (is_omp_master) CALL xios_set_field_attr("p_nudged_read",enabled=.TRUE.)
IF (is_omp_master) CALL xios_set_field_attr("p_nudged_read0",enabled=.TRUE.)
ENDIF
END SUBROUTINE pre_init_guided
......@@ -774,6 +776,38 @@ CONTAINS
IF (guide_T) CALL temperature2theta_rhodz(tf_ps%f_t1, tf_temp%f_t1, tf_theta_rhodz%f_t1)
ENDIF
! interpolate in time only those fields that we nudge to
IF (guide_PS) THEN
CALL interpolate_time_field(interp, tf_ps)
CALL transfert_request(tf_ps%f_t, req_i0)
CALL transfert_request(tf_ps%f_t, req_i1)
ENDIF
IF (guide_U) THEN
CALL interpolate_time_field(interp, tf_ulon)
CALL transfert_request(tf_ulon%f_t, req_i0)
CALL transfert_request(tf_ulon%f_t, req_i1)
CALL interpolate_time_field(interp, tf_ulat)
CALL transfert_request(tf_ulat%f_t, req_i0)
CALL transfert_request(tf_ulat%f_t, req_i1)
CALL ulonlat2un(tf_ulon%f_t, tf_ulat%f_t, tf_u%f_t)
CALL transfert_request(tf_u%f_t,req_e1_vect)
ENDIF
IF (guide_Q) THEN
CALL interpolate_time_field(interp, tf_q)
CALL transfert_request(tf_q%f_t, req_i0)
CALL transfert_request(tf_q%f_t, req_i1)
ENDIF
IF (guide_T) THEN
CALL interpolate_time_field(interp, tf_temp)
CALL transfert_request(tf_temp%f_t, req_i0)
CALL transfert_request(tf_temp%f_t, req_i1)
CALL temperature2theta_rhodz(tf_ps%f_t, tf_temp%f_t, tf_theta_rhodz%f_t)
ENDIF
ELSE ! (.NOT. do_vertical_remap)
! interpolate in time only those fields that we nudge to
......
MODULE nudging_forcing_mod
USE icosa
PRIVATE
TYPE(t_field),POINTER, SAVE :: f_ulon(:), f_ulat(:), f_temp(:), f_p(:), f_tracer(:)
PUBLIC :: pre_init_guided, init_guided, guided
CONTAINS
SUBROUTINE pre_init_guided
USE omp_para
USE xios_mod
USE getin_mod
IMPLICIT NONE
REAL(rstd) :: lon_start
REAL(rstd) :: lon_end
REAL(rstd) :: lon_delta
REAL(rstd) :: lat_start
REAL(rstd) :: lat_end
REAL(rstd) :: lat_delta
REAL(rstd) :: nudging_freq
TYPE(xios_duration) :: freq
INTEGER :: ni_glo
INTEGER :: nj_glo
lon_start=-180
CALL getin("nudging_lon_start", lon_start)
lon_end=180
CALL getin("nudging_lon_end", lon_end)
lon_delta=1
CALL getin("nudging_lon_delta", lon_delta)
lat_start=-90
CALL getin("nudging_lat_start", lat_start)
lat_end=90
CALL getin("nudging_lat_end", lat_end)
lat_delta=1
CALL getin("nudging_lat_delta", lat_delta)
CALL getin("nudging_freq", nudging_freq)
freq%second=nudging_freq
ni_glo=ABS(lon_end-lon_start)/lon_delta
nj_glo=ABS(lat_end-lat_start)/lat_delta
IF (is_omp_master) THEN
CALL xios_set_file_attr("nudging_forcing",enabled=.TRUE., output_freq=freq)
CALL xios_set_generate_rectilinear_domain_attr("nudging_zone",bounds_lon_start=lon_start, bounds_lon_end=lon_end, &
bounds_lat_start=lat_start, bounds_lat_end=lat_end)
CALL xios_set_domain_attr("domain_forcing",ni_glo=ni_glo, nj_glo=nj_glo)
ENDIF
END SUBROUTINE pre_init_guided
SUBROUTINE init_guided
IMPLICIT NONE
CALL allocate_field(f_ulon,field_t,type_real,llm, name="ulon")
CALL allocate_field(f_ulat,field_t,type_real,llm, name="ulat")
CALL allocate_field(f_temp,field_t,type_real,llm, name="temp")
CALL allocate_field(f_p, field_t,type_real,llm, name="pressure")
CALL allocate_field(f_tracer, field_t,type_real,llm, name="tracer")
END SUBROUTINE init_guided
SUBROUTINE guided(time, f_ps, f_mass, f_theta_rhodz, f_u, f_q)
USE wind_mod
USE xios_mod
USE pression_mod
USE theta2theta_rhodz_mod
USE tracer_icosa_mod, ONLY : tracers
USE omp_para
IMPLICIT NONE
REAL(rstd), INTENT(IN) :: time
TYPE(t_field), POINTER :: f_u(:)! initial condition
TYPE(t_field), POINTER :: f_theta_rhodz(:)! initial condition
TYPE(t_field), POINTER :: f_ps(:)! initial condition
TYPE(t_field), POINTER :: f_mass(:)! initial condition
TYPE(t_field), POINTER :: f_q(:)! initial condition
INTEGER :: nq, ind
CALL transfert_request(f_u, req_e1_vect)
CALL un2ulonlat(f_u, f_ulon, f_ulat)
CALL xios_write_field("ulon_forcing",f_ulon)
CALL xios_write_field("ulat_forcing",f_ulat)
CALL theta_rhodz2temperature(f_ps, f_theta_rhodz, f_temp)
CALL xios_write_field("temp_forcing",f_temp)
CALL pression_mid(f_ps,f_p)
CALL xios_write_field("ps_forcing",f_ps)
CALL xios_write_field("p_forcing",f_p)
DO nq=1,nqtot
IF (tracers(nq)%name=="H2O-g" .OR. tracers(nq)%name=="H2O-l" .OR. tracers(nq)%name=="H2O-s") THEN
DO ind=1,ndomain
IF (.NOT. assigned_domain(ind)) CYCLE
IF (is_omp_master) f_tracer(ind)%rval4d(:,:,1) = f_q(ind)%rval4d(:,:,nq)
ENDDO
CALL xios_write_field(TRIM(tracers(nq)%name)//'_forcing',f_tracer)
ENDIF
ENDDO
END SUBROUTINE guided
END MODULE nudging_forcing_mod
......@@ -4,6 +4,54 @@
<!-- =========================================================================================================== -->
<context id="icosagcm" >
<!-- output forcing field for nudging -->
<file_definition>
<file id="nudging_forcing" enabled="false" output_freq="3h" >
<field_group operation="instant" domain_ref="domain_forcing" freq_offset="0ts">
<field field_ref="ulon_forcing" name="u"/>
<field field_ref="ulat_forcing" name="v"/>
<field field_ref="temp_forcing" name="t"/>
<field field_ref="ps_forcing" name="sp" />
<field field_ref="p_forcing" name="pressure"/>
<field field_ref="H2O-g_forcing" name="q"/>
<field field_ref="H2O-l_forcing" name="clwc"/>
<field field_ref="H2O-s_forcing" name="ciwc"/>
</field_group>
</file >
</file_definition>
<field_definition>
<field_group domain_ref="i">
<field id="ulon_forcing" axis_ref="lev"/>
<field id="ulat_forcing" axis_ref="lev"/>
<field id="temp_forcing" axis_ref="lev"/>
<field id="ps_forcing" />
<field id="p_forcing" axis_ref="lev"/>
<field id="H2O-g_forcing" axis_ref="lev"/>
<field id="H2O-l_forcing" axis_ref="lev"/>
<field id="H2O-s_forcing" axis_ref="lev"/>
</field_group>
</field_definition>
<domain_definition>
<domain id="domain_forcing" type="rectilinear" >
<generate_rectilinear_domain id="nudging_zone" />
<interpolate_domain order="2"/>
</domain>
</domain_definition>
<!-- =========================================================================================================== -->
<!-- nudging configuration -->
<file_definition>
<file_group id="nudging_files" enabled="false"> <!-- enabled will be set from model in nudging case -->
......@@ -24,9 +72,10 @@
</file>
<file id="nudging_in" name="ERA5" enabled="false" output_freq="1h" mode="read" record_offset="1" time_counter_name="time">
<file id="nudging_in" name="nudging_forcing" enabled="false" output_freq="1h" mode="read" record_offset="1" time_counter_name="time" cyclic="true">
<field_group operation="instant" freq_offset="1ts" >
<field id="ps_nudged_read" name="sp" domain_ref="domain_nudged" />
<field id="p_nudged_read" name="pressure" domain_ref="domain_nudged" axis_ref="axis_nudged" enabled="false" />
<field id="ulon_nudged_read" name="u" domain_ref="domain_nudged" axis_ref="axis_nudged" />
<field id="ulat_nudged_read" name="v" domain_ref="domain_nudged" axis_ref="axis_nudged" />
<field id="temp_nudged_read" name="t" domain_ref="domain_nudged" axis_ref="axis_nudged" />
......@@ -37,9 +86,10 @@
</field_group>
</file>
<file id="nudging_in0" name="ERA5" enabled="false" output_freq="1000y" mode="read" record_offset="0" time_counter_name="time">
<file id="nudging_in0" name="nudging_forcing" enabled="false" output_freq="1000y" mode="read" record_offset="0" time_counter_name="time">
<field_group operation="once" freq_offset="1ts" >
<field id="ps_nudged_read0" name="sp" domain_ref="domain_nudged" />
<field id="p_nudged_read0" name="pressure" domain_ref="domain_nudged" axis_ref="axis_nudged" enabled="false"/>
<field id="ulon_nudged_read0" name="u" domain_ref="domain_nudged" axis_ref="axis_nudged" />
<field id="ulat_nudged_read0" name="v" domain_ref="domain_nudged" axis_ref="axis_nudged" />
<field id="temp_nudged_read0" name="t" domain_ref="domain_nudged" axis_ref="axis_nudged" />
......@@ -98,7 +148,7 @@
<field id="p_nudged_horiz_interp0" field_ref="p_nudged_read0" domain_ref="from_nudged" axis_ref="axis_nudged" read_access="false"/> <!-- read_access will be set from model -->
<field id="temp_nudged0" field_ref="temp_nudged_horiz_interp0" domain_ref="from_nudged" axis_ref="from_nudged0"/>
<field id="ulon_nudged0" field_ref="ulon_nudged_horiz_interp0" domain_ref="from_nudged" axis_ref="from_nudged0"/>
<field id="ulon_nudged0" field_ref="ulon_nudged_horiz_interp0" domain_ref="from_nudged" axis_ref="from_nudged0" build_workflow_graph="true" />
<field id="ulat_nudged0" field_ref="ulat_nudged_horiz_interp0" domain_ref="from_nudged" axis_ref="from_nudged0"/>
<field id="q_nudged0" field_ref="q_nudged_horiz_interp0" grid_ref="grid_q_from_nudged0"/>
<field id="H2O-g_nudged0" field_ref="H2O-g_nudged_horiz_interp0" domain_ref="from_nudged" axis_ref="from_nudged0"/>
......@@ -132,6 +182,10 @@
<interpolate_axis order="1" coordinate_src="p_nudged_horiz_interp" coordinate_dst="p_nudged" />
</axis>
<axis id="nudged_vert_interp_src_dest0" axis_ref="lev">
<interpolate_axis order="1" coordinate_src="p_nudged_horiz_interp0" coordinate_dst="p_nudged0" />
</axis>
<axis id="nudged_vert_interp_dest" axis_ref="lev">
<interpolate_axis order="1" coordinate_dst="p_nudged" />
</axis>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment