Skip to content

Commit

Permalink
removal of #ifdef USE_ATS_LIB
Browse files Browse the repository at this point in the history
  • Loading branch information
fmyuan authored and rfiorella committed Oct 23, 2024
1 parent fa5d7c0 commit ed69a90
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 35 deletions.
3 changes: 0 additions & 3 deletions components/elm/src/biogeophys/SoilWaterMovementMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ subroutine SoilWater(bounds, num_hydrologyc, filter_hydrologyc, &
!----------------------------------------------------------------------------------------
case (ATS_HYDRO)

#ifdef USE_ATS_LIB
#ifndef _OPENACC
call EMI_Driver(EM_ID_ATS, EM_ATS_SOIL_HYDRO_STAGE, &
dt=dt, number_step=nstep, clump_rank=bounds%clump_index, &
Expand Down Expand Up @@ -172,8 +171,6 @@ subroutine SoilWater(bounds, num_hydrologyc, filter_hydrologyc, &

end do


#endif
#endif

!----------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module ELM_ATS_InterfaceMod

#ifdef USE_ATS_LIB

!-----------------------------------------------------------------------
! !DESCRIPTION:
Expand Down Expand Up @@ -234,6 +233,4 @@ end subroutine ats_getdata_hydro
!------------------------------------------------------------------------


#endif

end module ELM_ATS_InterfaceMod
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module ExternalModelATSMod

#ifdef USE_ATS_LIB

!-----------------------------------------------------------------------
! !DESCRIPTION:
!
Expand Down Expand Up @@ -1028,6 +1026,4 @@ end subroutine EM_ATS_Finalize

!------------------------------------------------------------------------

#endif

end module ExternalModelATSMod
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module ExternalModelATS_createMod

#ifdef USE_ATS_LIB

!-----------------------------------------------------------------------
! !DESCRIPTION:
!
Expand Down Expand Up @@ -115,6 +113,5 @@ end subroutine get_mesh_local

!------------------------------------------------------------------------

#endif

end module ExternalModelATS_createMod
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ module ExternalModelInterfaceMod
use ExternalModelFATESMod , only : em_fates_type
use ExternalModelStubMod , only : em_stub_type
use ExternalModelAlquimiaMod , only : em_alquimia_type
#ifdef USE_ATS_LIB

use ExternalModelATSMod , only : em_ats_type
#endif

use EMI_TemperatureType_ExchangeMod , only : EMI_Pack_TemperatureType_at_Column_Level_for_EM
use EMI_TemperatureType_ExchangeMod , only : EMI_Unpack_TemperatureType_at_Column_Level_from_EM
Expand Down Expand Up @@ -81,10 +80,10 @@ module ExternalModelInterfaceMod
class(em_fates_type) , pointer :: em_fates
class(em_stub_type) , pointer :: em_stub(:)
class(em_alquimia_type) , pointer :: em_alquimia(:)
#ifdef USE_ATS_LIB

! for ats, don't instance for each individual clump (or mpi rank)
class(em_ats_type) , pointer, public :: em_ats
#endif


public :: EMI_Determine_Active_EMs
public :: EMI_Init_EM
Expand Down Expand Up @@ -167,10 +166,10 @@ subroutine EMI_Determine_Active_EMs()
if (use_ats) then
num_em = num_em + 1
index_em_ats = num_em
#ifdef USE_ATS_LIB

if(.not.use_ats_mesh) &
allocate(em_ats)
#endif

endif

! Is PETSc based Thermal Model active?
Expand Down Expand Up @@ -641,7 +640,6 @@ subroutine EMI_Init_EM(em_id)
! start of EM_ID_ATS block
case (EM_ID_ATS)

#ifdef USE_ATS_LIB
! Initialize EM

! Initialize lists of data to be exchanged between ELM and ATS
Expand Down Expand Up @@ -770,9 +768,6 @@ subroutine EMI_Init_EM(em_id)
enddo
!$OMP END PARALLEL DO

#else
call endrun('ATS is on but code was not compiled with -DUSE_ATS_LIB')
#endif
! End of EM_ID_ATS block
! ------------------------------------------------------------------------------

Expand Down Expand Up @@ -1406,12 +1401,10 @@ subroutine EMI_Driver(em_id, em_stage, dt, number_step, &

!-------------------------------------------------------------------------------
case (EM_ID_ATS)
#ifdef USE_ATS_LIB

call em_ats%Solve(em_stage, dtime, nstep, clump_rank, &
l2e_driver_list(iem), e2l_driver_list(iem), bounds_clump)
#else
call endrun('ATS is on but code was not compiled with -DUSE_ATS_LIB')
#endif

!-------------------------------------------------------------------------------

case (EM_ID_STUB)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ subroutine EMI_Pack_WaterFluxType_at_Column_Level_for_EM(data_list, em_stage, &
!
! !USES:
use elm_varpar , only : nlevsoi, nlevgrnd, nlevsno
use elm_varctl , only : use_ats
!
implicit none
!
Expand Down Expand Up @@ -178,26 +179,26 @@ subroutine EMI_Pack_WaterFluxType_at_Column_Level_for_EM(data_list, em_stage, &
case (L2E_FLUX_GROSS_EVAP_SOIL)
do fc = 1, num_filter
c = filter(fc)
#ifdef USE_ATS_LIB
if (use_ats) then
! when coupling with ATS, ground surface hydrology is integrated into subsurface hydrology
! soil evap is that between soil/ground and near-air
cur_data%data_real_1d(c) = qflx_evap_soi(c)
#else
else
cur_data%data_real_1d(c) = qflx_gross_evap_soil(c)
#endif
endif
enddo
cur_data%is_set = .true.

case (L2E_FLUX_GROSS_INFL_SOIL)
do fc = 1, num_filter
c = filter(fc)
#ifdef USE_ATS_LIB
if (use_ats) then
! when coupling with ATS, ground surface hydrology is integrated into subsurface hydrology
! So, water input into soil should be rainfall+snowmelt (todo check if dew is accounted into soil evap???)
cur_data%data_real_1d(c) = qflx_top_soil(c)
#else
else
cur_data%data_real_1d(c) = qflx_gross_infl_soil(c)
#endif
endif
enddo
cur_data%is_set = .true.

Expand Down
2 changes: 0 additions & 2 deletions components/elm/src/main/elm_initializeMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ subroutine initialize1( )
use domainLateralMod , only: ldomain_lateral, domainlateral_init
use SoilTemperatureMod , only: init_soil_temperature
use ExternalModelInterfaceMod , only: EMI_Determine_Active_EMs
#ifdef USE_ATS_LIB
use ExternalModelInterfaceMod , only: em_ats
#endif
use dynSubgridControlMod , only: dynSubgridControl_init
use filterMod , only: allocFilters
use reweightMod , only: reweight_wrapup
Expand Down

0 comments on commit ed69a90

Please sign in to comment.