From 954e9b221eb232393e30ce2797f2372ec4190e8a Mon Sep 17 00:00:00 2001 From: Paul Rigor Date: Tue, 11 Oct 2022 13:51:12 +0200 Subject: [PATCH] eCLM-ICON coupling (#18) Model developments by @s-poll : * 9f00031 introduce precompiler COUP_OAS_ICON and COUP_OAS_PFL * 59702f3 Oasis define for ICON () * a98d2cd Oasis snd/rcv for ICON (CLM3 vars) * 1641475 consistent coupler precompiler naming * f3c0cad include oas_receive_icon in eclm time stepping * f7be360 renaming of coupled ICON-ECLM vars in oas_defineMod * 27d984d Update snd/rcv fields from ICON * ed1af99 Implementation of coupled variable t_sf. * 47c2068 Couple rain_rate and snow_rate in seperate variables. * 60850cf Restructure oasis_def_var. * a42a3eb Inclusion of urban landunit. Merges and bugfixes by @kvrigor : * d79df54 Merge clm5nl-gen v0.6 (#16) * 8ffe78f Merge eCLM-ParFlow coupling (#17) * dfb6e69 Added compile definition COUP_OAS_PFL for ParFlow * 0263ae8 Removed `use_parflow_soilwater()` in `BalanceCheckMod.F90` and `TotalWaterAndHeatMod.F90` * 9ea5952 Fixed missing `psit` calculation when not coupled with ParFlow Co-authored-by: Stefan Poll --- src/clm5/biogeophys/BalanceCheckMod.F90 | 46 +++++------ src/clm5/biogeophys/BareGroundFluxesMod.F90 | 10 ++- src/clm5/biogeophys/CanopyFluxesMod.F90 | 8 ++ src/clm5/biogeophys/CanopyTemperatureMod.F90 | 16 ++-- src/clm5/biogeophys/HydrologyDrainageMod.F90 | 26 +++++- .../biogeophys/HydrologyNoDrainageMod.F90 | 21 ++++- src/clm5/biogeophys/SoilFluxesMod.F90 | 7 +- src/clm5/biogeophys/SoilHydrologyMod.F90 | 21 ++--- src/clm5/biogeophys/SoilMoistStressMod.F90 | 26 +++--- src/clm5/biogeophys/SoilWaterMovementMod.F90 | 15 ++-- src/clm5/biogeophys/TemperatureType.F90 | 13 +++ src/clm5/biogeophys/TotalWaterAndHeatMod.F90 | 15 ++-- src/clm5/biogeophys/UrbanFluxesMod.F90 | 7 +- src/clm5/biogeophys/WaterStateType.F90 | 10 ++- src/clm5/biogeophys/WaterfluxType.F90 | 10 ++- src/clm5/cpl/lnd_comp_mct.F90 | 21 ++++- src/clm5/main/atm2lndType.F90 | 12 +-- src/clm5/main/clm_driver.F90 | 5 +- src/clm5/main/lnd2atmMod.F90 | 24 +++++- src/clm5/main/lnd2atmType.F90 | 18 ++++- src/clm5/oasis3/oas_defineMod.F90 | 59 +++++++++++++- src/clm5/oasis3/oas_sendReceiveMod.F90 | 80 ++++++++++++++++++- src/clm5/oasis3/oas_vardefMod.F90 | 37 ++++++++- src/csm_share/CMakeLists.txt | 8 ++ 24 files changed, 410 insertions(+), 105 deletions(-) diff --git a/src/clm5/biogeophys/BalanceCheckMod.F90 b/src/clm5/biogeophys/BalanceCheckMod.F90 index b3733d78f1..c567e64877 100644 --- a/src/clm5/biogeophys/BalanceCheckMod.F90 +++ b/src/clm5/biogeophys/BalanceCheckMod.F90 @@ -184,7 +184,6 @@ subroutine BalanceCheck( bounds, & use clm_time_manager , only : get_nstep_since_startup_or_lastDA_restart_or_pause use CanopyStateType , only : canopystate_type use SurfaceAlbedoType , only : surfalb_type - use SoilWaterMovementMod , only : use_parflow_soilwater use subgridAveMod ! ! !ARGUMENTS: @@ -228,7 +227,6 @@ subroutine BalanceCheck( bounds, & errh2osno => waterstate_inst%errh2osno_col , & ! Output: [real(r8) (:) ] error in h2osno (kg m-2) endwb => waterstate_inst%endwb_col , & ! Output: [real(r8) (:) ] water mass end of the time step total_plant_stored_h2o_col => waterstate_inst%total_plant_stored_h2o_col, & ! Input: [real(r8) (:) ] water mass in plant tissues (kg m-2) - pfl_psi => waterstate_inst%pfl_psi_col , & ! Input: [real(r8) (:,:) ] COUP_OAS_PFL qflx_rootsoi_col => waterflux_inst%qflx_rootsoi_col , & ! Input [real(r8) (:) ] water loss in soil layers to root uptake (mm H2O/s) ! (ie transpiration demand, often = transpiration) @@ -404,14 +402,13 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'deltawb/dtime = ',(endwb(indexc)-begwb(indexc))/dtime write(iulog,*)'deltaflux = ',forc_rain_col(indexc)+forc_snow_col(indexc) - (qflx_evap_tot(indexc) + & qflx_surf(indexc)+qflx_h2osfc_surf(indexc)+qflx_drain(indexc)) - - if (use_parflow_soilwater()) then - ! TODO: Balance errors must be fixed for fully coupled model (ICON-eCLM-ParFlow) - write(iulog,*)'Ignoring water balance error...' - else - write(iulog,*)'clm model is stopping - error is greater than 1e-5 (mm)' - call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - end if +#ifdef COUP_OAS_PFL + ! TODO: Balance errors must be fixed for fully coupled model (ICON-eCLM-ParFlow) + write(iulog,*)'Ignoring water balance error...' +#else + write(iulog,*)'clm model is stopping - error is greater than 1e-5 (mm)' + call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) +#endif else if (abs(errh2o(indexc)) > 1.e-5_r8 .and. (DAnstep > skip_steps) ) then @@ -440,13 +437,13 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'qflx_drain_perched = ',qflx_drain_perched(indexc)*dtime write(iulog,*)'qflx_glcice_dyn_water_flux = ',qflx_glcice_dyn_water_flux(indexc)*dtime write(iulog,*)'qflx_rootsoi_col(1:nlevsoil) = ',qflx_rootsoi_col(indexc,:)*dtime - if (use_parflow_soilwater()) then - ! TODO: Balance errors must be fixed for fully coupled model (ICON-eCLM-ParFlow) - write(iulog,*)'Ignoring water balance error...' - else - write(iulog,*)'clm model is stopping - error is greater than 1e-5 (mm)' - call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - end if +#ifdef COUP_OAS_PFL + ! TODO: Balance errors must be fixed for fully coupled model (ICON-eCLM-ParFlow) + write(iulog,*)'Ignoring water balance error...' +#else + write(iulog,*)'clm model is stopping - error is greater than 1e-5 (mm)' + call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) +#endif end if end if @@ -693,7 +690,6 @@ subroutine BalanceCheck( bounds, & end if ! Soil energy balance check - ! COUP_OAS_PFL found = .false. do c = bounds%begc,bounds%endc if (col%active(c)) then @@ -707,13 +703,13 @@ subroutine BalanceCheck( bounds, & write(iulog,*)'WARNING: BalanceCheck: soil balance error (W/m2)' write(iulog,*)'nstep = ',nstep write(iulog,*)'errsoi_col = ',errsoi_col(indexc) - if (use_parflow_soilwater()) then - ! TODO: Balance errors must be fixed for fully coupled model (ICON-eCLM-ParFlow) - write(iulog,*)'Ignoring soil balance error...' - else - write(iulog,*)'clm model is stopping - error is greater than 1e-5 (mm)' - call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - end if +#ifdef COUP_OAS_PFL + ! TODO: Balance errors must be fixed for fully coupled model (ICON-eCLM-ParFlow) + write(iulog,*)'Ignoring soil balance error...' +#else + write(iulog,*)'clm model is stopping - error is greater than 1e-5 (mm)' + call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) +#endif end if end associate diff --git a/src/clm5/biogeophys/BareGroundFluxesMod.F90 b/src/clm5/biogeophys/BareGroundFluxesMod.F90 index 5b914a3a07..5d108a8ccf 100644 --- a/src/clm5/biogeophys/BareGroundFluxesMod.F90 +++ b/src/clm5/biogeophys/BareGroundFluxesMod.F90 @@ -195,7 +195,10 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & t_ref2m => temperature_inst%t_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface air temperature (Kelvin) t_ref2m_r => temperature_inst%t_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m height surface air temperature (Kelvin) t_veg => temperature_inst%t_veg_patch , & ! Output: [real(r8) (:) ] vegetation temperature (Kelvin) - +#ifdef COUP_OAS_ICON + t_sf_patch => temperature_inst%t_sf_patch , & ! Output: [real(r8) (:) ] patch surface temperature (K) +! q_sf_patch => waterstate_inst%q_sf_patch , & ! Output: [real(r8) (:) ] patch surface humidity (kg/kg) +#endif q_ref2m => waterstate_inst%q_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface specific humidity (kg/kg) rh_ref2m_r => waterstate_inst%rh_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m height surface relative humidity (%) rh_ref2m => waterstate_inst%rh_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface relative humidity (%) @@ -374,6 +377,11 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & qflx_ev_soil(p) = -raiw*(forc_q(c) - qg_soil(c)) qflx_ev_h2osfc(p) = -raiw*(forc_q(c) - qg_h2osfc(c)) +#ifdef COUP_OAS_ICON + t_sf_patch(p) = t_grnd(c) +! q_sf_patch(p) = qg(c) +#endif + ! 2 m height air temperature t_ref2m(p) = thm(p) + temp1(p)*dth(p)*(1._r8/temp12m(p) - 1._r8/temp1(p)) diff --git a/src/clm5/biogeophys/CanopyFluxesMod.F90 b/src/clm5/biogeophys/CanopyFluxesMod.F90 index 5890ad9869..d4448529a0 100644 --- a/src/clm5/biogeophys/CanopyFluxesMod.F90 +++ b/src/clm5/biogeophys/CanopyFluxesMod.F90 @@ -453,6 +453,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, t_ref2m => temperature_inst%t_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface air temperature (Kelvin) t_ref2m_r => temperature_inst%t_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m height surface air temperature (Kelvin) t_skin_patch => temperature_inst%t_skin_patch , & ! Output: [real(r8) (:) ] patch skin temperature (K) +#ifdef COUP_OAS_ICON + t_sf_patch => temperature_inst%t_sf_patch , & ! Output: [real(r8) (:) ] patch surface temperature (K) +! q_sf_patch => waterstate_inst%q_sf_patch , & ! Output: [real(r8) (:) ] patch surface humidity (kg/kg) +#endif frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] fraction of surface water fwet => waterstate_inst%fwet_patch , & ! Input: [real(r8) (:) ] fraction of canopy that is wet (0 to 1) @@ -1177,6 +1181,10 @@ subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, delq_h2osfc = wtalq(p)*qg_h2osfc(c)-wtlq0(p)*qsatl(p)-wtaq0(p)*forc_q(c) qflx_ev_h2osfc(p) = forc_rho(c)*wtgq(p)*delq_h2osfc +#ifdef COUP_OAS_ICON + t_sf_patch(p) = taf(p) +! q_sf(p) = qaf(p) +#endif ! 2 m height air temperature t_ref2m(p) = thm(p) + temp1(p)*dth(p)*(1._r8/temp12m(p) - 1._r8/temp1(p)) diff --git a/src/clm5/biogeophys/CanopyTemperatureMod.F90 b/src/clm5/biogeophys/CanopyTemperatureMod.F90 index 6dcec7fd71..7429fa130d 100644 --- a/src/clm5/biogeophys/CanopyTemperatureMod.F90 +++ b/src/clm5/biogeophys/CanopyTemperatureMod.F90 @@ -151,9 +151,10 @@ subroutine CanopyTemperature(bounds, & qg_soil => waterstate_inst%qg_soil_col , & ! Output: [real(r8) (:) ] specific humidity at soil surface [kg/kg] qg => waterstate_inst%qg_col , & ! Output: [real(r8) (:) ] ground specific humidity [kg/kg] qg_h2osfc => waterstate_inst%qg_h2osfc_col , & ! Output: [real(r8) (:) ] specific humidity at h2osfc surface [kg/kg] - dqgdT => waterstate_inst%dqgdT_col , & ! Output: [real(r8) (:) ] d(qg)/dT + dqgdT => waterstate_inst%dqgdT_col , & ! Output: [real(r8) (:) ] d(qg)/dT +#ifdef COUP_OAS_PFL pfl_psi => waterstate_inst%pfl_psi_col , & ! Input: [real(r8) (:,:) ] COUP_OAS_PFL - +#endif qflx_evap_tot => waterflux_inst%qflx_evap_tot_patch , & ! Output: [real(r8) (:) ] qflx_evap_soi + qflx_evap_can + qflx_tran_veg qflx_evap_veg => waterflux_inst%qflx_evap_veg_patch , & ! Output: [real(r8) (:) ] vegetation evaporation (mm H2O/s) (+ = to atm) qflx_tran_veg => waterflux_inst%qflx_tran_veg_patch , & ! Output: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) @@ -257,15 +258,14 @@ subroutine CanopyTemperature(bounds, & wx = (h2osoi_liq(c,1)/denh2o+h2osoi_ice(c,1)/denice)/dz(c,1) fac = min(1._r8, wx/watsat(c,1)) fac = max( fac, 0.01_r8 ) +#ifdef COUP_OAS_PFL ! clm3.5/bld/usr.src/Biogeophysics1Mod.F90 - ! if COUP_OAS_PFL if (pfl_psi(c,1)>= 0.0_r8) psit = 0._r8 if (pfl_psi(c,1) < 0.0_r8) psit = pfl_psi(c,1) - !else - !psit = -sucsat(c,1) * fac ** (-bsw(c,1)) - !psit = max(smpmin(c), psit) - !end if - +#else + psit = -sucsat(c,1) * fac ** (-bsw(c,1)) + psit = max(smpmin(c), psit) +#endif ! modify qred to account for h2osfc hr = exp(psit/roverg/t_soisno(c,1)) qred = (1._r8 - frac_sno(c) - frac_h2osfc(c))*hr & diff --git a/src/clm5/biogeophys/HydrologyDrainageMod.F90 b/src/clm5/biogeophys/HydrologyDrainageMod.F90 index 09e3792077..e332aede58 100644 --- a/src/clm5/biogeophys/HydrologyDrainageMod.F90 +++ b/src/clm5/biogeophys/HydrologyDrainageMod.F90 @@ -52,8 +52,13 @@ subroutine HydrologyDrainage(bounds, & use clm_varctl , only : use_vichydro use clm_varpar , only : nlevgrnd, nlevurb, nlevsoi use clm_time_manager , only : get_step_size, get_nstep +#if defined(COUP_OAS_PFL) use SoilHydrologyMod , only : CLMVICMap, Drainage, PerchedLateralFlow, LateralFlowPowerLaw, ParFlowDrainage use SoilWaterMovementMod , only : use_aquifer_layer, use_parflow_soilwater +#else + use SoilHydrologyMod , only : CLMVICMap, Drainage, PerchedLateralFlow, LateralFlowPowerLaw + use SoilWaterMovementMod , only : use_aquifer_layer +#endif ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds @@ -125,7 +130,7 @@ subroutine HydrologyDrainage(bounds, & call CLMVICMap(bounds, num_hydrologyc, filter_hydrologyc, & soilhydrology_inst, waterstate_inst) endif - +#if defined(COUP_OAS_PFL) if (use_parflow_soilwater()) then ! clm3.5/bld/usr.src/SoilHydrologyMod.F90 ! ignore drainage calculations in eCLM and instead pass these fluxes to ParFlow @@ -148,7 +153,24 @@ subroutine HydrologyDrainage(bounds, & soilhydrology_inst, soilstate_inst, & waterstate_inst, waterflux_inst) - endif + endif +#else + if (use_aquifer_layer()) then + call Drainage(bounds, num_hydrologyc, filter_hydrologyc, & + num_urbanc, filter_urbanc,& + temperature_inst, soilhydrology_inst, soilstate_inst, & + waterstate_inst, waterflux_inst) + else + call PerchedLateralFlow(bounds, num_hydrologyc, filter_hydrologyc, & + num_urbanc, filter_urbanc,& + soilhydrology_inst, soilstate_inst, & + waterstate_inst, waterflux_inst) + + call LateralFlowPowerLaw(bounds, num_hydrologyc, filter_hydrologyc, & + num_urbanc, filter_urbanc,& + soilhydrology_inst, soilstate_inst, & + waterstate_inst, waterflux_inst) +#endif endif do j = 1, nlevgrnd diff --git a/src/clm5/biogeophys/HydrologyNoDrainageMod.F90 b/src/clm5/biogeophys/HydrologyNoDrainageMod.F90 index 78464886aa..6870e851da 100644 --- a/src/clm5/biogeophys/HydrologyNoDrainageMod.F90 +++ b/src/clm5/biogeophys/HydrologyNoDrainageMod.F90 @@ -72,7 +72,11 @@ subroutine HydrologyNoDrainage(bounds, & use SnowHydrologyMod , only : SnowWater, BuildSnowFilter use SoilHydrologyMod , only : CLMVICMap, SurfaceRunoff, Infiltration, WaterTable, PerchedWaterTable use SoilHydrologyMod , only : ThetaBasedWaterTable, RenewCondensation +#ifdef COUP_OAS_PFL use SoilWaterMovementMod , only : SoilWater, use_parflow_soilwater +#else + use SoilWaterMovementMod , only : SoilWater +#endif use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type use SoilWaterMovementMod , only : use_aquifer_layer use SoilWaterPlantSinkMod , only : Compute_EffecRootFrac_And_VertTranSink @@ -155,9 +159,7 @@ subroutine HydrologyNoDrainage(bounds, & h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Output: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] h2osno_top => waterstate_inst%h2osno_top_col , & ! Output: [real(r8) (:) ] mass of snow in top layer (col) [kg] wf => waterstate_inst%wf_col , & ! Output: [real(r8) (:) ] soil water as frac. of whc for top 0.05 m - wf2 => waterstate_inst%wf2_col , & ! Output: [real(r8) (:) ] soil water as frac. of whc for top 0.17 m - pfl_psi => waterstate_inst%pfl_psi_col , & ! Input: [real(r8) (:,:) ] COUP_OAS_PFL - + wf2 => waterstate_inst%wf2_col , & ! Output: [real(r8) (:) ] soil water as frac. of whc for top 0.17 m watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" @@ -476,6 +478,7 @@ subroutine HydrologyNoDrainage(bounds, & ! ZMS: Note, this form, which seems to be the same as used in SoilWater, DOES NOT distinguish between ! ice and water volume, in contrast to the soilpsi calculation above. It won't be used in ch4Mod if ! t_soisno <= tfrz, though. +#ifdef COUP_OAS_PFL if (.not. use_parflow_soilwater()) then do j = 1, nlevgrnd do fc = 1, num_hydrologyc @@ -489,7 +492,19 @@ subroutine HydrologyNoDrainage(bounds, & end do end do endif +#else + do j = 1, nlevgrnd + do fc = 1, num_hydrologyc + c = filter_hydrologyc(fc) + s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) + s_node = min(1.0_r8, s_node) + + smp_l(c,j) = -sucsat(c,j)*s_node**(-bsw(c,j)) + smp_l(c,j) = max(smpmin(c), smp_l(c,j)) + end do + end do +#endif ! if (use_cn) then ! Available soil water up to a depth of 0.05 m. diff --git a/src/clm5/biogeophys/SoilFluxesMod.F90 b/src/clm5/biogeophys/SoilFluxesMod.F90 index 0e848d6193..368d6ff769 100644 --- a/src/clm5/biogeophys/SoilFluxesMod.F90 +++ b/src/clm5/biogeophys/SoilFluxesMod.F90 @@ -331,11 +331,12 @@ subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & ! for evaporation partitioning between liquid evap and ice sublimation, ! use the ratio of liquid to (liquid+ice) in the top layer to determine split if ((h2osoi_liq(c,j)+h2osoi_ice(c,j)) > 0.) then +#ifdef COUP_OAS_PFL ! clm3.5/bld/usr.src/Biogeophysics2Mod.F90 - ! if COUP_OAS_PFL qflx_evap_grnd(p) = qflx_ev_snow(p)*(h2osoi_liq(c,j)/(h2osoi_liq(c,j)+h2osoi_ice(c,j))) - !else - !qflx_evap_grnd(p) = max(qflx_ev_snow(p)*(h2osoi_liq(c,j)/(h2osoi_liq(c,j)+h2osoi_ice(c,j))), 0._r8) +#else + qflx_evap_grnd(p) = max(qflx_ev_snow(p)*(h2osoi_liq(c,j)/(h2osoi_liq(c,j)+h2osoi_ice(c,j))), 0._r8) +#endif else qflx_evap_grnd(p) = 0. end if diff --git a/src/clm5/biogeophys/SoilHydrologyMod.F90 b/src/clm5/biogeophys/SoilHydrologyMod.F90 index 6fd5b06ec4..059f630823 100644 --- a/src/clm5/biogeophys/SoilHydrologyMod.F90 +++ b/src/clm5/biogeophys/SoilHydrologyMod.F90 @@ -257,18 +257,19 @@ subroutine SurfaceRunoff (bounds, num_hydrologyc, filter_hydrologyc, & do fc = 1, num_hydrologyc c = filter_hydrologyc(fc) + +#ifdef COUP_OAS_PFL ! clm3.5/bld/usr.src/SoilHydrologyMod.F90 - ! if COUP_OAS_PFL qflx_surf(c) = 0._r8 - - !else +#else ! assume qinmax large relative to qflx_top_soil in control - !if (origflag == 1) then - ! qflx_surf(c) = fcov(c) * qflx_top_soil(c) - !else - ! ! only send fast runoff directly to streams - ! qflx_surf(c) = fsat(c) * qflx_top_soil(c) - !endif + if (origflag == 1) then + qflx_surf(c) = fcov(c) * qflx_top_soil(c) + else + ! only send fast runoff directly to streams + qflx_surf(c) = fsat(c) * qflx_top_soil(c) + endif +#endif end do ! Determine water in excess of ponding limit for urban roof and impervious road. @@ -2339,6 +2340,7 @@ subroutine RenewCondensation(bounds, num_hydrologyc, filter_hydrologyc, & end subroutine RenewCondensation !#8 +#ifdef COUP_OAS_PFL !----------------------------------------------------------------------- subroutine ParFlowDrainage(bounds, num_hydrologyc, filter_hydrologyc, & num_urbanc, filter_urbanc, waterflux_inst) @@ -2407,5 +2409,6 @@ subroutine ParFlowDrainage(bounds, num_hydrologyc, filter_hydrologyc, & end do end associate end subroutine ParFlowDrainage +#endif !#0 end module SoilHydrologyMod diff --git a/src/clm5/biogeophys/SoilMoistStressMod.F90 b/src/clm5/biogeophys/SoilMoistStressMod.F90 index a549a9afb9..49b2fba502 100644 --- a/src/clm5/biogeophys/SoilMoistStressMod.F90 +++ b/src/clm5/biogeophys/SoilMoistStressMod.F90 @@ -376,10 +376,11 @@ subroutine calc_root_moist_stress_clm45default(bounds, & rresis => energyflux_inst%rresis_patch , & ! Output: [real(r8) (:,:) ] root soil water stress (resistance) by layer (0-1) (nlevgrnd) h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - h2osoi_liqvol => waterstate_inst%h2osoi_liqvol_col , & ! Output: [real(r8) (:,:) ] liquid volumetric moisture, will be used for BeTR - pfl_psi => waterstate_inst%pfl_psi_col & ! Input: [real(r8) (:,:) ] COUP_OAS_PFL - ) - +#ifdef COUP_OAS_PFL + pfl_psi => waterstate_inst%pfl_psi_col , & ! Input: [real(r8) (:,:) ] COUP_OAS_PFL +#endif + h2osoi_liqvol => waterstate_inst%h2osoi_liqvol_col & ! Output: [real(r8) (:,:) ] liquid volumetric moisture, will be used for BeTR + ) do j = 1,nlevgrnd do f = 1, fn p = filterp(f) @@ -392,19 +393,14 @@ subroutine calc_root_moist_stress_clm45default(bounds, & rootr(p,j) = 0._r8 else s_node = max(h2osoi_liqvol(c,j)/eff_porosity(c,j),0.01_r8) - - !smp_node = max(smpsc(patch%itype(p)), -sucsat(c,j)*s_node**(-bsw(c,j))) -! call soil_water_retention_curve%soil_suction(sucsat(c,j), s_node, bsw(c,j), smp_node) -!scs - -!scs + +#ifdef COUP_OAS_PFL ! clm3.5/bld/usr.src/CanopyFluxesMod.F90 - ! if COUP_OAS_PFL smp_node = max(smpsc(patch%itype(p)), pfl_psi(c,j)) - ! else - ! call soil_water_retention_curve%soil_suction(c, j, s_node, soilstate_inst, smp_node) - ! smp_node = max(smpsc(patch%itype(p)), smp_node) - ! end if +#else + call soil_water_retention_curve%soil_suction(c, j, s_node, soilstate_inst, smp_node) + smp_node = max(smpsc(patch%itype(p)), smp_node) +#endif rresis(p,j) = min( (eff_porosity(c,j)/watsat(c,j))* & (smp_node - smpsc(patch%itype(p))) / (smpso(patch%itype(p)) - smpsc(patch%itype(p))), 1._r8) diff --git a/src/clm5/biogeophys/SoilWaterMovementMod.F90 b/src/clm5/biogeophys/SoilWaterMovementMod.F90 index 669161e60d..bc6c5c5ac8 100644 --- a/src/clm5/biogeophys/SoilWaterMovementMod.F90 +++ b/src/clm5/biogeophys/SoilWaterMovementMod.F90 @@ -19,8 +19,9 @@ module SoilWaterMovementMod ! !PUBLIC MEMBER FUNCTIONS: public :: SoilWater ! Calculate soil hydrology public :: init_soilwater_movement +#ifdef COUP_OAS_PFL public :: use_parflow_soilwater - +#endif private :: soilwater_zengdecker2009 private :: soilwater_moisture_form ! private :: soilwater_mixed_form @@ -213,14 +214,15 @@ function use_aquifer_layer() result(lres) end function use_aquifer_layer - !------------------------------------------------------------------------------ + !------------------------------------------------------------------------------ +#ifdef COUP_OAS_PFL logical function use_parflow_soilwater() implicit none use_parflow_soilwater = (soilwater_movement_method == coupled_parflow) end function use_parflow_soilwater - +#endif !#3 !----------------------------------------------------------------------- subroutine SoilWater(bounds, num_hydrologyc, filter_hydrologyc, & @@ -307,14 +309,14 @@ subroutine SoilWater(bounds, num_hydrologyc, filter_hydrologyc, & !!$ call soilwater_head_form(bounds, num_hydrologyc, filter_hydrologyc, & !!$ num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & !!$ waterflux_inst, waterstate_inst, temperature_inst) - +#ifdef COUP_OAS_PFL case (coupled_parflow) call soilwater_parflow(bounds, num_hydrologyc, filter_hydrologyc, & num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & waterflux_inst, waterstate_inst, temperature_inst, & canopystate_inst, energyflux_inst, soil_water_retention_curve) - +#endif case default call endrun(subname // ':: a SoilWater implementation must be specified!') @@ -1441,6 +1443,7 @@ end subroutine soilwater_moisture_form !#8 !----------------------------------------------------------------------- +#ifdef COUP_OAS_PFL subroutine soilwater_parflow(bounds, num_hydrologyc, & filter_hydrologyc, num_urbanc, filter_urbanc, soilhydrology_inst, & soilstate_inst, waterflux_inst, waterstate_inst, temperature_inst, & @@ -1506,7 +1509,7 @@ subroutine soilwater_parflow(bounds, num_hydrologyc, & end associate end subroutine soilwater_parflow - +#endif subroutine compute_hydraulic_properties(c, nlayers, & soilhydrology_inst, soilstate_inst, & soil_water_retention_curve, vwc_liq, hk ,smp, & diff --git a/src/clm5/biogeophys/TemperatureType.F90 b/src/clm5/biogeophys/TemperatureType.F90 index 5dfc3bc704..7dfbb5d95f 100644 --- a/src/clm5/biogeophys/TemperatureType.F90 +++ b/src/clm5/biogeophys/TemperatureType.F90 @@ -24,6 +24,9 @@ module TemperatureType ! Temperatures real(r8), pointer :: t_veg_patch (:) ! patch vegetation temperature (Kelvin) real(r8), pointer :: t_skin_patch (:) ! patch skin temperature (Kelvin) +#ifdef COUP_OAS_ICON + real(r8), pointer :: t_sf_patch (:) ! patch surface temperature (Kelvin) +#endif real(r8), pointer :: t_veg_day_patch (:) ! patch daytime accumulative vegetation temperature (Kelvinx*nsteps), LUNA specific, from midnight to current step real(r8), pointer :: t_veg_night_patch (:) ! patch night-time accumulative vegetation temperature (Kelvin*nsteps), LUNA specific, from midnight to current step real(r8), pointer :: t_veg10_day_patch (:) ! 10 day running mean of patch daytime time vegetation temperature (Kelvin), LUNA specific, but can be reused @@ -190,6 +193,9 @@ subroutine InitAllocate(this, bounds) ! Temperatures allocate(this%t_veg_patch (begp:endp)) ; this%t_veg_patch (:) = nan allocate(this%t_skin_patch (begp:endp)) ; this%t_skin_patch (:) = nan +#ifdef COUP_OAS_ICON + allocate(this%t_sf_patch (begp:endp)) ; this%t_sf_patch (:) = nan +#endif if(use_luna) then allocate(this%t_veg_day_patch (begp:endp)) ; this%t_veg_day_patch (:) = spval allocate(this%t_veg_night_patch (begp:endp)) ; this%t_veg_night_patch (:) = spval @@ -393,6 +399,13 @@ subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp ) avgflag='A', long_name='skin temperature', & ptr_patch=this%t_skin_patch, c2l_scale_type='urbans') +#ifdef COUP_OAS_ICON + this%t_sf_patch(begp:endp) = spval + call hist_addfld1d (fname='TSF', units='K', & + avgflag='A', long_name='surface temperature -- coupled', & + ptr_patch=this%t_sf_patch) +#endif + this%t_grnd_col(begc:endc) = spval call hist_addfld1d (fname='TG', units='K', & avgflag='A', long_name='ground temperature', & diff --git a/src/clm5/biogeophys/TotalWaterAndHeatMod.F90 b/src/clm5/biogeophys/TotalWaterAndHeatMod.F90 index 82fc1d27df..15c8373362 100644 --- a/src/clm5/biogeophys/TotalWaterAndHeatMod.F90 +++ b/src/clm5/biogeophys/TotalWaterAndHeatMod.F90 @@ -173,7 +173,6 @@ subroutine ComputeLiqIceMassNonLake(bounds, num_nolakec, filter_nolakec, & ! to ComputeHeatNonLake ! ! !USES: - use SoilWaterMovementMod , only : use_parflow_soilwater ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter @@ -252,10 +251,10 @@ subroutine ComputeLiqIceMassNonLake(bounds, num_nolakec, filter_nolakec, & ! no liquid water in this case) ice_mass(c) = ice_mass(c) + h2osno(c) end if - - ! -- clm3.5/bld/usr.src/BalanceCheckMod.F90 - ! -- clm3.5/bld/usr.src/Hydrology2Mod.F90 - ! COUP_OAS_PFL +#ifndef COUP_OAS_PFL + ! When coupled with ParFlow, ignore water aquifer. + ! -- clm3.5/bld/usr.src/BalanceCheckMod.F90 + ! -- clm3.5/bld/usr.src/Hydrology2Mod.F90 if (col%hydrologically_active(c)) then ! It's important to exclude non-hydrologically-active points, because some of ! them have wa set, but seemingly incorrectly (set to 4000). @@ -268,11 +267,9 @@ subroutine ComputeLiqIceMassNonLake(bounds, num_nolakec, filter_nolakec, & ! hydrologically-active columns, yet this apparently doesn't interact with the ! system, so we don't want to count that water mass in the total column water. - ! When coupled with ParFlow, ignore water aquifer. - if (.not. use_parflow_soilwater()) then - liquid_mass(c) = liquid_mass(c) + (wa(c) - aquifer_water_baseline) - end if + liquid_mass(c) = liquid_mass(c) + (wa(c) - aquifer_water_baseline) end if +#endif if (col%itype(c) == icol_roof .or. col%itype(c) == icol_sunwall & .or. col%itype(c) == icol_shadewall .or. col%itype(c) == icol_road_imperv) then diff --git a/src/clm5/biogeophys/UrbanFluxesMod.F90 b/src/clm5/biogeophys/UrbanFluxesMod.F90 index 29f6b71aba..e8738028cf 100644 --- a/src/clm5/biogeophys/UrbanFluxesMod.F90 +++ b/src/clm5/biogeophys/UrbanFluxesMod.F90 @@ -219,7 +219,9 @@ subroutine UrbanFluxes (bounds, num_nourbanl, filter_nourbanl, t_ref2m_u => temperature_inst%t_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m height surface air temperature (K) t_veg => temperature_inst%t_veg_patch , & ! Output: [real(r8) (:) ] vegetation temperature (K) taf => temperature_inst%taf_lun , & ! Output: [real(r8) (:) ] urban canopy air temperature (K) - +#ifdef COUP_OAS_ICON + t_sf_patch => temperature_inst%t_sf_patch , & ! Output: [real(r8) (:) ] patch surface temperature (K) +#endif tc_ref2m => humanindex_inst%tc_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface air temperature (C) vap_ref2m => humanindex_inst%vap_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height vapor pressure (Pa) @@ -765,6 +767,9 @@ subroutine UrbanFluxes (bounds, num_nourbanl, filter_nourbanl, eflx_sh_grnd_scale(p) = -forc_rho(g)*cpair*wtus(c)*dth(l) qflx_evap_soi_scale(p) = -forc_rho(g)*wtuq(c)*dqh(l) +#ifdef COUP_OAS_ICON + t_sf_patch(p) = taf(l) +#endif end do ! Check to see that total sensible and latent heat equal the sum of diff --git a/src/clm5/biogeophys/WaterStateType.F90 b/src/clm5/biogeophys/WaterStateType.F90 index cc6268946c..65944de240 100644 --- a/src/clm5/biogeophys/WaterStateType.F90 +++ b/src/clm5/biogeophys/WaterStateType.F90 @@ -54,8 +54,10 @@ module WaterstateType real(r8), pointer :: ice1_grc (:) ! grc initial gridcell total h2o ice content real(r8), pointer :: ice2_grc (:) ! grc post land cover change total ice content real(r8), pointer :: tws_grc (:) ! grc total water storage (mm H2O) +#ifdef COUP_OAS_PFL real(r8), pointer :: pfl_psi_col (:,:) ! ParFlow pressure head COUP_OAS_PFL real(r8), pointer :: pfl_h2osoi_liq_col (:,:) ! ParFlow soil liquid COUP_OAS_PFL +#endif real(r8), pointer :: total_plant_stored_h2o_col(:)! col water that is bound in plants, including roots, sapwood, leaves, etc ! in most cases, the vegetation scheme does not have a dynamic ! water storage in plants, and thus 0.0 is a suitable for the trivial case. @@ -191,8 +193,10 @@ subroutine InitAllocate(this, bounds) allocate(this%h2osoi_liqvol_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%h2osoi_liqvol_col (:,:) = nan allocate(this%h2osoi_ice_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%h2osoi_ice_col (:,:) = nan allocate(this%h2osoi_liq_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%h2osoi_liq_col (:,:) = nan +#ifdef COUP_OAS_PFL allocate(this%pfl_psi_col (begc:endc,1:nlevgrnd)) ; this%pfl_psi_col (:,:) = nan allocate(this%pfl_h2osoi_liq_col (begc:endc,1:nlevgrnd)) ; this%pfl_h2osoi_liq_col (:,:) = nan +#endif allocate(this%h2osoi_ice_tot_col (begc:endc)) ; this%h2osoi_ice_tot_col (:) = nan allocate(this%h2osoi_liq_tot_col (begc:endc)) ; this%h2osoi_liq_tot_col (:) = nan allocate(this%h2ocan_patch (begp:endp)) ; this%h2ocan_patch (:) = nan @@ -291,7 +295,7 @@ subroutine InitHistory(this, bounds) call hist_addfld2d (fname='H2OSOI', units='mm3/mm3', type2d='levsoi', & avgflag='A', long_name='volumetric soil water (vegetated landunits only)', & ptr_col=this%h2osoi_vol_col, l2g_scale_type='veg') - +#ifdef COUP_OAS_PFL data2dptr => this%pfl_psi_col(begc:endc,1:nlevgrnd) call hist_addfld2d (fname='PFL_PSI', units='mm', type2d='levgrnd', & avgflag='A', long_name='ParFlow pressure head', & @@ -301,7 +305,7 @@ subroutine InitHistory(this, bounds) call hist_addfld2d (fname='PFL_SOILLIQ', units='mm', type2d='levgrnd', & avgflag='A', long_name='Parflow H2O soil liquid', & ptr_col=this%pfl_h2osoi_liq_col, l2g_scale_type='veg') - +#endif if ( use_soil_moisture_streams )then data2dptr => this%h2osoi_vol_prs_grc(begg:endg,1:nlevsoi) call hist_addfld2d (fname='H2OSOI_PRESCRIBED_GRC', units='mm3/mm3', type2d='levsoi', & @@ -760,8 +764,10 @@ subroutine InitCold(this, bounds, & ! and urban pervious road (other urban columns have zero soil water) this%h2osoi_vol_col(bounds%begc:bounds%endc, 1:) = spval +#ifdef COUP_OAS_PFL this%pfl_psi_col(bounds%begc:bounds%endc, 1:) = -1000._r8 this%pfl_h2osoi_liq_col(bounds%begc:bounds%endc, 1:) = spval +#endif this%h2osoi_vol_prs_grc(bounds%begg:bounds%endg, 1:) = spval this%h2osoi_liq_col(bounds%begc:bounds%endc,-nlevsno+1:) = spval this%h2osoi_ice_col(bounds%begc:bounds%endc,-nlevsno+1:) = spval diff --git a/src/clm5/biogeophys/WaterfluxType.F90 b/src/clm5/biogeophys/WaterfluxType.F90 index 1f7806385a..ea1add1359 100644 --- a/src/clm5/biogeophys/WaterfluxType.F90 +++ b/src/clm5/biogeophys/WaterfluxType.F90 @@ -72,7 +72,9 @@ module WaterfluxType real(r8), pointer :: qflx_adv_col (:,:) ! col advective flux across different soil layer interfaces [mm H2O/s] [+ downward] real(r8), pointer :: qflx_rootsoi_col (:,:) ! col root and soil water exchange [mm H2O/s] [+ into root] +#ifdef COUP_OAS_PFL real(r8), pointer :: qflx_parflow_col (:,:) ! col source/sink flux per soil layer sent to ParFlow [mm H2O/s] [- out from root] +#endif real(r8), pointer :: qflx_infl_col (:) ! col infiltration (mm H2O /s) real(r8), pointer :: qflx_surf_col (:) ! col surface runoff (mm H2O /s) real(r8), pointer :: qflx_drain_col (:) ! col sub-surface runoff (mm H2O /s) @@ -215,7 +217,9 @@ subroutine InitAllocate(this, bounds) allocate(this%qflx_drain_vr_col (begc:endc,1:nlevsoi)) ; this%qflx_drain_vr_col (:,:) = nan allocate(this%qflx_adv_col (begc:endc,0:nlevsoi)) ; this%qflx_adv_col (:,:) = nan allocate(this%qflx_rootsoi_col (begc:endc,1:nlevsoi)) ; this%qflx_rootsoi_col (:,:) = nan +#ifdef COUP_OAS_PFL allocate(this%qflx_parflow_col (begc:endc,1:nlevsoi)) ; this%qflx_parflow_col (:,:) = nan +#endif allocate(this%qflx_infl_col (begc:endc)) ; this%qflx_infl_col (:) = nan allocate(this%qflx_surf_col (begc:endc)) ; this%qflx_surf_col (:) = nan allocate(this%qflx_drain_col (begc:endc)) ; this%qflx_drain_col (:) = nan @@ -420,12 +424,12 @@ subroutine InitHistory(this, bounds) call hist_addfld2d (fname='QROOTSINK', units='mm/s', type2d='levsoi', & avgflag='A', long_name='water flux from soil to root in each soil-layer', & ptr_col=this%qflx_rootsoi_col, set_spec=spval, l2g_scale_type='veg', default='inactive') - - this%qflx_parflow_col(begc:endc,:) = spval +#ifdef COUP_OAS_PFL + this%qflx_parflow_col(begc:endc,:) = spval call hist_addfld2d (fname='QPARFLOW', units='mm/s', type2d='levsoi', & avgflag='A', long_name='Water fluxes per soil layer sent to Parflow', & ptr_col=this%qflx_parflow_col, set_spec=spval, l2g_scale_type='veg', default='inactive') - +#endif this%qflx_evap_can_patch(begp:endp) = spval call hist_addfld1d (fname='QVEGE', units='mm/s', & avgflag='A', long_name='canopy evaporation', & diff --git a/src/clm5/cpl/lnd_comp_mct.F90 b/src/clm5/cpl/lnd_comp_mct.F90 index 9c2cbdc308..a402546177 100644 --- a/src/clm5/cpl/lnd_comp_mct.F90 +++ b/src/clm5/cpl/lnd_comp_mct.F90 @@ -14,7 +14,12 @@ module lnd_comp_mct use lnd_import_export, only : lnd_import, lnd_export #if defined(USE_OASIS) use oas_defineMod , only : oas_definitions_init - use oas_sendReceiveMod, only : oas_receive, oas_send +#ifdef COUP_OAS_ICON + use oas_sendReceiveMod, only : oas_receive_icon, oas_send_icon +#endif +#ifdef COUP_OAS_PFL + use oas_sendReceiveMod, only : oas_receive, oas_send +#endif #endif ! ! !public member functions: @@ -415,6 +420,7 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) call t_stopf ('lc_lnd_import') ! Use infodata to set orbital values if updated mid-run + call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & orb_lambm0=lambm0, orb_obliqr=obliqr ) @@ -453,7 +459,11 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) nlend = .false. if (nlend_sync .and. dosend) nlend = .true. -#if defined(USE_OASIS) +#ifdef COUP_OAS_ICON + call oas_receive_icon(bounds, time_elapsed, atm2lnd_inst) +#endif + +#ifdef COUP_OAS_PFL call oas_receive(bounds, time_elapsed, atm2lnd_inst) #endif ! Run clm @@ -467,7 +477,12 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) call clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic) call t_stopf ('clm_run') -#if defined(USE_OASIS) + +#if defined(COUP_OAS_ICON) + call oas_send_icon(bounds, time_elapsed, lnd2atm_inst) +#endif + +#if defined(COUP_OAS_PFL) call oas_send(bounds, time_elapsed, lnd2atm_inst) #endif ! Create l2x_l export state - add river runoff input to l2x_l if appropriate diff --git a/src/clm5/main/atm2lndType.F90 b/src/clm5/main/atm2lndType.F90 index f1f0738a67..524908fe3c 100644 --- a/src/clm5/main/atm2lndType.F90 +++ b/src/clm5/main/atm2lndType.F90 @@ -116,11 +116,11 @@ module atm2lndType real(r8), pointer :: forc_flood_grc (:) => null() ! rof flood (mm/s) real(r8), pointer :: volr_grc (:) => null() ! rof volr total volume (m3) real(r8), pointer :: volrmch_grc (:) => null() ! rof volr main channel (m3) - +#ifdef COUP_OAS_PFL ! parflow->lnd real(r8), pointer :: pfl_psi_grc (:,:) => null() ! Parflow soil matrix potential [mm] COUP_OAS_PFL real(r8), pointer :: pfl_h2osoi_liq_grc (:,:) => null() ! Parflow H2O soil liquid [mm] COUP_OAS_PFL - +#endif ! anomaly forcing real(r8), pointer :: af_precip_grc (:) => null() ! anomaly forcing real(r8), pointer :: af_uwind_grc (:) => null() ! anomaly forcing @@ -547,11 +547,11 @@ subroutine InitAllocate(this, bounds) allocate(this%forc_flood_grc (begg:endg)) ; this%forc_flood_grc (:) = ival allocate(this%volr_grc (begg:endg)) ; this%volr_grc (:) = ival allocate(this%volrmch_grc (begg:endg)) ; this%volrmch_grc (:) = ival - +#ifdef COUP_OAS_PFL ! parflow->lnd allocate(this%pfl_psi_grc (begg:endg,1:nlevgrnd)); this%pfl_psi_grc (:,:) = ival allocate(this%pfl_h2osoi_liq_grc (begg:endg,1:nlevgrnd)); this%pfl_h2osoi_liq_grc (:,:) = ival - +#endif ! anomaly forcing allocate(this%bc_precip_grc (begg:endg)) ; this%bc_precip_grc (:) = ival allocate(this%af_precip_grc (begg:endg)) ; this%af_precip_grc (:) = ival @@ -615,7 +615,7 @@ subroutine InitHistory(this, bounds) call hist_addfld1d (fname='VOLRMCH', units='m3', & avgflag='A', long_name='river channel main channel water storage', & ptr_lnd=this%volrmch_grc) - +#ifdef COUP_OAS_PFL this%pfl_psi_grc(begg:endg, :) = 0._r8 call hist_addfld2d (fname='PFL_PSI_GRC', units='mm', type2d='levgrnd', & avgflag='A', long_name='Parflow pressure head (gridcell)', & @@ -625,7 +625,7 @@ subroutine InitHistory(this, bounds) call hist_addfld2d (fname='PFL_SOILLIQ_GRC', units='mm', type2d='levgrnd', & avgflag='A', long_name='Parflow H2O soil liquid (gridcell)', & ptr_lnd=this%pfl_h2osoi_liq_grc, default='inactive') - +#endif this%forc_wind_grc(begg:endg) = spval call hist_addfld1d (fname='WIND', units='m/s', & avgflag='A', long_name='atmospheric wind velocity magnitude', & diff --git a/src/clm5/main/clm_driver.F90 b/src/clm5/main/clm_driver.F90 index 96325b1ddb..7fef829b08 100644 --- a/src/clm5/main/clm_driver.F90 +++ b/src/clm5/main/clm_driver.F90 @@ -1251,8 +1251,10 @@ subroutine clm_drv_init(bounds, & h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) h2osno_old => waterstate_inst%h2osno_old_col , & ! Output: [real(r8) (:) ] snow water (mm H2O) at previous time step frac_iceold => waterstate_inst%frac_iceold_col , & ! Output: [real(r8) (:,:) ] fraction of ice relative to the tot water +#ifdef COUP_OAS_PFL pfl_psi => waterstate_inst%pfl_psi_col , & ! Input: [real(r8) (:,:) ] COUP_OAS_PFL pfl_h2osoi_liq => waterstate_inst%pfl_h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] COUP_OAS_PFL +#endif elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index with burying by snow frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Output: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] @@ -1300,6 +1302,7 @@ subroutine clm_drv_init(bounds, & end do end do +#ifdef COUP_OAS_PFL ! TSMP/bldsva/intf_oas3/clm3_5/mct/receive_fld_2pfl.F90 ! COUP_OAS_PFL do f = 1, num_soilc @@ -1308,7 +1311,7 @@ subroutine clm_drv_init(bounds, & pfl_psi(c,:) = atm2lnd_inst%pfl_psi_grc(g,:) pfl_h2osoi_liq(c,:) = atm2lnd_inst%pfl_h2osoi_liq_grc(g,:) end do - +#endif end associate end subroutine clm_drv_init diff --git a/src/clm5/main/lnd2atmMod.F90 b/src/clm5/main/lnd2atmMod.F90 index 5899c705f5..61e44b3f9b 100644 --- a/src/clm5/main/lnd2atmMod.F90 +++ b/src/clm5/main/lnd2atmMod.F90 @@ -316,6 +316,25 @@ subroutine lnd2atm(bounds, & c2l_scale_type= 'unity', l2g_scale_type='unity' ) end if +#ifdef COUP_OAS_ICON + + call p2g(bounds, & + temperature_inst%t_sf_patch (bounds%begp:bounds%endp), & + lnd2atm_inst%t_sf_grc (bounds%begg:bounds%endg), & + p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') + +! call p2g(bounds, & +! waterstate_inst%q_sf_patch (bounds%begp:bounds%endp), & +! lnd2atm_inst%q_sf_grc (bounds%begg:bounds%endg), & +! p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') + +! call p2g(bounds, & +! frictionvel_inst%rah1_patch (bounds%begp:bounds%endp), & +! lnd2atm_inst%rah1_grc (bounds%begg:bounds%endg), & +! p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') + +#endif + !---------------------------------------------------- ! lnd -> rof !---------------------------------------------------- @@ -407,7 +426,7 @@ subroutine lnd2atm(bounds, & do g = bounds%begg, bounds%endg waterstate_inst%tws_grc(g) = waterstate_inst%tws_grc(g) + atm2lnd_inst%volr_grc(g) / grc%area(g) * 1.e-3_r8 enddo - +#ifdef COUP_OAS_PFL ! Calculate Parflow water fluxes call c2g( bounds, nlevsoi, & waterflux_inst%qflx_parflow_col (bounds%begc:bounds%endc, :), & @@ -425,7 +444,8 @@ subroutine lnd2atm(bounds, & enddo end if end if - end do + end do +#endif end subroutine lnd2atm diff --git a/src/clm5/main/lnd2atmType.F90 b/src/clm5/main/lnd2atmType.F90 index f9e4220755..11e93930a1 100644 --- a/src/clm5/main/lnd2atmType.F90 +++ b/src/clm5/main/lnd2atmType.F90 @@ -61,6 +61,11 @@ module lnd2atmType real(r8), pointer :: fireflx_grc (:,:) => null() ! Wild Fire Emissions real(r8), pointer :: fireztop_grc (:) => null() ! Wild Fire Emissions vertical distribution top real(r8), pointer :: flux_ch4_grc (:) => null() ! net CH4 flux (kg C/m**2/s) [+ to atm] +#ifdef COUP_OAS_ICON + real(r8), pointer :: t_sf_grc (:) => null() ! surface temperature (Kelvin) +! real(r8), pointer :: q_sf_grc (:) => null() ! surface humidity (kg/kg) +! real(r8), pointer :: rah1_grc (:) => null() ! aerodynamical resistance for heat (s/m) +#endif ! lnd->rof real(r8), pointer :: qflx_rofliq_grc (:) => null() ! rof liq forcing real(r8), pointer :: qflx_rofliq_qsur_grc (:) => null() ! rof liq -- surface runoff component @@ -70,7 +75,9 @@ module lnd2atmType real(r8), pointer :: qflx_rofliq_drain_perched_grc (:) => null() ! rof liq -- perched water table runoff component real(r8), pointer :: qflx_rofice_grc (:) => null() ! rof ice forcing real(r8), pointer :: qflx_liq_from_ice_col (:) => null() ! liquid runoff from converted ice runoff +#ifdef COUP_OAS_PFL real(r8), pointer :: qflx_parflow_grc (:,:) => null() ! source/sink flux per soil layer sent to ParFlow [1/hr] [- out from root] +#endif real(r8), pointer :: qirrig_grc (:) => null() ! irrigation flux contains @@ -169,6 +176,11 @@ subroutine InitAllocate(this, bounds) allocate(this%fv_grc (begg:endg)) ; this%fv_grc (:) =ival allocate(this%flxdst_grc (begg:endg,1:ndst)) ; this%flxdst_grc (:,:) =ival allocate(this%flux_ch4_grc (begg:endg)) ; this%flux_ch4_grc (:) =ival +#ifdef COUP_OAS_ICON + allocate(this%t_sf_grc (begg:endg)) ; this%t_sf_grc (:) =ival +! allocate(this%q_sf_grc (begg:endg)) ; this%q_sf_grc (:) =ival +! allocate(this%rah1_grc (begg:endg)) ; this%rah1_grc (:) =ival +#endif allocate(this%qflx_rofliq_grc (begg:endg)) ; this%qflx_rofliq_grc (:) =ival allocate(this%qflx_rofliq_qsur_grc (begg:endg)) ; this%qflx_rofliq_qsur_grc (:) =ival allocate(this%qflx_rofliq_qsub_grc (begg:endg)) ; this%qflx_rofliq_qsub_grc (:) =ival @@ -177,7 +189,9 @@ subroutine InitAllocate(this, bounds) allocate(this%qflx_rofliq_drain_perched_grc (begg:endg)) ; this%qflx_rofliq_drain_perched_grc (:) =ival allocate(this%qflx_rofice_grc (begg:endg)) ; this%qflx_rofice_grc (:) =ival allocate(this%qflx_liq_from_ice_col(begc:endc)) ; this%qflx_liq_from_ice_col(:) =ival +#ifdef COUP_OAS_PFL allocate(this%qflx_parflow_grc (begg:endg,1:nlevsoi)); this%qflx_parflow_grc (:,:) =ival +#endif allocate(this%qirrig_grc (begg:endg)) ; this%qirrig_grc (:) =ival if (shr_megan_mechcomps_n>0) then @@ -325,12 +339,12 @@ subroutine InitHistory(this, bounds) avgflag='A', long_name='Gridcell net adjustment to net carbon exchange passed to atm. for methane production', & ptr_lnd=this%nem_grc) end if - +#ifdef COUP_OAS_PFL this%qflx_parflow_grc(begg:endg, :) = 0._r8 call hist_addfld2d (fname='QPARFLOW_TO_OASIS', units='1/hr', type2d='levsoi', & avgflag='A', long_name='source/sink flux per soil layer sent to ParFlow', & ptr_lnd=this%qflx_parflow_grc, default='inactive') - +#endif end subroutine InitHistory end module lnd2atmType diff --git a/src/clm5/oasis3/oas_defineMod.F90 b/src/clm5/oasis3/oas_defineMod.F90 index 59239d18ff..07605e61f4 100644 --- a/src/clm5/oasis3/oas_defineMod.F90 +++ b/src/clm5/oasis3/oas_defineMod.F90 @@ -22,14 +22,19 @@ subroutine oas_definitions_init(bounds) integer :: gcell_previous ! gridcell index from previous loop iteration integer :: k, g ! array/loop indices integer :: grid_id ! id returned after call to oasis_def_partition +#ifdef COUP_OAS_ICON + integer :: jg ! loop counter +#endif ! oasis_def_var integer :: var_nodims(2) ! var dimension parameters + if (masterproc) then call define_grid() end if + ! ----------------------------------------------------------------- ! ... Define partition ! ----------------------------------------------------------------- @@ -70,6 +75,8 @@ subroutine oas_definitions_init(bounds) ! ----------------------------------------------------------------- ! ... Define coupling fields ! ----------------------------------------------------------------- + +#ifdef COUP_OAS_PFL var_nodims(1) = 1 ! unused var_nodims(2) = nlevsoi ! number of fields in a bundle @@ -78,6 +85,56 @@ subroutine oas_definitions_init(bounds) var_nodims(2) = nlevgrnd ! number of fields in a bundle call oasis_def_var(oas_sat_id, "ECLM_SOILLIQ", grid_id, var_nodims, OASIS_In, OASIS_Real, ierror) call oasis_def_var(oas_psi_id, "ECLM_PSI", grid_id, var_nodims, OASIS_In, OASIS_Real, ierror) +#endif + +#ifdef COUP_OAS_ICON + + var_nodims(1) = 1 ! unused + var_nodims(2) = 1 ! number of fields in a bundle + + ! send to ICON + CALL oasis_def_var(oas_id_t, "CLMTEMPE", grid_id, var_nodims, OASIS_In, OASIS_Real, ierror) ! 1 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMTEMPE.') + CALL oasis_def_var(oas_id_u, "CLMUWIND", grid_id, var_nodims, OASIS_In, OASIS_Real, ierror) ! 2 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMUWIND.') + CALL oasis_def_var(oas_id_v, "CLMVWIND", grid_id, var_nodims, OASIS_In, OASIS_Real, ierror) ! 3 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMVWIND.') + CALL oasis_def_var(oas_id_qv, "CLMSPWAT", grid_id, var_nodims, OASIS_In, OASIS_Real, ierror) ! 4 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMSPWAT.') + CALL oasis_def_var(oas_id_ht, "CLMTHICK", grid_id, var_nodims, OASIS_In, OASIS_Real, ierror) ! 5 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMTHICK.') + CALL oasis_def_var(oas_id_pr, "CLMPRESS", grid_id, var_nodims, OASIS_In, OASIS_Real, ierror) ! 6 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMPRESS.') + CALL oasis_def_var(oas_id_rs, "CLMDIRSW", grid_id, var_nodims, OASIS_In, OASIS_Real, ierror) ! 7 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMDIRSW.') + CALL oasis_def_var(oas_id_fs, "CLMDIFSW", grid_id, var_nodims, OASIS_In, OASIS_Real, ierror) ! 8 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMDIFSW.') + CALL oasis_def_var(oas_id_lw, "CLMLONGW", grid_id, var_nodims, OASIS_In, OASIS_Real, ierror) ! 9 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMLONGW.') + CALL oasis_def_var(oas_id_cr, "CLMCVPRE", grid_id, var_nodims, OASIS_In, OASIS_Real, ierror) !10 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMCVPRE.') + CALL oasis_def_var(oas_id_gr, "CLMGSPRE", grid_id, var_nodims, OASIS_In, OASIS_Real, ierror) !11 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMGSPRE.') + + ! receive from ICON + CALL oasis_def_var(oas_id_it, "CLMINFRA", grid_id, var_nodims, OASIS_Out, OASIS_Real, ierror) !12 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMINFRA.') + CALL oasis_def_var(oas_id_ad, "CLMALBED", grid_id, var_nodims, OASIS_Out, OASIS_Real, ierror) !13 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMALBED.') + CALL oasis_def_var(oas_id_ai, "CLMALBEI", grid_id, var_nodims, OASIS_Out, OASIS_Real, ierror) !14 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMALBEI.') + CALL oasis_def_var(oas_id_tx, "CLMTAUX" , grid_id, var_nodims, OASIS_Out, OASIS_Real, ierror) !15 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMTAUX.') + CALL oasis_def_var(oas_id_ty, "CLMTAUY" , grid_id, var_nodims, OASIS_Out, OASIS_Real, ierror) !16 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMTAUY.') + CALL oasis_def_var(oas_id_sh, "CLMSHFLX", grid_id, var_nodims, OASIS_Out, OASIS_Real, ierror) !17 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMSHFLX.') + CALL oasis_def_var(oas_id_lh, "CLMLHFLX", grid_id, var_nodims, OASIS_Out, OASIS_Real, ierror) !18 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMLHFLX.') + CALL oasis_def_var(oas_id_st, "CLMTGRND", grid_id, var_nodims, OASIS_Out, OASIS_Real, ierror) !19 + IF (ierror /= 0) CALL oasis_abort(oas_comp_id, oas_comp_name, 'Failure in oasis_def_var for CLMTGRND.') + +#endif ! End definition phase call oasis_enddef(ierror) @@ -188,4 +245,4 @@ subroutine define_grid() deallocate(oas_lon, oas_lat, oas_corner_lon, oas_corner_lat, oas_mask, corner_lon, corner_lat) end if end subroutine define_grid -end module oas_defineMod \ No newline at end of file +end module oas_defineMod diff --git a/src/clm5/oasis3/oas_sendReceiveMod.F90 b/src/clm5/oasis3/oas_sendReceiveMod.F90 index 1afaac7343..44972232ae 100644 --- a/src/clm5/oasis3/oas_sendReceiveMod.F90 +++ b/src/clm5/oasis3/oas_sendReceiveMod.F90 @@ -10,11 +10,19 @@ module oas_sendReceiveMod save private +#ifdef COUP_OAS_PFL public :: oas_send public :: oas_receive - +#endif + +#ifdef COUP_OAS_ICON + public :: oas_send_icon + public :: oas_receive_icon +#endif + contains +#ifdef COUP_OAS_PFL subroutine oas_receive(bounds, seconds_elapsed, atm2lnd_inst) use atm2lndType, only: atm2lnd_type @@ -42,5 +50,75 @@ subroutine oas_send(bounds, seconds_elapsed, lnd2atm_inst) call oasis_put(oas_et_loss_id, seconds_elapsed, lnd2atm_inst%qflx_parflow_grc, info) end subroutine oas_send +#endif + +#ifdef COUP_OAS_ICON + subroutine oas_receive_icon(bounds, seconds_elapsed, atm2lnd_inst) + use atm2lndType, only: atm2lnd_type + + type(bounds_type), intent(in) :: bounds + integer , intent(in) :: seconds_elapsed + type(atm2lnd_type), intent(inout) :: atm2lnd_inst + real(kind=r8), allocatable :: buffer(:,:) + integer :: num_grid_points + integer :: info + integer :: g + + + num_grid_points = (bounds%endg - bounds%begg) + 1 + allocate(buffer(num_grid_points, 1)) + + ! call oasis_get(oas_id_t, seconds_elapsed, oas_rcv_meta(:,:,oas_id_t), info) + call oasis_get(oas_id_t, seconds_elapsed, atm2lnd_inst%forc_t_not_downscaled_grc, info) + call oasis_get(oas_id_u, seconds_elapsed, atm2lnd_inst%forc_u_grc, info) + call oasis_get(oas_id_v, seconds_elapsed, atm2lnd_inst%forc_v_grc, info) + call oasis_get(oas_id_qv, seconds_elapsed, atm2lnd_inst%forc_q_not_downscaled_grc, info) + call oasis_get(oas_id_ht, seconds_elapsed, atm2lnd_inst%forc_hgt_grc, info) + call oasis_get(oas_id_pr, seconds_elapsed, atm2lnd_inst%forc_pbot_not_downscaled_grc, info) + call oasis_get(oas_id_rs, seconds_elapsed, atm2lnd_inst%forc_solad_grc(:,1), info) + call oasis_get(oas_id_fs, seconds_elapsed, atm2lnd_inst%forc_solai_grc(:,1), info) + call oasis_get(oas_id_lw, seconds_elapsed, atm2lnd_inst%forc_lwrad_not_downscaled_grc, info) + call oasis_get(oas_id_cr, seconds_elapsed, atm2lnd_inst%forc_rain_not_downscaled_grc, info) + call oasis_get(oas_id_gr, seconds_elapsed, atm2lnd_inst%forc_snow_not_downscaled_grc, info) + + !SPo: some postprocessing of atm2lnd is missing; may better use x2l + + do g=bounds%begg,bounds%endg + atm2lnd_inst%forc_solad_grc(g,1) = 0.5_r8 * atm2lnd_inst%forc_solad_grc(g,1) + atm2lnd_inst%forc_solad_grc(g,2) = atm2lnd_inst%forc_solad_grc(g,1) + atm2lnd_inst%forc_solai_grc(g,1) = 0.5_r8 * atm2lnd_inst%forc_solai_grc(g,1) + atm2lnd_inst%forc_solai_grc(g,2) = atm2lnd_inst%forc_solai_grc(g,1) + atm2lnd_inst%forc_solar_grc(g) = atm2lnd_inst%forc_solad_grc(g,2) + atm2lnd_inst%forc_solad_grc(g,1) & + + atm2lnd_inst%forc_solai_grc(g,2) + atm2lnd_inst%forc_solai_grc(g,1) + enddo + + end subroutine oas_receive_icon + + subroutine oas_send_icon(bounds, seconds_elapsed, lnd2atm_inst) + use lnd2atmType, only : lnd2atm_type + use spmdMod, only : mpicom + use shr_mpi_mod, only: shr_mpi_barrier + + type(bounds_type), intent(in) :: bounds + integer , intent(in) :: seconds_elapsed + type(lnd2atm_type), intent(inout) :: lnd2atm_inst + real(kind=r8), allocatable :: aux_buffer(:,:) + integer :: num_grid_points + integer :: info + + num_grid_points = (bounds%endg - bounds%begg) + 1 + allocate(aux_buffer(num_grid_points, 1)) + + call oasis_put(oas_id_it, seconds_elapsed,lnd2atm_inst%t_rad_grc, info) ! "CLM_INFRA" + call oasis_put(oas_id_ad, seconds_elapsed,lnd2atm_inst%albd_grc(:,1), info) ! "CLM_ALBED" + call oasis_put(oas_id_ai, seconds_elapsed,lnd2atm_inst%albi_grc(:,1), info) ! "CLM_ALBEI" + call oasis_put(oas_id_tx, seconds_elapsed,lnd2atm_inst%taux_grc, info) ! "CLM_TAUX" + call oasis_put(oas_id_ty, seconds_elapsed,lnd2atm_inst%tauy_grc, info) ! "CLM_TAUY" + call oasis_put(oas_id_sh, seconds_elapsed,lnd2atm_inst%eflx_sh_tot_grc, info) ! "CLM_SHFLX" + call oasis_put(oas_id_lh, seconds_elapsed,lnd2atm_inst%eflx_lh_tot_grc, info) ! "CLM_LHFLX" + call oasis_put(oas_id_st, seconds_elapsed,lnd2atm_inst%t_sf_grc, info) ! "CLM_TGRND" + + end subroutine oas_send_icon +#endif end module oas_sendReceiveMod diff --git a/src/clm5/oasis3/oas_vardefMod.F90 b/src/clm5/oasis3/oas_vardefMod.F90 index 46972c9d12..56ef8e0752 100644 --- a/src/clm5/oasis3/oas_vardefMod.F90 +++ b/src/clm5/oasis3/oas_vardefMod.F90 @@ -1,7 +1,40 @@ module oas_vardefMod implicit none save - + +#ifdef COUP_OAS_PFL integer :: oas_psi_id, oas_et_loss_id, oas_sat_id +#endif + +#ifdef COUP_OAS_ICON + INTEGER :: oas_comp_id + CHARACTER(len=4) :: oas_comp_name="eCLM" +! TYPE :: t_oas_field +! CHARACTER(len = 8) :: clpname +! INTEGER :: vid +! END TYPE t_oas_field +! TYPE(t_oas_field), DIMENSION(8) :: oas_snd_meta +! TYPE(t_oas_field), DIMENSION(11) :: oas_rcv_meta + integer :: oas_id_t ! temperature (K) + integer :: oas_id_u ! u wind (m/s) + integer :: oas_id_v ! v wind (m/s) + integer :: oas_id_qv ! specific water vapor content () + integer :: oas_id_ht ! thickness of lowest level (m) + integer :: oas_id_pr ! surface pressure (Pa) + integer :: oas_id_rs ! direct shortwave downward radiation (W/m2) + integer :: oas_id_fs ! diffuse shortwave downward radiation (W/m2) + integer :: oas_id_lw ! longwave downward radiation (W/m2) + integer :: oas_id_cr ! rain precipitation (kg/m2*s) + integer :: oas_id_gr ! snow precipitation (kg/m2*s) + + integer :: oas_id_it ! radiation temperature (K) + integer :: oas_id_ad ! direct albedo (%) + integer :: oas_id_ai ! diffuse albedo (%) + integer :: oas_id_tx ! momentum flux x (N/m2) + integer :: oas_id_ty ! momentum flux y (N/m2) + integer :: oas_id_sh ! sensible heat flux (W/m2) + integer :: oas_id_lh ! latent heat flux (W/m2) + integer :: oas_id_st ! surface temperature (K) +#endif -end module oas_vardefMod \ No newline at end of file +end module oas_vardefMod diff --git a/src/csm_share/CMakeLists.txt b/src/csm_share/CMakeLists.txt index 6309ed82e4..c0c38eb235 100644 --- a/src/csm_share/CMakeLists.txt +++ b/src/csm_share/CMakeLists.txt @@ -117,6 +117,14 @@ if (USE_OASIS) if (OASIS3MCT_FOUND) target_link_libraries(${PROJECT_NAME} PUBLIC OASIS3MCT::OASIS3MCT) target_compile_definitions(${PROJECT_NAME} PUBLIC USE_OASIS) + option(COUP_OAS_ICON "Couple eCLM with ICON" OFF) + if(COUP_OAS_ICON) + target_compile_definitions(${PROJECT_NAME} PUBLIC COUP_OAS_ICON) + endif() + option(COUP_OAS_PFL "Couple eCLM with ParFlow" OFF) + if(COUP_OAS_PFL) + target_compile_definitions(${PROJECT_NAME} PUBLIC COUP_OAS_PFL) + endif() endif() endif() install (TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})