Commit e98bb189 authored by Martin Claus's avatar Martin Claus

Merge branch '2-switch-grid-for-input-topography-from-h-to-eta-branch-0-2' into '0.2'

Resolve "Switch grid for input topography from H to ETA (branch 0.2)"

See merge request !1
parents 73d3417a 333e55bb
......@@ -90,14 +90,14 @@ MODULE domain_module
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!! Coordinate vectors for all grids
!------------------------------------------------------------------
FORALL (j=1:Ny) lat_v(j) = (j - 1) * (lat_e - lat_s) / (Ny - 1) + lat_s
FORALL (j=1:Ny) lat_eta(j) = (j - 1) * (lat_e - lat_s) / (Ny - 1) + lat_s
lat_u = lat_eta
lat_v = lat_u - (lat_e - lat_s) / (2. * (Ny - 1))
lat_H = lat_v
lat_u = lat_v + (lat_e - lat_s) / (2. * (Ny - 1))
lat_eta = lat_u
FORALL (i=1:Nx) lon_H(i) = (i - 1) * (lon_e - lon_s) / (Nx - 1) + lon_s
FORALL (i=1:Nx) lon_eta(i) = (i - 1) * (lon_e - lon_s) / (Nx - 1) + lon_s
lon_v = lon_eta
lon_H = lon_eta - (lon_e - lon_s) / (2. * (Nx - 1))
lon_u = lon_H
lon_v = lon_H + (lon_e - lon_s) / (2. * (Nx - 1))
lon_eta = lon_v
if (len_trim(in_file_H).ne.0) then
......@@ -107,42 +107,39 @@ MODULE domain_module
!! close N/S boundary (should be done anyway in input H field)
!------------------------------------------------------------------
CALL initFH(in_file_H,in_varname_H,FH_H)
CALL readInitialCondition(FH_H,H,missmask)
CALL readInitialCondition(FH_H, H_eta, missmask)
missmask_H = missmask
WHERE(missmask_H .EQ. 1) H = 0._8
WHERE(H .LE. 0.) H = 0._8
WHERE(missmask_H .EQ. 1) H_eta = 0._8
WHERE(H_eta .LE. 0.) H_eta = 0._8
else
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!! create rectangular basin with closed boundaries and depth of
!! 1 m. Use h_overwrite to set a different depth.
!------------------------------------------------------------------
H = 1._8
H(1,:) = 0._8
H(Nx,:) = 0._8
H_eta = 1._8
!H_eta(1,:) = 0._8
H_eta(Nx,:) = 0._8
end if
H(:,1) = 0._8
H(:,Ny) = 0._8
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!! interpolate topography on all grids
!------------------------------------------------------------------
FORALL (i=1:Nx,j=1:Ny)
H_u(i,j) = (H(i,j) + H(i,jp1(j))) / 2._8
H_v(i,j) = (H(i,j) + H(ip1(i),j)) / 2._8
H_eta(i,j) = (H(i,j) + H(ip1(i),j) + H(i,jp1(j)) + H(ip1(i),jp1(j))) / 4._8
END FORALL
!H_eta(:,1) = 0._8
H_eta(:,Ny) = 0._8
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!! create landmasks
!------------------------------------------------------------------
land_H = 0_1
WHERE (H .EQ. 0._8) land_H = 1_1
land_eta = 0_1
WHERE (H_eta .EQ. 0._8) land_eta = 1_1
land_H = 0_1
land_u = 0_1
WHERE (H_u .EQ. 0._8) land_u = 1_1
land_v = 0_1
WHERE (H_v .EQ. 0._8) land_v = 1_1
do j = 1, Ny
do i = 1, Nx
if (land_eta(im1(i), j) + land_eta(i, j) .GT. 0_1) land_u(i, j) = 1_1
if (land_eta(i, jm1(j)) + land_eta(i, j) .GT. 0_1) land_v(i, j) = 1_1
if (land_eta(im1(i), j) + land_eta(i, j) &
+ land_eta(im1(i), jm1(j)) + land_eta(i, jm1(j)) .GT. 0_1) land_H(i, j) = 1_1
end do
end do
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!! create oceanmasks
......@@ -154,12 +151,21 @@ MODULE domain_module
#ifdef H_OVERWRITE
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!! overwrite bathimetry of all grids with constant value
!! set bathimetry of all grids with constant value
!------------------------------------------------------------------
H = ocean_H * H_overwrite
H_u = ocean_u * H_overwrite
H_v = ocean_v * H_overwrite
H_eta = ocean_eta * H_overwrite
#else
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!! interpolate topography on all grids
!------------------------------------------------------------------
FORALL (i=1:Nx,j=1:Ny)
H_u(i,j) = (H_eta(i, j) + H_eta(im1(i), j)) / 2._8
H_v(i,j) = (H_eta(i, j) + H_eta(i, jm1(j))) / 2._8
H(i,j) = (H_eta(i, j) + H_eta(im1(i),j) + H_eta(i,jm1(j)) + H_eta(im1(i),jm1(j))) / 4._8
END FORALL
#endif
!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!! set the grid-type for all grids
......
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