Commit 95178fbb authored by Karsten Bolding's avatar Karsten Bolding

added flexible output to master - copy/merge from output branch

parent e6ca1f12
......@@ -104,6 +104,7 @@ elseif(${GETM_COORDINATE_TYPE} STREQUAL "Curvilinear")
endif()
message(${GETM_COORDINATE_TYPE})
# Specify default build type for single-type systems (not VS)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
......@@ -282,6 +283,7 @@ add_library(getm OBJECT
getm/compilation_options.F90
getm/initialise.F90
getm/integration.F90
getm/register_all_variables.F90
getm/print_version.F90
)
......@@ -380,12 +382,14 @@ if(GOTM_BASE)
set(GOTM_USE_FABM ${GETM_USE_FABM} CACHE BOOL "Include support for Framework for Aquatic Biogeochemical Models (fabm.net)" FORCE)
add_subdirectory(${GOTM_BASE}/src gotm)
set(GOTM_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/gotm/modules)
set(GOTM_LIBRARIES turbulence util)
set(GOTM_LIBRARIES turbulence util output_manager)
#KB set(GOTM_LIBRARIES ${GOTM_LIBRARIES} output_manager)
if(GETM_USE_FABM)
set(GOTM_LIBRARIES ${GOTM_LIBRARIES} gotm_fabm)
set_property(TARGET 3d getm APPEND PROPERTY INCLUDE_DIRECTORIES $<TARGET_PROPERTY:gotm_fabm,INTERFACE_INCLUDE_DIRECTORIES>)
endif()
mark_as_advanced(GOTM_PREFIX GOTM_USE_FABM)
#KB add_dependencies(output ${GOTM_LIBRARIES})
add_dependencies(3d ${GOTM_LIBRARIES})
else()
find_package(GOTM REQUIRED)
......@@ -396,7 +400,12 @@ else()
set_property(TARGET 3d getm APPEND PROPERTY INCLUDE_DIRECTORIES "${FABM_INCLUDE_DIRS}")
endif()
endif()
set_property(TARGET 2d APPEND PROPERTY INCLUDE_DIRECTORIES "${GOTM_INCLUDE_DIRS}")
set_property(TARGET 3d getm APPEND PROPERTY INCLUDE_DIRECTORIES "${GOTM_INCLUDE_DIRS}")
set_property(TARGET output APPEND PROPERTY INCLUDE_DIRECTORIES "${GOTM_INCLUDE_DIRS}")
set_property(TARGET ncdf APPEND PROPERTY INCLUDE_DIRECTORIES "${GOTM_INCLUDE_DIRS}")
set_property(TARGET input APPEND PROPERTY INCLUDE_DIRECTORIES "${GOTM_INCLUDE_DIRS}")
set_property(TARGET getm APPEND PROPERTY INCLUDE_DIRECTORIES "${GOTM_INCLUDE_DIRS}")
# Build GETM executable.
add_executable(getm_exe
......@@ -412,6 +421,7 @@ add_executable(getm_exe
$<TARGET_OBJECTS:futils>
)
set_property(TARGET getm_exe PROPERTY OUTPUT_NAME "getm${exe_id}")
set_property(TARGET getm_exe APPEND PROPERTY INCLUDE_DIRECTORIES "${GOTM_INCLUDE_DIRS}")
target_link_libraries(getm_exe ${GOTM_LIBRARIES} ${NetCDF_LIBRARIES})
if (NetCDF_STATIC_MSVC_BUILD)
......
......@@ -20,7 +20,9 @@
use rivers, only: clean_rivers
use m3d, only: clean_3d
#endif
use register_all_variables, only: fm
use output, only: clean_output
use output_manager
use kurt_parallel, only: clean_parallel
IMPLICIT NONE
!
......@@ -59,6 +61,9 @@
if( .not. dryrun ) then
call clean_output(runtype,loop)
end if
call output_manager_clean()
call fm%finalize()
call clean_input()
......
......@@ -10,6 +10,10 @@
! !DESCRIPTION:
!
! !USES:
use register_all_variables
use output_manager_core, only:output_manager_host=>host, type_output_manager_host=>type_host
use time, only: CalDat,JulDay
use output_manager
IMPLICIT NONE
!
! !PUBLIC DATA MEMBERS:
......@@ -19,6 +23,12 @@
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Hans Burchard
type,extends(type_output_manager_host) :: type_getm_host
contains
procedure :: julian_day => getm_host_julian_day
procedure :: calendar_date => getm_host_calendar_date
end type
!
!EOP
!-----------------------------------------------------------------------
......@@ -41,10 +51,13 @@
use output, only: init_output,do_output,restart_file,out_dir
use input, only: init_input
use domain, only: init_domain
use domain, only: iextr,jextr,imin,imax,jmin,jmax,kmax
use domain, only: vert_cord,maxdepth
use domain, only: H
use domain, only: iextr,jextr,imin,imax,ioff,jmin,jmax,joff,kmax
use domain, only: xcord,ycord
use domain, only: vert_cord,maxdepth,ga
use time, only: init_time,update_time,write_time_string
use time, only: start,timestr,timestep
use time, only: julianday,secondsofday
use m2d, only: init_2d,postinit_2d, z
use getm_timers, only: init_getm_timers, tic, toc, TIM_INITIALIZE
#ifndef NO_3D
......@@ -106,6 +119,8 @@
#endif
character(len=PATH_MAX) :: hot_in=''
character(len=16) :: postfix
namelist /param/ &
dryrun,runid,title,parallel,runtype, &
hotstart,use_epoch,save_initial
......@@ -209,13 +224,13 @@
FATAL 'A non valid runtype has been specified.'
stop 'initialise()'
end select
call init_time(MinN,MaxN)
if(use_epoch) then
LEVEL2 'using "',start,'" as time reference'
end if
call init_domain(input_dir)
call init_domain(input_dir,runtype)
call init_meteo(hotstart)
......@@ -251,7 +266,21 @@
end if
#endif
call init_output(runid,title,start,runtype,dryrun,myid)
call init_register_all_variables(runtype)
allocate(type_getm_host::output_manager_host)
if (myid .ge. 0) then
write(postfix,'(A,I4.4)') '.',myid
call output_manager_init(fm,title,trim(postfix))
else
call output_manager_init(fm,title)
end if
call do_register_all_variables(runtype)
! call fm%list()
! call init_output(runid,title,start,runtype,dryrun,myid)
call init_output(runid,title,start,runtype,dryrun,myid,MinN,MaxN,save_initial)
close(NAMLST)
......@@ -318,8 +347,9 @@
#endif
end if
if (save_initial .and. .not. dryrun) then
if (.not. dryrun) then
call do_output(runtype,MinN-1,timestep)
if (save_initial) call output_manager_save(julianday,secondsofday,MinN-1)
end if
#ifdef DEBUG
......@@ -332,6 +362,20 @@
!-----------------------------------------------------------------------
subroutine getm_host_julian_day(self,yyyy,mm,dd,julian)
class (type_getm_host), intent(in) :: self
integer, intent(in) :: yyyy,mm,dd
integer, intent(out) :: julian
call JulDay(yyyy,mm,dd,julian)
end subroutine
subroutine getm_host_calendar_date(self,julian,yyyy,mm,dd)
class (type_getm_host), intent(in) :: self
integer, intent(in) :: julian
integer, intent(out) :: yyyy,mm,dd
call CalDat(julian,yyyy,mm,dd)
end subroutine
end module initialise
!-----------------------------------------------------------------------
......
......@@ -38,6 +38,7 @@
!
! !USES:
use time, only: update_time,timestep
use time, only: julianday,secondsofday
use domain, only: kmax
use meteo, only: do_meteo,tausx,tausy,airp,swr,albedo
use meteo, only: fwf_method,evap,precip
......@@ -65,6 +66,7 @@
#ifdef TEST_NESTING
use nesting, only: nesting_file
#endif
use output_manager
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -157,16 +159,12 @@
end if
#endif
call do_output(runtype,n,timestep)
call output_manager_save(julianday,secondsofday,n)
#ifdef DIAGNOSE
call diagnose(n,MaxN,runtype)
#endif
end do
#ifndef NO_3D
if (meanout .eq. 0) then
call calc_mean_fields(n,n)
end if
#endif
#ifdef DEBUG
write(debug,*) 'Leaving time_loop()'
......
This diff is collapsed.
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