Commit 7418b137 authored by kbk's avatar kbk
Browse files

support for biology via GOTMs biology modules

parent e939ae08
...@@ -81,6 +81,9 @@ ...@@ -81,6 +81,9 @@
if (rc /= 0) stop 'init_3d: Error allocating memory (spm_pool)' if (rc /= 0) stop 'init_3d: Error allocating memory (spm_pool)'
#endif #endif
allocate(light(I3DFIELD),stat=rc) ! light advection velocity
if (rc /= 0) stop 'init_3d: Error allocating memory (light)'
#ifdef UV_TVD #ifdef UV_TVD
allocate(uadv(I3DFIELD),stat=rc) ! u advection velocity allocate(uadv(I3DFIELD),stat=rc) ! u advection velocity
if (rc /= 0) stop 'init_3d: Error allocating memory (uadv)' if (rc /= 0) stop 'init_3d: Error allocating memory (uadv)'
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
REALTYPE, dimension(:,:), allocatable :: spm_pool REALTYPE, dimension(:,:), allocatable :: spm_pool
#endif #endif
REALTYPE, dimension(:,:,:), allocatable :: light
#ifdef UV_TVD #ifdef UV_TVD
REALTYPE, dimension(:,:,:), allocatable :: uadv,vadv,wadv REALTYPE, dimension(:,:,:), allocatable :: uadv,vadv,wadv
REALTYPE, dimension(:,:,:), allocatable :: huadv,hvadv,hoadv,hnadv REALTYPE, dimension(:,:,:), allocatable :: huadv,hvadv,hoadv,hnadv
......
!$Id: m3d.F90,v 1.24 2005-04-25 07:55:50 kbk Exp $ !$Id: m3d.F90,v 1.25 2005-09-23 11:27:10 kbk Exp $
#include "cppdefs.h" #include "cppdefs.h"
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
!BOP !BOP
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
#endif #endif
#ifdef SPM #ifdef SPM
use suspended_matter, only: init_spm, do_spm use suspended_matter, only: init_spm, do_spm
#endif
#ifdef GETM_BIO
use bio, only: bio_calc
use getm_bio, only: init_getm_bio, do_getm_bio
#endif #endif
use variables_3d use variables_3d
use advection_3d, only: init_advection_3d use advection_3d, only: init_advection_3d
...@@ -54,7 +58,10 @@ ...@@ -54,7 +58,10 @@
! Original author(s): Karsten Bolding & Hans Burchard ! Original author(s): Karsten Bolding & Hans Burchard
! !
! $Log: m3d.F90,v $ ! $Log: m3d.F90,v $
! Revision 1.24 2005-04-25 07:55:50 kbk ! Revision 1.25 2005-09-23 11:27:10 kbk
! support for biology via GOTMs biology modules
!
! Revision 1.24 2005/04/25 07:55:50 kbk
! use more general frame for error handling - Umlauf ! use more general frame for error handling - Umlauf
! !
! Revision 1.23 2004/08/09 07:48:07 kbk ! Revision 1.23 2004/08/09 07:48:07 kbk
...@@ -279,6 +286,10 @@ ...@@ -279,6 +286,10 @@
if(calc_spm) stop 'To use SPM you have to recompile with -DSPM' if(calc_spm) stop 'To use SPM you have to recompile with -DSPM'
#endif #endif
#ifndef GETM_BIO
!KBK if(bio_calc) stop 'To use BIO you have to recompile with -DBIO'
#endif
! Allocates memory for the public data members - if not static ! Allocates memory for the public data members - if not static
call init_variables_3d(runtype) call init_variables_3d(runtype)
...@@ -387,9 +398,15 @@ ...@@ -387,9 +398,15 @@
end if end if
end if end if
#endif #endif
#ifdef SPM #ifdef SPM
if(calc_spm) call init_spm(hotstart_spm,runtype) if(calc_spm) call init_spm(hotstart_spm,runtype)
if(runtype.ne.4) call init_advection_3d(2) if(runtype .ne. 4) call init_advection_3d(2)
#endif
#ifdef GETM_BIO
!KBK if(bio_calc) call init_getm_bio()
call init_getm_bio()
#endif #endif
if (bdy3d) call init_bdy_3d() if (bdy3d) call init_bdy_3d()
...@@ -512,7 +529,11 @@ ...@@ -512,7 +529,11 @@
#endif #endif
#ifdef SPM #ifdef SPM
if (calc_spm) call do_spm() if (calc_spm) call do_spm()
#endif
#ifdef GETM_BIO
if (bio_calc) call do_getm_bio(dt)
#endif #endif
UEx=_ZERO_ ; VEx=_ZERO_ UEx=_ZERO_ ; VEx=_ZERO_
......
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
REALTYPE :: spm_pool(I2DFIELD) REALTYPE :: spm_pool(I2DFIELD)
#endif #endif
REALTYPE :: light(I3DFIELD)
#ifdef UV_TVD #ifdef UV_TVD
REALTYPE :: uadv(I3DFIELD) REALTYPE :: uadv(I3DFIELD)
REALTYPE :: vadv(I3DFIELD) REALTYPE :: vadv(I3DFIELD)
......
!$Id: variables_3d.F90,v 1.6 2004-01-06 15:04:00 kbk Exp $ !$Id: variables_3d.F90,v 1.7 2005-09-23 11:27:10 kbk Exp $
#include "cppdefs.h" #include "cppdefs.h"
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
!BOP !BOP
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
#include "static_3d.h" #include "static_3d.h"
#else #else
#include "dynamic_declarations_3d.h" #include "dynamic_declarations_3d.h"
#endif
#ifdef GETM_BIO
REALTYPE, allocatable :: cc3d(:,:,:,:)
REALTYPE, allocatable :: ws3d(:,:,:,:)
#endif #endif
integer :: size3d_field integer :: size3d_field
integer :: mem3d integer :: mem3d
...@@ -35,7 +40,10 @@ ...@@ -35,7 +40,10 @@
! Original author(s): Karsten Bolding & Hans Burchard ! Original author(s): Karsten Bolding & Hans Burchard
! !
! $Log: variables_3d.F90,v $ ! $Log: variables_3d.F90,v $
! Revision 1.6 2004-01-06 15:04:00 kbk ! Revision 1.7 2005-09-23 11:27:10 kbk
! support for biology via GOTMs biology modules
!
! Revision 1.6 2004/01/06 15:04:00 kbk
! FCT advection + split of advection_3d.F90 + extra adv. input checks ! FCT advection + split of advection_3d.F90 + extra adv. input checks
! !
! Revision 1.5 2003/12/16 15:58:54 kbk ! Revision 1.5 2003/12/16 15:58:54 kbk
...@@ -126,6 +134,8 @@ ...@@ -126,6 +134,8 @@
uuEx= _ZERO_ ; vvEx= _ZERO_ uuEx= _ZERO_ ; vvEx= _ZERO_
tke=1.e-10 ; eps=1.e-10 tke=1.e-10 ; eps=1.e-10
light=_ONE_
#ifdef UV_TVD #ifdef UV_TVD
uadv = _ZERO_ ; vadv = _ZERO_ ; wadv = _ZERO_ uadv = _ZERO_ ; vadv = _ZERO_ ; wadv = _ZERO_
hnadv = _ZERO_ ; hoadv = _ZERO_ hnadv = _ZERO_ ; hoadv = _ZERO_
......
#$Id: Rules.make,v 1.11 2004-06-15 08:25:57 kbk Exp $ #$Id: Rules.make,v 1.12 2005-09-23 11:27:10 kbk Exp $
# #
# This file contains rules which are shared between multiple Makefiles. # This file contains rules which are shared between multiple Makefiles.
# This file is quite complicated - all compilation options are set in this # This file is quite complicated - all compilation options are set in this
...@@ -35,6 +35,10 @@ ifeq ($(GETM_SPM),true) ...@@ -35,6 +35,10 @@ ifeq ($(GETM_SPM),true)
DEFINES += -DSPM DEFINES += -DSPM
endif endif
ifeq ($(GETM_BIO),true)
DEFINES += -DGETM_BIO
endif
# The compilation mode is obtained from $COMPILATION_MODE # The compilation mode is obtained from $COMPILATION_MODE
# default production - else debug or profiling # default production - else debug or profiling
ifndef GETM_PARALLEL ifndef GETM_PARALLEL
...@@ -101,6 +105,10 @@ INCDIRS = -I$(GETMDIR)/include -I$(MODDIR) ...@@ -101,6 +105,10 @@ INCDIRS = -I$(GETMDIR)/include -I$(MODDIR)
LINKDIRS = -L$(LIBDIR) LINKDIRS = -L$(LIBDIR)
EXTRA_LIBS = EXTRA_LIBS =
ifeq ($(GETM_BIO),true)
EXTRA_LIBS += -lbio$(buildtype)
endif
ifeq ($(turbulence),gotm) ifeq ($(turbulence),gotm)
ifndef GOTMDIR ifndef GOTMDIR
GOTMDIR = $(HOME)/gotm GOTMDIR = $(HOME)/gotm
......
!$Id: initialise.F90,v 1.7 2004-06-15 09:04:51 kbk Exp $ !$Id: initialise.F90,v 1.8 2005-09-23 11:27:10 kbk Exp $
#include "cppdefs.h" #include "cppdefs.h"
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
!BOP !BOP
...@@ -22,7 +22,10 @@ ...@@ -22,7 +22,10 @@
! Original author(s): Karsten Bolding & Hans Burchard ! Original author(s): Karsten Bolding & Hans Burchard
! !
! $Log: initialise.F90,v $ ! $Log: initialise.F90,v $
! Revision 1.7 2004-06-15 09:04:51 kbk ! Revision 1.8 2005-09-23 11:27:10 kbk
! support for biology via GOTMs biology modules
!
! Revision 1.7 2004/06/15 09:04:51 kbk
! CONST_VISC --> CONSTANT_VISCOSITY - Ruiz ! CONST_VISC --> CONSTANT_VISCOSITY - Ruiz
! !
! Revision 1.6 2004/01/13 07:49:06 kbk ! Revision 1.6 2004/01/13 07:49:06 kbk
...@@ -103,6 +106,9 @@ ...@@ -103,6 +106,9 @@
use m3d, only: cord_relax,init_3d,ssen,ssun,ssvn use m3d, only: cord_relax,init_3d,ssen,ssun,ssvn
#ifndef NO_BAROCLINIC #ifndef NO_BAROCLINIC
use m3d, only: T use m3d, only: T
#endif
#ifdef GETM_BIO
use rivers, only: init_rivers_bio
#endif #endif
use turbulence, only: init_turbulence use turbulence, only: init_turbulence
use mtridiagonal, only: init_tridiagonal use mtridiagonal, only: init_tridiagonal
...@@ -231,21 +237,20 @@ ...@@ -231,21 +237,20 @@
call init_domain(input_dir) call init_domain(input_dir)
!KBK-2003-02-10 call init_output(runid,title,start,runtype,dryrun,myid)
call init_meteo() call init_meteo()
#ifndef NO_3D #ifndef NO_3D
call init_rivers() call init_rivers()
#endif #endif
call init_output(runid,title,start,runtype,dryrun,myid)
call init_2d(runtype,timestep,hotstart) call init_2d(runtype,timestep,hotstart)
#ifndef NO_3D #ifndef NO_3D
if (runtype .gt. 1) then if (runtype .gt. 1) then
call init_3d(runtype,timestep,hotstart) call init_3d(runtype,timestep,hotstart)
#ifdef GETM_BIO
call init_rivers_bio
#endif
#ifndef CONSTANT_VISCOSITY #ifndef CONSTANT_VISCOSITY
call init_turbulence(60,trim(input_dir) // 'gotmturb.inp',kmax) call init_turbulence(60,trim(input_dir) // 'gotmturb.inp',kmax)
#else #else
...@@ -254,9 +259,12 @@ ...@@ -254,9 +259,12 @@
LEVEL2 'background turbulent viscosity set to',avmback LEVEL2 'background turbulent viscosity set to',avmback
LEVEL2 'background turbulent diffusivity set to',avhback LEVEL2 'background turbulent diffusivity set to',avhback
call init_tridiagonal(kmax) call init_tridiagonal(kmax)
end if end if
#endif #endif
call init_output(runid,title,start,runtype,dryrun,myid)
#if 0 #if 0
call init_waves(hotstart) call init_waves(hotstart)
call init_biology(hotstart) call init_biology(hotstart)
......
!$Id: init_3d_ncdf.F90,v 1.9 2005-04-25 09:32:34 kbk Exp $ !$Id: init_3d_ncdf.F90,v 1.10 2005-09-23 11:27:10 kbk Exp $
#include "cppdefs.h" #include "cppdefs.h"
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
!BOP !BOP
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
use domain, only: ioff,joff use domain, only: ioff,joff
use domain, only: imin,imax,jmin,jmax,kmax use domain, only: imin,imax,jmin,jmax,kmax
use domain, only: vert_cord use domain, only: vert_cord
#ifdef GETM_BIO
use bio_var, only: numc,var_names,var_units,var_long
#endif
IMPLICIT NONE IMPLICIT NONE
! !
...@@ -29,7 +32,10 @@ ...@@ -29,7 +32,10 @@
! !REVISION HISTORY: ! !REVISION HISTORY:
! !
! $Log: init_3d_ncdf.F90,v $ ! $Log: init_3d_ncdf.F90,v $
! Revision 1.9 2005-04-25 09:32:34 kbk ! Revision 1.10 2005-09-23 11:27:10 kbk
! support for biology via GOTMs biology modules
!
! Revision 1.9 2005/04/25 09:32:34 kbk
! added NetCDF IO rewrite + de-stag of velocities - Umlauf ! added NetCDF IO rewrite + de-stag of velocities - Umlauf
! !
! Revision 1.8 2004/10/07 15:46:56 kbk ! Revision 1.8 2004/10/07 15:46:56 kbk
...@@ -79,6 +85,7 @@ ...@@ -79,6 +85,7 @@
! !
! !LOCAL VARIABLES: ! !LOCAL VARIABLES:
integer :: err integer :: err
integer :: n,rc
integer :: xlen,ylen,zlen integer :: xlen,ylen,zlen
integer :: scalar(1),axisdim(1),f3_dims(3),f4_dims(4) integer :: scalar(1),axisdim(1),f3_dims(3),f4_dims(4)
REALTYPE :: fv,mv,vr(2) REALTYPE :: fv,mv,vr(2)
...@@ -331,14 +338,11 @@ ...@@ -331,14 +338,11 @@
do n=1,numc do n=1,numc
err = nf_def_var(ncid,var_names(n),NF_REAL,4,f4_dims,bio_ids(n)) err = nf_def_var(ncid,var_names(n),NF_REAL,4,f4_dims,bio_ids(n))
if (err .NE. NF_NOERR) go to 10 if (err .NE. NF_NOERR) go to 10
STDERR n,var_names(n),bio_ids(n)
call set_attributes(ncid,bio_ids(n), & call set_attributes(ncid,bio_ids(n), &
long_name=var_long(n), & long_name=trim(var_long(n)), &
units=' ', & units=trim(var_units(n)), &
FillValue=fv,missing_value=mv,valid_range=vr) FillValue=fv,missing_value=mv,valid_range=vr)
end do end do
STDERR 'init_3d_ncdf() - remember more bio settings'
#endif #endif
! globals ! globals
......
!$Id: save_3d_ncdf.F90,v 1.10 2005-04-25 09:32:34 kbk Exp $ !$Id: save_3d_ncdf.F90,v 1.11 2005-09-23 11:27:10 kbk Exp $
#include "cppdefs.h" #include "cppdefs.h"
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
!BOP !BOP
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
use variables_3d, only: tke,num,nuh,eps use variables_3d, only: tke,num,nuh,eps
#ifdef SPM #ifdef SPM
use variables_3d, only: spm_pool,spm use variables_3d, only: spm_pool,spm
#endif
#ifdef GETM_BIO
use bio_var, only: numc
use variables_3d, only: cc3d,ws3d
#endif #endif
use parameters, only: g,rho_0 use parameters, only: g,rho_0
IMPLICIT NONE IMPLICIT NONE
...@@ -40,7 +44,10 @@ ...@@ -40,7 +44,10 @@
! Original author(s): Karsten Bolding & Hans Burchard ! Original author(s): Karsten Bolding & Hans Burchard
! !
! $Log: save_3d_ncdf.F90,v $ ! $Log: save_3d_ncdf.F90,v $
! Revision 1.10 2005-04-25 09:32:34 kbk ! Revision 1.11 2005-09-23 11:27:10 kbk
! support for biology via GOTMs biology modules
!
! Revision 1.10 2005/04/25 09:32:34 kbk
! added NetCDF IO rewrite + de-stag of velocities - Umlauf ! added NetCDF IO rewrite + de-stag of velocities - Umlauf
! !
! Revision 1.9 2004/06/15 08:25:57 kbk ! Revision 1.9 2004/06/15 08:25:57 kbk
...@@ -84,7 +91,7 @@ ...@@ -84,7 +91,7 @@
! !
! !
! !LOCAL VARIABLES: ! !LOCAL VARIABLES:
integer :: err integer :: err,n
integer :: start(4),edges(4) integer :: start(4),edges(4)
integer, save :: n3d=0 integer, save :: n3d=0
REALTYPE, parameter :: x=-rho_0/g REALTYPE, parameter :: x=-rho_0/g
......
!$Id: output.F90,v 1.11 2005-05-04 11:45:30 kbk Exp $ !$Id: output.F90,v 1.12 2005-09-23 11:27:11 kbk Exp $
#include "cppdefs.h" #include "cppdefs.h"
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
!BOP !BOP
...@@ -55,7 +55,10 @@ ...@@ -55,7 +55,10 @@
! Original author(s): Karsten Bolding & Hans Burchard ! Original author(s): Karsten Bolding & Hans Burchard
! !
! $Log: output.F90,v $ ! $Log: output.F90,v $
! Revision 1.11 2005-05-04 11:45:30 kbk ! Revision 1.12 2005-09-23 11:27:11 kbk
! support for biology via GOTMs biology modules
!
! Revision 1.11 2005/05/04 11:45:30 kbk
! adding model time stamp on IO ! adding model time stamp on IO
! !
! Revision 1.10 2005/04/25 09:32:34 kbk ! Revision 1.10 2005/04/25 09:32:34 kbk
...@@ -359,7 +362,13 @@ ...@@ -359,7 +362,13 @@
#endif #endif
#ifdef SPM #ifdef SPM
use m3d, only: spm,spm_pool,calc_spm,hotstart_spm use m3d, only: spm,spm_pool,calc_spm,hotstart_spm
#endif #endif
#ifdef GETM_BIO
use bio, only: bio_calc
use bio_var, only: numc
use getm_bio, only: hotstart_bio
use variables_3d, only: cc3d
#endif
IMPLICIT NONE IMPLICIT NONE
! !
! !INPUT PARAMETERS: ! !INPUT PARAMETERS:
...@@ -377,6 +386,7 @@ ...@@ -377,6 +386,7 @@
! !
! !LOCAL VARIABLES ! !LOCAL VARIABLES
integer, save :: n=0 integer, save :: n=0
integer :: i
logical, save :: continuous=.false. logical, save :: continuous=.false.
integer :: jd,secs integer :: jd,secs
character(len=19) :: timestr_out character(len=19) :: timestr_out
...@@ -417,7 +427,13 @@ ...@@ -417,7 +427,13 @@
LEVEL3 'saving spm' LEVEL3 'saving spm'
write(RESTART) spm write(RESTART) spm
write(RESTART) spm_pool write(RESTART) spm_pool
end if end if
#endif
#ifdef GETM_BIO
if(bio_calc) then
LEVEL3 'saving bio variables'
write(RESTART) cc3d
end if
#endif #endif
end if end if
#endif #endif
...@@ -462,6 +478,12 @@ ...@@ -462,6 +478,12 @@
LEVEL3 'set spm_init_method=0 to read them from hotstart file' LEVEL3 'set spm_init_method=0 to read them from hotstart file'
end if end if
end if end if
#endif
#ifdef GETM_BIO
if(bio_calc .and. hotstart_bio) then
LEVEL3 'reading bio variables'
read(RESTART) cc3d
end if
#endif #endif
end if end if
#endif #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