Commit bb9a0625 authored by Knut's avatar Knut

Merge branch 'numerical_analyses' into gvc

Conflicts:
	src/3d/vertical_coordinates.F90
	src/getm/register_all_variables.F90
parents 2ca5afcd b17c4f28
......@@ -203,6 +203,123 @@
end subroutine postinit_variables_2d
!EOC
!-----------------------------------------------------------------------
!BOP
!
! !ROUTINE: register_2d_variables() - register GETM variables.
!
! !INTERFACE:
subroutine register_2d_variables(fm)
!
! !DESCRIPTION:
!
! !USES:
use field_manager
IMPLICIT NONE
!
! !INPUT PARAMETERS:
type (type_field_manager) :: fm
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Jorn Bruggeman
!
! !LOCAL VARIABLES:
logical :: used
integer,parameter :: rk = kind(_ONE_)
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL2 'register_2d_variables()'
!D(E2DFIELD)
!DU,DV
!z(E2DFIELD)
!zo(E2DFIELD)
!U(E2DFIELD)
!V(E2DFIELD)
!UEx(E2DFIELD)
!VEx(E2DFIELD)
!fU(E2DFIELD)
!fV(E2DFIELD)
!ru(E2DFIELD)
!rv(E2DFIELD)
!Uint(E2DFIELD)
!Vint(E2DFIELD)
!Uinto(E2DFIELD)
!Vinto(E2DFIELD)
!res_du(E2DFIELD)
!res_u(E2DFIELD)
!res_dv(E2DFIELD)
!res_v(E2DFIELD)
!kbk
!SlUx(E2DFIELD)
!SlVx(E2DFIELD)
!Slru(E2DFIELD)
!Slrv(E2DFIELD)
!zub(E2DFIELD)
!zvb(E2DFIELD)
!zub0(E2DFIELD)
!zvb0(E2DFIELD)
!An(E2DFIELD)
!AnX(E2DFIELD)
!fwf(E2DFIELD)
!fwf_int(E2DFIELD)
!EWbdy(jmax),ENbdy(imax),EEbdy(jmax),ESbdy(imax)
! category - 2d
call fm%register('z', 'm', 'sea surface elevation', standard_name='sea surface elevation', fill_value=-9999.0_rk, data2d=z(_2D_W_), category="2d", part_of_state=.true.)
call fm%register('zo', 'm', 'sea surface elevation', standard_name='sea surface elevation', fill_value=-9999.0_rk, data2d=zo(_2D_W_), category="2d", output_level=output_level_debug)
call fm%register('D', 'm', 'water depth', standard_name='water depth', fill_value=-10009.0_rk, data2d=D(_2D_W_), category="2d", part_of_state=.true.)
call fm%register('U', 'm2/s', 'transport in local x-direction', standard_name='', data2d=U(_2D_W_), category='2d', output_level=output_level_debug, part_of_state=.true.)
call fm%register('V', 'm2/s', 'transport in local y-direction', standard_name='', data2d=V(_2D_W_), category='2d', output_level=output_level_debug, part_of_state=.true.)
call fm%register('velx', 'm/s', 'velocity in global x-direction', standard_name='', data2d=velx(_2D_W_), category='2d', fill_value=-9999.0_rk, output_level=output_level_debug)
call fm%register('vely', 'm/s', 'velocity in global y-direction', standard_name='', data2d=vely(_2D_W_), category='2d', fill_value=-9999.0_rk, output_level=output_level_debug)
if (do_numerical_analyses_2d) then
call fm%register('numdis_2d', 'W/kg', 'numerical dissipation', standard_name='', category='2d', output_level=output_level_debug)
call fm%register('phydis_2d', 'W/kg', 'physical dissipation' , standard_name='', category='2d', output_level=output_level_debug)
end if
return
end subroutine register_2d_variables
!EOC
!-----------------------------------------------------------------------
!BOP
!
! !ROUTINE: finalize_register_2d_variables() - send optional variables.
!
! !INTERFACE:
subroutine finalize_register_2d_variables(fm)
!
! !DESCRIPTION:
!
! !USES:
use field_manager
IMPLICIT NONE
!
! !INPUT PARAMETERS:
type (type_field_manager) :: fm
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Jorn Bruggeman
!
! !LOCAL VARIABLES:
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL1 'finalize_register_2d_variables()'
if (do_numerical_analyses_2d) then
call fm%send_data('numdis_2d', numdis_2d(_2D_W_))
call fm%send_data('phydis_2d', phydis_2d(_2D_W_))
end if
return
end subroutine finalize_register_2d_variables
!EOC
!-----------------------------------------------------------------------
!BOP
!
......
......@@ -73,6 +73,9 @@
if (rc /= 0) stop 'init_3d: Error allocating memory (sf)'
#endif
allocate(zc(I3DFIELD),stat=rc) ! 3D field for cell center coordinates
if (rc /= 0) stop 'init_3d: Error allocating memory (zc)'
allocate(ho(I3DFIELD),stat=rc) ! 3D field for old box height (z-column)
if (rc /= 0) stop 'init_3d: Error allocating memory (ho)'
......
......@@ -23,6 +23,7 @@
#ifdef STRUCTURE_FRICTION
REALTYPE, dimension(:,:,:), allocatable :: sf
#endif
REALTYPE, dimension(:,:,:), allocatable, target :: zc
REALTYPE, dimension(:,:,:), allocatable, target :: hn,hvel,hun,hvn
REALTYPE, dimension(:,:,:), allocatable :: ho,huo,hvo
REALTYPE, dimension(:,:,:), allocatable, target :: zwn,zcn
......
......@@ -41,6 +41,7 @@
! !PUBLIC DATA MEMBERS:
public init_getm_fabm, postinit_getm_fabm, do_getm_fabm, model, output_none
public init_getm_fabm_fields
public register_fabm_variables, finalize_register_fabm_variables
integer, public :: fabm_init_method=0
character(len=PATH_MAX) :: fabm_init_file
integer :: fabm_init_format, fabm_field_no
......@@ -334,6 +335,123 @@ end interface
end subroutine init_getm_fabm_fields
!EOC
#ifdef _FABM_
!-----------------------------------------------------------------------
!BOP
!
! !ROUTINE: register_fabm_variables() - register FABM variables.
!
! !INTERFACE:
subroutine register_fabm_variables(fm)
!
! !DESCRIPTION:
!
! !USES:
use field_manager
IMPLICIT NONE
!
! !INPUT PARAMETERS:
type (type_field_manager) :: fm
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Jorn Bruggeman
!
! !LOCAL VARIABLES:
integer :: i,output_level
logical :: in_output
!EOP
!-----------------------------------------------------------------------
!BOC
if (.not. fabm_calc) return
LEVEL2 'register_fabm_variables()'
do i=1,size(model%state_variables)
output_level = output_level_default
if (model%state_variables(i)%output==output_none) output_level = output_level_debug
call fm%register(model%state_variables(i)%name, model%state_variables(i)%units, &
model%state_variables(i)%long_name, minimum=model%state_variables(i)%minimum, maximum=model%state_variables(i)%maximum, &
fill_value=model%state_variables(i)%missing_value, dimensions=(/id_dim_z/), data3d=fabm_pel(_3D_W_,i), category='fabm'//model%state_variables(i)%target%owner%get_path(), output_level=output_level)
end do
do i=1,size(model%bottom_state_variables)
output_level = output_level_default
if (model%bottom_state_variables(i)%output==output_none) output_level = output_level_debug
call fm%register(model%bottom_state_variables(i)%name, model%bottom_state_variables(i)%units, &
model%bottom_state_variables(i)%long_name, minimum=model%bottom_state_variables(i)%minimum, &
maximum=model%bottom_state_variables(i)%maximum, fill_value=model%bottom_state_variables(i)%missing_value, &
data2d=fabm_ben(_2D_W_,i), category='fabm'//model%bottom_state_variables(i)%target%owner%get_path(), output_level=output_level)
end do
do i=1,size(model%diagnostic_variables)
output_level = output_level_default
if (model%diagnostic_variables(i)%output==output_none) output_level = output_level_debug
call fm%register(model%diagnostic_variables(i)%name, model%diagnostic_variables(i)%units, &
model%diagnostic_variables(i)%long_name, minimum=model%diagnostic_variables(i)%minimum, maximum=model%diagnostic_variables(i)%maximum, &
fill_value=model%diagnostic_variables(i)%missing_value, dimensions=(/id_dim_z/), data3d=fabm_diag(_3D_W_,i), category='fabm'//model%diagnostic_variables(i)%target%owner%get_path(), output_level=output_level, used=in_output)
if (in_output) model%diagnostic_variables(i)%save = .true.
end do
do i=1,size(model%horizontal_diagnostic_variables)
output_level = output_level_default
if (model%horizontal_diagnostic_variables(i)%output==output_none) output_level = output_level_debug
call fm%register(model%horizontal_diagnostic_variables(i)%name, model%horizontal_diagnostic_variables(i)%units, &
model%horizontal_diagnostic_variables(i)%long_name, minimum=model%horizontal_diagnostic_variables(i)%minimum, maximum=model%horizontal_diagnostic_variables(i)%maximum, &
fill_value=model%horizontal_diagnostic_variables(i)%missing_value, data2d=fabm_diag_hz(_2D_W_,i), category='fabm'//model%horizontal_diagnostic_variables(i)%target%owner%get_path(), output_level=output_level, used=in_output)
if (in_output) model%horizontal_diagnostic_variables(i)%save = .true.
end do
if (do_numerical_analyses_3d) then
do i=1,size(model%state_variables)
call fm%register('nummix_'//trim(model%state_variables(i)%name), &
'('//trim(model%state_variables(i)%units)//')**2/s', &
'numerical mixing of '//trim(model%state_variables(i)%long_name), &
dimensions=(/id_dim_z/), &
category='fabm'//model%state_variables(i)%target%owner%get_path(), &
output_level=output_level_debug)
end do
end if
return
end subroutine register_fabm_variables
!EOC
#endif
!-----------------------------------------------------------------------
!BOP
!
! !ROUTINE: finalize_register_fabm_variables() - send optional variables.
!
! !INTERFACE:
subroutine finalize_register_fabm_variables(fm)
!
! !DESCRIPTION:
!
! !USES:
use field_manager
IMPLICIT NONE
!
! !INPUT PARAMETERS:
type (type_field_manager) :: fm
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Jorn Bruggeman
!
! !LOCAL VARIABLES:
integer :: i
!EOP
!-----------------------------------------------------------------------
!BOC
LEVEL1 'finalize_register_fabm_variables()'
if (fabm_calc) then
if (do_numerical_analyses_3d) then
do i=1,size(model%state_variables)
call fm%send_data('nummix_'//trim(model%state_variables(i)%name), nummix_fabm_pel(_3D_W_,i))
end do
end if
end if
return
end subroutine finalize_register_fabm_variables
!EOC
!-----------------------------------------------------------------------
!BOP
!
......
......@@ -38,6 +38,7 @@
#ifdef STRUCTURE_FRICTION
REALTYPE :: sf(I3DFIELD)
#endif
REALTYPE :: zc(I3DFIELD)
REALTYPE :: ho(I3DFIELD)
REALTYPE,dimension(I3DFIELD),target :: hn,hvel,hun,hvn
REALTYPE,dimension(I3DFIELD),target :: zwn,zcn
......
This diff is collapsed.
......@@ -69,6 +69,7 @@
!
!
! !USES:
use variables_3d, only: zc
use getm_timers, only: tic, toc,TIM_COORDS
IMPLICIT NONE
!
......@@ -158,6 +159,15 @@ stop
call hcheck(hvn,Dvn,av)
end if
! KK-TODO: remove because we already have zcn
! calculate the z-coordinate of the cell centers
! references to mean sea level
zc(:,:,0)=-H(:,:)
zc(:,:,1)=-H(:,:) + 0.5*hn(:,:,1)
do k=2,kmax
zc(:,:,k)=zc(:,:,k-1)+0.5*(hn(:,:,k-1)+hn(:,:,k))
end do
#ifdef SLICE_MODEL
do i=imin,imax
do k=kvmin(i,2),kmax
......
......@@ -79,11 +79,6 @@ if(GETM_USE_FABM)
endif(GETM_USE_FABM)
option(GETM_USE_FLEXIBLE_OUTPUT "Use new output manager" ON)
if(GETM_USE_FLEXIBLE_OUTPUT)
add_definitions(-D_FLEXIBLE_OUTPUT_)
endif()
option(GETM_USE_STRUCTURE_FRICTION "Include structure friction" OFF)
if(GETM_USE_STRUCTURE_FRICTION)
add_definitions(-DSTRUCTURE_FRICTION)
......@@ -350,6 +345,7 @@ add_library(output OBJECT
output/diagnostic_variables.F90
output/ncdf_out.F90
output/nesting.F90
output/output_processing.F90
output/output.F90
)
......@@ -361,12 +357,12 @@ add_library(output OBJECT
add_dependencies(domain futils)
add_dependencies(meteo futils domain)
add_dependencies(2d domain)
add_dependencies(2d domain util)
add_dependencies(3d meteo domain 2d)
add_dependencies(output futils domain 2d 3d meteo)
add_dependencies(ncdf futils domain output)
add_dependencies(input futils 2d 3d ncdf)
add_dependencies(getm input)
add_dependencies(getm input output)
set_property(TARGET futils ncdf input APPEND PROPERTY INCLUDE_DIRECTORIES "${NetCDF_INCLUDE_DIRS}")
add_definitions(-DNETCDF_FMT -DREAL_4B=real\(4\))
......@@ -377,13 +373,10 @@ find_path(GOTM_BASE src/gotm/gotm.F90 DOC "Path to GOTM source directory.")
if(GOTM_BASE)
set(GOTM_BUILD_LIBRARIES_ONLY ON)
set(GOTM_USE_FABM ${GETM_USE_FABM} CACHE BOOL "Include support for Framework for Aquatic Biogeochemical Models (fabm.net)" FORCE)
set(GOTM_USE_FLEXIBLE_OUTPUT ${GETM_USE_FLEXIBLE_OUTPUT} CACHE BOOL "Use new output manager" FORCE)
add_subdirectory(${GOTM_BASE}/src gotm)
set(GOTM_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/gotm/modules)
set(GOTM_LIBRARIES turbulence util)
if(GETM_USE_FLEXIBLE_OUTPUT)
set(GOTM_LIBRARIES ${GOTM_LIBRARIES} output_manager)
endif()
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>)
......
......@@ -113,10 +113,7 @@ ifdef GOTM_PREFIX
GOTMLIBDIR = $(GOTM_PREFIX)/lib
LINKDIRS += -L$(GOTMLIBDIR)
ifeq ($(GETM_FLEXIBLE_OUTPUT),true)
DEFINES += -D_FLEXIBLE_OUTPUT_
EXTRA_LIBS += -loutput_manager
endif
ifeq ($(FABM),true)
EXTRA_LIBS += -lgotm_fabm
endif
......
......@@ -6,13 +6,6 @@ find_path(GOTM_PREFIX
DOC "Installation prefix for General Ocean Turbulence Models - gotm.net"
)
# Find GOTM output_manager library
if(GETM_USE_FLEXIBLE_OUTPUT)
find_library(GOTM_OUTMAN NAMES output_manager
HINTS ${GOTM_PREFIX}/lib
DOC "GOTM output_manager library")
endif(GETM_USE_FLEXIBLE_OUTPUT)
# Find GOTM/FABM coupling library if USE_FABM
if(GETM_USE_FABM)
find_library(GOTM_FABM NAMES gotm_fabm
......@@ -25,12 +18,17 @@ find_library(GOTM_TURBULENCE NAMES turbulence
HINTS ${GOTM_PREFIX}/lib
DOC "GOTM turbulence library")
# Find GOTM output_manager library
find_library(GOTM_OUTMAN NAMES output_manager
HINTS ${GOTM_PREFIX}/lib
DOC "GOTM output_manager library")
# Find GOTM utility library
find_library(GOTM_UTIL NAMES util
HINTS ${GOTM_PREFIX}/lib
DOC "GOTM utility library")
set(GOTM_LIBRARIES ${GOTM_OUTMAN} ${GOTM_FABM} ${GOTM_TURBULENCE} ${GOTM_UTIL})
set(GOTM_LIBRARIES ${GOTM_FABM} ${GOTM_TURBULENCE} ${GOTM_OUTMAN} ${GOTM_UTIL})
# Store configurable path of GOTM include directory
find_path(GOTM_INCLUDE_DIRS
......@@ -39,7 +37,7 @@ find_path(GOTM_INCLUDE_DIRS
DOC "GOTM include directories"
)
mark_as_advanced(GOTM_LIBRARIES GOTM_INCLUDE_DIRS GOTM_TURBULENCE GOTM_UTIL GOTM_FABM GOTM_OUTMAN)
mark_as_advanced(GOTM_LIBRARIES GOTM_INCLUDE_DIRS GOTM_TURBULENCE GOTM_OUTMAN GOTM_UTIL GOTM_FABM)
# Process default arguments (QUIET, REQUIRED)
include(FindPackageHandleStandardArgs)
......
......@@ -217,25 +217,25 @@
call read_topo_file(bathy_format,bathymetry)
if ( runtype .ge. 2 ) then
select case (vert_cord)
case(_SIGMA_COORDS_)
LEVEL2 'Using sigma coordinates'
case(_Z_COORDS_)
LEVEL2 'Using z-level coordinates'
case(_GENERAL_COORDS_)
LEVEL2 'Using general vertical coordinates'
case (_HYBRID_COORDS_) ! hybrid vertical coordinates
LEVEL2 'using hybrid vertical coordinates'
STDERR 'domain: hybrid_coordinates not coded yet'
stop
case (_ADAPTIVE_COORDS_) ! adaptive vertical coordinates
LEVEL2 'using adaptive vertical coordinates'
case default
call getm_error("init_domain()", &
"A non valid vertical coordinate system has been chosen");
end select
allocate(ga(0:kmax),stat=rc)
if (rc /= 0) stop 'init_domain: Error allocating memory (ga)'
select case (vert_cord)
case(_SIGMA_COORDS_)
LEVEL2 'Using sigma coordinates'
case(_Z_COORDS_)
LEVEL2 'Using z-level coordinates'
case(_GENERAL_COORDS_)
LEVEL2 'Using general vertical coordinates'
case (_HYBRID_COORDS_) ! hybrid vertical coordinates
LEVEL2 'using hybrid vertical coordinates'
STDERR 'domain: hybrid_coordinates not coded yet'
stop
case (_ADAPTIVE_COORDS_) ! adaptive vertical coordinates
LEVEL2 'using adaptive vertical coordinates'
case default
call getm_error("init_domain()", &
"A non valid vertical coordinate system has been chosen");
end select
allocate(ga(0:kmax),stat=rc)
if (rc /= 0) stop 'init_domain: Error allocating memory (ga)'
end if
! Calculation masks
......
......@@ -74,6 +74,8 @@
! This is for do_input and do_output
integer, parameter :: TIM_INPUT = 90 ! input
integer, parameter :: TIM_OUTPUT = 92 ! output
integer, parameter :: TIM_FLEX_OUTPUT = 95 ! output_manager
integer, parameter :: TIM_OUTPUT_PROC = 96 ! output_processing
! These catch stuff that are *also* measured somewhere else:
integer, parameter :: TIM_ADV = 100 ! 2d advection
integer, parameter :: TIM_ADVH = 101 ! 2d advection halo parts
......@@ -179,6 +181,8 @@
timernames(TIM_METEO) = 'do_meteo'
timernames(TIM_INPUT) = 'do_input'
timernames(TIM_OUTPUT) = 'do_output'
timernames(TIM_FLEX_OUTPUT) = 'output_manager_save'
timernames(TIM_OUTPUT_PROC) = 'do_output_processing'
#ifdef GETM_PARALLEL
timernames(TIM_MOMENTUMH) = ' momentum-halo'
......
......@@ -22,9 +22,7 @@
#endif
use register_all_variables, only: fm
use output, only: clean_output
#if defined(_FLEXIBLE_OUTPUT_)
use output_manager
#endif
use kurt_parallel, only: clean_parallel
IMPLICIT NONE
!
......@@ -63,9 +61,7 @@
if( .not. dryrun ) then
call clean_output(runtype,loop)
end if
#if defined(_FLEXIBLE_OUTPUT_)
call output_manager_clean()
#endif
call fm%finalize()
......
......@@ -159,9 +159,6 @@
#ifdef _NCDF_SAVE_DOUBLE_
LEVEL1 '_NCDF_SAVE_DOUBLE_'
#endif
#ifdef _FLEXIBLE_OUTPUT_
LEVEL1 '_FLEXIBLE_OUTPUT_'
#endif
STDERR LINE
......
......@@ -11,28 +11,25 @@
!
! !USES:
use register_all_variables
#ifdef _FLEXIBLE_OUTPUT_
use output_manager_core, only:output_manager_host=>host, type_output_manager_host=>type_host
use time, only: CalDat,JulDay
use output_manager
#endif
IMPLICIT NONE
!
! !PUBLIC DATA MEMBERS:
public :: init_model
integer :: runtype=1
logical :: dryrun=.false.
logical :: list_variables=.false.
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Hans Burchard
#ifdef _FLEXIBLE_OUTPUT_
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
#endif
!
!EOP
!-----------------------------------------------------------------------
......@@ -53,6 +50,7 @@
use halo_mpi, only: init_mpi,print_MPI_info
#endif
use output, only: init_output,do_output,restart_file,out_dir
use output_processing
use input, only: init_input
use domain, only: init_domain
use domain, only: H
......@@ -270,10 +268,10 @@
#endif
end if
#endif
call init_output_processing()
call init_register_all_variables(runtype)
#ifdef _FLEXIBLE_OUTPUT_
allocate(type_getm_host::output_manager_host)
if (myid .ge. 0) then
write(postfix,'(A,I4.4)') '.',myid
......@@ -281,12 +279,12 @@
else
call output_manager_init(fm,title)
end if
#endif
! call init_output(runid,title,start,runtype,dryrun,myid)
call init_output(runid,title,start,runtype,dryrun,myid,MinN,MaxN,save_initial)
call do_register_all_variables(runtype)
if (list_variables) call fm%list()
close(NAMLST)
......@@ -367,10 +365,12 @@
end if
if (.not. dryrun) then
if (save_initial) then
call output_manager_prepare_save(julianday, int(secondsofday), 0, int(MinN-1))
call do_output_processing()
call output_manager_save(julianday,secondsofday,MinN-1)
end if
call do_output(runtype,MinN-1,timestep)
#ifdef _FLEXIBLE_OUTPUT_
if (save_initial) call output_manager_save(julianday,secondsofday,MinN-1)
#endif
end if
#ifdef DEBUG
......@@ -383,7 +383,6 @@
!-----------------------------------------------------------------------
#ifdef _FLEXIBLE_OUTPUT_
subroutine getm_host_julian_day(self,yyyy,mm,dd,julian)
class (type_getm_host), intent(in) :: self
integer, intent(in) :: yyyy,mm,dd
......@@ -397,7 +396,6 @@
integer, intent(out) :: yyyy,mm,dd
call CalDat(julian,yyyy,mm,dd)
end subroutine
#endif
end module initialise
......
......@@ -63,13 +63,13 @@
use suspended_matter, only: spm_calc,do_spm
#endif
use input, only: do_input
use output_processing, only: do_output_processing
use output, only: do_output
#ifdef TEST_NESTING
use nesting, only: nesting_file
#endif
#ifdef _FLEXIBLE_OUTPUT_
use output_manager
#endif
use getm_timers, only: tic, toc, TIM_FLEX_OUTPUT, TIM_OUTPUT_PROC
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -158,12 +158,19 @@
call nesting_file(WRITING)
end if
#endif
call update_time(n)