149 integer,
intent(in) :: ng
155 real(dp) :: Aweight, Bweight, Cweight, Cbot, Csur, Hscale
156 real(dp) :: ds, exp_bot, exp_sur, rk, rN, sc_r, sc_w
157 real(dp) :: cff, cff1, cff2
158 real(dp) :: zhc, z1, z2, z3
202 IF (
theta_s(ng).ne.0.0_dp)
THEN
204 cff2=0.5_dp/tanh(0.5_dp*
theta_s(ng))
208 ds=1.0_dp/real(
n(ng),dp)
210 scalars(ng)%sc_w(k)=ds*real(k-
n(ng),dp)
211 scalars(ng)%sc_r(k)=ds*(real(k-
n(ng),dp)-0.5_dp)
212 IF (
theta_s(ng).ne.0.0_dp)
THEN
269 ds=1.0_dp/real(
n(ng),dp)
274 sc_w=ds*real(k-
n(ng),dp)
276 IF (
theta_s(ng).gt.0.0_dp)
THEN
277 csur=(1.0_dp-cosh(
theta_s(ng)*sc_w))/ &
279 IF (
theta_b(ng).gt.0.0_dp)
THEN
280 cbot=sinh(
theta_b(ng)*(sc_w+1.0_dp))/ &
282 cweight=(sc_w+1.0_dp)**aweight* &
283 & (1.0_dp+(aweight/bweight)* &
284 & (1.0_dp-(sc_w+1.0_dp)**bweight))
285 scalars(ng)%Cs_w(k)=cweight*csur+(1.0_dp-cweight)*cbot
297 sc_r=ds*(real(k-
n(ng),dp)-0.5_dp)
299 IF (
theta_s(ng).gt.0.0_dp)
THEN
300 csur=(1.0_dp-cosh(
theta_s(ng)*sc_r))/ &
302 IF (
theta_b(ng).gt.0.0_dp)
THEN
303 cbot=sinh(
theta_b(ng)*(sc_r+1.0_dp))/ &
305 cweight=(sc_r+1.0_dp)**aweight* &
306 & (1.0_dp+(aweight/bweight)* &
307 & (1.0_dp-(sc_r+1.0_dp)**bweight))
308 scalars(ng)%Cs_r(k)=cweight*csur+(1.0_dp-cweight)*cbot
360 ds=1.0_dp/real(
n(ng),dp)
365 sc_w=ds*real(k-
n(ng),dp)
367 cbot= log(cosh(hscale*(sc_w+1.0_dp)**exp_bot))/ &
368 & log(cosh(hscale))-1.0_dp
369 csur=-log(cosh(hscale*abs(sc_w)**exp_sur))/ &
371 cweight=0.5_dp*(1.0_dp-tanh(hscale*(sc_w+0.5_dp)))
372 scalars(ng)%Cs_w(k)=cweight*cbot+(1.0_dp-cweight)*csur
378 sc_r=ds*(real(k-
n(ng),dp)-0.5_dp)
380 cbot= log(cosh(hscale*(sc_r+1.0_dp)**exp_bot))/ &
381 & log(cosh(hscale))-1.0_dp
382 csur=-log(cosh(hscale*abs(sc_r)**exp_sur))/ &
384 cweight=0.5_dp*(1.0_dp-tanh(hscale*(sc_r+0.5_dp)))
385 scalars(ng)%Cs_r(k)=cweight*cbot+(1.0_dp-cweight)*csur
433 ds=1.0_dp/real(
n(ng),dp)
438 sc_w=ds*real(k-
n(ng),dp)
440 IF (
theta_s(ng).gt.0.0_dp)
THEN
441 csur=(1.0_dp-cosh(
theta_s(ng)*sc_w))/ &
446 IF (
theta_b(ng).gt.0.0_dp)
THEN
447 cbot=(exp(
theta_b(ng)*csur)-1.0_dp)/ &
458 sc_r=ds*(real(k-
n(ng),dp)-0.5_dp)
460 IF (
theta_s(ng).gt.0.0_dp)
THEN
461 csur=(1.0_dp-cosh(
theta_s(ng)*sc_r))/ &
466 IF (
theta_b(ng).gt.0.0_dp)
THEN
467 cbot=(exp(
theta_b(ng)*csur)-1.0_dp)/ &
492 sc_w=-(rk*rk - 2.0_dp*rk*rn + rk + rn*rn - rn)/(rn*rn - rn)- &
493 0.01_dp*(rk*rk - rk*rn)/(1.0_dp - rn)
495 IF (
theta_s(ng).gt.0.0_dp)
THEN
496 csur=(1.0_dp-cosh(
theta_s(ng)*sc_w))/ &
501 IF (
theta_b(ng).gt.0.0_dp)
THEN
502 cbot=(exp(
theta_b(ng)*csur)-1.0_dp)/ &
515 sc_r=-(rk*rk - 2.0_dp*rk*rn + rk + rn*rn - rn)/(rn*rn - rn)- &
516 0.01_dp*(rk*rk - rk*rn)/(1.0_dp - rn)
518 IF (
theta_s(ng).gt.0.0_dp)
THEN
519 csur=(1.0_dp-cosh(
theta_s(ng)*sc_r))/ &
524 IF (
theta_b(ng).gt.0.0_dp)
THEN
525 cbot=(exp(
theta_b(ng)*csur)-1.0_dp)/ &
554 IF (
hc(ng).gt.
hmax(ng))
THEN
557 zhc=0.5_dp*
hc(ng)*(
scalars(ng)%sc_w(k)+ &
562 &
scalars(ng)%Cs_w(k), z1, zhc, z2, z3
566 10
FORMAT (/,
' Vertical S-coordinate System, Grid ',i2.2,
':'/,/, &
567 &
' level S-coord Cs-curve Z',3x, &
568 &
'at hmin at hc half way at hmax',/)
569 20
FORMAT (i6,2f12.7,1x,4f12.3)