!-------------------------------------------------------------------------- !---------------------------- compute_geopot ---------------------------------- SELECT CASE(caldyn_thermo) CASE(thermo_boussinesq) ! use hydrostatic balance with theta*rhodz to find pk (=Lagrange multiplier=pressure) DO ij=ij_omp_begin_ext,ij_omp_end_ext pk(ij,llm) = ptop + .5*g* theta(ij,llm,1)*rhodz(ij,llm) END DO DO l = llm-1,1,-1 DO ij=ij_omp_begin_ext,ij_omp_end_ext pk(ij,l) = pk(ij,l+1) + (.5*g)*( theta(ij,l,1)*rhodz(ij,l) + theta(ij,l+1,1)*rhodz(ij,l+1) ) END DO END DO IF(caldyn_eta == eta_lag) THEN DO ij=ij_omp_begin_ext,ij_omp_end_ext ps(ij) = pk(ij,1) + .5*g* theta(ij,1,1)*rhodz(ij,1) END DO END IF ! now pk contains the Lagrange multiplier (pressure) ! specific volume 1 = dphi/g/rhodz DO l = 1,llm DO ij=ij_omp_begin_ext,ij_omp_end_ext geopot(ij,l+1) = geopot(ij,l) + g*rhodz(ij,l) END DO END DO CASE(thermo_theta) DO ij=ij_omp_begin_ext,ij_omp_end_ext pk(ij,llm) = ptop + .5*g* rhodz(ij,llm) END DO DO l = llm-1,1,-1 DO ij=ij_omp_begin_ext,ij_omp_end_ext pk(ij,l) = pk(ij,l+1) + (.5*g)*( rhodz(ij,l) + rhodz(ij,l+1) ) END DO END DO IF(caldyn_eta == eta_lag) THEN DO ij=ij_omp_begin_ext,ij_omp_end_ext ps(ij) = pk(ij,1) + .5*g* rhodz(ij,1) END DO END IF DO l = 1,llm DO ij=ij_omp_begin_ext,ij_omp_end_ext p_ik = pk(ij,l) exner_ik = cpp * (p_ik/preff) ** kappa gv = (g*kappa)*theta(ij,l,1)*exner_ik/p_ik pk(ij,l) = exner_ik geopot(ij,l+1) = geopot(ij,l) + gv*rhodz(ij,l) END DO END DO CASE(thermo_entropy) DO ij=ij_omp_begin_ext,ij_omp_end_ext pk(ij,llm) = ptop + .5*g* rhodz(ij,llm) END DO DO l = llm-1,1,-1 DO ij=ij_omp_begin_ext,ij_omp_end_ext pk(ij,l) = pk(ij,l+1) + (.5*g)*( rhodz(ij,l) + rhodz(ij,l+1) ) END DO END DO IF(caldyn_eta == eta_lag) THEN DO ij=ij_omp_begin_ext,ij_omp_end_ext ps(ij) = pk(ij,1) + .5*g* rhodz(ij,1) END DO END IF DO l = 1,llm DO ij=ij_omp_begin_ext,ij_omp_end_ext p_ik = pk(ij,l) temp_ik = Treff*exp((theta(ij,l,1) + Rd*log(p_ik/preff))/cpp) gv = (g*Rd)*temp_ik/p_ik ! specific volume v = Rd*T/p pk(ij,l) = temp_ik geopot(ij,l+1) = geopot(ij,l) + gv*rhodz(ij,l) END DO END DO CASE(thermo_moist) DO ij=ij_omp_begin_ext,ij_omp_end_ext pk(ij,llm) = ptop + .5*g* rhodz(ij,llm)*(1.+theta(ij,llm,2)) END DO DO l = llm-1,1,-1 DO ij=ij_omp_begin_ext,ij_omp_end_ext pk(ij,l) = pk(ij,l+1) + (.5*g)*( rhodz(ij,l)*(1.+theta(ij,l,2)) + rhodz(ij,l+1)*(1.+theta(ij,l+1,2)) ) END DO END DO IF(caldyn_eta == eta_lag) THEN DO ij=ij_omp_begin_ext,ij_omp_end_ext ps(ij) = pk(ij,1) + .5*g* rhodz(ij,1)*(1.+theta(ij,1,2)) END DO END IF DO l = 1,llm DO ij=ij_omp_begin_ext,ij_omp_end_ext p_ik = pk(ij,l) qv = theta(ij,l,2) ! water vaper mixing ratio = mv/md Rmix = Rd+qv*Rv chi = ( theta(ij,l,1) + Rmix*log(p_ik/preff) ) / (cpp + qv*cppv) ! log(T/Treff) temp_ik = Treff*exp(chi) ! specific volume v = R*T/p ! R = (Rd + qv.Rv)/(1+qv) gv = g*Rmix*temp_ik/(p_ik*(1+qv)) pk(ij,l) = temp_ik geopot(ij,l+1) = geopot(ij,l) + gv*rhodz(ij,l) END DO END DO END SELECT !---------------------------- compute_geopot ---------------------------------- !--------------------------------------------------------------------------