Commit ea1c1cf2 authored by kbk's avatar kbk
Browse files

cleaned code + TABS to spaces

parent acf5ca12
!$Id: cnv_2d.F90,v 1.1 2002-05-02 14:01:18 gotm Exp $
!$Id: cnv_2d.F90,v 1.2 2003-04-23 12:02:43 kbk Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -14,21 +14,24 @@
! !USES:
!
! !INPUT PARAMETERS:
integer, intent(in) :: il,jl,ih,jh
integer, intent(in) :: imin,jmin,imax,jmax
REALTYPE, intent(in) :: var(E2DFIELD)
integer, intent(in) :: il,jl,ih,jh
integer, intent(in) :: imin,jmin,imax,jmax
REALTYPE, intent(in) :: var(E2DFIELD)
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
REAL_4B, intent(out) :: ws(*)
REAL_4B, intent(out) :: ws(*)
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: cnv_2d.F90,v $
! Revision 1.1 2002-05-02 14:01:18 gotm
! Initial revision
! Revision 1.2 2003-04-23 12:02:43 kbk
! cleaned code + TABS to spaces
!
! Revision 1.1.1.1 2002/05/02 14:01:18 gotm
! recovering after CVS crash
!
! Revision 1.2 2001/04/21 09:41:33 bbh
! Partial fixed problem with workspace (ws) variables in ncdf_save_?d.F90 and various conversion programs
......@@ -38,8 +41,8 @@
!
!
! !LOCAL VARIABLES:
integer :: i,j
integer :: indx
integer :: i,j
integer :: indx
!EOP
!-----------------------------------------------------------------------
!BOC
......
!$Id: cnv_3d.F90,v 1.1 2002-05-02 14:01:18 gotm Exp $
!$Id: cnv_3d.F90,v 1.2 2003-04-23 12:02:43 kbk Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -14,21 +14,24 @@
! !USES:
!
! !INPUT PARAMETERS:
integer, intent(in) :: maxindx
integer, intent(in) :: iimin,jjmin,kmin,iimax,jjmax,kmax
REALTYPE, intent(in) :: var(I3DFIELD)
integer, intent(in) :: maxindx
integer, intent(in) :: iimin,jjmin,kmin,iimax,jjmax,kmax
REALTYPE, intent(in) :: var(I3DFIELD)
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
REAL_4B, intent(out) :: ws(*)
REAL_4B, intent(out) :: ws(*)
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: cnv_3d.F90,v $
! Revision 1.1 2002-05-02 14:01:18 gotm
! Initial revision
! Revision 1.2 2003-04-23 12:02:43 kbk
! cleaned code + TABS to spaces
!
! Revision 1.1.1.1 2002/05/02 14:01:18 gotm
! recovering after CVS crash
!
! Revision 1.2 2001/04/21 09:41:33 bbh
! Partial fixed problem with workspace (ws) variables in ncdf_save_?d.F90 and various conversion programs
......@@ -36,10 +39,9 @@
! Revision 1.1.1.1 2001/04/17 08:43:09 bbh
! initial import into CVS
!
!
! !LOCAL VARIABLES:
integer :: i,j,k
integer :: indx
integer :: i,j,k
integer :: indx
!EOP
!-----------------------------------------------------------------------
!BOC
......
!$Id: eta_mask.F90,v 1.1 2002-05-02 14:01:18 gotm Exp $
!$Id: eta_mask.F90,v 1.2 2003-04-23 12:02:43 kbk Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -15,12 +15,12 @@
! !USES:
!
! !INPUT PARAMETERS:
integer, intent(in) :: il,jl,ih,jh
integer, intent(in) :: imin,jmin,imax,jmax
REALTYPE, intent(in) :: z(E2DFIELD)
REALTYPE, intent(in) :: D(E2DFIELD)
REALTYPE, intent(in) :: H(E2DFIELD)
REALTYPE, intent(in) :: min_depth
integer, intent(in) :: il,jl,ih,jh
integer, intent(in) :: imin,jmin,imax,jmax
REALTYPE, intent(in) :: z(E2DFIELD)
REALTYPE, intent(in) :: D(E2DFIELD)
REALTYPE, intent(in) :: H(E2DFIELD)
REALTYPE, intent(in) :: min_depth
!
! !INPUT/OUTPUT PARAMETERS:
!
......@@ -31,8 +31,11 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: eta_mask.F90,v $
! Revision 1.1 2002-05-02 14:01:18 gotm
! Initial revision
! Revision 1.2 2003-04-23 12:02:43 kbk
! cleaned code + TABS to spaces
!
! Revision 1.1.1.1 2002/05/02 14:01:18 gotm
! recovering after CVS crash
!
! Revision 1.2 2001/04/21 09:41:33 bbh
! Partial fixed problem with workspace (ws) variables in ncdf_save_?d.F90 and various conversion programs
......@@ -42,8 +45,8 @@
!
!
! !LOCAL VARIABLES:
integer :: i,j
integer :: indx
integer :: i,j
integer :: indx
!EOP
!-----------------------------------------------------------------------
!BOC
......
!$Id: grid_interpol.F90,v 1.2 2003-04-07 15:25:06 kbk Exp $
!$Id: grid_interpol.F90,v 1.3 2003-04-23 12:02:43 kbk Exp $
#include "cppdefs.h"
#ifndef HALO
#define HALO 0
......@@ -25,9 +25,9 @@
! !PUBLIC DATA MEMBERS:
!
! !PRIVATE DATA MEMBERS:
REALTYPE, parameter :: pi=3.1415926535897932384626433832795029
REALTYPE, parameter :: deg2rad=pi/180.,rad2deg=180./pi
REALTYPE, parameter :: earth_radius=6370.9490e3
REALTYPE, parameter :: pi=3.1415926535897932384626433832795029
REALTYPE, parameter :: deg2rad=pi/180.,rad2deg=180./pi
REALTYPE, parameter :: earth_radius=6370.9490e3
REALTYPE, allocatable, dimension(:,:) :: rlon,rlat,beta
integer :: il,ih,jl,jh
......@@ -36,7 +36,10 @@
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: grid_interpol.F90,v $
! Revision 1.2 2003-04-07 15:25:06 kbk
! Revision 1.3 2003-04-23 12:02:43 kbk
! cleaned code + TABS to spaces
!
! Revision 1.2 2003/04/07 15:25:06 kbk
! parallel support
!
! Revision 1.1.1.1 2002/05/02 14:01:21 gotm
......@@ -64,21 +67,22 @@
! !IROUTINE: init_grid_interpol - initialise grid interpolation.
!
! !INTERFACE:
subroutine init_grid_interpol(imin,imax,jmin,jmax,mask, &
subroutine init_grid_interpol(imin,imax,jmin,jmax,mask, &
olon,olat,met_lon,met_lat,southpole, &
gridmap,t,u,met_mask)
gridmap,t,u,met_mask)
IMPLICIT NONE
!
! !DESCRIPTION:
! To be written.
!
! !INPUT PARAMETERS:
integer, intent(in) :: imin,imax,jmin,jmax
integer, intent(in) :: mask(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: olon(-HALO+1:,-HALO+1:),olat(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: met_lon(:,:),met_lat(:,:)
REALTYPE, intent(in) :: southpole(2)
integer, optional, intent(in) :: met_mask(:,:)
integer, intent(in) :: imin,imax,jmin,jmax
integer, intent(in) :: mask(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: olon(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: olat(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: met_lon(:,:),met_lat(:,:)
REALTYPE, intent(in) :: southpole(2)
integer, optional, intent(in) :: met_mask(:,:)
!
! !INPUT/OUTPUT PARAMETERS:
!
......@@ -91,9 +95,9 @@
! See module for log.
!
! !LOCAL VARIABLES:
integer :: rc
integer :: i,j
logical :: rotated_grid
integer :: rc
integer :: i,j
logical :: rotated_grid
!EOP
!-------------------------------------------------------------------------
#ifdef DEBUG
......@@ -153,24 +157,25 @@ stop 'init_grid_interpol.F90'
! To be written.
!
! !INPUT PARAMETERS:
integer, intent(in) :: mask(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: ifield(:,:)
integer, intent(in) :: gridmap(-HALO+1:,-HALO+1:,1:)
REALTYPE, intent(in) :: t(-HALO+1:,-HALO+1:),u(-HALO+1:,-HALO+1:)
integer, intent(in) :: mask(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: ifield(:,:)
integer, intent(in) :: gridmap(-HALO+1:,-HALO+1:,1:)
REALTYPE, intent(in) :: t(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: u(-HALO+1:,-HALO+1:)
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
REALTYPE, intent(out) :: ofield(-HALO+1:,-HALO+1:)
REALTYPE, intent(out) :: ofield(-HALO+1:,-HALO+1:)
!
! !REVISION HISTORY:
!
! See module for log.
!
! !LOCAL VARIABLES:
integer :: i,j
integer :: i1,i2,j1,j2
REALTYPE :: d11,d21,d22,d12
integer :: i,j
integer :: i1,i2,j1,j2
REALTYPE :: d11,d21,d22,d12
!
!EOP
!-------------------------------------------------------------------------
......@@ -200,8 +205,8 @@ stop 'init_grid_interpol.F90'
d21 = t(i,j)*(_ONE_-u(i,j))
d22 = t(i,j)*u(i,j)
d12 = (_ONE_-t(i,j))*u(i,j)
ofield(i,j) = d11*ifield(i1,j1)+d21*ifield(i2,j1)+ &
d22*ifield(i2,j2)+d12*ifield(i1,j2)
ofield(i,j) = d11*ifield(i1,j1)+d21*ifield(i2,j1)+ &
d22*ifield(i2,j2)+d12*ifield(i1,j2)
end if
else
ofield(i,j) = _ZERO_
......@@ -250,23 +255,24 @@ stop 'kbk'
! To be written.
!
! !INPUT PARAMETERS:
REALTYPE, intent(in) :: ifield(:,:,:)
integer, intent(in) :: gridmap(-HALO+1:,-HALO+1:,1:)
REALTYPE, intent(in) :: t(-HALO+1:,-HALO+1:),u(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: ifield(:,:,:)
integer, intent(in) :: gridmap(-HALO+1:,-HALO+1:,1:)
REALTYPE, intent(in) :: t(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: u(-HALO+1:,-HALO+1:)
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
REALTYPE, intent(out) :: ofield(-HALO+1:,-HALO+1:,0:)
REALTYPE, intent(out) :: ofield(-HALO+1:,-HALO+1:,0:)
!
! !REVISION HISTORY:
!
! See module for log.
!
! !LOCAL VARIABLES:
integer :: i,j
integer :: i1,i2,j1,j2
REALTYPE :: d11,d21,d22,d12
integer :: i,j
integer :: i1,i2,j1,j2
REALTYPE :: d11,d21,d22,d12
!
!EOP
!-------------------------------------------------------------------------
......@@ -285,8 +291,8 @@ stop 'kbk'
d21 = t(i,j)*(_ONE_-u(i,j))
d22 = t(i,j)*u(i,j)
d12 = (_ONE_-t(i,j))*u(i,j)
ofield(i,j,1:) = d11*ifield(i1,j1,:)+d21*ifield(i2,j1,:)+ &
d22*ifield(i2,j2,:)+d12*ifield(i1,j2,:)
ofield(i,j,1:) = d11*ifield(i1,j1,:)+d21*ifield(i2,j1,:)+ &
d22*ifield(i2,j2,:)+d12*ifield(i1,j2,:)
end do
end do
......@@ -311,25 +317,27 @@ stop 'kbk'
! To be written.
!
! !INPUT PARAMETERS:
REALTYPE, intent(in) :: southpole(2)
REALTYPE, intent(in) :: met_lon(-HALO+1:,-HALO+1:),met_lat(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: southpole(2)
REALTYPE, intent(in) :: met_lon(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: met_lat(-HALO+1:,-HALO+1:)
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
REALTYPE, intent(out):: rot_lon(-HALO+1:,-HALO+1:),rot_lat(-HALO+1:,-HALO+1:)
REALTYPE, intent(out):: beta(-HALO+1:,-HALO+1:)
REALTYPE, intent(out) :: rot_lon(-HALO+1:,-HALO+1:)
REALTYPE, intent(out) :: rot_lat(-HALO+1:,-HALO+1:)
REALTYPE, intent(out) :: beta(-HALO+1:,-HALO+1:)
!
! !REVISION HISTORY:
!
! See module for log.
!
! !LOCAL VARIABLES:
integer :: i,j
REALTYPE :: sinphis,cosphis
REALTYPE :: alpha,cosalpha,sinalpha
REALTYPE :: phi,sinphi,cosphi
REALTYPE :: SA,CA,SB,CB
integer :: i,j
REALTYPE :: sinphis,cosphis
REALTYPE :: alpha,cosalpha,sinalpha
REALTYPE :: phi,sinphi,cosphi
REALTYPE :: SA,CA,SB,CB
!
!EOP
!-------------------------------------------------------------------------
......@@ -389,7 +397,7 @@ stop 'kbk'
! usually the radius of the earth.
!
! !INPUT PARAMETERS:
REALTYPE, intent(in) :: radius,lon1,lat1,lon2,lat2
REALTYPE, intent(in) :: radius,lon1,lat1,lon2,lat2
!
! !INPUT/OUTPUT PARAMETERS:
!
......@@ -400,7 +408,7 @@ stop 'kbk'
! See module for log.
!
! !LOCAL VARIABLES:
REALTYPE :: a,b,c
REALTYPE :: a,b,c
!
!EOP
!-------------------------------------------------------------------------
......@@ -424,27 +432,29 @@ stop 'kbk'
! To be written.
!
! !INPUT PARAMETERS:
integer, intent(in) :: mask(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: olon(-HALO+1:,-HALO+1:),olat(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: met_lon(:,:),met_lat(:,:)
integer, optional, intent(in) :: met_mask(:,:)
integer, intent(in) :: mask(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: olon(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: olat(-HALO+1:,-HALO+1:)
REALTYPE, intent(in) :: met_lon(:,:),met_lat(:,:)
integer, optional, intent(in) :: met_mask(:,:)
!
! !INPUT/OUTPUT PARAMETERS:
!
! !OUTPUT PARAMETERS:
integer, intent(out):: gridmap(-HALO+1:,-HALO+1:,1:)
REALTYPE, intent(out):: t(-HALO+1:,-HALO+1:),u(-HALO+1:,-HALO+1:)
integer, intent(out) :: gridmap(-HALO+1:,-HALO+1:,1:)
REALTYPE, intent(out) :: t(-HALO+1:,-HALO+1:)
REALTYPE, intent(out) :: u(-HALO+1:,-HALO+1:)
!
! !REVISION HISTORY:
!
! See module for log.
!
! !LOCAL VARIABLES:
integer :: i,j,im,jm
REALTYPE :: x,y,lon1,lat1,lon2,lat2
integer :: ngood
logical :: outside=.false.
integer :: max_i,max_j
integer :: i,j,im,jm
REALTYPE :: x,y,lon1,lat1,lon2,lat2
integer :: ngood
logical :: outside=.false.
integer :: max_i,max_j
!EOP
!-------------------------------------------------------------------------
! first find the lower left (im,jm) in the m-grid which coresponds to
......@@ -493,13 +503,13 @@ max_j = size(met_lat,2)
y = olat(i,j)
im = gridmap(i,j,1)
jm = gridmap(i,j,2)
if(im .ge. max_i .or. jm .ge. max_j) then
if(im .ge. max_i .or. jm .ge. max_j) then
t(i,j) = _ZERO_
u(i,j) = _ZERO_
else
if(present(met_mask)) then
ngood = met_mask(im ,jm )+met_mask(im+1,jm )+ &
met_mask(im+1,jm+1)+met_mask(im ,jm+1)
met_mask(im+1,jm+1)+met_mask(im ,jm+1)
else
ngood = 4
end if
......
!$Id: halo_mpi.F90,v 1.1 2003-04-07 12:05:42 kbk Exp $
!$Id: halo_mpi.F90,v 1.2 2003-04-23 12:02:43 kbk Exp $
#include "cppdefs.h"
#ifndef HALO
#define HALO 0
#endif
#define STATIC
!kbk#define STATIC
!-----------------------------------------------------------------------
!BOP
......@@ -25,78 +25,81 @@ include "mpif.h"
private
!
! !PUBLIC MEMBER FUNCTIONS:
public :: init_mpi,print_MPI_info,barrier
public :: set_active_communicator
public :: update_2d_halo_mpi,update_3d_halo_mpi,wait_halo_mpi
public :: part_domain_mpi
integer, public, parameter :: H_TAG=10,HU_TAG=11,HV_TAG=12
integer, public, parameter :: D_TAG=20,DU_TAG=21,DV_TAG=22
integer, public, parameter :: z_TAG=30,U_TAG=31,V_TAG=32
private :: MPI_data_types
public :: init_mpi,print_MPI_info,barrier
public :: set_active_communicator
public :: update_2d_halo_mpi
public :: update_3d_halo_mpi
public :: wait_halo_mpi
public:: part_domain_mpi
integer, public, parameter :: H_TAG=10,HU_TAG=11,HV_TAG=12
integer, public, parameter :: D_TAG=20,DU_TAG=21,DV_TAG=22
integer, public, parameter :: z_TAG=30,U_TAG=31,V_TAG=32
private :: MPI_data_types
! !PUBLIC DATA MEMBERS:
integer, public :: myid=-1, nprocs=1
integer, public :: comm_hd=MPI_COMM_WORLD
! integer, public :: comm_wave=MPI_COMM_WORLD
! integer, public :: comm_biology=MPI_COMM_WORLD
integer, public :: myid=-1, nprocs=1
integer, public :: comm_hd=MPI_COMM_WORLD
! integer, public :: comm_wave=MPI_COMM_WORLD
! integer, public :: comm_biology=MPI_COMM_WORLD
!
! !DEFINED PARAMETERS:
integer, parameter :: nneighbours=8
integer, parameter :: nneighbours=8
! Different mesh specification methods
integer, parameter :: ONE_CELL=-1
integer, parameter :: ONED_MESH=0
integer, parameter :: TWOD_MESH=1
integer, parameter :: MESH_FROM_FILE=2
integer, parameter :: ONE_CELL=-1
integer, parameter :: ONED_MESH=0
integer, parameter :: TWOD_MESH=1
integer, parameter :: MESH_FROM_FILE=2
! Methods of communication
integer, parameter :: ONE_PROCESS=-1
integer, parameter :: ONED_SENDRECV=0
integer, parameter :: ONED_NONBLOCKING=1
integer, parameter :: TWOD_SENDRECV=2
integer, parameter :: TWOD_NONBLOCKING=3
integer, parameter :: ONE_PROCESS=-1
integer, parameter :: ONED_SENDRECV=0
integer, parameter :: ONED_NONBLOCKING=1
integer, parameter :: TWOD_SENDRECV=2
integer, parameter :: TWOD_NONBLOCKING=3
! Direction in case of ONED_? communications
integer, parameter :: RIGHT_LEFT=1
integer, parameter :: DOWN_UP=2
integer, parameter :: RIGHT_LEFT=1
integer, parameter :: DOWN_UP=2
! Last action
! integer, parameter :: SEND_1D=1
! integer, parameter :: SEND_2D=2
integer, parameter :: SENDING=1
integer, parameter :: WAITING=2
integer, parameter :: SENDING=1
integer, parameter :: WAITING=2
!
! !REVISION HISTORY:
! Original author(s): Karsten Bolding & Hans Burchard
!
! $Log: halo_mpi.F90,v $
! Revision 1.1 2003-04-07 12:05:42 kbk
! Revision 1.2 2003-04-23 12:02:43 kbk
! cleaned code + TABS to spaces
!
! Revision 1.1 2003/04/07 12:05:42 kbk
! new parallel related files
!
! Revision 1.1.1.1 2002/05/02 14:01:30 gotm
! recovering after CVS crash
!
! !LOCAL VARIABLES:
character(LEN = 256), private :: pname
integer :: active_comm=MPI_COMM_WORLD
integer :: mesh_method=ONE_CELL
logical :: re_order=.false.
integer :: comm_method=ONE_PROCESS
integer :: len
integer :: ierr
integer :: x_line,x_lines,y_line,y_lines
integer :: i1_slice
integer :: xz_slice,xz_slices
integer :: yz_slice,yz_slices
integer :: z_column
integer :: x_size,y_size,z_size
integer :: xy_size,xz_size,yz_size,xyz_size
integer :: com_direction
integer :: req(2*nneighbours)
integer :: status_array(MPI_STATUS_SIZE,2*nneighbours)
integer :: dims(2),coords(2)
logical :: periods(2)
integer :: up,down,left,right
integer :: ur,ul,ll,lr
integer :: status(MPI_STATUS_SIZE)
integer :: last_action=WAITING
character(LEN = 256), private:: pname
integer :: active_comm=MPI_COMM_WORLD
integer :: mesh_method=ONE_CELL
logical :: re_order=.false.
integer :: comm_method=ONE_PROCESS
integer :: len
integer :: ierr
integer :: x_line,x_lines,y_line,y_lines
integer :: i1_slice
integer :: xz_slice,xz_slices
integer :: yz_slice,yz_slices
integer :: z_column
integer :: x_size,y_size,z_size
integer :: xy_size,xz_size,yz_size,xyz_size
integer :: com_direction
integer :: req(2*nneighbours)
integer :: status_array(MPI_STATUS_SIZE,2*nneighbours)
integer :: dims(2),coords(2)
logical :: periods(2)
integer :: up,down,left,right
integer :: ur,ul,ll,lr
integer :: status(MPI_STATUS_SIZE)
integer :: last_action=WAITING
!EOP
!-----------------------------------------------------------------------
!BOC
......@@ -116,7 +119,7 @@ include "mpif.h"
! Initialize MPI parallel environment, i.e. getting process id etc.
!
! !INPUT PARAMTERS:
character(len=*) :: input_dir
character(len=*) :: input_dir
!
! !INPUT/OUTPUT PARAMTERS:
!
......@@ -126,9 +129,10 @@ include "mpif.h"
! Original author(s): Karsten Bolding & Hans Burchard
!
! !LOCAL VARIABLES:
integer :: MeshMethod,MsgMethod
logical :: reorder
namelist /nampar/ MeshMethod,reorder,MsgMethod
integer :: MeshMethod,MsgMethod
logical :: reorder
namelist /nampar/ &
MeshMethod,reorder,MsgMethod
!