Commit a9453527 authored by kbk's avatar kbk
Browse files

parallel support, NO_3D

parent d1467182
!$Id: cleanup.F90,v 1.1 2002-05-02 14:01:25 gotm Exp $
!$Id: cleanup.F90,v 1.2 2003-04-07 16:39:16 kbk Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -14,12 +14,15 @@
! Some run-time statistics could also be put here.
!
! !USES:
use output, only: clean_output
use input, only: clean_input
use meteo, only: clean_meteo
use rivers, only: clean_rivers
use m2d, only: clean_2d
#ifndef NO_3D
use rivers, only: clean_rivers
use m3d, only: clean_3d
#endif
use output, only: clean_output
use kurt_parallel, only: clean_parallel
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -33,8 +36,11 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: cleanup.F90,v $
! Revision 1.1 2002-05-02 14:01:25 gotm
! Initial revision
! Revision 1.2 2003-04-07 16:39:16 kbk
! parallel support, NO_3D
!
! Revision 1.1.1.1 2002/05/02 14:01:25 gotm
! recovering after CVS crash
!
! Revision 1.2 2001/09/18 17:48:32 bbh
! Added algoritm for rivers - getting river data still missing
......@@ -42,7 +48,6 @@
! Revision 1.1.1.1 2001/04/17 08:43:09 bbh
! initial import into CVS
!
!
!EOP
!-----------------------------------------------------------------------
!BOC
......@@ -58,11 +63,12 @@
call clean_meteo()
call clean_rivers()
call clean_2d()
#ifndef NO_3D
call clean_rivers()
call clean_3d()
#endif
if( .not. dryrun ) then
call clean_output()
......@@ -70,6 +76,8 @@
call clean_input()
call clean_parallel()
#ifdef DEBUG
write(debug,*) 'Leaving clean_up()'
write(debug,*)
......
!$Id: initialise.F90,v 1.1 2002-05-02 14:01:25 gotm Exp $
!$Id: initialise.F90,v 1.2 2003-04-07 16:39:16 kbk Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -22,8 +22,11 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: initialise.F90,v $
! Revision 1.1 2002-05-02 14:01:25 gotm
! Initial revision
! Revision 1.2 2003-04-07 16:39:16 kbk
! parallel support, NO_3D
!
! Revision 1.1.1.1 2002/05/02 14:01:25 gotm
! recovering after CVS crash
!
! Revision 1.10 2001/10/22 12:24:07 bbh
! Typo
......@@ -68,27 +71,37 @@
! !IROUTINE: init_model - initialise getm
!
! !INTERFACE:
subroutine init_model()
subroutine init_model(dstr,tstr)
!
! !USES:
use commhalo, only: init_mpi,print_mpi_info,myid,nprocs
use kurt_parallel, only: init_parallel,myid
use output, only: init_output,do_output,restart_file
use input, only: init_input
use domain, only: init_domain,iimin,iimax,jjmin,jjmax,kmax
use domain, only: init_domain
use domain, only: iextr,jextr,imin,imax,jmin,jmax
use domain, only: iimin,iimax,jjmin,jjmax,kmax
use domain, only: vert_cord
use time, only: init_time,update_time,write_time_string
use time, only: start,timestr,timestep
use m2d, only: init_2d,z,zu,zv
use m3d, only: cord_relax,init_3d,ssen,ssun,ssvn,T
#ifndef NO_3D
use m3d, only: cord_relax,init_3d,ssen,ssun,ssvn
#ifndef NO_BAROCLINIC
use m3d, only: T
#endif
use turbulence, only: init_turbulence
use mtridiagonal, only: init_tridiagonal
use meteo, only: init_meteo,do_meteo
use rivers, only: init_rivers
#endif
use meteo, only: init_meteo,do_meteo
use integration, only: MinN,MaxN
#ifndef NO_BAROCLINIC
use eqstate, only: do_eqstate
#endif
IMPLICIT NONE
!
! !INPUT PARAMETERS:
character(len=*) :: dstr,tstr
!
! !INPUT/OUTPUT PARAMETERS:
!
......@@ -103,11 +116,19 @@
!
! !LOCAL VARIABLES:
integer :: i,j
character(len=8) :: buf
character(len=64) :: runid
character(len=80) :: title
logical :: parallel=.false.
logical :: hotstart=.false.
logical :: save_initial=.false.
#if (defined PARALLEL && defined INPUT_DIR)
character(len=PATH_MAX) :: input_dir=INPUT_DIR
#else
character(len=PATH_MAX) :: input_dir='./'
#endif
character(len=PATH_MAX) :: hot_in=''
namelist /param/ dryrun,runid,title,parallel,runtype, &
hotstart,save_initial
!
......@@ -120,28 +141,60 @@
write(debug,*) 'init_model() # ',Ncall
#endif
STDERR LINE
STDERR 'Initialising....'
STDERR LINE
! We need to pass info about the input directory
#if 0
call getarg(1,base_dir)
if(len_trim(base_dir) .eq. 0) then
call getenv("base_dir",base_dir)
end if
if(len_trim(base_dir) .gt. 0) then
base_dir = trim(base_dir) // '/'
end if
#endif
#if (defined PARALLEL && defined INPUT_DIR)
STDERR 'input_dir:'
STDERR trim(input_dir)
#endif
!
! Open the namelist file to get basic run parameters.
!
title='A descriptive title can be specified in the param namelist'
open(NAMLST,status='unknown',file='getm.inp')
open(NAMLST,status='unknown',file=trim(input_dir) // "/getm.inp")
read(NAMLST,NML=param)
LEVEL1 'The run id is: ',trim(runid)
LEVEL1 'The title is: ',trim(title)
!
! call all modules Init... routines
!
#ifdef NO_BAROCLINIC
if(runtype .ge. 3) then
FATAL 'getm not compiled for baroclinic runs'
stop 'init_model()'
end if
#endif
#ifdef NO_3D
if(runtype .ge. 2) then
FATAL 'getm not compiled for 3D runs'
stop 'init_model()'
end if
#endif
! call all modules init_ ... routines
if (parallel) then
call init_mpi()
call print_mpi_info()
else
LEVEL1 'OK - we are making a sequential run'
myid = -1; nprocs = 1
#ifdef PARALLEL
call init_parallel(runid,input_dir)
#else
STDERR 'You must define GETM_PARALLEL and recompile'
STDERR 'in order to run in parallel'
stop 'init_model()'
#endif
end if
STDERR LINE
STDERR 'getm ver. ',RELEASE,': Started on ',dstr,' ',tstr
STDERR LINE
STDERR 'Initialising....'
STDERR LINE
LEVEL1 'the run id is: ',trim(runid)
LEVEL1 'the title is: ',trim(title)
select case (runtype)
case (1)
......@@ -157,26 +210,29 @@
stop 'initialise()'
end select
! This is not at all ready yet - requires change in sequence of namelists!!!!
! Maybe it should not be done - main reason is handling of - hotstart.
call init_time(MinN,MaxN)
call init_domain()
call init_domain(input_dir)
call init_output(runid,title,start,runtype,dryrun)
!KBK-2003-02-10 call init_output(runid,title,start,runtype,dryrun,myid)
call init_meteo()
#ifndef NO_3D
call init_rivers()
#endif
call init_output(runid,title,start,runtype,dryrun,myid)
call init_2d(runtype,timestep,hotstart)
#ifndef NO_3D
if (runtype .gt. 1) then
call init_3d(runtype,timestep,hotstart)
call init_turbulence(60,'gotmturb.inp',kmax)
call init_turbulence(60,trim(input_dir) // 'gotmturb.inp',kmax)
call init_tridiagonal(kmax)
end if
#endif
#if 0
call init_waves(hotstart)
......@@ -185,20 +241,34 @@
if (hotstart) then
LEVEL1 'hotstart'
call restart_file(READING,'restart.in',MinN,runtype)
if (myid .ge. 0) then
write(buf,'.(I3.3).in') myid
! buf = '.' // trim(buf) // '.in'
STDERR buf
stop 'kbk: initialise'
else
buf = '.in'
end if
hot_in = trim(input_dir) //'/'// 'restart' // trim(buf)
call restart_file(READING,trim(hot_in),MinN,runtype)
#ifndef NO_3D
if (runtype .gt. 1) then
call start_macro()
call coordinates(vert_cord,cord_relax)
end if
#endif
call depth_update
if (runtype .gt. 1) call do_eqstate()
#ifndef NO_BAROCLINIC
if (runtype .ge. 3) call do_eqstate()
#endif
call update_time(MinN)
call write_time_string()
LEVEL3 timestr
MinN = MinN+1
end if
if (runtype .gt. 1) then
#ifndef NO_3D
if (runtype .ge. 2) then
do j=jjmin-1,jjmax
do i=iimin-1,iimax
ssen(i,j)=z(i,j)
......@@ -207,10 +277,17 @@
end do
end do
end if
#endif
call init_input(MinN)
call init_input(input_dir,MinN)
call do_meteo(MinN,T(:,:,kmax))
if(runtype .le. 2) then
call do_meteo(MinN)
#ifndef NO_BAROCLINIC
else
call do_meteo(MinN,T(:,:,kmax))
#endif
end if
if (save_initial .and. .not. dryrun) call do_output(runtype,0,_ZERO_)
......
!$Id: integration.F90,v 1.1 2002-05-02 14:01:25 gotm Exp $
!$Id: integration.F90,v 1.2 2003-04-07 16:39:16 kbk Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -20,8 +20,11 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: integration.F90,v $
! Revision 1.1 2002-05-02 14:01:25 gotm
! Initial revision
! Revision 1.2 2003-04-07 16:39:16 kbk
! parallel support, NO_3D
!
! Revision 1.1.1.1 2002/05/02 14:01:25 gotm
! recovering after CVS crash
!
! Revision 1.10 2001/10/26 09:11:28 bbh
! Stresses in meteo.F90 are in N/m2 - divide by rho_0 where necessary
......@@ -76,9 +79,14 @@
use time, only: update_time,timestep
use domain, only: kmax
use meteo, only: do_meteo,tausx,tausy,airp
use rivers, only: do_rivers
use m2d, only: integrate_2d
use m3d, only: integrate_3d,M,T
#ifndef NO_3D
use m3d, only: integrate_3d,M
#ifndef NO_BAROCLINIC
use m3d, only: T
#endif
use rivers, only: do_rivers
#endif
use input, only: do_input
use output, only: do_output
#ifdef TEST_NESTING
......@@ -116,11 +124,19 @@
if (mod(n,100) .eq. 0) STDERR n
do_3d = (runtype .gt. 1 .and. mod(n,M) .eq. 0)
#ifndef NO_3D
do_3d = (runtype .ge. 2 .and. mod(n,M) .eq. 0)
#endif
call do_input(n)
call do_meteo(n,T(:,:,kmax))
if(runtype .le. 2) then
call do_meteo(n)
#ifndef NO_BAROCLINIC
else
call do_meteo(n,T(:,:,kmax))
#endif
end if
call integrate_2d(runtype,n,tausx,tausy,airp)
#ifndef NO_3D
call do_rivers(do_3d)
if (do_3d) then
call integrate_3d(runtype,n)
......@@ -129,6 +145,7 @@
call do_biology()
#endif
end if
#endif
#ifdef TEST_NESTING
if (mod(n,80) .eq. 0) then
......@@ -138,6 +155,7 @@
call update_time(n)
call do_output(runtype,n,timestep)
#ifdef DIAGNOSE
call diagnose(n,MaxN,runtype)
#endif
......
!$Id: main.F90,v 1.2 2003-03-17 15:02:03 gotm Exp $
!$Id: main.F90,v 1.3 2003-04-07 16:39:16 kbk Exp $
#include "cppdefs.h"
!!-----------------------------------------------------------------------
!!BOI
......@@ -26,11 +26,12 @@
!
! !USES:
use initialise, only: init_model,runtype,dryrun
use commhalo, only: myid
use time, only: simtime
use domain, only: calc_points
use m2d, only: mem2d
#ifndef NO_3D
use m3d, only: mem3d
#endif
use integration
IMPLICIT NONE
!
......@@ -38,8 +39,8 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: main.F90,v $
! Revision 1.2 2003-03-17 15:02:03 gotm
! emphasizing (stable version)
! Revision 1.3 2003-04-07 16:39:16 kbk
! parallel support, NO_3D
!
! Revision 1.1.1.1 2002/05/02 14:01:25 gotm
! recovering after CVS crash
......@@ -70,13 +71,8 @@
call CPU_Time(t1)
#endif
call Date_And_Time(datestr,timestr)
STDERR LINE
STDERR 'getm ver. ',RELEASE,': Started on ',datestr,' ',timestr
STDERR LINE
call compilation_options
call init_model()
call init_model(datestr,timestr)
if ( .not. dryrun ) then
call time_loop(runtype)
end if
......@@ -93,16 +89,20 @@
LEVEL1 'Number of calc-points: ',Calc_Points
LEVEL1 'Space requirements (global 2D and 3D arrays):'
LEVEL2 '2D: ',mem2d/1024,' kbytes'
if(runtype .gt. 1) then
#ifndef NO_3D
if(runtype .ge. 2) then
LEVEL2 '3D: ',mem3d/1024,' kbytes'
end if
#endif
else
LEVEL1 'getm ver. ',RELEASE,': Completed on ',datestr,' ',timestr
LEVEL1 'Memory used (global 2D and 3D arrays):'
LEVEL2 '2D: ',mem2d/1024,' kbytes'
if(runtype .gt. 1) then
#ifndef NO_3D
if(runtype .ge. 2) then
LEVEL2 '3D: ',mem3d/1024,' kbytes'
end if
#endif
if(secs .gt. _ZERO_) then
LEVEL1 'Total CPU-time was: ',secs,' seconds'
end if
......@@ -118,9 +118,7 @@
LEVEL1 'under the General Public License (GPL) - http://www.gnu.org '
STDERR LINE
if (myid .ge. 0) then
ierr = 0
end if
call compilation_options
end program getm
......@@ -134,9 +132,22 @@
IMPLICIT NONE
!
STDERR LINE
STDERR 'Compilation options: (stable version)'
STDERR 'Compilation options (unstable version):'
STDERR LINE
!
#ifdef PARALLEL
LEVEL1 'Compiled for parallel execution'
#else
LEVEL1 'Compiled for serial execution'
#endif
!
#ifdef NO_3D
LEVEL1 'NO_3D'
#endif
#ifdef NO_BAROCLINIC
LEVEL1 'NO_BAROCLINIC'
#endif
!
#ifdef FORTRAN90
LEVEL1 'Fortran 90 compilation'
#endif
......
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