Browse Source

Fixed some bugs.

Both, coupled and uncoupled, are running now.
Output has to be checked carefully.
issues/1-unify-defines
Sven Karsten 2 years ago
parent
commit
dd01471ddb
  1. 32
      src/coupler/coupler_main.F90
  2. 41
      src/coupler/flux_exchange.F90
  3. 23
      src/ice_sis/ice_model.F90
  4. 30
      src/mom5/ocean_core/ocean_model.F90
  5. 15
      src/mom5/ocean_wave/ocean_wave.F90

32
src/coupler/coupler_main.F90

@ -428,28 +428,20 @@ character(len=256), parameter :: note_header =
!#######################################################################
#IFDEF OASIS_IOW_ESM
IF (TRIM(type_atmos) == 'none') THEN
#ENDIF
call mpp_init()
#IFDEF OASIS_IOW_ESM
ELSE
call oas_init(mpi_comm_mom)
call mpp_init(localcomm=mpi_comm_mom)
ENDIF
#ELSE
call mpp_init()
#ENDIF
!these clocks are on the global pelist
initClock = mpp_clock_id( 'Initialization' )
call mpp_clock_begin(initClock)
#IFDEF OASIS_IOW_ESM
IF (TRIM(type_atmos) == 'none') THEN
#ENDIF
call fms_init()
#IFDEF OASIS_IOW_ESM
ELSE
call fms_init(mpi_comm_mom)
ENDIF
#ELSE
call fms_init()
#ENDIF
call coupler_init
@ -460,10 +452,9 @@ ENDIF
call mpp_set_current_pelist()
#IFDEF OASIS_IOW_ESM
IF (TRIM(type_atmos) /= 'none') THEN
call oas_define(mpi_comm_mom)
ENDIF
#ENDIF
call mpp_clock_end (initClock) !end initialization
@ -820,17 +811,8 @@ call mpp_clock_end(newClock14)
#IFDEF OASIS_IOW_ESM
IF (TRIM(type_atmos) /= 'none') THEN
call oas_finalize ! needs to be called after fms_end()
ENDIF
call oas_finalize ! needs to be called after fms_end()
#ENDIF
IF (mpp_pe().EQ.mpp_root_pe()) THEN
open(unit=50, file='goodfile')
write(50,*)'go on'
close(50)
ENDIF
!-----------------------------------------------------------------------

41
src/coupler/flux_exchange.F90

@ -867,9 +867,7 @@ subroutine flux_exchange_init ( Time, Atm, Land, Ice, Ocean, Ocean_state,&
allocate( atmos_ice_boundary%t_flux(is:ie,js:je,kd) )
allocate( atmos_ice_boundary%q_flux(is:ie,js:je,kd) )
#IFDEF OASIS_IOW_ESM
IF (TRIM(type_atmos) == 'flux_calculator') THEN
allocate( atmos_ice_boundary%lh_flux(is:ie,js:je,kd) )
ENDIF
allocate( atmos_ice_boundary%lh_flux(is:ie,js:je,kd) )
#ENDIF
allocate( atmos_ice_boundary%lw_flux(is:ie,js:je,kd) )
allocate( atmos_ice_boundary%sw_flux_vis_dir(is:ie,js:je,kd) )
@ -890,9 +888,7 @@ subroutine flux_exchange_init ( Time, Atm, Land, Ice, Ocean, Ocean_state,&
atmos_ice_boundary%t_flux=0.0
atmos_ice_boundary%q_flux=0.0
#IFDEF OASIS_IOW_ESM
IF (TRIM(type_atmos) == 'flux_calculator') THEN
atmos_ice_boundary%lh_flux=0.0
ENDIF
atmos_ice_boundary%lh_flux=0.0
#ENDIF
atmos_ice_boundary%lw_flux=0.0
atmos_ice_boundary%sw_flux_vis_dir=0.0
@ -1052,10 +1048,8 @@ subroutine flux_exchange_init ( Time, Atm, Land, Ice, Ocean, Ocean_state,&
allocate( ice_ocean_boundary%p (is:ie,js:je) ) ; ice_ocean_boundary%p = 0.0
allocate( ice_ocean_boundary%mi (is:ie,js:je) ) ; ice_ocean_boundary%mi = 0.0
#IFDEF OASIS_IOW_ESM
IF (TRIM(type_atmos) == 'flux_calculator') THEN
allocate( ice_ocean_boundary%u_wind (is:ie,js:je) ) ; ice_ocean_boundary%u_wind = 0.0
allocate( ice_ocean_boundary%v_wind (is:ie,js:je) ) ; ice_ocean_boundary%v_wind = 0.0
ENDIF
allocate( ice_ocean_boundary%u_wind (is:ie,js:je) ) ; ice_ocean_boundary%u_wind = 0.0
allocate( ice_ocean_boundary%v_wind (is:ie,js:je) ) ; ice_ocean_boundary%v_wind = 0.0
#ENDIF
!
@ -2164,23 +2158,32 @@ end subroutine sfc_boundary_layer
! A derived data type to specify properties and fluxes passed from atmosphere to ice.
! </INOUT>
!
subroutine flux_down_from_atmos (Time, Atm, Land, Ice, &
Atmos_boundary, Land_boundary, &
#IFDEF OASIS_IOW_ESM
Ice_boundary,ice_ocean_boundary,Time_start,Timet, couple_flux_calculator )
subroutine flux_down_from_atmos (Time, Atm, Land, Ice, &
Atmos_boundary, Land_boundary, Ice_boundary, ice_ocean_boundary, &
Time_start, Timet, couple_flux_calculator )
type(time_type), intent(in) :: Time
type(atmos_data_type), intent(inout) :: Atm
type(land_data_type), intent(in) :: Land
type(ice_data_type), intent(in) :: Ice
type(land_ice_atmos_boundary_type),intent(in) :: Atmos_boundary
type(atmos_land_boundary_type), intent(inout):: Land_boundary
type(atmos_ice_boundary_type), intent(inout):: Ice_boundary
type(time_type), intent(in) :: Time_start,Timet
type(ice_ocean_boundary_type), intent(inout):: ice_ocean_boundary
logical, intent(in) :: couple_flux_calculator
#ELSE
Ice_boundary)
#ENDIF
subroutine flux_down_from_atmos (Time, Atm, Land, Ice, &
Atmos_boundary, Land_boundary, Ice_boundary)
type(time_type), intent(in) :: Time
type(atmos_data_type), intent(inout) :: Atm
type(land_data_type), intent(in) :: Land
type(ice_data_type), intent(in) :: Ice
type(land_ice_atmos_boundary_type),intent(in) :: Atmos_boundary
type(atmos_land_boundary_type), intent(inout):: Land_boundary
type(atmos_ice_boundary_type), intent(inout):: Ice_boundary
#IFDEF OASIS_IOW_ESM
type(time_type), intent(in) :: Time,Time_start,Timet
type(ice_ocean_boundary_type), intent(inout):: ice_ocean_boundary
logical, intent(in) :: couple_flux_calculator
#ENDIF
real, dimension(n_xgrid_sfc) :: ex_flux_sw, ex_flux_lwd, &

23
src/ice_sis/ice_model.F90

@ -197,7 +197,7 @@ contains
subroutine update_ice_model_fast_new ( Atmos_boundary, Ice, type_atmos )
type(atmos_ice_boundary_type), intent(inout) :: Atmos_boundary
type (ice_data_type), intent(inout) :: Ice
CHARACTER(*), intent(in) :: type_atmos
CHARACTER(*), OPTIONAL, INTENT(IN) :: type_atmos
#ELSE
subroutine update_ice_model_fast_new ( Atmos_boundary, Ice )
type(atmos_ice_boundary_type), intent(inout) :: Atmos_boundary
@ -767,7 +767,7 @@ subroutine update_ice_model_fast_new ( Atmos_boundary, Ice, type_atmos )
real, dimension(isc:iec,jsc:jec,km), intent(in) :: flux_q ! specific humidity flux (+up)
#IFDEF OASIS_IOW_ESM
real, dimension(isc:iec,jsc:jec,km), optional, intent(in) :: flux_lhc ! latent heat flux (+up)
CHARACTER(len=16) :: type_atmos
CHARACTER(len=16), OPTIONAL, INTENT(IN) :: type_atmos
#ENDIF
real, dimension(isc:iec,jsc:jec,km), intent(in) :: flux_sw_nir_dir ! net near IR direct shortwave radiation (+ down)
real, dimension(isc:iec,jsc:jec,km), intent(in) :: flux_sw_nir_dif ! net near IR diffuse shortwave radiation (+ down)
@ -793,6 +793,15 @@ subroutine update_ice_model_fast_new ( Atmos_boundary, Ice, type_atmos )
type (time_type) :: Dt_ice
real, dimension(isc:iec,jsc:jec) :: cosz_alb
#IFDEF OASIS_IOW_ESM
CHARACTER (len=16) :: type_atmos_local
IF(present(type_atmos)) THEN
type_atmos_local=type_atmos
ELSE
type_atmos_local='none'
ENDIF
#ENDIF
if (id_alb>0) sent = send_data(id_alb, all_avg(Ice%albedo,Ice%part_size(isc:iec,jsc:jec,:)), &
Ice%Time, mask=Ice%mask)
!
@ -806,9 +815,9 @@ subroutine update_ice_model_fast_new ( Atmos_boundary, Ice, type_atmos )
flux_t_new(i,j,k) = flux_t(i,j,k)
flux_q_new(i,j,k) = flux_q(i,j,k)
#IFDEF OASIS_IOW_ESM
IF (TRIM(type_atmos) == 'flux_calculator') THEN
IF (TRIM(type_atmos_local) == 'flux_calculator') THEN
flux_lh_new(i,j,k) = flux_lhc(i,j,k)
ELSE
ELSEIF (TRIM(type_atmos_local) == 'none') THEN
#ENDIF
flux_lh_new(i,j,k) = hlv*flux_q(i,j,k)
#IFDEF OASIS_IOW_ESM
@ -1846,9 +1855,9 @@ subroutine atm_ice_bnd_type_chksum(id, timestep, bnd_type)
write(outunit,100) 'atm_ice_bnd_type%t_flux ',mpp_chksum(bnd_type%t_flux)
write(outunit,100) 'atm_ice_bnd_type%q_flux ',mpp_chksum(bnd_type%q_flux)
#IFDEF OASIS_IOW_ESM
write(outunit,100) 'atm_ice_bnd_type%lh_flux ',mpp_chksum(bnd_type%lh_flux)
write(outunit,100) 'atm_ice_bnd_type%u_wind ',mpp_chksum(bnd_type%u_wind)
write(outunit,100) 'atm_ice_bnd_type%v_wind ',mpp_chksum(bnd_type%v_wind)
write(outunit,100) 'atm_ice_bnd_type%lh_flux ',mpp_chksum(bnd_type%lh_flux)
write(outunit,100) 'atm_ice_bnd_type%u_wind ',mpp_chksum(bnd_type%u_wind)
write(outunit,100) 'atm_ice_bnd_type%v_wind ',mpp_chksum(bnd_type%v_wind)
#ENDIF
write(outunit,100) 'atm_ice_bnd_type%lw_flux ',mpp_chksum(bnd_type%lw_flux)
write(outunit,100) 'atm_ice_bnd_type%sw_flux_vis_dir ',mpp_chksum(bnd_type%sw_flux_vis_dir)

30
src/mom5/ocean_core/ocean_model.F90

@ -1394,28 +1394,40 @@ subroutine ocean_model_init(Ocean, Ocean_state, Time_init, Time_in)
! this module and intent inout, and Ocean_sfc is intent out.
! </DESCRIPTION>
!
subroutine update_ocean_model(Ice_ocean_boundary, Ocean_state, Ocean_sfc, &
time_start_update, Ocean_coupling_time_step, &
#IFDEF OASIS_IOW_ESM
type_atmos, do_wave_in)
subroutine update_ocean_model(Ice_ocean_boundary, Ocean_state, Ocean_sfc, &
time_start_update, Ocean_coupling_time_step, type_atmos, do_wave_in)
type(ice_ocean_boundary_type), intent(inout) :: Ice_ocean_boundary
type(ocean_state_type), pointer :: Ocean_state
type(ocean_public_type), intent(inout) :: Ocean_sfc
type(time_type), intent(in) :: time_start_update
type(time_type), intent(in) :: Ocean_coupling_time_step
CHARACTER(*), optional, intent(in) :: type_atmos
logical, optional, intent(in) :: do_wave_in
#ELSE
do_wave_in)
#ENDIF
subroutine update_ocean_model(Ice_ocean_boundary, Ocean_state, Ocean_sfc, &
time_start_update, Ocean_coupling_time_step, do_wave_in)
type(ice_ocean_boundary_type), intent(inout) :: Ice_ocean_boundary
type(ocean_state_type), pointer :: Ocean_state
type(ocean_public_type), intent(inout) :: Ocean_sfc
type(time_type), intent(in) :: time_start_update
type(time_type), intent(in) :: Ocean_coupling_time_step
#IFDEF OASIS_IOW_ESM
CHARACTER(*), optional, intent(in) :: type_atmos
#ENDIF
logical, optional, intent(in) :: do_wave_in
#ENDIF
integer :: seconds, days
integer :: num_ocn
integer :: taum1, tau, taup1
integer :: i, j, k, n
#IFDEF OASIS_IOW_ESM
CHARACTER (len=16) :: type_atmos_local
IF(present(type_atmos)) THEN
type_atmos_local=type_atmos
ELSE
type_atmos_local='none'
ENDIF
#ENDIF
call mpp_clock_begin(id_ocean)
@ -1531,7 +1543,7 @@ subroutine ocean_model_init(Ocean, Ocean_state, Time_init, Time_in)
! update the simplified MOM version of a wave model
call mpp_clock_begin(id_wave)
#IFDEF OASIS_IOW_ESM
call ocean_wave_model(Time, Waves, Ice_ocean_boundary, type_atmos)
call ocean_wave_model(Time, Waves, Ice_ocean_boundary, type_atmos_local)
#ELSE
call ocean_wave_model(Time, Waves, Ice_ocean_boundary)
#ENDIF

15
src/mom5/ocean_wave/ocean_wave.F90

@ -398,7 +398,7 @@ subroutine ocean_wave_model(Time, Waves, Ice_ocean_boundary, type_atmos)
type(ocean_time_type), intent(in) :: Time
type(ocean_wave_type), intent(inout) :: Waves
type(ice_ocean_boundary_type), intent(in) :: Ice_ocean_boundary
CHARACTER(*), intent(in) :: type_atmos
CHARACTER(*), OPTIONAL, INTENT(IN) :: type_atmos
#ELSE
subroutine ocean_wave_model(Time, Waves, Ice_ocean_boundary)
type(ocean_time_type), intent(in) :: Time
@ -409,6 +409,15 @@ subroutine ocean_wave_model(Time, Waves, Ice_ocean_boundary)
integer :: ndtt, nww
real :: wmax, cspeed, dtwmax, cm
#IFDEF OASIS_IOW_ESM
CHARACTER (len=16) :: type_atmos_local
IF(present(type_atmos)) THEN
type_atmos_local=type_atmos
ELSE
type_atmos_local='none'
ENDIF
#ENDIF
if ( .not.module_is_initialized ) return
if(debug_this_module) then
@ -427,10 +436,10 @@ subroutine ocean_wave_model(Time, Waves, Ice_ocean_boundary)
windy = 0.0
#IFDEF OASIS_IOW_ESM
IF (TRIM(type_atmos) == 'flux_calculator') THEN
IF (TRIM(type_atmos_local) == 'flux_calculator') THEN
wrk1(isc:iec,jsc:jec)=Ice_ocean_boundary%u_wind(isc:iec,jsc:jec)
wrk2(isc:iec,jsc:jec)=Ice_ocean_boundary%v_wind(isc:iec,jsc:jec)
ELSEIF (TRIM(type_atmos) == 'none') THEN
ELSEIF (TRIM(type_atmos_local) == 'none') THEN
#ENDIF
call data_override('OCN', 'u_bot', wrk1, Time%model_time )
call data_override('OCN', 'v_bot', wrk2, Time%model_time )

Loading…
Cancel
Save