SUBROUTINE init_ocean !------------------------------------------------------------------------------! ! Actual revisions: ! ----------------- ! ! ! Former revisions: ! ------------------ ! $Id: init_ocean.f90 336 2009-06-10 11:19:35Z maronga $ ! ! 124 2007-10-19 15:47:46Z raasch ! Bugfix: Initial density rho is calculated ! ! 97 2007-06-21 08:23:15Z raasch ! Initial revision ! ! Description: ! ------------ ! Initialization of quantities needed for the ocean version !------------------------------------------------------------------------------! USE arrays_3d USE control_parameters USE eqn_state_seawater_mod USE pegrid USE grid_variables USE indices IMPLICIT NONE INTEGER :: k, n REAL :: sa_l, pt_l, rho_l REAL, DIMENSION(nzb:nzt+1) :: rho_init ALLOCATE( hyp(nzb:nzt+1) ) ! !-- Set water density near the ocean surface rho_surface = 1027.62 ! !-- Calculate initial vertical profile of hydrostatic pressure (in Pa) !-- and the reference density (used later in buoyancy term) hyp(nzt+1) = surface_pressure * 100.0 hyp(nzt) = hyp(nzt+1) + rho_surface * g * 0.5 * dzu(nzt+1) rho_init(nzt) = rho_surface DO k = nzt-1, 0, -1 hyp(k) = hyp(k+1) + rho_surface * g * dzu(k) ENDDO IF ( myid == 0 ) THEN print*,'hydro pres using rho_surface' DO k = nzt+1, 0, -1 print*, 'k = ', k, ' hyp = ', hyp(k) ENDDO print*, ' ' ENDIF DO n = 1, 5 rho_reference = rho_surface * 0.5 * dzu(nzt+1) DO k = nzt-1, 0, -1 sa_l = 0.5 * ( sa_init(k) + sa_init(k+1) ) pt_l = 0.5 * ( pt_init(k) + pt_init(k+1) ) rho_init(k) = eqn_state_seawater_func( hyp(k), pt_l, sa_l ) rho_reference = rho_reference + rho_init(k) * dzu(k+1) ENDDO rho_reference = rho_reference / ( zw(nzt) - zu(nzb) ) DO k = nzt-1, 0, -1 hyp(k) = hyp(k+1) + g * 0.5 * ( rho_init(k) + rho_init(k+1 ) ) * & dzu(k+1) ENDDO IF ( myid == 0 ) THEN print*,'hydro pres / rho n = ', n DO k = nzt+1, 0, -1 print*, 'k = ', k, ' hyp = ', hyp(k), ' rho = ', rho_init(k) ENDDO print*, ' ' ENDIF ENDDO ! !-- Calculate the reference potential density prho_reference = 0.0 DO k = 0, nzt sa_l = 0.5 * ( sa_init(k) + sa_init(k+1) ) pt_l = 0.5 * ( pt_init(k) + pt_init(k+1) ) prho_reference = prho_reference + dzu(k+1) * & eqn_state_seawater_func( 0.0, pt_l, sa_l ) ENDDO prho_reference = prho_reference / ( zu(nzt) - zu(nzb) ) ! !-- Calculate the initial potential density, based on the initial !-- temperature and salinity profile CALL eqn_state_seawater END SUBROUTINE init_ocean