Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,9 @@
<file>env_run.xml</file>
<desc>
Determines what ESMF log files (if any) are generated when
USE_ESMF_LIB is TRUE.
USE_ESMF_LIB is TRUE.
ESMF_LOGKIND_SINGLE: Use a single log file, combining messages from
all of the PETs. Not supported on some platforms.
all of the PETs. Not supported on some platforms.
ESMF_LOGKIND_MULTI: Use multiple log files -- one per PET.
ESMF_LOGKIND_NONE: Do not issue messages to a log file.
By default, no ESMF log files are generated.
Expand Down Expand Up @@ -2018,7 +2018,7 @@
<desc>pio rearranger communication max pending requests (io2comp) :
-2 implies that CIME internally calculates the value ( = 64),
-1 implies no bound on max pending requests
0 implies that MPI_ALLTOALL will be used
0 implies that MPI_ALLTOALL will be used
</desc>
</entry>

Expand Down Expand Up @@ -2600,7 +2600,7 @@
</entry>

<!-- ===================================================================== -->
<!-- write ESMF PET log files even without an error -->
<!-- Include the AOFLUX calculation for this compset -->
<!-- ===================================================================== -->

<entry id="ADD_AOFLUX_TO_RUNSEQ">
Expand Down
8 changes: 5 additions & 3 deletions cime_config/runseq/runseq_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ def gen_runseq(case, coupling_times):
rundir = case.get_value("RUNDIR")
caseroot = case.get_value("CASEROOT")
cpl_seq_option = case.get_value('CPL_SEQ_OPTION')
cpl_add_aoflux = case.get_value('ADD_AOFLUX_TO_RUNSEQ')
coupling_mode = case.get_value('COUPLING_MODE')
diag_mode = case.get_value('BUDGETS')
xcompset = case.get_value("COMP_ATM") == 'xatm'
cpl_add_aoflux = not xcompset and case.get_value('ADD_AOFLUX_TO_RUNSEQ')

# It is assumed that if a component will be run it will send information to the mediator
# so the flags run_xxx and xxx_to_med are redundant
Expand All @@ -34,6 +35,7 @@ def gen_runseq(case, coupling_times):
run_rof, med_to_rof, rof_cpl_time = driver_config['rof']
run_wav, med_to_wav, wav_cpl_time = driver_config['wav']


# Note: assume that atm_cpl_dt, lnd_cpl_dt, ice_cpl_dt and wav_cpl_dt are the same

if lnd_cpl_time != atm_cpl_time:
Expand Down Expand Up @@ -89,7 +91,7 @@ def gen_runseq(case, coupling_times):
runseq.add_action("MED med_phases_aofluxes_run" , run_ocn and run_atm and (med_to_ocn or med_to_atm))
runseq.add_action("MED med_phases_prep_ocn_merge" , med_to_ocn)
runseq.add_action("MED med_phases_prep_ocn_accum_fast" , med_to_ocn)
runseq.add_action("MED med_phases_ocnalb_run" , run_ocn and run_atm and (med_to_ocn or med_to_atm))
runseq.add_action("MED med_phases_ocnalb_run" , (run_ocn and run_atm and (med_to_ocn or med_to_atm)) and not xcompset)
runseq.add_action("MED med_phases_prep_lnd" , med_to_lnd)
runseq.add_action("MED -> LND :remapMethod=redist" , med_to_lnd)
runseq.add_action("MED med_phases_prep_ice" , med_to_ice)
Expand All @@ -116,7 +118,7 @@ def gen_runseq(case, coupling_times):
runseq.add_action("MED med_phases_aofluxes_run" , run_ocn and run_atm)
runseq.add_action("MED med_phases_prep_ocn_merge" , med_to_ocn)
runseq.add_action("MED med_phases_prep_ocn_accum_fast" , med_to_ocn)
runseq.add_action("MED med_phases_ocnalb_run" , run_ocn and run_atm)
runseq.add_action("MED med_phases_ocnalb_run" , (run_ocn and run_atm) and not xcompset)
runseq.add_action("MED med_phases_diag_ocn" , run_ocn and diag_mode and not ocn_outer_loop)
runseq.add_action("LND -> MED :remapMethod=redist" , run_lnd)
runseq.add_action("ICE -> MED :remapMethod=redist" , run_ice)
Expand Down
83 changes: 41 additions & 42 deletions mediator/med_phases_aofluxes_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ subroutine med_phases_aofluxes_run(gcomp, rc)
use NUOPC , only : NUOPC_IsConnected, NUOPC_CompAttributeGet
use esmFlds , only : med_fldList_GetNumFlds, med_fldList_GetFldNames
use esmFlds , only : fldListFr, fldListMed_aoflux, compatm, compocn, compname
use NUOPC , only : NUOPC_CompAttributeGet

!-----------------------------------------------------------------------
! Compute atm/ocn fluxes
Expand Down Expand Up @@ -189,7 +190,7 @@ subroutine med_aofluxes_init(gcomp, aoflux, FBAtm, FBOcn, FBFrac, FBMed_aoflux,
use ESMF , only : ESMF_GridComp, ESMF_GridCompGet, ESMF_VM
use ESMF , only : ESMF_Field, ESMF_FieldGet, ESMF_FieldBundle, ESMF_VMGet
use NUOPC , only : NUOPC_CompAttributeGet

use shr_flux_mod , only : shr_flux_adjust_constants
!-----------------------------------------------------------------------
! Initialize pointers to the module variables
!-----------------------------------------------------------------------
Expand All @@ -212,6 +213,10 @@ subroutine med_aofluxes_init(gcomp, aoflux, FBAtm, FBOcn, FBFrac, FBMed_aoflux,
character(CL) :: cvalue
logical :: flds_wiso ! use case
character(len=CX) :: tmpstr
real(R8) :: flux_convergence ! convergence criteria for imlicit flux computation
integer :: flux_max_iteration ! maximum number of iterations for convergence
logical :: coldair_outbreak_mod ! cold air outbreak adjustment (Mahrt & Sun 1995,MWR)
logical :: isPresent, isSet
character(*),parameter :: subName = '(med_aofluxes_init) '
!-----------------------------------------------------------------------

Expand Down Expand Up @@ -381,6 +386,40 @@ subroutine med_aofluxes_init(gcomp, aoflux, FBAtm, FBOcn, FBFrac, FBMed_aoflux,
! call FB_getFldPtr(FBFrac , fldname='ifrac' , fldptr1=ifrac, rc=rc)
! if (chkerr(rc,__LINE__,u_FILE_u)) return
! where (ofrac(:) + ifrac(:) <= 0.0_R8) mask(:) = 0
!----------------------------------
! Get config variables on first call
!----------------------------------

call NUOPC_CompAttributeGet(gcomp, name='coldair_outbreak_mod', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
read(cvalue,*) coldair_outbreak_mod
else
coldair_outbreak_mod = .false.
end if

call NUOPC_CompAttributeGet(gcomp, name='flux_max_iteration', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
read(cvalue,*) flux_max_iteration
else
flux_max_iteration = 1
end if

call NUOPC_CompAttributeGet(gcomp, name='flux_convergence', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
read(cvalue,*) flux_convergence
else
flux_convergence = 0.0_r8
end if

call shr_flux_adjust_constants(&
flux_convergence_tolerance=flux_convergence, &
flux_convergence_max_iteration=flux_max_iteration, &
coldair_outbreak_mod=coldair_outbreak_mod)



if (dbug_flag > 5) then
call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO)
Expand All @@ -397,7 +436,7 @@ subroutine med_aofluxes_run(gcomp, aoflux, rc)
use ESMF , only : ESMF_GridCompGet, ESMF_ClockGet, ESMF_TimeGet, ESMF_TimeIntervalGet
use ESMF , only : ESMF_LogWrite, ESMF_LogMsg_Info
use NUOPC , only : NUOPC_CompAttributeGet
use shr_flux_mod , only : shr_flux_atmocn, shr_flux_adjust_constants
use shr_flux_mod , only : shr_flux_atmocn

!-----------------------------------------------------------------------
! Determine atm/ocn fluxes eother on atm or on ocean grid
Expand All @@ -414,53 +453,13 @@ subroutine med_aofluxes_run(gcomp, aoflux, rc)
character(CL) :: cvalue
integer :: n,i ! indices
integer :: lsize ! local size
real(R8) :: flux_convergence ! convergence criteria for imlicit flux computation
integer :: flux_max_iteration ! maximum number of iterations for convergence
logical :: coldair_outbreak_mod ! cold air outbreak adjustment (Mahrt & Sun 1995,MWR)
character(len=CX) :: tmpstr
logical :: isPresent, isSet
logical,save :: first_call = .true.
character(*),parameter :: subName = '(med_aofluxes_run) '
!-----------------------------------------------------------------------

call t_startf('MED:'//subname)

!----------------------------------
! Get config variables on first call
!----------------------------------

if (first_call) then
call NUOPC_CompAttributeGet(gcomp, name='coldair_outbreak_mod', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
read(cvalue,*) coldair_outbreak_mod
else
coldair_outbreak_mod = .false.
end if

call NUOPC_CompAttributeGet(gcomp, name='flux_max_iteration', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
read(cvalue,*) flux_max_iteration
else
flux_max_iteration = 1
end if

call NUOPC_CompAttributeGet(gcomp, name='flux_convergence', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
read(cvalue,*) flux_convergence
else
flux_convergence = 0.0_r8
end if

call shr_flux_adjust_constants(&
flux_convergence_tolerance=flux_convergence, &
flux_convergence_max_iteration=flux_max_iteration, &
coldair_outbreak_mod=coldair_outbreak_mod)

first_call = .false.
end if

!----------------------------------
! Determine the compute mask
Expand Down