38 use_exact_qs_input, do_simple, &
39 construct_table_wrt_liq, &
40 construct_table_wrt_liq_and_ice, &
43 integer,
intent(in) :: table_size
44 real(kind=fms_svp_kind_),
intent(in) :: tcmin
45 real(kind=fms_svp_kind_),
intent(in) :: tcmax
46 real(kind=fms_svp_kind_),
intent(in) :: tfreeze
47 real(kind=fms_svp_kind_),
intent(in) :: hlv
48 real(kind=fms_svp_kind_),
intent(in) :: rvgas
49 real(kind=fms_svp_kind_),
intent(in) :: es0
50 logical,
intent(in) :: use_exact_qs_input
51 logical,
intent(in) :: do_simple
52 logical,
intent(in) :: construct_table_wrt_liq
53 logical,
intent(in) :: construct_table_wrt_liq_and_ice
54 character(len=*),
intent(out) :: err_msg
55 real(kind=fms_svp_kind_),
intent(out),
optional :: teps
56 real(kind=fms_svp_kind_),
intent(out),
optional :: tmin
57 real(kind=fms_svp_kind_),
intent(out),
optional :: dtinv
64 real(kind=r8_kind),
dimension(3) :: tem(3), es(3)
65 real(kind=r8_kind) :: hdtinv, tinrc, tfact
70 if (module_is_initialized)
return
72 if(
allocated(table) .or.
allocated(dtable) .or.
allocated(d2table))
then
73 err_msg =
'Attempt to allocate sat vapor pressure tables when already allocated'
76 allocate(table(table_size), dtable(table_size), d2table(table_size))
79 if (construct_table_wrt_liq)
then
80 if(
allocated(table2) .or.
allocated(dtable2) .or.
allocated(d2table2))
then
81 err_msg =
'Attempt to allocate sat vapor pressure table2s when already allocated'
84 allocate(table2(table_size), dtable2(table_size), d2table2(table_size))
88 if (construct_table_wrt_liq_and_ice)
then
89 if(
allocated(table3) .or.
allocated(dtable3) .or.
allocated(d2table3))
then
90 err_msg =
'Attempt to allocate sat vapor pressure table2s when already allocated'
93 allocate(table3(table_size), dtable3(table_size), d2table3(table_size))
97 table_siz = table_size
98 dtres = (real(tcmax,r8_kind)-real(tcmin,r8_kind))/real(table_size-1,r8_kind)
99 tminl = real(tcmin,r8_kind)+real(tfreeze,r8_kind)
100 dtinvl = 1.0_r8_kind/dtres
101 tepsl = 0.5_r8_kind*dtres
102 tinrc = 0.1_r8_kind*dtres
103 if(
present(teps )) teps =real(tepsl, fms_svp_kind_)
104 if(
present(tmin )) tmin =real(tminl, fms_svp_kind_)
105 if(
present(dtinv)) dtinv=real(dtinvl, fms_svp_kind_)
110 tfact = 5.0_r8_kind*dtinvl
112 hdtinv = 0._r8_kind*dtinvl
122 tem(1) = tminl + dtres*real(i-1,r8_kind)
123 table(i) = real(es0,r8_kind)*610.78_r8_kind* &
124 exp( -real(hlv,r8_kind)/real(rvgas,r8_kind) * (1.0_r8_kind/tem(1) - 1._r8_kind/real(tfreeze,r8_kind)) )
125 dtable(i) = real(hlv,r8_kind)*table(i)/real(rvgas,r8_kind)/tem(1)**2._r8_kind
131 tem(1) = tminl + dtres*real(i-1,r8_kind)
132 tem(2) = tem(1)-tinrc
133 tem(3) = tem(1)+tinrc
134 es = compute_es_k(tem, real(tfreeze,r8_kind))
136 dtable(i) = (es(3)-es(2))*tfact
144 do i = 2, table_size-1
145 d2table(i) = 0.25_r8_kind*dtinvl*(dtable(i+1)-dtable(i-1))
149 d2table(1) = 0.50_r8_kind*dtinvl*(dtable(2)-dtable(1))
151 d2table(table_size) = 0.50_r8_kind*dtinvl*(dtable(table_size)-dtable(table_size-1))
153 if (construct_table_wrt_liq)
then
158 tem(1) = tminl + dtres*real(i-1,r8_kind)
159 tem(2) = tem(1)-tinrc
160 tem(3) = tem(1)+tinrc
162 es = compute_es_liq_k(tem, real(tfreeze,r8_kind))
164 dtable2(i) = (es(3)-es(2))*tfact
170 do i = 2, table_size-1
171 d2table2(i) = 0.25_r8_kind*dtinvl*(dtable2(i+1)-dtable2(i-1))
175 d2table2(1) = 0.50_r8_kind*dtinvl*(dtable2(2)-dtable2(1))
177 d2table2(table_size) = 0.50_r8_kind*dtinvl*(dtable2(table_size)-dtable2(table_size-1))
181 if (construct_table_wrt_liq_and_ice)
then
186 tem(1) = tminl + dtres*real(i-1,r8_kind)
187 tem(2) = tem(1)-tinrc
188 tem(3) = tem(1)+tinrc
190 es = compute_es_liq_ice_k(tem, real(tfreeze,r8_kind))
192 dtable3(i) = (es(3)-es(2))*tfact
198 do i = 2, table_size-1
199 d2table3(i) = 0.25_r8_kind*dtinvl*(dtable3(i+1)-dtable3(i-1))
203 d2table3(1) = 0.50_r8_kind*dtinvl*(dtable3(2)-dtable3(1))
205 d2table3(table_size) = 0.50_r8_kind*dtinvl*(dtable3(table_size)-dtable3(table_size-1))
208 use_exact_qs = use_exact_qs_input
209 module_is_initialized = .true.
216 real(kind=fms_svp_kind_),
intent(in) :: tem(:)
217 real(kind=fms_svp_kind_),
intent(in) :: tfreeze
218 real(kind=fms_svp_kind_) :: es(
size(tem,1))
220 real(kind=fms_svp_kind_) :: x
221 real(kind=fms_svp_kind_) :: esice
222 real(kind=fms_svp_kind_) :: esh2o
223 real(kind=fms_svp_kind_) :: tbasw
224 real(kind=fms_svp_kind_) :: tbasi
227 integer,
parameter :: lkind=fms_svp_kind_
229 real(kind=fms_svp_kind_),
parameter :: esbasw = 101324.60_lkind
230 real(kind=fms_svp_kind_),
parameter :: esbasi = 610.71_lkind
234 real(fms_svp_kind_),
parameter :: one=1.0_lkind
235 real(fms_svp_kind_),
parameter :: ten=10.0_lkind
237 tbasw = tfreeze+100.0_lkind
246 if (tem(i) < tbasi)
then
247 x = -9.09718_lkind*(tbasi/tem(i)-one) &
248 -3.56654_lkind*log10(tbasi/tem(i)) &
249 +0.876793_lkind*(one-tem(i)/tbasi) + log10(esbasi)
263 if (tem(i) > -20.0_lkind+tbasi)
then
264 x = -7.90298_lkind*(tbasw/tem(i)-one) &
265 +5.02808_lkind*log10(tbasw/tem(i)) &
266 -1.3816e-07_lkind*(ten**((one-tem(i)/tbasw)*11.344_lkind)-one) &
267 +8.1328e-03_lkind*(ten**((tbasw/tem(i)-one)*(-3.49149_lkind))-one) &
278 if (tem(i) <= -20.0_lkind+tbasi)
then
280 else if (tem(i) >= tbasi)
then
283 es(i) = 0.05_lkind*((tbasi-tem(i))*esice + (tem(i)-tbasi+20.0_lkind)*esh2o)
293 real(kind=fms_svp_kind_),
intent(in) :: tem(:)
294 real(kind=fms_svp_kind_),
intent(in) :: tfreeze
295 real(kind=fms_svp_kind_) :: es(
size(tem,1))
297 real(kind=fms_svp_kind_) :: x
298 real(kind=fms_svp_kind_) :: esh2o
299 real(kind=fms_svp_kind_) :: tbasw
305 integer,
parameter :: lkind=fms_svp_kind_
306 real(kind=fms_svp_kind_),
parameter :: one=1.0_lkind
307 real(kind=fms_svp_kind_),
parameter :: ten=10.0_lkind
308 real(kind=fms_svp_kind_),
parameter :: esbasw = 101324.60_lkind
310 tbasw = tfreeze+100.0_lkind
322 x = -7.90298_lkind*(tbasw/tem(i)-one) &
323 +5.02808_lkind*log10(tbasw/tem(i)) &
324 -1.3816e-07_lkind*(ten**((one-tem(i)/tbasw)*11.344_lkind)-one) &
325 +8.1328e-03_lkind*(ten**((tbasw/tem(i)-one)*(-3.49149_lkind))-one)&
338 real(kind=fms_svp_kind_),
intent(in) :: tem(:)
339 real(kind=fms_svp_kind_),
intent(in) :: tfreeze
340 real(kind=fms_svp_kind_) :: es(
size(tem,1))
342 real(kind=fms_svp_kind_) :: x
343 real(kind=fms_svp_kind_) :: tbasw
344 real(kind=fms_svp_kind_) :: tbasi
347 integer,
parameter :: lkind=fms_svp_kind_
348 real(kind=fms_svp_kind_),
parameter :: esbasw = 101324.60_lkind
349 real(kind=fms_svp_kind_),
parameter :: esbasi = 610.71_lkind
352 real(kind=fms_svp_kind_),
parameter :: one=1.0_lkind
353 real(kind=fms_svp_kind_),
parameter :: ten=10.0_lkind
355 tbasw = tfreeze+100.0_lkind
360 if (tem(i) < tbasi)
then
365 x = -9.09718_lkind*(tbasi/tem(i)-one) &
366 -3.56654_lkind*log10(tbasi/tem(i)) &
367 +0.876793_lkind*(one-tem(i)/tbasi) + log10(esbasi)
378 x = -7.90298_lkind*(tbasw/tem(i)-one) &
379 +5.02808_lkind*log10(tbasw/tem(i)) &
380 -1.3816e-07_lkind*(ten**((one-tem(i)/tbasw)*11.344_lkind)-one) &
381 +8.1328e-03_lkind*(ten**((tbasw/tem(i)-one)*(-3.49149_lkind))-one) &
392 dqsdT, esat, es_over_liq, es_over_liq_and_ice)
394 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
395 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: press
396 real(kind=fms_svp_kind_),
intent(in) :: eps
397 real(kind=fms_svp_kind_),
intent(in) :: zvir
398 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: qs
399 integer,
intent(out) :: nbad
400 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:),
optional :: q
401 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
402 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:),
optional :: dqsdt
403 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:),
optional :: esat
404 logical,
intent(in),
optional :: es_over_liq
405 logical,
intent(in),
optional :: es_over_liq_and_ice
407 integer,
parameter :: lkind=fms_svp_kind_
409 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2), size(temp,3)) :: esloc
410 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2), size(temp,3)) :: desat
411 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2), size(temp,3)) :: denom
413 real(kind=fms_svp_kind_) :: hc_loc
415 if (
present(hc))
then
420 if (
present(es_over_liq))
then
421 if (
present (dqsdt))
then
422 call lookup_es2_des2_k (temp, esloc, desat, nbad)
425 call lookup_es2_k (temp, esloc, nbad)
427 else if (
present(es_over_liq_and_ice))
then
428 if (
present (dqsdt))
then
429 call lookup_es3_des3_k (temp, esloc, desat, nbad)
432 call lookup_es3_k (temp, esloc, nbad)
435 if (
present (dqsdt))
then
436 call lookup_es_des_k (temp, esloc, desat, nbad)
439 call lookup_es_k (temp, esloc, nbad)
443 if (
present (esat))
then
447 if (
present (q) .and. use_exact_qs)
then
448 qs = (1.0_lkind + zvir*q)*eps*esloc/press
449 if (
present (dqsdt))
then
450 dqsdt = (1.0_lkind + zvir*q)*eps*desat/press
453 denom = press - (1.0_lkind - eps)*esloc
457 if (denom(i,j,k) > 0.0_lkind)
then
458 qs(i,j,k) = eps*esloc(i,j,k)/denom(i,j,k)
465 if (
present (dqsdt))
then
466 dqsdt = eps*press*desat/denom**2
471 if (
present (dqsdt))
then
474 if (
present (esat))
then
485 dqsdT, esat, es_over_liq, es_over_liq_and_ice)
487 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
488 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: press
489 real(kind=fms_svp_kind_),
intent(in) :: eps
490 real(kind=fms_svp_kind_),
intent(in) :: zvir
491 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: qs
492 integer,
intent(out) :: nbad
493 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:),
optional :: q
494 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
495 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:),
optional :: dqsdt
496 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:),
optional :: esat
497 logical,
intent(in),
optional :: es_over_liq
498 logical,
intent(in),
optional :: es_over_liq_and_ice
500 integer,
parameter :: lkind=fms_svp_kind_
502 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2)) :: esloc
503 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2)) :: desat
504 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2)) :: denom
506 real(kind=fms_svp_kind_) :: hc_loc
508 if (
present(hc))
then
514 if (
present(es_over_liq))
then
515 if (
present (dqsdt))
then
516 call lookup_es2_des2_k (temp, esloc, desat, nbad)
519 call lookup_es2_k (temp, esloc, nbad)
521 else if (
present(es_over_liq_and_ice))
then
522 if (
present (dqsdt))
then
523 call lookup_es3_des3_k (temp, esloc, desat, nbad)
526 call lookup_es3_k (temp, esloc, nbad)
529 if (
present (dqsdt))
then
530 call lookup_es_des_k (temp, esloc, desat, nbad)
533 call lookup_es_k (temp, esloc, nbad)
537 if (
present (esat))
then
541 if (
present (q) .and. use_exact_qs)
then
542 qs = (1.0_lkind + zvir*q)*eps*esloc/press
543 if (
present (dqsdt))
then
544 dqsdt = (1.0_lkind + zvir*q)*eps*desat/press
547 denom = press - (1.0_lkind - eps)*esloc
550 if (denom(i,j) > 0.0_lkind)
then
551 qs(i,j) = eps*esloc(i,j)/denom(i,j)
557 if (
present (dqsdt))
then
558 dqsdt = eps*press*desat/denom**2
563 if (
present (dqsdt))
then
566 if (
present (esat))
then
577 dqsdT, esat, es_over_liq, es_over_liq_and_ice)
579 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
580 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: press
581 real(kind=fms_svp_kind_),
intent(in) :: eps
582 real(kind=fms_svp_kind_),
intent(in) :: zvir
583 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: qs
584 integer,
intent(out) :: nbad
585 real(kind=fms_svp_kind_),
intent(in),
dimension(:),
optional :: q
586 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
587 real(kind=fms_svp_kind_),
intent(out),
dimension(:),
optional :: dqsdt
588 real(kind=fms_svp_kind_),
intent(out),
dimension(:),
optional :: esat
589 logical,
intent(in),
optional :: es_over_liq
590 logical,
intent(in),
optional :: es_over_liq_and_ice
592 integer,
parameter :: lkind=fms_svp_kind_
594 real(kind=fms_svp_kind_),
dimension(size(temp,1)) :: esloc
595 real(kind=fms_svp_kind_),
dimension(size(temp,1)) :: desat
596 real(kind=fms_svp_kind_),
dimension(size(temp,1)) :: denom
598 real(kind=fms_svp_kind_) :: hc_loc
600 if (
present(hc))
then
606 if (
present(es_over_liq))
then
607 if (
present (dqsdt))
then
608 call lookup_es2_des2_k (temp, esloc, desat, nbad)
611 call lookup_es2_k (temp, esloc, nbad)
613 else if (
present(es_over_liq_and_ice))
then
614 if (
present (dqsdt))
then
615 call lookup_es3_des3_k (temp, esloc, desat, nbad)
618 call lookup_es3_k (temp, esloc, nbad)
621 if (
present (dqsdt))
then
622 call lookup_es_des_k (temp, esloc, desat, nbad)
625 call lookup_es_k (temp, esloc, nbad)
629 if (
present (esat))
then
633 if (
present (q) .and. use_exact_qs)
then
634 qs = (1.0_lkind + zvir*q)*eps*esloc/press
635 if (
present (dqsdt))
then
636 dqsdt = (1.0_lkind + zvir*q)*eps*desat/press
639 denom = press - (1.0_lkind - eps)*esloc
641 if (denom(i) > 0.0_lkind)
then
642 qs(i) = eps*esloc(i)/denom(i)
647 if (
present (dqsdt))
then
648 dqsdt = eps*press*desat/denom**2
653 if (
present (dqsdt))
then
656 if (
present (esat))
then
667 dqsdT, esat, es_over_liq, es_over_liq_and_ice)
669 real(kind=fms_svp_kind_),
intent(in) :: temp
670 real(kind=fms_svp_kind_),
intent(in) :: press
671 real(kind=fms_svp_kind_),
intent(in) :: eps
672 real(kind=fms_svp_kind_),
intent(in) :: zvir
673 real(kind=fms_svp_kind_),
intent(out) :: qs
674 integer,
intent(out) :: nbad
675 real(kind=fms_svp_kind_),
intent(in),
optional :: q
676 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
677 real(kind=fms_svp_kind_),
intent(out),
optional :: dqsdt
678 real(kind=fms_svp_kind_),
intent(out),
optional :: esat
679 logical,
intent(in),
optional :: es_over_liq
680 logical,
intent(in),
optional :: es_over_liq_and_ice
682 integer,
parameter :: lkind=fms_svp_kind_
684 real(kind=fms_svp_kind_) :: esloc
685 real(kind=fms_svp_kind_) :: desat
686 real(kind=fms_svp_kind_) :: denom
687 real(kind=fms_svp_kind_) :: hc_loc
689 if (
present(hc))
then
695 if (
present(es_over_liq))
then
696 if (
present (dqsdt))
then
697 call lookup_es2_des2_k (temp, esloc, desat, nbad)
700 call lookup_es2_k (temp, esloc, nbad)
702 else if (
present(es_over_liq_and_ice))
then
703 if (
present (dqsdt))
then
704 call lookup_es3_des3_k (temp, esloc, desat, nbad)
707 call lookup_es3_k (temp, esloc, nbad)
710 if (
present (dqsdt))
then
711 call lookup_es_des_k (temp, esloc, desat, nbad)
714 call lookup_es_k (temp, esloc, nbad)
718 if (
present (esat))
then
722 if (
present (q) .and. use_exact_qs)
then
723 qs = (1.0_lkind + zvir*q)*eps*esloc/press
724 if (
present (dqsdt))
then
725 dqsdt = (1.0_lkind + zvir*q)*eps*desat/press
728 denom = press - (1.0_lkind - eps)*esloc
729 if (denom > 0.0_lkind)
then
734 if (
present (dqsdt))
then
735 dqsdt = eps*press*desat/denom**2
740 if (
present (dqsdt))
then
743 if (
present (esat))
then
754 mr, hc, dmrsdT, esat,es_over_liq, es_over_liq_and_ice)
756 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
757 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: press
758 real(kind=fms_svp_kind_),
intent(in) :: eps
759 real(kind=fms_svp_kind_),
intent(in) :: zvir
760 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: mrs
761 integer,
intent(out) :: nbad
762 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:),
optional :: mr
763 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
764 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:),
optional :: dmrsdt
765 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:),
optional :: esat
766 logical,
intent(in),
optional :: es_over_liq
767 logical,
intent(in),
optional :: es_over_liq_and_ice
769 real(FMS_SVP_KIND_),
dimension(size(temp,1), size(temp,2), size(temp,3)) :: esloc
770 real(FMS_SVP_KIND_),
dimension(size(temp,1), size(temp,2), size(temp,3)) :: desat
771 real(FMS_SVP_KIND_),
dimension(size(temp,1), size(temp,2), size(temp,3)) :: denom
773 integer,
parameter :: lkind=fms_svp_kind_
776 real(FMS_SVP_KIND_) :: hc_loc
778 if (
present(hc))
then
784 if (
present (es_over_liq))
then
785 if (
present (dmrsdt))
then
786 call lookup_es2_des2_k (temp, esloc, desat, nbad)
789 call lookup_es2_k (temp, esloc, nbad)
791 else if (
present(es_over_liq_and_ice))
then
792 if (
present (dmrsdt))
then
793 call lookup_es3_des3_k (temp, esloc, desat, nbad)
796 call lookup_es3_k (temp, esloc, nbad)
799 if (
present (dmrsdt))
then
800 call lookup_es_des_k (temp, esloc, desat, nbad)
803 call lookup_es_k (temp, esloc, nbad)
807 if (
present (esat))
then
811 if (
present (mr) .and. use_exact_qs)
then
812 mrs = (eps + mr)*esloc/press
813 if (
present (dmrsdt))
then
814 dmrsdt = (eps + mr)*desat/press
817 denom = press - esloc
821 if (denom(i,j,k) > 0.0_lkind)
then
822 mrs(i,j,k) = eps*esloc(i,j,k)/denom(i,j,k)
829 if (
present (dmrsdt))
then
830 dmrsdt = eps*press*desat/denom**2
835 if (
present (dmrsdt))
then
836 dmrsdt = -999.0_lkind
838 if (
present (esat))
then
848 mr, hc, dmrsdT, esat,es_over_liq, es_over_liq_and_ice)
850 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
851 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: press
852 real(kind=fms_svp_kind_),
intent(in) :: eps
853 real(kind=fms_svp_kind_),
intent(in) :: zvir
854 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: mrs
855 integer,
intent(out) :: nbad
856 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:),
optional :: mr
857 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
858 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:),
optional :: dmrsdt
859 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:),
optional :: esat
860 logical,
intent(in),
optional :: es_over_liq
861 logical,
intent(in),
optional :: es_over_liq_and_ice
863 integer,
parameter :: lkind=fms_svp_kind_
865 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2)) :: esloc
866 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2)) :: desat
867 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2)) :: denom
869 real(kind=fms_svp_kind_) :: hc_loc
871 if (
present(hc))
then
877 if (
present (es_over_liq))
then
878 if (
present (dmrsdt))
then
879 call lookup_es2_des2_k (temp, esloc, desat, nbad)
882 call lookup_es2_k (temp, esloc, nbad)
884 else if (
present(es_over_liq_and_ice))
then
885 if (
present (dmrsdt))
then
886 call lookup_es3_des3_k (temp, esloc, desat, nbad)
889 call lookup_es3_k (temp, esloc, nbad)
892 if (
present (dmrsdt))
then
893 call lookup_es_des_k (temp, esloc, desat, nbad)
896 call lookup_es_k (temp, esloc, nbad)
900 if (
present (esat))
then
904 if (
present (mr) .and. use_exact_qs)
then
905 mrs = (eps + mr)*esloc/press
906 if (
present (dmrsdt))
then
907 dmrsdt = (eps + mr)*desat/press
910 denom = press - esloc
913 if (denom(i,j) > 0.0_lkind)
then
914 mrs(i,j) = eps*esloc(i,j)/denom(i,j)
920 if (
present (dmrsdt))
then
921 dmrsdt = eps*press*desat/denom**2
926 if (
present (dmrsdt))
then
927 dmrsdt = -999.0_lkind
929 if (
present (esat))
then
940 mr, hc, dmrsdT, esat,es_over_liq, es_over_liq_and_ice)
942 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
943 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: press
944 real(kind=fms_svp_kind_),
intent(in) :: eps
945 real(kind=fms_svp_kind_),
intent(in) :: zvir
946 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: mrs
947 integer,
intent(out) :: nbad
948 real(kind=fms_svp_kind_),
intent(in),
dimension(:),
optional :: mr
949 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
950 real(kind=fms_svp_kind_),
intent(out),
dimension(:),
optional :: dmrsdt
951 real(kind=fms_svp_kind_),
intent(out),
dimension(:),
optional :: esat
952 logical,
intent(in),
optional :: es_over_liq
953 logical,
intent(in),
optional :: es_over_liq_and_ice
955 integer,
parameter :: lkind=fms_svp_kind_
957 real(kind=fms_svp_kind_),
dimension(size(temp,1)) :: esloc
958 real(kind=fms_svp_kind_),
dimension(size(temp,1)) :: desat
959 real(kind=fms_svp_kind_),
dimension(size(temp,1)) :: denom
961 real(kind=fms_svp_kind_) :: hc_loc
963 if (
present(hc))
then
969 if (
present (es_over_liq))
then
970 if (
present (dmrsdt))
then
971 call lookup_es2_des2_k (temp, esloc, desat, nbad)
974 call lookup_es2_k (temp, esloc, nbad)
976 else if (
present(es_over_liq_and_ice))
then
977 if (
present (dmrsdt))
then
978 call lookup_es3_des3_k (temp, esloc, desat, nbad)
981 call lookup_es3_k (temp, esloc, nbad)
984 if (
present (dmrsdt))
then
985 call lookup_es_des_k (temp, esloc, desat, nbad)
988 call lookup_es_k (temp, esloc, nbad)
992 if (
present (esat))
then
996 if (
present (mr) .and. use_exact_qs)
then
997 mrs = (eps + mr)*esloc/press
998 if (
present (dmrsdt))
then
999 dmrsdt = (eps + mr)*desat/press
1002 denom = press - esloc
1004 if (denom(i) > 0.0_lkind)
then
1005 mrs(i) = eps*esloc(i)/denom(i)
1010 if (
present (dmrsdt))
then
1011 dmrsdt = eps*press*desat/denom**2
1016 if (
present (dmrsdt))
then
1017 dmrsdt = -999.0_lkind
1019 if (
present (esat))
then
1030 mr, hc, dmrsdT, esat,es_over_liq, es_over_liq_and_ice)
1032 real(kind=fms_svp_kind_),
intent(in) :: temp
1033 real(kind=fms_svp_kind_),
intent(in) :: press
1034 real(kind=fms_svp_kind_),
intent(in) :: eps
1035 real(kind=fms_svp_kind_),
intent(in) :: zvir
1036 real(kind=fms_svp_kind_),
intent(out) :: mrs
1037 integer,
intent(out) :: nbad
1038 real(kind=fms_svp_kind_),
intent(in),
optional :: mr
1039 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
1040 real(kind=fms_svp_kind_),
intent(out),
optional :: dmrsdt
1041 real(kind=fms_svp_kind_),
intent(out),
optional :: esat
1042 logical,
intent(in),
optional :: es_over_liq
1043 logical,
intent(in),
optional :: es_over_liq_and_ice
1045 integer,
parameter :: lkind=fms_svp_kind_
1047 real(kind=fms_svp_kind_) :: esloc
1048 real(kind=fms_svp_kind_) :: desat
1049 real(kind=fms_svp_kind_) :: denom
1050 real(kind=fms_svp_kind_) :: hc_loc
1052 if (
present(hc))
then
1058 if (
present (es_over_liq))
then
1059 if (
present (dmrsdt))
then
1060 call lookup_es2_des2_k (temp, esloc, desat, nbad)
1061 desat = desat*hc_loc
1063 call lookup_es2_k (temp, esloc, nbad)
1065 else if (
present(es_over_liq_and_ice))
then
1066 if (
present (dmrsdt))
then
1067 call lookup_es3_des3_k (temp, esloc, desat, nbad)
1068 desat = desat*hc_loc
1070 call lookup_es3_k (temp, esloc, nbad)
1073 if (
present (dmrsdt))
then
1074 call lookup_es_des_k (temp, esloc, desat, nbad)
1075 desat = desat*hc_loc
1077 call lookup_es_k (temp, esloc, nbad)
1080 esloc = esloc*hc_loc
1081 if (
present (esat))
then
1085 if (
present (mr) .and. use_exact_qs)
then
1086 mrs = (eps + mr)*esloc/press
1087 if (
present (dmrsdt))
then
1088 dmrsdt = (eps + mr)*desat/press
1091 denom = press - esloc
1092 if (denom > 0.0_lkind)
then
1093 mrs = eps*esloc/denom
1097 if (
present (dmrsdt))
then
1098 dmrsdt = eps*press*desat/denom**2
1103 if (
present (dmrsdt))
then
1104 dmrsdt = -999.0_lkind
1106 if (
present (esat))
then
1118 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
1119 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: esat
1120 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: desat
1121 integer,
intent(out) :: nbad
1123 real(kind=fms_svp_kind_) :: tmp
1124 real(kind=fms_svp_kind_) :: del
1125 integer :: ind, i, j, k
1129 real(kind=fms_svp_kind_) :: dtresl
1130 real(kind=fms_svp_kind_) :: tepsll
1131 real(kind=fms_svp_kind_) :: tminll
1132 real(kind=fms_svp_kind_) :: dtinvll
1133 integer,
parameter :: lkind=fms_svp_kind_
1135 dtresl=real(dtres, fms_svp_kind_)
1136 tminll=real(tminl, fms_svp_kind_)
1137 tepsll=real(tepsl, fms_svp_kind_)
1138 dtinvll=real(dtinvl, fms_svp_kind_)
1141 do k = 1,
size(temp,3)
1142 do j = 1,
size(temp,2)
1143 do i = 1,
size(temp,1)
1144 tmp = temp(i,j,k)-tminll
1145 ind = int(dtinvll*(tmp+tepsll))
1146 if (ind < 0 .or. ind >= table_siz)
then
1149 del = tmp-real(dtresl,fms_svp_kind_)*real(ind,fms_svp_kind_)
1152 esat(i,j,k) = real(table(ind+1),fms_svp_kind_) &
1153 + del*( real(dtable(ind+1),fms_svp_kind_) &
1154 + del*real(d2table(ind+1),fms_svp_kind_) )
1157 desat(i,j,k) = real(dtable(ind+1), fms_svp_kind_) &
1158 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1169 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
1170 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: esat
1171 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: desat
1172 integer,
intent(out) :: nbad
1173 real(kind=fms_svp_kind_) :: tmp
1174 real(kind=fms_svp_kind_) :: del
1175 integer :: ind, i, j
1179 real(kind=fms_svp_kind_) :: dtresl
1180 real(kind=fms_svp_kind_) :: tepsll
1181 real(kind=fms_svp_kind_) :: tminll
1182 real(kind=fms_svp_kind_) :: dtinvll
1183 integer,
parameter :: lkind=fms_svp_kind_
1185 dtresl=real(dtres, fms_svp_kind_)
1186 tminll=real(tminl, fms_svp_kind_)
1187 tepsll=real(tepsl, fms_svp_kind_)
1188 dtinvll=real(dtinvl, fms_svp_kind_)
1192 do j = 1,
size(temp,2)
1193 do i = 1,
size(temp,1)
1194 tmp = temp(i,j)-tminll
1195 ind = int(dtinvll*(tmp+tepsll))
1196 if (ind < 0 .or. ind >= table_siz)
then
1199 del = tmp-dtresl*real(ind,fms_svp_kind_)
1202 esat(i,j) = real(table(ind+1),fms_svp_kind_) &
1203 + del*( real(dtable(ind+1),fms_svp_kind_) &
1204 + del*real(d2table(ind+1),fms_svp_kind_) )
1207 desat(i,j) = real(dtable(ind+1),fms_svp_kind_) &
1208 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1218 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
1219 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: esat
1220 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: desat
1221 integer,
intent(out) :: nbad
1223 real(kind=fms_svp_kind_) :: tmp
1224 real(kind=fms_svp_kind_) :: del
1229 real(kind=fms_svp_kind_) :: dtresl
1230 real(kind=fms_svp_kind_) :: tepsll
1231 real(kind=fms_svp_kind_) :: tminll
1232 real(kind=fms_svp_kind_) :: dtinvll
1233 integer,
parameter :: lkind=fms_svp_kind_
1235 dtresl=real(dtres, fms_svp_kind_)
1236 tminll=real(tminl, fms_svp_kind_)
1237 tepsll=real(tepsl, fms_svp_kind_)
1238 dtinvll=real(dtinvl, fms_svp_kind_)
1242 do i = 1,
size(temp,1)
1243 tmp = temp(i)-tminll
1244 ind = int(dtinvll*(tmp+tepsll))
1245 if (ind < 0 .or. ind >= table_siz)
then
1248 del = tmp-dtresl*real(ind,fms_svp_kind_)
1251 esat(i) = real(table(ind+1),fms_svp_kind_) &
1252 + del*( real(dtable(ind+1),fms_svp_kind_) &
1253 + del*real(d2table(ind+1),fms_svp_kind_) )
1256 desat(i) = real(dtable(ind+1),fms_svp_kind_) &
1257 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1266 real(kind=fms_svp_kind_),
intent(in) :: temp
1267 real(kind=fms_svp_kind_),
intent(out) :: esat
1268 real(kind=fms_svp_kind_),
intent(out) :: desat
1269 integer,
intent(out) :: nbad
1271 real(kind=fms_svp_kind_) :: tmp
1272 real(kind=fms_svp_kind_) :: del
1277 real(kind=fms_svp_kind_) :: dtresl
1278 real(kind=fms_svp_kind_) :: tepsll
1279 real(kind=fms_svp_kind_) :: tminll
1280 real(kind=fms_svp_kind_) :: dtinvll
1281 integer,
parameter :: lkind=fms_svp_kind_
1283 dtresl=real(dtres, fms_svp_kind_)
1284 tminll=real(tminl, fms_svp_kind_)
1285 tepsll=real(tepsl, fms_svp_kind_)
1286 dtinvll=real(dtinvl, fms_svp_kind_)
1290 ind = int(dtinvll*(tmp+tepsll))
1291 if (ind < 0 .or. ind >= table_siz)
then
1294 del = tmp-dtresl*real(ind,fms_svp_kind_)
1297 esat = real(table(ind+1),fms_svp_kind_) &
1298 + del*( real(dtable(ind+1),fms_svp_kind_) &
1299 + del*real(d2table(ind+1),fms_svp_kind_) )
1302 desat = real(dtable(ind+1),fms_svp_kind_) &
1303 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1311 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
1312 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: esat
1313 integer,
intent(out) :: nbad
1314 real(kind=fms_svp_kind_) :: tmp
1315 real(kind=fms_svp_kind_) :: del
1316 integer :: ind, i, j, k
1320 real(kind=fms_svp_kind_) :: dtresl
1321 real(kind=fms_svp_kind_) :: tepsll
1322 real(kind=fms_svp_kind_) :: tminll
1323 real(kind=fms_svp_kind_) :: dtinvll
1325 dtresl=real(dtres, fms_svp_kind_)
1326 tminll=real(tminl, fms_svp_kind_)
1327 tepsll=real(tepsl, fms_svp_kind_)
1328 dtinvll=real(dtinvl, fms_svp_kind_)
1331 do k = 1,
size(temp,3)
1332 do j = 1,
size(temp,2)
1333 do i = 1,
size(temp,1)
1334 tmp = temp(i,j,k)-tminll
1335 ind = int(dtinvll*(tmp+tepsll))
1336 if (ind < 0 .or. ind >= table_siz)
then
1339 del = tmp-dtresl*real(ind,fms_svp_kind_)
1342 esat(i,j,k) = real(table(ind+1),fms_svp_kind_) &
1343 + del*( real(dtable(ind+1),fms_svp_kind_) &
1344 + del*real(d2table(ind+1),fms_svp_kind_) )
1355 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
1356 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: desat
1357 integer,
intent(out) :: nbad
1358 real(kind=fms_svp_kind_) :: tmp
1359 real(kind=fms_svp_kind_) :: del
1360 integer :: ind, i, j, k
1364 real(kind=fms_svp_kind_) :: dtresl
1365 real(kind=fms_svp_kind_) :: tepsll
1366 real(kind=fms_svp_kind_) :: tminll
1367 real(kind=fms_svp_kind_) :: dtinvll
1368 integer,
parameter :: lkind=fms_svp_kind_
1370 dtresl=real(dtres, fms_svp_kind_)
1371 tminll=real(tminl, fms_svp_kind_)
1372 tepsll=real(tepsl, fms_svp_kind_)
1373 dtinvll=real(dtinvl, fms_svp_kind_)
1376 do k = 1,
size(temp,3)
1377 do j = 1,
size(temp,2)
1378 do i = 1,
size(temp,1)
1379 tmp = temp(i,j,k)-tminll
1380 ind = int(dtinvll*(tmp+tepsll))
1381 if (ind < 0 .or. ind >= table_siz)
then
1384 del = tmp-dtresl*real(ind,fms_svp_kind_)
1387 desat(i,j,k) = real(dtable(ind+1),fms_svp_kind_) &
1388 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1398 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
1399 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: desat
1400 integer,
intent(out) :: nbad
1401 real(kind=fms_svp_kind_) :: tmp
1402 real(kind=fms_svp_kind_) :: del
1403 integer :: ind, i, j
1408 real(kind=fms_svp_kind_) :: dtresl
1409 real(kind=fms_svp_kind_) :: tepsll
1410 real(kind=fms_svp_kind_) :: tminll
1411 real(kind=fms_svp_kind_) :: dtinvll
1412 integer,
parameter :: lkind=fms_svp_kind_
1414 dtresl=real(dtres, fms_svp_kind_)
1415 tminll=real(tminl, fms_svp_kind_)
1416 tepsll=real(tepsl, fms_svp_kind_)
1417 dtinvll=real(dtinvl, fms_svp_kind_)
1420 do j = 1,
size(temp,2)
1421 do i = 1,
size(temp,1)
1422 tmp = temp(i,j)-tminll
1423 ind = int(dtinvll*(tmp+tepsll))
1424 if (ind < 0 .or. ind >= table_siz)
then
1427 del = tmp-dtresl*real(ind,fms_svp_kind_)
1430 desat(i,j) = real(dtable(ind+1),fms_svp_kind_) &
1431 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1439 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
1440 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: esat
1441 integer,
intent(out) :: nbad
1442 real(kind=fms_svp_kind_) :: tmp
1443 real(kind=fms_svp_kind_) :: del
1444 integer :: ind, i, j
1448 real(kind=fms_svp_kind_) :: dtresl
1449 real(kind=fms_svp_kind_) :: tepsll
1450 real(kind=fms_svp_kind_) :: tminll
1451 real(kind=fms_svp_kind_) :: dtinvll
1453 dtresl=real(dtres, fms_svp_kind_)
1454 tminll=real(tminl, fms_svp_kind_)
1455 tepsll=real(tepsl, fms_svp_kind_)
1456 dtinvll=real(dtinvl, fms_svp_kind_)
1460 do j = 1,
size(temp,2)
1461 do i = 1,
size(temp,1)
1462 tmp = temp(i,j)-tminll
1463 ind = int(dtinvll*(tmp+tepsll))
1464 if (ind < 0 .or. ind >= table_siz)
then
1467 del = tmp-dtresl*real(ind,fms_svp_kind_)
1470 esat(i,j) = real(table(ind+1),fms_svp_kind_) &
1471 + del*(real(dtable(ind+1),fms_svp_kind_) &
1472 + del*real(d2table(ind+1),fms_svp_kind_) )
1480 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
1481 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: desat
1482 integer,
intent(out) :: nbad
1483 real(kind=fms_svp_kind_) :: tmp
1484 real(kind=fms_svp_kind_) :: del
1489 real(kind=fms_svp_kind_) :: dtresl
1490 real(kind=fms_svp_kind_) :: tepsll
1491 real(kind=fms_svp_kind_) :: tminll
1492 real(kind=fms_svp_kind_) :: dtinvll
1493 integer,
parameter :: lkind=fms_svp_kind_
1495 dtresl=real(dtres, fms_svp_kind_)
1496 tminll=real(tminl, fms_svp_kind_)
1497 tepsll=real(tepsl, fms_svp_kind_)
1498 dtinvll=real(dtinvl, fms_svp_kind_)
1501 do i = 1,
size(temp,1)
1502 tmp = temp(i)-tminll
1503 ind = int(dtinvll*(tmp+tepsll))
1504 if (ind < 0 .or. ind >= table_siz)
then
1507 del = tmp-dtresl*real(ind,fms_svp_kind_)
1510 desat(i) = real(dtable(ind+1),fms_svp_kind_) &
1511 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1518 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
1519 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: esat
1520 integer,
intent(out) :: nbad
1521 real(kind=fms_svp_kind_) :: tmp
1522 real(kind=fms_svp_kind_) :: del
1527 real(kind=fms_svp_kind_) :: dtresl
1528 real(kind=fms_svp_kind_) :: tepsll
1529 real(kind=fms_svp_kind_) :: tminll
1530 real(kind=fms_svp_kind_) :: dtinvll
1532 dtresl=real(dtres, fms_svp_kind_)
1533 tminll=real(tminl, fms_svp_kind_)
1534 tepsll=real(tepsl, fms_svp_kind_)
1535 dtinvll=real(dtinvl, fms_svp_kind_)
1538 do i = 1,
size(temp,1)
1539 tmp = temp(i)-tminll
1540 ind = int(dtinvll*(tmp+tepsll))
1541 if (ind < 0 .or. ind >= table_siz)
then
1544 del = tmp-dtresl*real(ind,fms_svp_kind_)
1547 esat(i) = real(table(ind+1),fms_svp_kind_) &
1548 + del*(real(dtable(ind+1),fms_svp_kind_) &
1549 + del*real(d2table(ind+1),fms_svp_kind_) )
1556 real(kind=fms_svp_kind_),
intent(in) :: temp
1557 real(kind=fms_svp_kind_),
intent(out) :: desat
1558 integer,
intent(out) :: nbad
1559 real(kind=fms_svp_kind_) :: tmp
1560 real(kind=fms_svp_kind_) :: del
1565 real(kind=fms_svp_kind_) :: dtresl
1566 real(kind=fms_svp_kind_) :: tepsll
1567 real(kind=fms_svp_kind_) :: tminll
1568 real(kind=fms_svp_kind_) :: dtinvll
1569 integer,
parameter :: lkind=fms_svp_kind_
1571 dtresl=real(dtres, fms_svp_kind_)
1572 tminll=real(tminl, fms_svp_kind_)
1573 tepsll=real(tepsl, fms_svp_kind_)
1574 dtinvll=real(dtinvl, fms_svp_kind_)
1578 ind = int(dtinvll*(tmp+tepsll))
1579 if (ind < 0 .or. ind >= table_siz)
then
1582 del = tmp-dtresl*real(ind,fms_svp_kind_)
1585 desat = real(dtable(ind+1),fms_svp_kind_) &
1586 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1592 real(kind=fms_svp_kind_),
intent(in) :: temp
1593 real(kind=fms_svp_kind_),
intent(out) :: esat
1594 integer,
intent(out) :: nbad
1595 real(kind=fms_svp_kind_) :: tmp
1596 real(kind=fms_svp_kind_) :: del
1601 real(kind=fms_svp_kind_) :: dtresl
1602 real(kind=fms_svp_kind_) :: tepsll
1603 real(kind=fms_svp_kind_) :: tminll
1604 real(kind=fms_svp_kind_) :: dtinvll
1606 dtresl=real(dtres, fms_svp_kind_)
1607 tminll=real(tminl, fms_svp_kind_)
1608 tepsll=real(tepsl, fms_svp_kind_)
1609 dtinvll=real(dtinvl, fms_svp_kind_)
1613 ind = int(dtinvll*(tmp+tepsll))
1614 if (ind < 0 .or. ind >= table_siz)
then
1617 del = tmp-dtresl*real(ind,fms_svp_kind_)
1620 esat = real(table(ind+1),fms_svp_kind_) &
1621 + del*( real(dtable(ind+1),fms_svp_kind_) &
1622 + del*real(d2table(ind+1),fms_svp_kind_) )
1629 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
1630 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: esat
1631 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: desat
1632 integer,
intent(out) :: nbad
1634 real(kind=fms_svp_kind_) :: tmp
1635 real(kind=fms_svp_kind_) :: del
1636 integer :: ind, i, j, k
1640 real(kind=fms_svp_kind_) :: dtresl
1641 real(kind=fms_svp_kind_) :: tepsll
1642 real(kind=fms_svp_kind_) :: tminll
1643 real(kind=fms_svp_kind_) :: dtinvll
1644 integer,
parameter :: lkind=fms_svp_kind_
1646 dtresl=real(dtres, fms_svp_kind_)
1647 tminll=real(tminl, fms_svp_kind_)
1648 tepsll=real(tepsl, fms_svp_kind_)
1649 dtinvll=real(dtinvl, fms_svp_kind_)
1652 do k = 1,
size(temp,3)
1653 do j = 1,
size(temp,2)
1654 do i = 1,
size(temp,1)
1655 tmp = temp(i,j,k)-tminll
1656 ind = int(dtinvll*(tmp+tepsll))
1657 if (ind < 0 .or. ind >= table_siz)
then
1660 del = tmp-dtresl*real(ind,fms_svp_kind_)
1663 esat(i,j,k) = real(table2(ind+1),fms_svp_kind_) &
1664 + del*( real(dtable2(ind+1),fms_svp_kind_) &
1665 + del*real(d2table2(ind+1),fms_svp_kind_) )
1668 desat(i,j,k) = real(dtable2(ind+1),fms_svp_kind_) &
1669 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
1680 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
1681 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: esat
1682 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: desat
1683 integer,
intent(out) :: nbad
1685 real(kind=fms_svp_kind_) :: tmp
1686 real(kind=fms_svp_kind_) :: del
1687 integer :: ind, i, j
1691 real(kind=fms_svp_kind_) :: dtresl
1692 real(kind=fms_svp_kind_) :: tepsll
1693 real(kind=fms_svp_kind_) :: tminll
1694 real(kind=fms_svp_kind_) :: dtinvll
1695 integer,
parameter :: lkind=fms_svp_kind_
1697 dtresl=real(dtres, fms_svp_kind_)
1698 tminll=real(tminl, fms_svp_kind_)
1699 tepsll=real(tepsl, fms_svp_kind_)
1700 dtinvll=real(dtinvl, fms_svp_kind_)
1703 do j = 1,
size(temp,2)
1704 do i = 1,
size(temp,1)
1705 tmp = temp(i,j)-tminll
1706 ind = int(dtinvll*(tmp+tepsll))
1707 if (ind < 0 .or. ind >= table_siz)
then
1710 del = tmp-dtresl*real(ind,fms_svp_kind_)
1713 esat(i,j) = real(table2(ind+1),fms_svp_kind_) &
1714 + del*( real(dtable2(ind+1),fms_svp_kind_) &
1715 + del*real(d2table2(ind+1),fms_svp_kind_) )
1718 desat(i,j) = real(dtable2(ind+1),fms_svp_kind_) &
1719 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
1729 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
1730 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: esat
1731 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: desat
1732 integer,
intent(out) :: nbad
1734 real(kind=fms_svp_kind_) :: tmp
1735 real(kind=fms_svp_kind_) :: del
1740 real(kind=fms_svp_kind_) :: dtresl
1741 real(kind=fms_svp_kind_) :: tepsll
1742 real(kind=fms_svp_kind_) :: tminll
1743 real(kind=fms_svp_kind_) :: dtinvll
1744 integer,
parameter :: lkind=fms_svp_kind_
1746 dtresl=real(dtres, fms_svp_kind_)
1747 tminll=real(tminl, fms_svp_kind_)
1748 tepsll=real(tepsl, fms_svp_kind_)
1749 dtinvll=real(dtinvl, fms_svp_kind_)
1752 do i = 1,
size(temp,1)
1753 tmp = temp(i)-tminll
1754 ind = int(dtinvll*(tmp+tepsll))
1755 if (ind < 0 .or. ind >= table_siz)
then
1758 del = tmp-dtresl*real(ind,fms_svp_kind_)
1761 esat(i) = real(table2(ind+1),fms_svp_kind_) &
1762 + del*( real(dtable2(ind+1),fms_svp_kind_) &
1763 + del*real(d2table2(ind+1),fms_svp_kind_) )
1765 desat(i) = real(dtable2(ind+1),fms_svp_kind_) &
1766 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
1775 real(kind=fms_svp_kind_),
intent(in) :: temp
1776 real(kind=fms_svp_kind_),
intent(out) :: esat
1777 real(kind=fms_svp_kind_),
intent(out) :: desat
1778 integer,
intent(out) :: nbad
1780 real(kind=fms_svp_kind_) :: tmp
1781 real(kind=fms_svp_kind_) :: del
1786 real(kind=fms_svp_kind_) :: dtresl
1787 real(kind=fms_svp_kind_) :: tepsll
1788 real(kind=fms_svp_kind_) :: tminll
1789 real(kind=fms_svp_kind_) :: dtinvll
1790 integer,
parameter :: lkind=fms_svp_kind_
1792 dtresl=real(dtres, fms_svp_kind_)
1793 tminll=real(tminl, fms_svp_kind_)
1794 tepsll=real(tepsl, fms_svp_kind_)
1795 dtinvll=real(dtinvl, fms_svp_kind_)
1800 ind = int(dtinvll*(tmp+tepsll))
1801 if (ind < 0 .or. ind >= table_siz)
then
1804 del = tmp-dtresl*real(ind,fms_svp_kind_)
1807 esat = real(table2(ind+1),fms_svp_kind_) &
1808 + del*( real(dtable2(ind+1),fms_svp_kind_) &
1809 + del*real(d2table2(ind+1),fms_svp_kind_) )
1812 desat = real(dtable2(ind+1),fms_svp_kind_) &
1813 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
1821 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
1822 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: esat
1823 integer,
intent(out) :: nbad
1824 real(kind=fms_svp_kind_) :: tmp
1825 real(kind=fms_svp_kind_) :: del
1826 integer :: ind, i, j, k
1830 real(kind=fms_svp_kind_) :: dtresl
1831 real(kind=fms_svp_kind_) :: tepsll
1832 real(kind=fms_svp_kind_) :: tminll
1833 real(kind=fms_svp_kind_) :: dtinvll
1835 dtresl=real(dtres, fms_svp_kind_)
1836 tminll=real(tminl, fms_svp_kind_)
1837 tepsll=real(tepsl, fms_svp_kind_)
1838 dtinvll=real(dtinvl, fms_svp_kind_)
1841 do k = 1,
size(temp,3)
1842 do j = 1,
size(temp,2)
1843 do i = 1,
size(temp,1)
1844 tmp = temp(i,j,k)-tminll
1845 ind = int(dtinvll*(tmp+tepsll))
1846 if (ind < 0 .or. ind >= table_siz)
then
1849 del = tmp-dtresl*real(ind,fms_svp_kind_)
1852 esat(i,j,k) = real(table2(ind+1),fms_svp_kind_) &
1853 + del*( real(dtable2(ind+1),fms_svp_kind_) &
1854 + del*real(d2table2(ind+1),fms_svp_kind_) )
1865 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
1866 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: desat
1867 integer,
intent(out) :: nbad
1868 real(kind=fms_svp_kind_) :: tmp
1869 real(kind=fms_svp_kind_) :: del
1870 integer :: ind, i, j, k
1874 real(kind=fms_svp_kind_) :: dtresl
1875 real(kind=fms_svp_kind_) :: tepsll
1876 real(kind=fms_svp_kind_) :: tminll
1877 real(kind=fms_svp_kind_) :: dtinvll
1878 integer,
parameter :: lkind=fms_svp_kind_
1880 dtresl=real(dtres, fms_svp_kind_)
1881 tminll=real(tminl, fms_svp_kind_)
1882 tepsll=real(tepsl, fms_svp_kind_)
1883 dtinvll=real(dtinvl, fms_svp_kind_)
1886 do k = 1,
size(temp,3)
1887 do j = 1,
size(temp,2)
1888 do i = 1,
size(temp,1)
1889 tmp = temp(i,j,k)-tminll
1890 ind = int(dtinvll*(tmp+tepsll))
1891 if (ind < 0 .or. ind >= table_siz)
then
1894 del = tmp-dtresl*real(ind,fms_svp_kind_)
1897 desat(i,j,k) = real(dtable2(ind+1),fms_svp_kind_) &
1898 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
1908 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
1909 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: desat
1910 integer,
intent(out) :: nbad
1911 real(kind=fms_svp_kind_) :: tmp
1912 real(kind=fms_svp_kind_) :: del
1913 integer :: ind, i, j
1917 real(kind=fms_svp_kind_) :: dtresl
1918 real(kind=fms_svp_kind_) :: tepsll
1919 real(kind=fms_svp_kind_) :: tminll
1920 real(kind=fms_svp_kind_) :: dtinvll
1921 integer,
parameter :: lkind=fms_svp_kind_
1923 dtresl=real(dtres, fms_svp_kind_)
1924 tminll=real(tminl, fms_svp_kind_)
1925 tepsll=real(tepsl, fms_svp_kind_)
1926 dtinvll=real(dtinvl, fms_svp_kind_)
1929 do j = 1,
size(temp,2)
1930 do i = 1,
size(temp,1)
1931 tmp = temp(i,j)-tminll
1932 ind = int(dtinvll*(tmp+tepsll))
1933 if (ind < 0 .or. ind >= table_siz)
then
1936 del = tmp-dtresl*real(ind,fms_svp_kind_)
1939 desat(i,j) = real(dtable2(ind+1),fms_svp_kind_) &
1940 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
1948 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
1949 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: esat
1950 integer,
intent(out) :: nbad
1951 real(kind=fms_svp_kind_) :: tmp
1952 real(kind=fms_svp_kind_) :: del
1953 integer :: ind, i, j
1957 real(kind=fms_svp_kind_) :: dtresl
1958 real(kind=fms_svp_kind_) :: tepsll
1959 real(kind=fms_svp_kind_) :: tminll
1960 real(kind=fms_svp_kind_) :: dtinvll
1962 dtresl=real(dtres, fms_svp_kind_)
1963 tminll=real(tminl, fms_svp_kind_)
1964 tepsll=real(tepsl, fms_svp_kind_)
1965 dtinvll=real(dtinvl, fms_svp_kind_)
1968 do j = 1,
size(temp,2)
1969 do i = 1,
size(temp,1)
1970 tmp = temp(i,j)-tminll
1971 ind = int(dtinvll*(tmp+tepsll))
1972 if (ind < 0 .or. ind >= table_siz)
then
1975 del = tmp-dtresl*real(ind,kind=fms_svp_kind_)
1978 esat(i,j) = real(table2(ind+1),fms_svp_kind_) &
1979 + del*( real(dtable2(ind+1),fms_svp_kind_) &
1980 + del*real(d2table2(ind+1),fms_svp_kind_) )
1988 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
1989 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: desat
1990 integer,
intent(out) :: nbad
1991 real(kind=fms_svp_kind_) :: tmp
1992 real(kind=fms_svp_kind_) :: del
1997 real(kind=fms_svp_kind_) :: dtresl
1998 real(kind=fms_svp_kind_) :: tepsll
1999 real(kind=fms_svp_kind_) :: tminll
2000 real(kind=fms_svp_kind_) :: dtinvll
2001 integer,
parameter :: lkind=fms_svp_kind_
2003 dtresl=real(dtres, fms_svp_kind_)
2004 tminll=real(tminl, fms_svp_kind_)
2005 tepsll=real(tepsl, fms_svp_kind_)
2006 dtinvll=real(dtinvl, fms_svp_kind_)
2009 do i = 1,
size(temp,1)
2010 tmp = temp(i)-tminll
2011 ind = int(dtinvll*(tmp+tepsll))
2012 if (ind < 0 .or. ind >= table_siz)
then
2015 del = tmp-dtresl*real(ind,fms_svp_kind_)
2018 desat(i) = real(dtable2(ind+1),fms_svp_kind_) &
2019 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
2026 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
2027 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: esat
2028 integer,
intent(out) :: nbad
2029 real(kind=fms_svp_kind_) :: tmp
2030 real(kind=fms_svp_kind_) :: del
2035 real(kind=fms_svp_kind_) :: dtresl
2036 real(kind=fms_svp_kind_) :: tepsll
2037 real(kind=fms_svp_kind_) :: tminll
2038 real(kind=fms_svp_kind_) :: dtinvll
2040 dtresl=real(dtres, fms_svp_kind_)
2041 tminll=real(tminl, fms_svp_kind_)
2042 tepsll=real(tepsl, fms_svp_kind_)
2043 dtinvll=real(dtinvl, fms_svp_kind_)
2046 do i = 1,
size(temp,1)
2047 tmp = temp(i)-tminll
2048 ind = int(dtinvll*(tmp+tepsll))
2049 if (ind < 0 .or. ind >= table_siz)
then
2052 del = tmp-dtresl*real(ind,fms_svp_kind_)
2055 esat(i) = real(table2(ind+1),fms_svp_kind_) &
2056 + del*( real(dtable2(ind+1),fms_svp_kind_) &
2057 + del*real(d2table2(ind+1),fms_svp_kind_) )
2064 real(kind=fms_svp_kind_),
intent(in) :: temp
2065 real(kind=fms_svp_kind_),
intent(out) :: desat
2066 integer,
intent(out) :: nbad
2067 real(kind=fms_svp_kind_) :: tmp
2068 real(kind=fms_svp_kind_) :: del
2073 real(kind=fms_svp_kind_) :: dtresl
2074 real(kind=fms_svp_kind_) :: tepsll
2075 real(kind=fms_svp_kind_) :: tminll
2076 real(kind=fms_svp_kind_) :: dtinvll
2077 integer,
parameter :: lkind=fms_svp_kind_
2079 dtresl=real(dtres, fms_svp_kind_)
2080 tminll=real(tminl, fms_svp_kind_)
2081 tepsll=real(tepsl, fms_svp_kind_)
2082 dtinvll=real(dtinvl, fms_svp_kind_)
2086 ind = int(dtinvll*(tmp+tepsll))
2087 if (ind < 0 .or. ind >= table_siz)
then
2090 del = tmp-dtresl*real(ind,fms_svp_kind_)
2093 desat = real(dtable2(ind+1),fms_svp_kind_) &
2094 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
2100 real(kind=fms_svp_kind_),
intent(in) :: temp
2101 real(kind=fms_svp_kind_),
intent(out) :: esat
2102 integer,
intent(out) :: nbad
2103 real(kind=fms_svp_kind_) :: tmp
2104 real(kind=fms_svp_kind_) :: del
2109 real(kind=fms_svp_kind_) :: dtresl
2110 real(kind=fms_svp_kind_) :: tepsll
2111 real(kind=fms_svp_kind_) :: tminll
2112 real(kind=fms_svp_kind_) :: dtinvll
2114 dtresl=real(dtres, fms_svp_kind_)
2115 tminll=real(tminl, fms_svp_kind_)
2116 tepsll=real(tepsl, fms_svp_kind_)
2117 dtinvll=real(dtinvl, fms_svp_kind_)
2121 ind = int(dtinvll*(tmp+tepsll))
2122 if (ind < 0 .or. ind >= table_siz)
then
2125 del = tmp-dtresl*real(ind,fms_svp_kind_)
2128 esat = real(table2(ind+1),fms_svp_kind_) &
2129 + del*( real(dtable2(ind+1),fms_svp_kind_) &
2130 + del*real(d2table2(ind+1),fms_svp_kind_) )
2139 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
2140 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: esat
2141 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: desat
2142 integer,
intent(out) :: nbad
2144 real(kind=fms_svp_kind_) :: tmp
2145 real(kind=fms_svp_kind_) :: del
2146 integer :: ind, i, j, k
2150 real(kind=fms_svp_kind_) :: dtresl
2151 real(kind=fms_svp_kind_) :: tepsll
2152 real(kind=fms_svp_kind_) :: tminll
2153 real(kind=fms_svp_kind_) :: dtinvll
2154 integer,
parameter :: lkind=fms_svp_kind_
2156 dtresl=real(dtres, fms_svp_kind_)
2157 tminll=real(tminl, fms_svp_kind_)
2158 tepsll=real(tepsl, fms_svp_kind_)
2159 dtinvll=real(dtinvl, fms_svp_kind_)
2162 do k = 1,
size(temp,3)
2163 do j = 1,
size(temp,2)
2164 do i = 1,
size(temp,1)
2165 tmp = temp(i,j,k)-tminll
2166 ind = int(dtinvll*(tmp+tepsll))
2167 if (ind < 0 .or. ind >= table_siz)
then
2170 del = tmp-dtresl*real(ind,fms_svp_kind_)
2173 esat(i,j,k) = real(table3(ind+1),fms_svp_kind_) &
2174 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2175 + del*real(d2table3(ind+1),fms_svp_kind_) )
2178 desat(i,j,k) = real(dtable3(ind+1),fms_svp_kind_) &
2179 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2190 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
2191 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: esat
2192 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: desat
2193 integer,
intent(out) :: nbad
2195 real(kind=fms_svp_kind_) :: tmp
2196 real(kind=fms_svp_kind_) :: del
2197 integer :: ind, i, j
2201 real(kind=fms_svp_kind_) :: dtresl
2202 real(kind=fms_svp_kind_) :: tepsll
2203 real(kind=fms_svp_kind_) :: tminll
2204 real(kind=fms_svp_kind_) :: dtinvll
2205 integer,
parameter :: lkind=fms_svp_kind_
2207 dtresl=real(dtres, fms_svp_kind_)
2208 tminll=real(tminl, fms_svp_kind_)
2209 tepsll=real(tepsl, fms_svp_kind_)
2210 dtinvll=real(dtinvl, fms_svp_kind_)
2213 do j = 1,
size(temp,2)
2214 do i = 1,
size(temp,1)
2215 tmp = temp(i,j)-tminll
2216 ind = int(dtinvll*(tmp+tepsll))
2217 if (ind < 0 .or. ind >= table_siz)
then
2220 del = tmp-dtresl*real(ind,fms_svp_kind_)
2223 esat(i,j) = real(table3(ind+1),fms_svp_kind_) &
2224 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2225 + del*real(d2table3(ind+1),fms_svp_kind_) )
2228 desat(i,j) = real(dtable3(ind+1),fms_svp_kind_) &
2229 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2239 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
2240 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: esat
2241 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: desat
2242 integer,
intent(out) :: nbad
2244 real(kind=fms_svp_kind_) :: tmp
2245 real(kind=fms_svp_kind_) :: del
2250 real(kind=fms_svp_kind_) :: dtresl
2251 real(kind=fms_svp_kind_) :: tepsll
2252 real(kind=fms_svp_kind_) :: tminll
2253 real(kind=fms_svp_kind_) :: dtinvll
2254 integer,
parameter :: lkind=fms_svp_kind_
2256 dtresl=real(dtres, fms_svp_kind_)
2257 tminll=real(tminl, fms_svp_kind_)
2258 tepsll=real(tepsl, fms_svp_kind_)
2259 dtinvll=real(dtinvl, fms_svp_kind_)
2262 do i = 1,
size(temp,1)
2263 tmp = temp(i)-tminll
2264 ind = int(dtinvll*(tmp+tepsll))
2265 if (ind < 0 .or. ind >= table_siz)
then
2268 del = tmp-dtresl*real(ind,fms_svp_kind_)
2271 esat(i) = real(table3(ind+1),fms_svp_kind_) &
2272 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2273 + del*real(d2table3(ind+1),fms_svp_kind_) )
2276 desat(i) = real(dtable3(ind+1),fms_svp_kind_) &
2277 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2286 real(kind=fms_svp_kind_),
intent(in) :: temp
2287 real(kind=fms_svp_kind_),
intent(out) :: esat
2288 real(kind=fms_svp_kind_),
intent(out) :: desat
2289 integer,
intent(out) :: nbad
2291 real(kind=fms_svp_kind_) :: tmp
2292 real(kind=fms_svp_kind_) :: del
2297 real(kind=fms_svp_kind_) :: dtresl
2298 real(kind=fms_svp_kind_) :: tepsll
2299 real(kind=fms_svp_kind_) :: tminll
2300 real(kind=fms_svp_kind_) :: dtinvll
2301 integer,
parameter :: lkind=fms_svp_kind_
2303 dtresl=real(dtres, fms_svp_kind_)
2304 tminll=real(tminl, fms_svp_kind_)
2305 tepsll=real(tepsl, fms_svp_kind_)
2306 dtinvll=real(dtinvl, fms_svp_kind_)
2310 ind = int(dtinvll*(tmp+tepsll))
2311 if (ind < 0 .or. ind >= table_siz)
then
2314 del = tmp-dtresl*real(ind,fms_svp_kind_)
2317 esat = real(table3(ind+1),fms_svp_kind_) &
2318 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2319 + del*real(d2table3(ind+1),fms_svp_kind_) )
2322 desat = real(dtable3(ind+1),fms_svp_kind_) &
2323 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2331 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
2332 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: esat
2333 integer,
intent(out) :: nbad
2334 real(kind=fms_svp_kind_) :: tmp
2335 real(kind=fms_svp_kind_) :: del
2336 integer :: ind, i, j, k
2340 real(kind=fms_svp_kind_) :: dtresl
2341 real(kind=fms_svp_kind_) :: tepsll
2342 real(kind=fms_svp_kind_) :: tminll
2343 real(kind=fms_svp_kind_) :: dtinvll
2345 dtresl=real(dtres, fms_svp_kind_)
2346 tminll=real(tminl, fms_svp_kind_)
2347 tepsll=real(tepsl, fms_svp_kind_)
2348 dtinvll=real(dtinvl, fms_svp_kind_)
2351 do k = 1,
size(temp,3)
2352 do j = 1,
size(temp,2)
2353 do i = 1,
size(temp,1)
2354 tmp = temp(i,j,k)-tminll
2355 ind = int(dtinvll*(tmp+tepsll))
2356 if (ind < 0 .or. ind >= table_siz)
then
2359 del = tmp-dtresl*real(ind,fms_svp_kind_)
2362 esat(i,j,k) = real(table3(ind+1),fms_svp_kind_) &
2363 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2364 + del*real(d2table3(ind+1),fms_svp_kind_) )
2375 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
2376 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: desat
2377 integer,
intent(out) :: nbad
2378 real(kind=fms_svp_kind_) :: tmp
2379 real(kind=fms_svp_kind_) :: del
2380 integer :: ind, i, j, k
2384 real(kind=fms_svp_kind_) :: dtresl
2385 real(kind=fms_svp_kind_) :: tepsll
2386 real(kind=fms_svp_kind_) :: tminll
2387 real(kind=fms_svp_kind_) :: dtinvll
2388 integer,
parameter :: lkind=fms_svp_kind_
2390 dtresl=real(dtres, fms_svp_kind_)
2391 tminll=real(tminl, fms_svp_kind_)
2392 tepsll=real(tepsl, fms_svp_kind_)
2393 dtinvll=real(dtinvl, fms_svp_kind_)
2396 do k = 1,
size(temp,3)
2397 do j = 1,
size(temp,2)
2398 do i = 1,
size(temp,1)
2399 tmp = temp(i,j,k)-tminll
2400 ind = int(dtinvll*(tmp+tepsll))
2401 if (ind < 0 .or. ind >= table_siz)
then
2404 del = tmp-dtresl*real(ind,fms_svp_kind_)
2407 desat(i,j,k) = real(dtable3(ind+1),fms_svp_kind_) &
2408 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2418 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
2419 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: desat
2420 integer,
intent(out) :: nbad
2421 real(kind=fms_svp_kind_) :: tmp
2422 real(kind=fms_svp_kind_) :: del
2423 integer :: ind, i, j
2427 real(kind=fms_svp_kind_) :: dtresl
2428 real(kind=fms_svp_kind_) :: tepsll
2429 real(kind=fms_svp_kind_) :: tminll
2430 real(kind=fms_svp_kind_) :: dtinvll
2431 integer,
parameter :: lkind=fms_svp_kind_
2433 dtresl=real(dtres, fms_svp_kind_)
2434 tminll=real(tminl, fms_svp_kind_)
2435 tepsll=real(tepsl, fms_svp_kind_)
2436 dtinvll=real(dtinvl, fms_svp_kind_)
2439 do j = 1,
size(temp,2)
2440 do i = 1,
size(temp,1)
2441 tmp = temp(i,j)-tminll
2442 ind = int(dtinvll*(tmp+tepsll))
2443 if (ind < 0 .or. ind >= table_siz)
then
2446 del = tmp-dtresl*real(ind,fms_svp_kind_)
2449 desat(i,j) = real(dtable3(ind+1),fms_svp_kind_) &
2450 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2458 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
2459 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: esat
2460 integer,
intent(out) :: nbad
2461 real(kind=fms_svp_kind_) :: tmp
2462 real(kind=fms_svp_kind_) :: del
2463 integer :: ind, i, j
2467 real(kind=fms_svp_kind_) :: dtresl
2468 real(kind=fms_svp_kind_) :: tepsll
2469 real(kind=fms_svp_kind_) :: tminll
2470 real(kind=fms_svp_kind_) :: dtinvll
2472 dtresl=real(dtres, fms_svp_kind_)
2473 tminll=real(tminl, fms_svp_kind_)
2474 tepsll=real(tepsl, fms_svp_kind_)
2475 dtinvll=real(dtinvl, fms_svp_kind_)
2478 do j = 1,
size(temp,2)
2479 do i = 1,
size(temp,1)
2480 tmp = temp(i,j)-tminll
2481 ind = int(dtinvll*(tmp+tepsll))
2482 if (ind < 0 .or. ind >= table_siz)
then
2485 del = tmp-dtresl*real(ind,fms_svp_kind_)
2488 esat(i,j) = real(table3(ind+1),fms_svp_kind_) &
2489 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2490 + del*real(d2table3(ind+1),fms_svp_kind_) )
2498 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
2499 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: desat
2500 integer,
intent(out) :: nbad
2501 real(kind=fms_svp_kind_) :: tmp
2502 real(kind=fms_svp_kind_) :: del
2507 real(kind=fms_svp_kind_) :: dtresl
2508 real(kind=fms_svp_kind_) :: tepsll
2509 real(kind=fms_svp_kind_) :: tminll
2510 real(kind=fms_svp_kind_) :: dtinvll
2511 integer,
parameter :: lkind=fms_svp_kind_
2513 dtresl=real(dtres, fms_svp_kind_)
2514 tminll=real(tminl, fms_svp_kind_)
2515 tepsll=real(tepsl, fms_svp_kind_)
2516 dtinvll=real(dtinvl, fms_svp_kind_)
2519 do i = 1,
size(temp,1)
2520 tmp = temp(i)-tminll
2521 ind = int(dtinvll*(tmp+tepsll))
2522 if (ind < 0 .or. ind >= table_siz)
then
2525 del = tmp-dtresl*real(ind,fms_svp_kind_)
2528 desat(i) = real(dtable3(ind+1),fms_svp_kind_) &
2529 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2536 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
2537 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: esat
2538 integer,
intent(out) :: nbad
2539 real(kind=fms_svp_kind_) :: tmp
2540 real(kind=fms_svp_kind_) :: del
2545 real(kind=fms_svp_kind_) :: dtresl
2546 real(kind=fms_svp_kind_) :: tepsll
2547 real(kind=fms_svp_kind_) :: tminll
2548 real(kind=fms_svp_kind_) :: dtinvll
2550 dtresl=real(dtres, fms_svp_kind_)
2551 tminll=real(tminl, fms_svp_kind_)
2552 tepsll=real(tepsl, fms_svp_kind_)
2553 dtinvll=real(dtinvl, fms_svp_kind_)
2556 do i = 1,
size(temp,1)
2557 tmp = temp(i)-tminll
2558 ind = int(dtinvll*(tmp+tepsll))
2559 if (ind < 0 .or. ind >= table_siz)
then
2562 del = tmp-dtresl*real(ind,fms_svp_kind_)
2565 esat(i) = real(table3(ind+1),fms_svp_kind_) &
2566 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2567 + del*real(d2table3(ind+1),fms_svp_kind_) )
2574 real(kind=fms_svp_kind_),
intent(in) :: temp
2575 real(kind=fms_svp_kind_),
intent(out) :: desat
2576 integer,
intent(out) :: nbad
2577 real(kind=fms_svp_kind_) :: tmp
2578 real(kind=fms_svp_kind_) :: del
2583 real(kind=fms_svp_kind_) :: dtresl
2584 real(kind=fms_svp_kind_) :: tepsll
2585 real(kind=fms_svp_kind_) :: tminll
2586 real(kind=fms_svp_kind_) :: dtinvll
2587 integer,
parameter :: lkind=fms_svp_kind_
2589 dtresl=real(dtres, fms_svp_kind_)
2590 tminll=real(tminl, fms_svp_kind_)
2591 tepsll=real(tepsl, fms_svp_kind_)
2592 dtinvll=real(dtinvl, fms_svp_kind_)
2596 ind = int(dtinvll*(tmp+tepsll))
2597 if (ind < 0 .or. ind >= table_siz)
then
2600 del = tmp-dtresl*real(ind,fms_svp_kind_)
2603 desat = real(dtable3(ind+1),fms_svp_kind_) &
2604 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2610 real(kind=fms_svp_kind_),
intent(in) :: temp
2611 real(kind=fms_svp_kind_),
intent(out) :: esat
2612 integer,
intent(out) :: nbad
2613 real(kind=fms_svp_kind_) :: tmp
2614 real(kind=fms_svp_kind_) :: del
2619 real(kind=fms_svp_kind_) :: dtresl
2620 real(kind=fms_svp_kind_) :: tepsll
2621 real(kind=fms_svp_kind_) :: tminll
2622 real(kind=fms_svp_kind_) :: dtinvll
2624 dtresl=real(dtres, fms_svp_kind_)
2625 tminll=real(tminl, fms_svp_kind_)
2626 tepsll=real(tepsl, fms_svp_kind_)
2627 dtinvll=real(dtinvl, fms_svp_kind_)
2631 ind = int(dtinvll*(tmp+tepsll))
2632 if (ind < 0 .or. ind >= table_siz)
then
2635 del = tmp-dtresl*real(ind,fms_svp_kind_)
2638 esat = real(table3(ind+1),fms_svp_kind_) &
2639 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2640 + del*real(d2table3(ind+1),fms_svp_kind_) )
subroutine lookup_es2_k_3d_(temp, esat, nbad)
subroutine lookup_es3_des3_k_1d_(temp, esat, desat, nbad)
subroutine lookup_es2_k_2d_(temp, esat, nbad)
subroutine lookup_es2_des2_k_0d_(temp, esat, desat, nbad)
subroutine compute_qs_k_2d_(temp, press, eps, zvir, qs, nbad, q, hc, dqsdT, esat, es_over_liq, es_over_liq_and_ice)
subroutine lookup_es_des_k_3d_(temp, esat, desat, nbad)
subroutine lookup_es3_k_2d_(temp, esat, nbad)
subroutine compute_qs_k_1d_(temp, press, eps, zvir, qs, nbad, q, hc, dqsdT, esat, es_over_liq, es_over_liq_and_ice)
subroutine compute_qs_k_0d_(temp, press, eps, zvir, qs, nbad, q, hc, dqsdT, esat, es_over_liq, es_over_liq_and_ice)
subroutine lookup_des_k_3d_(temp, desat, nbad)
subroutine lookup_es3_k_0d_(temp, esat, nbad)
subroutine lookup_es3_des3_k_2d_(temp, esat, desat, nbad)
subroutine lookup_es_k_2d_(temp, esat, nbad)
subroutine lookup_es3_k_1d_(temp, esat, nbad)
subroutine lookup_es2_des2_k_3d_(temp, esat, desat, nbad)
subroutine lookup_es_k_3d_(temp, esat, nbad)
subroutine lookup_des2_k_2d_(temp, desat, nbad)
subroutine lookup_des2_k_0d_(temp, desat, nbad)
subroutine lookup_es_des_k_2d_(temp, esat, desat, nbad)
subroutine lookup_es_des_k_0d_(temp, esat, desat, nbad)
subroutine lookup_es_des_k_1d_(temp, esat, desat, nbad)
subroutine lookup_des_k_0d_(temp, desat, nbad)
subroutine lookup_es2_des2_k_2d_(temp, esat, desat, nbad)
subroutine lookup_des2_k_1d_(temp, desat, nbad)
subroutine compute_qs_k_3d_(temp, press, eps, zvir, qs, nbad, q, hc, dqsdT, esat, es_over_liq, es_over_liq_and_ice)
subroutine lookup_es2_k_1d_(temp, esat, nbad)
subroutine lookup_es3_des3_k_0d_(temp, esat, desat, nbad)
subroutine lookup_es_k_0d_(temp, esat, nbad)
subroutine lookup_es3_k_3d_(temp, esat, nbad)
subroutine lookup_es3_des3_k_3d_(temp, esat, desat, nbad)
subroutine lookup_des_k_1d_(temp, desat, nbad)
real(kind=fms_svp_kind_) function, dimension(size(tem, 1)) compute_es_liq_k_(tem, TFREEZE)
subroutine lookup_es2_k_0d_(temp, esat, nbad)
subroutine lookup_des_k_2d_(temp, desat, nbad)
real(kind=fms_svp_kind_) function, dimension(size(tem, 1)) compute_es_liq_ice_k_(tem, TFREEZE)
subroutine lookup_des3_k_2d_(temp, desat, nbad)
subroutine lookup_es2_des2_k_1d_(temp, esat, desat, nbad)
subroutine lookup_des3_k_3d_(temp, desat, nbad)
subroutine lookup_es_k_1d_(temp, esat, nbad)
subroutine compute_mrs_k_0d_(temp, press, eps, zvir, mrs, nbad, mr, hc, dmrsdT, esat, es_over_liq, es_over_liq_and_ice)
subroutine lookup_des3_k_1d_(temp, desat, nbad)
subroutine compute_mrs_k_1d_(temp, press, eps, zvir, mrs, nbad, mr, hc, dmrsdT, esat, es_over_liq, es_over_liq_and_ice)
subroutine sat_vapor_pres_init_k_(table_size, tcmin, tcmax, TFREEZE, HLV, RVGAS, ES0, err_msg, use_exact_qs_input, do_simple, construct_table_wrt_liq, construct_table_wrt_liq_and_ice, teps, tmin, dtinv)
This routine has been generalized to return tables for any temperature range and resolution The TABLE...
subroutine compute_mrs_k_2d_(temp, press, eps, zvir, mrs, nbad, mr, hc, dmrsdT, esat, es_over_liq, es_over_liq_and_ice)
real(kind=fms_svp_kind_) function, dimension(size(tem, 1)) compute_es_k_(tem, TFREEZE)
subroutine lookup_des2_k_3d_(temp, desat, nbad)
subroutine lookup_des3_k_0d_(temp, desat, nbad)
subroutine compute_mrs_k_3d_(temp, press, eps, zvir, mrs, nbad, mr, hc, dmrsdT, esat, es_over_liq, es_over_liq_and_ice)