Skip to content
Snippets Groups Projects
Commit 07a0d47c authored by Evgeny Mortikov's avatar Evgeny Mortikov
Browse files

grid implementation update

parent ab23d4a8
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,9 @@ module obl_grid
real, allocatable :: dzp(:) !< = dz(k) + dz(k + 1) [m]
real, allocatable :: dzm(:) !< = dz(k) + dz(k - 1) [m]
real, allocatable :: dzph(:) !< = 0.5 * (dz(k) + dz(k + 1)) [m]
real, allocatable :: dzmh(:) !< = 0.5 * (dz(k) + dz(k - 1)) [m]
end type
......@@ -87,7 +90,9 @@ module obl_grid
close(io)
if (nedge > 0) then
allocate(edge(nedge))
endif
! --- read input data
open(newunit = io, file = filename, iostat = status, status = 'old')
......@@ -130,12 +135,17 @@ module obl_grid
grid%cz = cz
if (grid%cz == 0) return
allocate(grid%z(grid%cz))
allocate(grid%dz(grid%cz))
allocate(grid%dzp(grid%cz))
allocate(grid%dzm(grid%cz))
allocate(grid%dzph(grid%cz))
allocate(grid%dzmh(grid%cz))
do k = 1, grid%cz
grid%z(k) = 0.5 * (edge(k) + edge(k + 1))
grid%dz(k) = edge(k + 1) - edge(k)
......@@ -151,6 +161,11 @@ module obl_grid
grid%dzm(k) = grid%dz(k) + grid%dz(k - 1)
end do
do k = 1, grid%cz
grid%dzph(k) = 0.5 * grid%dzp(k)
grid%dzmh(k) = 0.5 * grid%dzm(k)
end do
end subroutine set_generic_grid
subroutine deallocate_grid(grid)
......@@ -165,6 +180,9 @@ module obl_grid
deallocate(grid%dzp)
deallocate(grid%dzm)
deallocate(grid%dzph)
deallocate(grid%dzmh)
end if
grid%cz = 0
......
......@@ -36,9 +36,9 @@ module obl_state_eq
! --------------------------------------------------------------------------------
integer, intent(in) :: cz !< grid size
real, intent(out) :: Rho(cz) !< density, [kg / m**3]
real, intent(in) :: Theta_dev(cz) !< temperature, [K]
real, intent(in) :: Salin_dev(cz) !< salinity, [PSU]
real, dimension(cz), intent(out) :: Rho !< density, [kg / m**3]
real, dimension(cz), intent(in) :: Theta_dev !< temperature, [K]
real, dimension(cz), intent(in) :: Salin_dev !< salinity, [PSU]
integer :: k
! --------------------------------------------------------------------------------
......@@ -55,9 +55,9 @@ module obl_state_eq
! --------------------------------------------------------------------------------
integer, intent(in) :: cz !< grid size
real, intent(out) :: Rho_dev(cz) !< density, [kg / m**3]
real, intent(in) :: Theta_dev(cz) !< temperature, [K]
real, intent(in) :: Salin_dev(cz) !< salinity, [PSU]
real, dimension(cz), intent(out) :: Rho_dev !< density, [kg / m**3]
real, dimension(cz), intent(in) :: Theta_dev !< temperature, [K]
real, dimension(cz), intent(in) :: Salin_dev !< salinity, [PSU]
integer :: k
! --------------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment