39 use_exact_qs_input, do_simple, &
40 construct_table_wrt_liq, &
41 construct_table_wrt_liq_and_ice, &
44 integer,
intent(in) :: table_size
45 real(kind=fms_svp_kind_),
intent(in) :: tcmin
46 real(kind=fms_svp_kind_),
intent(in) :: tcmax
47 real(kind=fms_svp_kind_),
intent(in) :: tfreeze
48 real(kind=fms_svp_kind_),
intent(in) :: hlv
49 real(kind=fms_svp_kind_),
intent(in) :: rvgas
50 real(kind=fms_svp_kind_),
intent(in) :: es0
51 logical,
intent(in) :: use_exact_qs_input
52 logical,
intent(in) :: do_simple
53 logical,
intent(in) :: construct_table_wrt_liq
54 logical,
intent(in) :: construct_table_wrt_liq_and_ice
55 character(len=*),
intent(out) :: err_msg
56 real(kind=fms_svp_kind_),
intent(out),
optional :: teps
57 real(kind=fms_svp_kind_),
intent(out),
optional :: tmin
58 real(kind=fms_svp_kind_),
intent(out),
optional :: dtinv
65 real(kind=r8_kind),
dimension(3) :: tem(3), es(3)
66 real(kind=r8_kind) :: hdtinv, tinrc, tfact
71 if (module_is_initialized)
return
73 if(
allocated(table) .or.
allocated(dtable) .or.
allocated(d2table))
then
74 err_msg =
'Attempt to allocate sat vapor pressure tables when already allocated'
77 allocate(table(table_size), dtable(table_size), d2table(table_size))
80 if (construct_table_wrt_liq)
then
81 if(
allocated(table2) .or.
allocated(dtable2) .or.
allocated(d2table2))
then
82 err_msg =
'Attempt to allocate sat vapor pressure table2s when already allocated'
85 allocate(table2(table_size), dtable2(table_size), d2table2(table_size))
89 if (construct_table_wrt_liq_and_ice)
then
90 if(
allocated(table3) .or.
allocated(dtable3) .or.
allocated(d2table3))
then
91 err_msg =
'Attempt to allocate sat vapor pressure table2s when already allocated'
94 allocate(table3(table_size), dtable3(table_size), d2table3(table_size))
98 table_siz = table_size
99 dtres = (real(tcmax,r8_kind)-real(tcmin,r8_kind))/real(table_size-1,r8_kind)
100 tminl = real(tcmin,r8_kind)+real(tfreeze,r8_kind)
101 dtinvl = 1.0_r8_kind/dtres
102 tepsl = 0.5_r8_kind*dtres
103 tinrc = 0.1_r8_kind*dtres
104 if(
present(teps )) teps =real(tepsl, fms_svp_kind_)
105 if(
present(tmin )) tmin =real(tminl, fms_svp_kind_)
106 if(
present(dtinv)) dtinv=real(dtinvl, fms_svp_kind_)
111 tfact = 5.0_r8_kind*dtinvl
113 hdtinv = 0._r8_kind*dtinvl
123 tem(1) = tminl + dtres*real(i-1,r8_kind)
124 table(i) = real(es0,r8_kind)*610.78_r8_kind* &
125 exp( -real(hlv,r8_kind)/real(rvgas,r8_kind) * (1.0_r8_kind/tem(1) - 1._r8_kind/real(tfreeze,r8_kind)) )
126 dtable(i) = real(hlv,r8_kind)*table(i)/real(rvgas,r8_kind)/tem(1)**2._r8_kind
132 tem(1) = tminl + dtres*real(i-1,r8_kind)
133 tem(2) = tem(1)-tinrc
134 tem(3) = tem(1)+tinrc
135 es = compute_es_k(tem, real(tfreeze,r8_kind))
137 dtable(i) = (es(3)-es(2))*tfact
145 do i = 2, table_size-1
146 d2table(i) = 0.25_r8_kind*dtinvl*(dtable(i+1)-dtable(i-1))
150 d2table(1) = 0.50_r8_kind*dtinvl*(dtable(2)-dtable(1))
152 d2table(table_size) = 0.50_r8_kind*dtinvl*(dtable(table_size)-dtable(table_size-1))
154 if (construct_table_wrt_liq)
then
159 tem(1) = tminl + dtres*real(i-1,r8_kind)
160 tem(2) = tem(1)-tinrc
161 tem(3) = tem(1)+tinrc
163 es = compute_es_liq_k(tem, real(tfreeze,r8_kind))
165 dtable2(i) = (es(3)-es(2))*tfact
171 do i = 2, table_size-1
172 d2table2(i) = 0.25_r8_kind*dtinvl*(dtable2(i+1)-dtable2(i-1))
176 d2table2(1) = 0.50_r8_kind*dtinvl*(dtable2(2)-dtable2(1))
178 d2table2(table_size) = 0.50_r8_kind*dtinvl*(dtable2(table_size)-dtable2(table_size-1))
182 if (construct_table_wrt_liq_and_ice)
then
187 tem(1) = tminl + dtres*real(i-1,r8_kind)
188 tem(2) = tem(1)-tinrc
189 tem(3) = tem(1)+tinrc
191 es = compute_es_liq_ice_k(tem, real(tfreeze,r8_kind))
193 dtable3(i) = (es(3)-es(2))*tfact
199 do i = 2, table_size-1
200 d2table3(i) = 0.25_r8_kind*dtinvl*(dtable3(i+1)-dtable3(i-1))
204 d2table3(1) = 0.50_r8_kind*dtinvl*(dtable3(2)-dtable3(1))
206 d2table3(table_size) = 0.50_r8_kind*dtinvl*(dtable3(table_size)-dtable3(table_size-1))
209 use_exact_qs = use_exact_qs_input
210 module_is_initialized = .true.
217 real(kind=fms_svp_kind_),
intent(in) :: tem(:)
218 real(kind=fms_svp_kind_),
intent(in) :: tfreeze
219 real(kind=fms_svp_kind_) :: es(
size(tem,1))
221 real(kind=fms_svp_kind_) :: x
222 real(kind=fms_svp_kind_) :: esice
223 real(kind=fms_svp_kind_) :: esh2o
224 real(kind=fms_svp_kind_) :: tbasw
225 real(kind=fms_svp_kind_) :: tbasi
228 integer,
parameter :: lkind=fms_svp_kind_
230 real(kind=fms_svp_kind_),
parameter :: esbasw = 101324.60_lkind
231 real(kind=fms_svp_kind_),
parameter :: esbasi = 610.71_lkind
235 real(fms_svp_kind_),
parameter :: one=1.0_lkind
236 real(fms_svp_kind_),
parameter :: ten=10.0_lkind
238 tbasw = tfreeze+100.0_lkind
247 if (tem(i) < tbasi)
then
248 x = -9.09718_lkind*(tbasi/tem(i)-one) &
249 -3.56654_lkind*log10(tbasi/tem(i)) &
250 +0.876793_lkind*(one-tem(i)/tbasi) + log10(esbasi)
264 if (tem(i) > -20.0_lkind+tbasi)
then
265 x = -7.90298_lkind*(tbasw/tem(i)-one) &
266 +5.02808_lkind*log10(tbasw/tem(i)) &
267 -1.3816e-07_lkind*(ten**((one-tem(i)/tbasw)*11.344_lkind)-one) &
268 +8.1328e-03_lkind*(ten**((tbasw/tem(i)-one)*(-3.49149_lkind))-one) &
279 if (tem(i) <= -20.0_lkind+tbasi)
then
281 else if (tem(i) >= tbasi)
then
284 es(i) = 0.05_lkind*((tbasi-tem(i))*esice + (tem(i)-tbasi+20.0_lkind)*esh2o)
294 real(kind=fms_svp_kind_),
intent(in) :: tem(:)
295 real(kind=fms_svp_kind_),
intent(in) :: tfreeze
296 real(kind=fms_svp_kind_) :: es(
size(tem,1))
298 real(kind=fms_svp_kind_) :: x
299 real(kind=fms_svp_kind_) :: esh2o
300 real(kind=fms_svp_kind_) :: tbasw
306 integer,
parameter :: lkind=fms_svp_kind_
307 real(kind=fms_svp_kind_),
parameter :: one=1.0_lkind
308 real(kind=fms_svp_kind_),
parameter :: ten=10.0_lkind
309 real(kind=fms_svp_kind_),
parameter :: esbasw = 101324.60_lkind
311 tbasw = tfreeze+100.0_lkind
323 x = -7.90298_lkind*(tbasw/tem(i)-one) &
324 +5.02808_lkind*log10(tbasw/tem(i)) &
325 -1.3816e-07_lkind*(ten**((one-tem(i)/tbasw)*11.344_lkind)-one) &
326 +8.1328e-03_lkind*(ten**((tbasw/tem(i)-one)*(-3.49149_lkind))-one)&
339 real(kind=fms_svp_kind_),
intent(in) :: tem(:)
340 real(kind=fms_svp_kind_),
intent(in) :: tfreeze
341 real(kind=fms_svp_kind_) :: es(
size(tem,1))
343 real(kind=fms_svp_kind_) :: x
344 real(kind=fms_svp_kind_) :: tbasw
345 real(kind=fms_svp_kind_) :: tbasi
348 integer,
parameter :: lkind=fms_svp_kind_
349 real(kind=fms_svp_kind_),
parameter :: esbasw = 101324.60_lkind
350 real(kind=fms_svp_kind_),
parameter :: esbasi = 610.71_lkind
353 real(kind=fms_svp_kind_),
parameter :: one=1.0_lkind
354 real(kind=fms_svp_kind_),
parameter :: ten=10.0_lkind
356 tbasw = tfreeze+100.0_lkind
361 if (tem(i) < tbasi)
then
366 x = -9.09718_lkind*(tbasi/tem(i)-one) &
367 -3.56654_lkind*log10(tbasi/tem(i)) &
368 +0.876793_lkind*(one-tem(i)/tbasi) + log10(esbasi)
379 x = -7.90298_lkind*(tbasw/tem(i)-one) &
380 +5.02808_lkind*log10(tbasw/tem(i)) &
381 -1.3816e-07_lkind*(ten**((one-tem(i)/tbasw)*11.344_lkind)-one) &
382 +8.1328e-03_lkind*(ten**((tbasw/tem(i)-one)*(-3.49149_lkind))-one) &
393 dqsdT, esat, es_over_liq, es_over_liq_and_ice)
395 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
396 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: press
397 real(kind=fms_svp_kind_),
intent(in) :: eps
398 real(kind=fms_svp_kind_),
intent(in) :: zvir
399 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: qs
400 integer,
intent(out) :: nbad
401 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:),
optional :: q
402 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
403 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:),
optional :: dqsdt
404 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:),
optional :: esat
405 logical,
intent(in),
optional :: es_over_liq
406 logical,
intent(in),
optional :: es_over_liq_and_ice
408 integer,
parameter :: lkind=fms_svp_kind_
410 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2), size(temp,3)) :: esloc
411 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2), size(temp,3)) :: desat
412 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2), size(temp,3)) :: denom
414 real(kind=fms_svp_kind_) :: hc_loc
416 if (
present(hc))
then
421 if (
present(es_over_liq))
then
422 if (
present (dqsdt))
then
423 call lookup_es2_des2_k (temp, esloc, desat, nbad)
426 call lookup_es2_k (temp, esloc, nbad)
428 else if (
present(es_over_liq_and_ice))
then
429 if (
present (dqsdt))
then
430 call lookup_es3_des3_k (temp, esloc, desat, nbad)
433 call lookup_es3_k (temp, esloc, nbad)
436 if (
present (dqsdt))
then
437 call lookup_es_des_k (temp, esloc, desat, nbad)
440 call lookup_es_k (temp, esloc, nbad)
444 if (
present (esat))
then
448 if (
present (q) .and. use_exact_qs)
then
449 qs = (1.0_lkind + zvir*q)*eps*esloc/press
450 if (
present (dqsdt))
then
451 dqsdt = (1.0_lkind + zvir*q)*eps*desat/press
454 denom = press - (1.0_lkind - eps)*esloc
458 if (denom(i,j,k) > 0.0_lkind)
then
459 qs(i,j,k) = eps*esloc(i,j,k)/denom(i,j,k)
466 if (
present (dqsdt))
then
467 dqsdt = eps*press*desat/denom**2
472 if (
present (dqsdt))
then
475 if (
present (esat))
then
486 dqsdT, esat, es_over_liq, es_over_liq_and_ice)
488 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
489 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: press
490 real(kind=fms_svp_kind_),
intent(in) :: eps
491 real(kind=fms_svp_kind_),
intent(in) :: zvir
492 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: qs
493 integer,
intent(out) :: nbad
494 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:),
optional :: q
495 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
496 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:),
optional :: dqsdt
497 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:),
optional :: esat
498 logical,
intent(in),
optional :: es_over_liq
499 logical,
intent(in),
optional :: es_over_liq_and_ice
501 integer,
parameter :: lkind=fms_svp_kind_
503 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2)) :: esloc
504 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2)) :: desat
505 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2)) :: denom
507 real(kind=fms_svp_kind_) :: hc_loc
509 if (
present(hc))
then
515 if (
present(es_over_liq))
then
516 if (
present (dqsdt))
then
517 call lookup_es2_des2_k (temp, esloc, desat, nbad)
520 call lookup_es2_k (temp, esloc, nbad)
522 else if (
present(es_over_liq_and_ice))
then
523 if (
present (dqsdt))
then
524 call lookup_es3_des3_k (temp, esloc, desat, nbad)
527 call lookup_es3_k (temp, esloc, nbad)
530 if (
present (dqsdt))
then
531 call lookup_es_des_k (temp, esloc, desat, nbad)
534 call lookup_es_k (temp, esloc, nbad)
538 if (
present (esat))
then
542 if (
present (q) .and. use_exact_qs)
then
543 qs = (1.0_lkind + zvir*q)*eps*esloc/press
544 if (
present (dqsdt))
then
545 dqsdt = (1.0_lkind + zvir*q)*eps*desat/press
548 denom = press - (1.0_lkind - eps)*esloc
551 if (denom(i,j) > 0.0_lkind)
then
552 qs(i,j) = eps*esloc(i,j)/denom(i,j)
558 if (
present (dqsdt))
then
559 dqsdt = eps*press*desat/denom**2
564 if (
present (dqsdt))
then
567 if (
present (esat))
then
578 dqsdT, esat, es_over_liq, es_over_liq_and_ice)
580 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
581 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: press
582 real(kind=fms_svp_kind_),
intent(in) :: eps
583 real(kind=fms_svp_kind_),
intent(in) :: zvir
584 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: qs
585 integer,
intent(out) :: nbad
586 real(kind=fms_svp_kind_),
intent(in),
dimension(:),
optional :: q
587 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
588 real(kind=fms_svp_kind_),
intent(out),
dimension(:),
optional :: dqsdt
589 real(kind=fms_svp_kind_),
intent(out),
dimension(:),
optional :: esat
590 logical,
intent(in),
optional :: es_over_liq
591 logical,
intent(in),
optional :: es_over_liq_and_ice
593 integer,
parameter :: lkind=fms_svp_kind_
595 real(kind=fms_svp_kind_),
dimension(size(temp,1)) :: esloc
596 real(kind=fms_svp_kind_),
dimension(size(temp,1)) :: desat
597 real(kind=fms_svp_kind_),
dimension(size(temp,1)) :: denom
599 real(kind=fms_svp_kind_) :: hc_loc
601 if (
present(hc))
then
607 if (
present(es_over_liq))
then
608 if (
present (dqsdt))
then
609 call lookup_es2_des2_k (temp, esloc, desat, nbad)
612 call lookup_es2_k (temp, esloc, nbad)
614 else if (
present(es_over_liq_and_ice))
then
615 if (
present (dqsdt))
then
616 call lookup_es3_des3_k (temp, esloc, desat, nbad)
619 call lookup_es3_k (temp, esloc, nbad)
622 if (
present (dqsdt))
then
623 call lookup_es_des_k (temp, esloc, desat, nbad)
626 call lookup_es_k (temp, esloc, nbad)
630 if (
present (esat))
then
634 if (
present (q) .and. use_exact_qs)
then
635 qs = (1.0_lkind + zvir*q)*eps*esloc/press
636 if (
present (dqsdt))
then
637 dqsdt = (1.0_lkind + zvir*q)*eps*desat/press
640 denom = press - (1.0_lkind - eps)*esloc
642 if (denom(i) > 0.0_lkind)
then
643 qs(i) = eps*esloc(i)/denom(i)
648 if (
present (dqsdt))
then
649 dqsdt = eps*press*desat/denom**2
654 if (
present (dqsdt))
then
657 if (
present (esat))
then
668 dqsdT, esat, es_over_liq, es_over_liq_and_ice)
670 real(kind=fms_svp_kind_),
intent(in) :: temp
671 real(kind=fms_svp_kind_),
intent(in) :: press
672 real(kind=fms_svp_kind_),
intent(in) :: eps
673 real(kind=fms_svp_kind_),
intent(in) :: zvir
674 real(kind=fms_svp_kind_),
intent(out) :: qs
675 integer,
intent(out) :: nbad
676 real(kind=fms_svp_kind_),
intent(in),
optional :: q
677 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
678 real(kind=fms_svp_kind_),
intent(out),
optional :: dqsdt
679 real(kind=fms_svp_kind_),
intent(out),
optional :: esat
680 logical,
intent(in),
optional :: es_over_liq
681 logical,
intent(in),
optional :: es_over_liq_and_ice
683 integer,
parameter :: lkind=fms_svp_kind_
685 real(kind=fms_svp_kind_) :: esloc
686 real(kind=fms_svp_kind_) :: desat
687 real(kind=fms_svp_kind_) :: denom
688 real(kind=fms_svp_kind_) :: hc_loc
690 if (
present(hc))
then
696 if (
present(es_over_liq))
then
697 if (
present (dqsdt))
then
698 call lookup_es2_des2_k (temp, esloc, desat, nbad)
701 call lookup_es2_k (temp, esloc, nbad)
703 else if (
present(es_over_liq_and_ice))
then
704 if (
present (dqsdt))
then
705 call lookup_es3_des3_k (temp, esloc, desat, nbad)
708 call lookup_es3_k (temp, esloc, nbad)
711 if (
present (dqsdt))
then
712 call lookup_es_des_k (temp, esloc, desat, nbad)
715 call lookup_es_k (temp, esloc, nbad)
719 if (
present (esat))
then
723 if (
present (q) .and. use_exact_qs)
then
724 qs = (1.0_lkind + zvir*q)*eps*esloc/press
725 if (
present (dqsdt))
then
726 dqsdt = (1.0_lkind + zvir*q)*eps*desat/press
729 denom = press - (1.0_lkind - eps)*esloc
730 if (denom > 0.0_lkind)
then
735 if (
present (dqsdt))
then
736 dqsdt = eps*press*desat/denom**2
741 if (
present (dqsdt))
then
744 if (
present (esat))
then
755 mr, hc, dmrsdT, esat,es_over_liq, es_over_liq_and_ice)
757 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
758 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: press
759 real(kind=fms_svp_kind_),
intent(in) :: eps
760 real(kind=fms_svp_kind_),
intent(in) :: zvir
761 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: mrs
762 integer,
intent(out) :: nbad
763 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:),
optional :: mr
764 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
765 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:),
optional :: dmrsdt
766 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:),
optional :: esat
767 logical,
intent(in),
optional :: es_over_liq
768 logical,
intent(in),
optional :: es_over_liq_and_ice
770 real(FMS_SVP_KIND_),
dimension(size(temp,1), size(temp,2), size(temp,3)) :: esloc
771 real(FMS_SVP_KIND_),
dimension(size(temp,1), size(temp,2), size(temp,3)) :: desat
772 real(FMS_SVP_KIND_),
dimension(size(temp,1), size(temp,2), size(temp,3)) :: denom
774 integer,
parameter :: lkind=fms_svp_kind_
777 real(FMS_SVP_KIND_) :: hc_loc
779 if (
present(hc))
then
785 if (
present (es_over_liq))
then
786 if (
present (dmrsdt))
then
787 call lookup_es2_des2_k (temp, esloc, desat, nbad)
790 call lookup_es2_k (temp, esloc, nbad)
792 else if (
present(es_over_liq_and_ice))
then
793 if (
present (dmrsdt))
then
794 call lookup_es3_des3_k (temp, esloc, desat, nbad)
797 call lookup_es3_k (temp, esloc, nbad)
800 if (
present (dmrsdt))
then
801 call lookup_es_des_k (temp, esloc, desat, nbad)
804 call lookup_es_k (temp, esloc, nbad)
808 if (
present (esat))
then
812 if (
present (mr) .and. use_exact_qs)
then
813 mrs = (eps + mr)*esloc/press
814 if (
present (dmrsdt))
then
815 dmrsdt = (eps + mr)*desat/press
818 denom = press - esloc
822 if (denom(i,j,k) > 0.0_lkind)
then
823 mrs(i,j,k) = eps*esloc(i,j,k)/denom(i,j,k)
830 if (
present (dmrsdt))
then
831 dmrsdt = eps*press*desat/denom**2
836 if (
present (dmrsdt))
then
837 dmrsdt = -999.0_lkind
839 if (
present (esat))
then
849 mr, hc, dmrsdT, esat,es_over_liq, es_over_liq_and_ice)
851 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
852 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: press
853 real(kind=fms_svp_kind_),
intent(in) :: eps
854 real(kind=fms_svp_kind_),
intent(in) :: zvir
855 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: mrs
856 integer,
intent(out) :: nbad
857 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:),
optional :: mr
858 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
859 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:),
optional :: dmrsdt
860 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:),
optional :: esat
861 logical,
intent(in),
optional :: es_over_liq
862 logical,
intent(in),
optional :: es_over_liq_and_ice
864 integer,
parameter :: lkind=fms_svp_kind_
866 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2)) :: esloc
867 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2)) :: desat
868 real(kind=fms_svp_kind_),
dimension(size(temp,1), size(temp,2)) :: denom
870 real(kind=fms_svp_kind_) :: hc_loc
872 if (
present(hc))
then
878 if (
present (es_over_liq))
then
879 if (
present (dmrsdt))
then
880 call lookup_es2_des2_k (temp, esloc, desat, nbad)
883 call lookup_es2_k (temp, esloc, nbad)
885 else if (
present(es_over_liq_and_ice))
then
886 if (
present (dmrsdt))
then
887 call lookup_es3_des3_k (temp, esloc, desat, nbad)
890 call lookup_es3_k (temp, esloc, nbad)
893 if (
present (dmrsdt))
then
894 call lookup_es_des_k (temp, esloc, desat, nbad)
897 call lookup_es_k (temp, esloc, nbad)
901 if (
present (esat))
then
905 if (
present (mr) .and. use_exact_qs)
then
906 mrs = (eps + mr)*esloc/press
907 if (
present (dmrsdt))
then
908 dmrsdt = (eps + mr)*desat/press
911 denom = press - esloc
914 if (denom(i,j) > 0.0_lkind)
then
915 mrs(i,j) = eps*esloc(i,j)/denom(i,j)
921 if (
present (dmrsdt))
then
922 dmrsdt = eps*press*desat/denom**2
927 if (
present (dmrsdt))
then
928 dmrsdt = -999.0_lkind
930 if (
present (esat))
then
941 mr, hc, dmrsdT, esat,es_over_liq, es_over_liq_and_ice)
943 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
944 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: press
945 real(kind=fms_svp_kind_),
intent(in) :: eps
946 real(kind=fms_svp_kind_),
intent(in) :: zvir
947 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: mrs
948 integer,
intent(out) :: nbad
949 real(kind=fms_svp_kind_),
intent(in),
dimension(:),
optional :: mr
950 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
951 real(kind=fms_svp_kind_),
intent(out),
dimension(:),
optional :: dmrsdt
952 real(kind=fms_svp_kind_),
intent(out),
dimension(:),
optional :: esat
953 logical,
intent(in),
optional :: es_over_liq
954 logical,
intent(in),
optional :: es_over_liq_and_ice
956 integer,
parameter :: lkind=fms_svp_kind_
958 real(kind=fms_svp_kind_),
dimension(size(temp,1)) :: esloc
959 real(kind=fms_svp_kind_),
dimension(size(temp,1)) :: desat
960 real(kind=fms_svp_kind_),
dimension(size(temp,1)) :: denom
962 real(kind=fms_svp_kind_) :: hc_loc
964 if (
present(hc))
then
970 if (
present (es_over_liq))
then
971 if (
present (dmrsdt))
then
972 call lookup_es2_des2_k (temp, esloc, desat, nbad)
975 call lookup_es2_k (temp, esloc, nbad)
977 else if (
present(es_over_liq_and_ice))
then
978 if (
present (dmrsdt))
then
979 call lookup_es3_des3_k (temp, esloc, desat, nbad)
982 call lookup_es3_k (temp, esloc, nbad)
985 if (
present (dmrsdt))
then
986 call lookup_es_des_k (temp, esloc, desat, nbad)
989 call lookup_es_k (temp, esloc, nbad)
993 if (
present (esat))
then
997 if (
present (mr) .and. use_exact_qs)
then
998 mrs = (eps + mr)*esloc/press
999 if (
present (dmrsdt))
then
1000 dmrsdt = (eps + mr)*desat/press
1003 denom = press - esloc
1005 if (denom(i) > 0.0_lkind)
then
1006 mrs(i) = eps*esloc(i)/denom(i)
1011 if (
present (dmrsdt))
then
1012 dmrsdt = eps*press*desat/denom**2
1017 if (
present (dmrsdt))
then
1018 dmrsdt = -999.0_lkind
1020 if (
present (esat))
then
1031 mr, hc, dmrsdT, esat,es_over_liq, es_over_liq_and_ice)
1033 real(kind=fms_svp_kind_),
intent(in) :: temp
1034 real(kind=fms_svp_kind_),
intent(in) :: press
1035 real(kind=fms_svp_kind_),
intent(in) :: eps
1036 real(kind=fms_svp_kind_),
intent(in) :: zvir
1037 real(kind=fms_svp_kind_),
intent(out) :: mrs
1038 integer,
intent(out) :: nbad
1039 real(kind=fms_svp_kind_),
intent(in),
optional :: mr
1040 real(kind=fms_svp_kind_),
intent(in),
optional :: hc
1041 real(kind=fms_svp_kind_),
intent(out),
optional :: dmrsdt
1042 real(kind=fms_svp_kind_),
intent(out),
optional :: esat
1043 logical,
intent(in),
optional :: es_over_liq
1044 logical,
intent(in),
optional :: es_over_liq_and_ice
1046 integer,
parameter :: lkind=fms_svp_kind_
1048 real(kind=fms_svp_kind_) :: esloc
1049 real(kind=fms_svp_kind_) :: desat
1050 real(kind=fms_svp_kind_) :: denom
1051 real(kind=fms_svp_kind_) :: hc_loc
1053 if (
present(hc))
then
1059 if (
present (es_over_liq))
then
1060 if (
present (dmrsdt))
then
1061 call lookup_es2_des2_k (temp, esloc, desat, nbad)
1062 desat = desat*hc_loc
1064 call lookup_es2_k (temp, esloc, nbad)
1066 else if (
present(es_over_liq_and_ice))
then
1067 if (
present (dmrsdt))
then
1068 call lookup_es3_des3_k (temp, esloc, desat, nbad)
1069 desat = desat*hc_loc
1071 call lookup_es3_k (temp, esloc, nbad)
1074 if (
present (dmrsdt))
then
1075 call lookup_es_des_k (temp, esloc, desat, nbad)
1076 desat = desat*hc_loc
1078 call lookup_es_k (temp, esloc, nbad)
1081 esloc = esloc*hc_loc
1082 if (
present (esat))
then
1086 if (
present (mr) .and. use_exact_qs)
then
1087 mrs = (eps + mr)*esloc/press
1088 if (
present (dmrsdt))
then
1089 dmrsdt = (eps + mr)*desat/press
1092 denom = press - esloc
1093 if (denom > 0.0_lkind)
then
1094 mrs = eps*esloc/denom
1098 if (
present (dmrsdt))
then
1099 dmrsdt = eps*press*desat/denom**2
1104 if (
present (dmrsdt))
then
1105 dmrsdt = -999.0_lkind
1107 if (
present (esat))
then
1119 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
1120 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: esat
1121 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: desat
1122 integer,
intent(out) :: nbad
1124 real(kind=fms_svp_kind_) :: tmp
1125 real(kind=fms_svp_kind_) :: del
1126 integer :: ind, i, j, k
1130 real(kind=fms_svp_kind_) :: dtresl
1131 real(kind=fms_svp_kind_) :: tepsll
1132 real(kind=fms_svp_kind_) :: tminll
1133 real(kind=fms_svp_kind_) :: dtinvll
1134 integer,
parameter :: lkind=fms_svp_kind_
1136 dtresl=real(dtres, fms_svp_kind_)
1137 tminll=real(tminl, fms_svp_kind_)
1138 tepsll=real(tepsl, fms_svp_kind_)
1139 dtinvll=real(dtinvl, fms_svp_kind_)
1142 do k = 1,
size(temp,3)
1143 do j = 1,
size(temp,2)
1144 do i = 1,
size(temp,1)
1145 tmp = temp(i,j,k)-tminll
1146 ind = int(dtinvll*(tmp+tepsll))
1147 if (ind < 0 .or. ind >= table_siz)
then
1150 del = tmp-real(dtresl,fms_svp_kind_)*real(ind,fms_svp_kind_)
1153 esat(i,j,k) = real(table(ind+1),fms_svp_kind_) &
1154 + del*( real(dtable(ind+1),fms_svp_kind_) &
1155 + del*real(d2table(ind+1),fms_svp_kind_) )
1158 desat(i,j,k) = real(dtable(ind+1), fms_svp_kind_) &
1159 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1170 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
1171 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: esat
1172 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: desat
1173 integer,
intent(out) :: nbad
1174 real(kind=fms_svp_kind_) :: tmp
1175 real(kind=fms_svp_kind_) :: del
1176 integer :: ind, i, j
1180 real(kind=fms_svp_kind_) :: dtresl
1181 real(kind=fms_svp_kind_) :: tepsll
1182 real(kind=fms_svp_kind_) :: tminll
1183 real(kind=fms_svp_kind_) :: dtinvll
1184 integer,
parameter :: lkind=fms_svp_kind_
1186 dtresl=real(dtres, fms_svp_kind_)
1187 tminll=real(tminl, fms_svp_kind_)
1188 tepsll=real(tepsl, fms_svp_kind_)
1189 dtinvll=real(dtinvl, fms_svp_kind_)
1193 do j = 1,
size(temp,2)
1194 do i = 1,
size(temp,1)
1195 tmp = temp(i,j)-tminll
1196 ind = int(dtinvll*(tmp+tepsll))
1197 if (ind < 0 .or. ind >= table_siz)
then
1200 del = tmp-dtresl*real(ind,fms_svp_kind_)
1203 esat(i,j) = real(table(ind+1),fms_svp_kind_) &
1204 + del*( real(dtable(ind+1),fms_svp_kind_) &
1205 + del*real(d2table(ind+1),fms_svp_kind_) )
1208 desat(i,j) = real(dtable(ind+1),fms_svp_kind_) &
1209 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1219 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
1220 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: esat
1221 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: desat
1222 integer,
intent(out) :: nbad
1224 real(kind=fms_svp_kind_) :: tmp
1225 real(kind=fms_svp_kind_) :: del
1230 real(kind=fms_svp_kind_) :: dtresl
1231 real(kind=fms_svp_kind_) :: tepsll
1232 real(kind=fms_svp_kind_) :: tminll
1233 real(kind=fms_svp_kind_) :: dtinvll
1234 integer,
parameter :: lkind=fms_svp_kind_
1236 dtresl=real(dtres, fms_svp_kind_)
1237 tminll=real(tminl, fms_svp_kind_)
1238 tepsll=real(tepsl, fms_svp_kind_)
1239 dtinvll=real(dtinvl, fms_svp_kind_)
1243 do i = 1,
size(temp,1)
1244 tmp = temp(i)-tminll
1245 ind = int(dtinvll*(tmp+tepsll))
1246 if (ind < 0 .or. ind >= table_siz)
then
1249 del = tmp-dtresl*real(ind,fms_svp_kind_)
1252 esat(i) = real(table(ind+1),fms_svp_kind_) &
1253 + del*( real(dtable(ind+1),fms_svp_kind_) &
1254 + del*real(d2table(ind+1),fms_svp_kind_) )
1257 desat(i) = real(dtable(ind+1),fms_svp_kind_) &
1258 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1267 real(kind=fms_svp_kind_),
intent(in) :: temp
1268 real(kind=fms_svp_kind_),
intent(out) :: esat
1269 real(kind=fms_svp_kind_),
intent(out) :: desat
1270 integer,
intent(out) :: nbad
1272 real(kind=fms_svp_kind_) :: tmp
1273 real(kind=fms_svp_kind_) :: del
1278 real(kind=fms_svp_kind_) :: dtresl
1279 real(kind=fms_svp_kind_) :: tepsll
1280 real(kind=fms_svp_kind_) :: tminll
1281 real(kind=fms_svp_kind_) :: dtinvll
1282 integer,
parameter :: lkind=fms_svp_kind_
1284 dtresl=real(dtres, fms_svp_kind_)
1285 tminll=real(tminl, fms_svp_kind_)
1286 tepsll=real(tepsl, fms_svp_kind_)
1287 dtinvll=real(dtinvl, fms_svp_kind_)
1291 ind = int(dtinvll*(tmp+tepsll))
1292 if (ind < 0 .or. ind >= table_siz)
then
1295 del = tmp-dtresl*real(ind,fms_svp_kind_)
1298 esat = real(table(ind+1),fms_svp_kind_) &
1299 + del*( real(dtable(ind+1),fms_svp_kind_) &
1300 + del*real(d2table(ind+1),fms_svp_kind_) )
1303 desat = real(dtable(ind+1),fms_svp_kind_) &
1304 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1312 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
1313 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: esat
1314 integer,
intent(out) :: nbad
1315 real(kind=fms_svp_kind_) :: tmp
1316 real(kind=fms_svp_kind_) :: del
1317 integer :: ind, i, j, k
1321 real(kind=fms_svp_kind_) :: dtresl
1322 real(kind=fms_svp_kind_) :: tepsll
1323 real(kind=fms_svp_kind_) :: tminll
1324 real(kind=fms_svp_kind_) :: dtinvll
1326 dtresl=real(dtres, fms_svp_kind_)
1327 tminll=real(tminl, fms_svp_kind_)
1328 tepsll=real(tepsl, fms_svp_kind_)
1329 dtinvll=real(dtinvl, fms_svp_kind_)
1332 do k = 1,
size(temp,3)
1333 do j = 1,
size(temp,2)
1334 do i = 1,
size(temp,1)
1335 tmp = temp(i,j,k)-tminll
1336 ind = int(dtinvll*(tmp+tepsll))
1337 if (ind < 0 .or. ind >= table_siz)
then
1340 del = tmp-dtresl*real(ind,fms_svp_kind_)
1343 esat(i,j,k) = real(table(ind+1),fms_svp_kind_) &
1344 + del*( real(dtable(ind+1),fms_svp_kind_) &
1345 + del*real(d2table(ind+1),fms_svp_kind_) )
1356 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
1357 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: desat
1358 integer,
intent(out) :: nbad
1359 real(kind=fms_svp_kind_) :: tmp
1360 real(kind=fms_svp_kind_) :: del
1361 integer :: ind, i, j, k
1365 real(kind=fms_svp_kind_) :: dtresl
1366 real(kind=fms_svp_kind_) :: tepsll
1367 real(kind=fms_svp_kind_) :: tminll
1368 real(kind=fms_svp_kind_) :: dtinvll
1369 integer,
parameter :: lkind=fms_svp_kind_
1371 dtresl=real(dtres, fms_svp_kind_)
1372 tminll=real(tminl, fms_svp_kind_)
1373 tepsll=real(tepsl, fms_svp_kind_)
1374 dtinvll=real(dtinvl, fms_svp_kind_)
1377 do k = 1,
size(temp,3)
1378 do j = 1,
size(temp,2)
1379 do i = 1,
size(temp,1)
1380 tmp = temp(i,j,k)-tminll
1381 ind = int(dtinvll*(tmp+tepsll))
1382 if (ind < 0 .or. ind >= table_siz)
then
1385 del = tmp-dtresl*real(ind,fms_svp_kind_)
1388 desat(i,j,k) = real(dtable(ind+1),fms_svp_kind_) &
1389 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1399 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
1400 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: desat
1401 integer,
intent(out) :: nbad
1402 real(kind=fms_svp_kind_) :: tmp
1403 real(kind=fms_svp_kind_) :: del
1404 integer :: ind, i, j
1409 real(kind=fms_svp_kind_) :: dtresl
1410 real(kind=fms_svp_kind_) :: tepsll
1411 real(kind=fms_svp_kind_) :: tminll
1412 real(kind=fms_svp_kind_) :: dtinvll
1413 integer,
parameter :: lkind=fms_svp_kind_
1415 dtresl=real(dtres, fms_svp_kind_)
1416 tminll=real(tminl, fms_svp_kind_)
1417 tepsll=real(tepsl, fms_svp_kind_)
1418 dtinvll=real(dtinvl, fms_svp_kind_)
1421 do j = 1,
size(temp,2)
1422 do i = 1,
size(temp,1)
1423 tmp = temp(i,j)-tminll
1424 ind = int(dtinvll*(tmp+tepsll))
1425 if (ind < 0 .or. ind >= table_siz)
then
1428 del = tmp-dtresl*real(ind,fms_svp_kind_)
1431 desat(i,j) = real(dtable(ind+1),fms_svp_kind_) &
1432 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1440 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
1441 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: esat
1442 integer,
intent(out) :: nbad
1443 real(kind=fms_svp_kind_) :: tmp
1444 real(kind=fms_svp_kind_) :: del
1445 integer :: ind, i, j
1449 real(kind=fms_svp_kind_) :: dtresl
1450 real(kind=fms_svp_kind_) :: tepsll
1451 real(kind=fms_svp_kind_) :: tminll
1452 real(kind=fms_svp_kind_) :: dtinvll
1454 dtresl=real(dtres, fms_svp_kind_)
1455 tminll=real(tminl, fms_svp_kind_)
1456 tepsll=real(tepsl, fms_svp_kind_)
1457 dtinvll=real(dtinvl, fms_svp_kind_)
1461 do j = 1,
size(temp,2)
1462 do i = 1,
size(temp,1)
1463 tmp = temp(i,j)-tminll
1464 ind = int(dtinvll*(tmp+tepsll))
1465 if (ind < 0 .or. ind >= table_siz)
then
1468 del = tmp-dtresl*real(ind,fms_svp_kind_)
1471 esat(i,j) = real(table(ind+1),fms_svp_kind_) &
1472 + del*(real(dtable(ind+1),fms_svp_kind_) &
1473 + del*real(d2table(ind+1),fms_svp_kind_) )
1481 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
1482 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: desat
1483 integer,
intent(out) :: nbad
1484 real(kind=fms_svp_kind_) :: tmp
1485 real(kind=fms_svp_kind_) :: del
1490 real(kind=fms_svp_kind_) :: dtresl
1491 real(kind=fms_svp_kind_) :: tepsll
1492 real(kind=fms_svp_kind_) :: tminll
1493 real(kind=fms_svp_kind_) :: dtinvll
1494 integer,
parameter :: lkind=fms_svp_kind_
1496 dtresl=real(dtres, fms_svp_kind_)
1497 tminll=real(tminl, fms_svp_kind_)
1498 tepsll=real(tepsl, fms_svp_kind_)
1499 dtinvll=real(dtinvl, fms_svp_kind_)
1502 do i = 1,
size(temp,1)
1503 tmp = temp(i)-tminll
1504 ind = int(dtinvll*(tmp+tepsll))
1505 if (ind < 0 .or. ind >= table_siz)
then
1508 del = tmp-dtresl*real(ind,fms_svp_kind_)
1511 desat(i) = real(dtable(ind+1),fms_svp_kind_) &
1512 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1519 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
1520 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: esat
1521 integer,
intent(out) :: nbad
1522 real(kind=fms_svp_kind_) :: tmp
1523 real(kind=fms_svp_kind_) :: del
1528 real(kind=fms_svp_kind_) :: dtresl
1529 real(kind=fms_svp_kind_) :: tepsll
1530 real(kind=fms_svp_kind_) :: tminll
1531 real(kind=fms_svp_kind_) :: dtinvll
1533 dtresl=real(dtres, fms_svp_kind_)
1534 tminll=real(tminl, fms_svp_kind_)
1535 tepsll=real(tepsl, fms_svp_kind_)
1536 dtinvll=real(dtinvl, fms_svp_kind_)
1539 do i = 1,
size(temp,1)
1540 tmp = temp(i)-tminll
1541 ind = int(dtinvll*(tmp+tepsll))
1542 if (ind < 0 .or. ind >= table_siz)
then
1545 del = tmp-dtresl*real(ind,fms_svp_kind_)
1548 esat(i) = real(table(ind+1),fms_svp_kind_) &
1549 + del*(real(dtable(ind+1),fms_svp_kind_) &
1550 + del*real(d2table(ind+1),fms_svp_kind_) )
1557 real(kind=fms_svp_kind_),
intent(in) :: temp
1558 real(kind=fms_svp_kind_),
intent(out) :: desat
1559 integer,
intent(out) :: nbad
1560 real(kind=fms_svp_kind_) :: tmp
1561 real(kind=fms_svp_kind_) :: del
1566 real(kind=fms_svp_kind_) :: dtresl
1567 real(kind=fms_svp_kind_) :: tepsll
1568 real(kind=fms_svp_kind_) :: tminll
1569 real(kind=fms_svp_kind_) :: dtinvll
1570 integer,
parameter :: lkind=fms_svp_kind_
1572 dtresl=real(dtres, fms_svp_kind_)
1573 tminll=real(tminl, fms_svp_kind_)
1574 tepsll=real(tepsl, fms_svp_kind_)
1575 dtinvll=real(dtinvl, fms_svp_kind_)
1579 ind = int(dtinvll*(tmp+tepsll))
1580 if (ind < 0 .or. ind >= table_siz)
then
1583 del = tmp-dtresl*real(ind,fms_svp_kind_)
1586 desat = real(dtable(ind+1),fms_svp_kind_) &
1587 + 2.0_lkind*del*real(d2table(ind+1),fms_svp_kind_)
1593 real(kind=fms_svp_kind_),
intent(in) :: temp
1594 real(kind=fms_svp_kind_),
intent(out) :: esat
1595 integer,
intent(out) :: nbad
1596 real(kind=fms_svp_kind_) :: tmp
1597 real(kind=fms_svp_kind_) :: del
1602 real(kind=fms_svp_kind_) :: dtresl
1603 real(kind=fms_svp_kind_) :: tepsll
1604 real(kind=fms_svp_kind_) :: tminll
1605 real(kind=fms_svp_kind_) :: dtinvll
1607 dtresl=real(dtres, fms_svp_kind_)
1608 tminll=real(tminl, fms_svp_kind_)
1609 tepsll=real(tepsl, fms_svp_kind_)
1610 dtinvll=real(dtinvl, fms_svp_kind_)
1614 ind = int(dtinvll*(tmp+tepsll))
1615 if (ind < 0 .or. ind >= table_siz)
then
1618 del = tmp-dtresl*real(ind,fms_svp_kind_)
1621 esat = real(table(ind+1),fms_svp_kind_) &
1622 + del*( real(dtable(ind+1),fms_svp_kind_) &
1623 + del*real(d2table(ind+1),fms_svp_kind_) )
1630 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
1631 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: esat
1632 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: desat
1633 integer,
intent(out) :: nbad
1635 real(kind=fms_svp_kind_) :: tmp
1636 real(kind=fms_svp_kind_) :: del
1637 integer :: ind, i, j, k
1641 real(kind=fms_svp_kind_) :: dtresl
1642 real(kind=fms_svp_kind_) :: tepsll
1643 real(kind=fms_svp_kind_) :: tminll
1644 real(kind=fms_svp_kind_) :: dtinvll
1645 integer,
parameter :: lkind=fms_svp_kind_
1647 dtresl=real(dtres, fms_svp_kind_)
1648 tminll=real(tminl, fms_svp_kind_)
1649 tepsll=real(tepsl, fms_svp_kind_)
1650 dtinvll=real(dtinvl, fms_svp_kind_)
1653 do k = 1,
size(temp,3)
1654 do j = 1,
size(temp,2)
1655 do i = 1,
size(temp,1)
1656 tmp = temp(i,j,k)-tminll
1657 ind = int(dtinvll*(tmp+tepsll))
1658 if (ind < 0 .or. ind >= table_siz)
then
1661 del = tmp-dtresl*real(ind,fms_svp_kind_)
1664 esat(i,j,k) = real(table2(ind+1),fms_svp_kind_) &
1665 + del*( real(dtable2(ind+1),fms_svp_kind_) &
1666 + del*real(d2table2(ind+1),fms_svp_kind_) )
1669 desat(i,j,k) = real(dtable2(ind+1),fms_svp_kind_) &
1670 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
1681 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
1682 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: esat
1683 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: desat
1684 integer,
intent(out) :: nbad
1686 real(kind=fms_svp_kind_) :: tmp
1687 real(kind=fms_svp_kind_) :: del
1688 integer :: ind, i, j
1692 real(kind=fms_svp_kind_) :: dtresl
1693 real(kind=fms_svp_kind_) :: tepsll
1694 real(kind=fms_svp_kind_) :: tminll
1695 real(kind=fms_svp_kind_) :: dtinvll
1696 integer,
parameter :: lkind=fms_svp_kind_
1698 dtresl=real(dtres, fms_svp_kind_)
1699 tminll=real(tminl, fms_svp_kind_)
1700 tepsll=real(tepsl, fms_svp_kind_)
1701 dtinvll=real(dtinvl, fms_svp_kind_)
1704 do j = 1,
size(temp,2)
1705 do i = 1,
size(temp,1)
1706 tmp = temp(i,j)-tminll
1707 ind = int(dtinvll*(tmp+tepsll))
1708 if (ind < 0 .or. ind >= table_siz)
then
1711 del = tmp-dtresl*real(ind,fms_svp_kind_)
1714 esat(i,j) = real(table2(ind+1),fms_svp_kind_) &
1715 + del*( real(dtable2(ind+1),fms_svp_kind_) &
1716 + del*real(d2table2(ind+1),fms_svp_kind_) )
1719 desat(i,j) = real(dtable2(ind+1),fms_svp_kind_) &
1720 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
1730 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
1731 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: esat
1732 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: desat
1733 integer,
intent(out) :: nbad
1735 real(kind=fms_svp_kind_) :: tmp
1736 real(kind=fms_svp_kind_) :: del
1741 real(kind=fms_svp_kind_) :: dtresl
1742 real(kind=fms_svp_kind_) :: tepsll
1743 real(kind=fms_svp_kind_) :: tminll
1744 real(kind=fms_svp_kind_) :: dtinvll
1745 integer,
parameter :: lkind=fms_svp_kind_
1747 dtresl=real(dtres, fms_svp_kind_)
1748 tminll=real(tminl, fms_svp_kind_)
1749 tepsll=real(tepsl, fms_svp_kind_)
1750 dtinvll=real(dtinvl, fms_svp_kind_)
1753 do i = 1,
size(temp,1)
1754 tmp = temp(i)-tminll
1755 ind = int(dtinvll*(tmp+tepsll))
1756 if (ind < 0 .or. ind >= table_siz)
then
1759 del = tmp-dtresl*real(ind,fms_svp_kind_)
1762 esat(i) = real(table2(ind+1),fms_svp_kind_) &
1763 + del*( real(dtable2(ind+1),fms_svp_kind_) &
1764 + del*real(d2table2(ind+1),fms_svp_kind_) )
1766 desat(i) = real(dtable2(ind+1),fms_svp_kind_) &
1767 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
1776 real(kind=fms_svp_kind_),
intent(in) :: temp
1777 real(kind=fms_svp_kind_),
intent(out) :: esat
1778 real(kind=fms_svp_kind_),
intent(out) :: desat
1779 integer,
intent(out) :: nbad
1781 real(kind=fms_svp_kind_) :: tmp
1782 real(kind=fms_svp_kind_) :: del
1787 real(kind=fms_svp_kind_) :: dtresl
1788 real(kind=fms_svp_kind_) :: tepsll
1789 real(kind=fms_svp_kind_) :: tminll
1790 real(kind=fms_svp_kind_) :: dtinvll
1791 integer,
parameter :: lkind=fms_svp_kind_
1793 dtresl=real(dtres, fms_svp_kind_)
1794 tminll=real(tminl, fms_svp_kind_)
1795 tepsll=real(tepsl, fms_svp_kind_)
1796 dtinvll=real(dtinvl, fms_svp_kind_)
1801 ind = int(dtinvll*(tmp+tepsll))
1802 if (ind < 0 .or. ind >= table_siz)
then
1805 del = tmp-dtresl*real(ind,fms_svp_kind_)
1808 esat = real(table2(ind+1),fms_svp_kind_) &
1809 + del*( real(dtable2(ind+1),fms_svp_kind_) &
1810 + del*real(d2table2(ind+1),fms_svp_kind_) )
1813 desat = real(dtable2(ind+1),fms_svp_kind_) &
1814 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
1822 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
1823 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: esat
1824 integer,
intent(out) :: nbad
1825 real(kind=fms_svp_kind_) :: tmp
1826 real(kind=fms_svp_kind_) :: del
1827 integer :: ind, i, j, k
1831 real(kind=fms_svp_kind_) :: dtresl
1832 real(kind=fms_svp_kind_) :: tepsll
1833 real(kind=fms_svp_kind_) :: tminll
1834 real(kind=fms_svp_kind_) :: dtinvll
1836 dtresl=real(dtres, fms_svp_kind_)
1837 tminll=real(tminl, fms_svp_kind_)
1838 tepsll=real(tepsl, fms_svp_kind_)
1839 dtinvll=real(dtinvl, fms_svp_kind_)
1842 do k = 1,
size(temp,3)
1843 do j = 1,
size(temp,2)
1844 do i = 1,
size(temp,1)
1845 tmp = temp(i,j,k)-tminll
1846 ind = int(dtinvll*(tmp+tepsll))
1847 if (ind < 0 .or. ind >= table_siz)
then
1850 del = tmp-dtresl*real(ind,fms_svp_kind_)
1853 esat(i,j,k) = real(table2(ind+1),fms_svp_kind_) &
1854 + del*( real(dtable2(ind+1),fms_svp_kind_) &
1855 + del*real(d2table2(ind+1),fms_svp_kind_) )
1866 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
1867 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: desat
1868 integer,
intent(out) :: nbad
1869 real(kind=fms_svp_kind_) :: tmp
1870 real(kind=fms_svp_kind_) :: del
1871 integer :: ind, i, j, k
1875 real(kind=fms_svp_kind_) :: dtresl
1876 real(kind=fms_svp_kind_) :: tepsll
1877 real(kind=fms_svp_kind_) :: tminll
1878 real(kind=fms_svp_kind_) :: dtinvll
1879 integer,
parameter :: lkind=fms_svp_kind_
1881 dtresl=real(dtres, fms_svp_kind_)
1882 tminll=real(tminl, fms_svp_kind_)
1883 tepsll=real(tepsl, fms_svp_kind_)
1884 dtinvll=real(dtinvl, fms_svp_kind_)
1887 do k = 1,
size(temp,3)
1888 do j = 1,
size(temp,2)
1889 do i = 1,
size(temp,1)
1890 tmp = temp(i,j,k)-tminll
1891 ind = int(dtinvll*(tmp+tepsll))
1892 if (ind < 0 .or. ind >= table_siz)
then
1895 del = tmp-dtresl*real(ind,fms_svp_kind_)
1898 desat(i,j,k) = real(dtable2(ind+1),fms_svp_kind_) &
1899 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
1909 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
1910 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: desat
1911 integer,
intent(out) :: nbad
1912 real(kind=fms_svp_kind_) :: tmp
1913 real(kind=fms_svp_kind_) :: del
1914 integer :: ind, i, j
1918 real(kind=fms_svp_kind_) :: dtresl
1919 real(kind=fms_svp_kind_) :: tepsll
1920 real(kind=fms_svp_kind_) :: tminll
1921 real(kind=fms_svp_kind_) :: dtinvll
1922 integer,
parameter :: lkind=fms_svp_kind_
1924 dtresl=real(dtres, fms_svp_kind_)
1925 tminll=real(tminl, fms_svp_kind_)
1926 tepsll=real(tepsl, fms_svp_kind_)
1927 dtinvll=real(dtinvl, fms_svp_kind_)
1930 do j = 1,
size(temp,2)
1931 do i = 1,
size(temp,1)
1932 tmp = temp(i,j)-tminll
1933 ind = int(dtinvll*(tmp+tepsll))
1934 if (ind < 0 .or. ind >= table_siz)
then
1937 del = tmp-dtresl*real(ind,fms_svp_kind_)
1940 desat(i,j) = real(dtable2(ind+1),fms_svp_kind_) &
1941 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
1949 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
1950 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: esat
1951 integer,
intent(out) :: nbad
1952 real(kind=fms_svp_kind_) :: tmp
1953 real(kind=fms_svp_kind_) :: del
1954 integer :: ind, i, j
1958 real(kind=fms_svp_kind_) :: dtresl
1959 real(kind=fms_svp_kind_) :: tepsll
1960 real(kind=fms_svp_kind_) :: tminll
1961 real(kind=fms_svp_kind_) :: dtinvll
1963 dtresl=real(dtres, fms_svp_kind_)
1964 tminll=real(tminl, fms_svp_kind_)
1965 tepsll=real(tepsl, fms_svp_kind_)
1966 dtinvll=real(dtinvl, fms_svp_kind_)
1969 do j = 1,
size(temp,2)
1970 do i = 1,
size(temp,1)
1971 tmp = temp(i,j)-tminll
1972 ind = int(dtinvll*(tmp+tepsll))
1973 if (ind < 0 .or. ind >= table_siz)
then
1976 del = tmp-dtresl*real(ind,kind=fms_svp_kind_)
1979 esat(i,j) = real(table2(ind+1),fms_svp_kind_) &
1980 + del*( real(dtable2(ind+1),fms_svp_kind_) &
1981 + del*real(d2table2(ind+1),fms_svp_kind_) )
1989 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
1990 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: desat
1991 integer,
intent(out) :: nbad
1992 real(kind=fms_svp_kind_) :: tmp
1993 real(kind=fms_svp_kind_) :: del
1998 real(kind=fms_svp_kind_) :: dtresl
1999 real(kind=fms_svp_kind_) :: tepsll
2000 real(kind=fms_svp_kind_) :: tminll
2001 real(kind=fms_svp_kind_) :: dtinvll
2002 integer,
parameter :: lkind=fms_svp_kind_
2004 dtresl=real(dtres, fms_svp_kind_)
2005 tminll=real(tminl, fms_svp_kind_)
2006 tepsll=real(tepsl, fms_svp_kind_)
2007 dtinvll=real(dtinvl, fms_svp_kind_)
2010 do i = 1,
size(temp,1)
2011 tmp = temp(i)-tminll
2012 ind = int(dtinvll*(tmp+tepsll))
2013 if (ind < 0 .or. ind >= table_siz)
then
2016 del = tmp-dtresl*real(ind,fms_svp_kind_)
2019 desat(i) = real(dtable2(ind+1),fms_svp_kind_) &
2020 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
2027 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
2028 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: esat
2029 integer,
intent(out) :: nbad
2030 real(kind=fms_svp_kind_) :: tmp
2031 real(kind=fms_svp_kind_) :: del
2036 real(kind=fms_svp_kind_) :: dtresl
2037 real(kind=fms_svp_kind_) :: tepsll
2038 real(kind=fms_svp_kind_) :: tminll
2039 real(kind=fms_svp_kind_) :: dtinvll
2041 dtresl=real(dtres, fms_svp_kind_)
2042 tminll=real(tminl, fms_svp_kind_)
2043 tepsll=real(tepsl, fms_svp_kind_)
2044 dtinvll=real(dtinvl, fms_svp_kind_)
2047 do i = 1,
size(temp,1)
2048 tmp = temp(i)-tminll
2049 ind = int(dtinvll*(tmp+tepsll))
2050 if (ind < 0 .or. ind >= table_siz)
then
2053 del = tmp-dtresl*real(ind,fms_svp_kind_)
2056 esat(i) = real(table2(ind+1),fms_svp_kind_) &
2057 + del*( real(dtable2(ind+1),fms_svp_kind_) &
2058 + del*real(d2table2(ind+1),fms_svp_kind_) )
2065 real(kind=fms_svp_kind_),
intent(in) :: temp
2066 real(kind=fms_svp_kind_),
intent(out) :: desat
2067 integer,
intent(out) :: nbad
2068 real(kind=fms_svp_kind_) :: tmp
2069 real(kind=fms_svp_kind_) :: del
2074 real(kind=fms_svp_kind_) :: dtresl
2075 real(kind=fms_svp_kind_) :: tepsll
2076 real(kind=fms_svp_kind_) :: tminll
2077 real(kind=fms_svp_kind_) :: dtinvll
2078 integer,
parameter :: lkind=fms_svp_kind_
2080 dtresl=real(dtres, fms_svp_kind_)
2081 tminll=real(tminl, fms_svp_kind_)
2082 tepsll=real(tepsl, fms_svp_kind_)
2083 dtinvll=real(dtinvl, fms_svp_kind_)
2087 ind = int(dtinvll*(tmp+tepsll))
2088 if (ind < 0 .or. ind >= table_siz)
then
2091 del = tmp-dtresl*real(ind,fms_svp_kind_)
2094 desat = real(dtable2(ind+1),fms_svp_kind_) &
2095 + 2.0_lkind*del*real(d2table2(ind+1),fms_svp_kind_)
2101 real(kind=fms_svp_kind_),
intent(in) :: temp
2102 real(kind=fms_svp_kind_),
intent(out) :: esat
2103 integer,
intent(out) :: nbad
2104 real(kind=fms_svp_kind_) :: tmp
2105 real(kind=fms_svp_kind_) :: del
2110 real(kind=fms_svp_kind_) :: dtresl
2111 real(kind=fms_svp_kind_) :: tepsll
2112 real(kind=fms_svp_kind_) :: tminll
2113 real(kind=fms_svp_kind_) :: dtinvll
2115 dtresl=real(dtres, fms_svp_kind_)
2116 tminll=real(tminl, fms_svp_kind_)
2117 tepsll=real(tepsl, fms_svp_kind_)
2118 dtinvll=real(dtinvl, fms_svp_kind_)
2122 ind = int(dtinvll*(tmp+tepsll))
2123 if (ind < 0 .or. ind >= table_siz)
then
2126 del = tmp-dtresl*real(ind,fms_svp_kind_)
2129 esat = real(table2(ind+1),fms_svp_kind_) &
2130 + del*( real(dtable2(ind+1),fms_svp_kind_) &
2131 + del*real(d2table2(ind+1),fms_svp_kind_) )
2140 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
2141 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: esat
2142 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: desat
2143 integer,
intent(out) :: nbad
2145 real(kind=fms_svp_kind_) :: tmp
2146 real(kind=fms_svp_kind_) :: del
2147 integer :: ind, i, j, k
2151 real(kind=fms_svp_kind_) :: dtresl
2152 real(kind=fms_svp_kind_) :: tepsll
2153 real(kind=fms_svp_kind_) :: tminll
2154 real(kind=fms_svp_kind_) :: dtinvll
2155 integer,
parameter :: lkind=fms_svp_kind_
2157 dtresl=real(dtres, fms_svp_kind_)
2158 tminll=real(tminl, fms_svp_kind_)
2159 tepsll=real(tepsl, fms_svp_kind_)
2160 dtinvll=real(dtinvl, fms_svp_kind_)
2163 do k = 1,
size(temp,3)
2164 do j = 1,
size(temp,2)
2165 do i = 1,
size(temp,1)
2166 tmp = temp(i,j,k)-tminll
2167 ind = int(dtinvll*(tmp+tepsll))
2168 if (ind < 0 .or. ind >= table_siz)
then
2171 del = tmp-dtresl*real(ind,fms_svp_kind_)
2174 esat(i,j,k) = real(table3(ind+1),fms_svp_kind_) &
2175 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2176 + del*real(d2table3(ind+1),fms_svp_kind_) )
2179 desat(i,j,k) = real(dtable3(ind+1),fms_svp_kind_) &
2180 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2191 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
2192 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: esat
2193 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: desat
2194 integer,
intent(out) :: nbad
2196 real(kind=fms_svp_kind_) :: tmp
2197 real(kind=fms_svp_kind_) :: del
2198 integer :: ind, i, j
2202 real(kind=fms_svp_kind_) :: dtresl
2203 real(kind=fms_svp_kind_) :: tepsll
2204 real(kind=fms_svp_kind_) :: tminll
2205 real(kind=fms_svp_kind_) :: dtinvll
2206 integer,
parameter :: lkind=fms_svp_kind_
2208 dtresl=real(dtres, fms_svp_kind_)
2209 tminll=real(tminl, fms_svp_kind_)
2210 tepsll=real(tepsl, fms_svp_kind_)
2211 dtinvll=real(dtinvl, fms_svp_kind_)
2214 do j = 1,
size(temp,2)
2215 do i = 1,
size(temp,1)
2216 tmp = temp(i,j)-tminll
2217 ind = int(dtinvll*(tmp+tepsll))
2218 if (ind < 0 .or. ind >= table_siz)
then
2221 del = tmp-dtresl*real(ind,fms_svp_kind_)
2224 esat(i,j) = real(table3(ind+1),fms_svp_kind_) &
2225 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2226 + del*real(d2table3(ind+1),fms_svp_kind_) )
2229 desat(i,j) = real(dtable3(ind+1),fms_svp_kind_) &
2230 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2240 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
2241 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: esat
2242 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: desat
2243 integer,
intent(out) :: nbad
2245 real(kind=fms_svp_kind_) :: tmp
2246 real(kind=fms_svp_kind_) :: del
2251 real(kind=fms_svp_kind_) :: dtresl
2252 real(kind=fms_svp_kind_) :: tepsll
2253 real(kind=fms_svp_kind_) :: tminll
2254 real(kind=fms_svp_kind_) :: dtinvll
2255 integer,
parameter :: lkind=fms_svp_kind_
2257 dtresl=real(dtres, fms_svp_kind_)
2258 tminll=real(tminl, fms_svp_kind_)
2259 tepsll=real(tepsl, fms_svp_kind_)
2260 dtinvll=real(dtinvl, fms_svp_kind_)
2263 do i = 1,
size(temp,1)
2264 tmp = temp(i)-tminll
2265 ind = int(dtinvll*(tmp+tepsll))
2266 if (ind < 0 .or. ind >= table_siz)
then
2269 del = tmp-dtresl*real(ind,fms_svp_kind_)
2272 esat(i) = real(table3(ind+1),fms_svp_kind_) &
2273 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2274 + del*real(d2table3(ind+1),fms_svp_kind_) )
2277 desat(i) = real(dtable3(ind+1),fms_svp_kind_) &
2278 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2287 real(kind=fms_svp_kind_),
intent(in) :: temp
2288 real(kind=fms_svp_kind_),
intent(out) :: esat
2289 real(kind=fms_svp_kind_),
intent(out) :: desat
2290 integer,
intent(out) :: nbad
2292 real(kind=fms_svp_kind_) :: tmp
2293 real(kind=fms_svp_kind_) :: del
2298 real(kind=fms_svp_kind_) :: dtresl
2299 real(kind=fms_svp_kind_) :: tepsll
2300 real(kind=fms_svp_kind_) :: tminll
2301 real(kind=fms_svp_kind_) :: dtinvll
2302 integer,
parameter :: lkind=fms_svp_kind_
2304 dtresl=real(dtres, fms_svp_kind_)
2305 tminll=real(tminl, fms_svp_kind_)
2306 tepsll=real(tepsl, fms_svp_kind_)
2307 dtinvll=real(dtinvl, fms_svp_kind_)
2311 ind = int(dtinvll*(tmp+tepsll))
2312 if (ind < 0 .or. ind >= table_siz)
then
2315 del = tmp-dtresl*real(ind,fms_svp_kind_)
2318 esat = real(table3(ind+1),fms_svp_kind_) &
2319 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2320 + del*real(d2table3(ind+1),fms_svp_kind_) )
2323 desat = real(dtable3(ind+1),fms_svp_kind_) &
2324 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2332 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
2333 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: esat
2334 integer,
intent(out) :: nbad
2335 real(kind=fms_svp_kind_) :: tmp
2336 real(kind=fms_svp_kind_) :: del
2337 integer :: ind, i, j, k
2341 real(kind=fms_svp_kind_) :: dtresl
2342 real(kind=fms_svp_kind_) :: tepsll
2343 real(kind=fms_svp_kind_) :: tminll
2344 real(kind=fms_svp_kind_) :: dtinvll
2346 dtresl=real(dtres, fms_svp_kind_)
2347 tminll=real(tminl, fms_svp_kind_)
2348 tepsll=real(tepsl, fms_svp_kind_)
2349 dtinvll=real(dtinvl, fms_svp_kind_)
2352 do k = 1,
size(temp,3)
2353 do j = 1,
size(temp,2)
2354 do i = 1,
size(temp,1)
2355 tmp = temp(i,j,k)-tminll
2356 ind = int(dtinvll*(tmp+tepsll))
2357 if (ind < 0 .or. ind >= table_siz)
then
2360 del = tmp-dtresl*real(ind,fms_svp_kind_)
2363 esat(i,j,k) = real(table3(ind+1),fms_svp_kind_) &
2364 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2365 + del*real(d2table3(ind+1),fms_svp_kind_) )
2376 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:,:) :: temp
2377 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:,:) :: desat
2378 integer,
intent(out) :: nbad
2379 real(kind=fms_svp_kind_) :: tmp
2380 real(kind=fms_svp_kind_) :: del
2381 integer :: ind, i, j, k
2385 real(kind=fms_svp_kind_) :: dtresl
2386 real(kind=fms_svp_kind_) :: tepsll
2387 real(kind=fms_svp_kind_) :: tminll
2388 real(kind=fms_svp_kind_) :: dtinvll
2389 integer,
parameter :: lkind=fms_svp_kind_
2391 dtresl=real(dtres, fms_svp_kind_)
2392 tminll=real(tminl, fms_svp_kind_)
2393 tepsll=real(tepsl, fms_svp_kind_)
2394 dtinvll=real(dtinvl, fms_svp_kind_)
2397 do k = 1,
size(temp,3)
2398 do j = 1,
size(temp,2)
2399 do i = 1,
size(temp,1)
2400 tmp = temp(i,j,k)-tminll
2401 ind = int(dtinvll*(tmp+tepsll))
2402 if (ind < 0 .or. ind >= table_siz)
then
2405 del = tmp-dtresl*real(ind,fms_svp_kind_)
2408 desat(i,j,k) = real(dtable3(ind+1),fms_svp_kind_) &
2409 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2419 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
2420 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: desat
2421 integer,
intent(out) :: nbad
2422 real(kind=fms_svp_kind_) :: tmp
2423 real(kind=fms_svp_kind_) :: del
2424 integer :: ind, i, j
2428 real(kind=fms_svp_kind_) :: dtresl
2429 real(kind=fms_svp_kind_) :: tepsll
2430 real(kind=fms_svp_kind_) :: tminll
2431 real(kind=fms_svp_kind_) :: dtinvll
2432 integer,
parameter :: lkind=fms_svp_kind_
2434 dtresl=real(dtres, fms_svp_kind_)
2435 tminll=real(tminl, fms_svp_kind_)
2436 tepsll=real(tepsl, fms_svp_kind_)
2437 dtinvll=real(dtinvl, fms_svp_kind_)
2440 do j = 1,
size(temp,2)
2441 do i = 1,
size(temp,1)
2442 tmp = temp(i,j)-tminll
2443 ind = int(dtinvll*(tmp+tepsll))
2444 if (ind < 0 .or. ind >= table_siz)
then
2447 del = tmp-dtresl*real(ind,fms_svp_kind_)
2450 desat(i,j) = real(dtable3(ind+1),fms_svp_kind_) &
2451 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2459 real(kind=fms_svp_kind_),
intent(in),
dimension(:,:) :: temp
2460 real(kind=fms_svp_kind_),
intent(out),
dimension(:,:) :: esat
2461 integer,
intent(out) :: nbad
2462 real(kind=fms_svp_kind_) :: tmp
2463 real(kind=fms_svp_kind_) :: del
2464 integer :: ind, i, j
2468 real(kind=fms_svp_kind_) :: dtresl
2469 real(kind=fms_svp_kind_) :: tepsll
2470 real(kind=fms_svp_kind_) :: tminll
2471 real(kind=fms_svp_kind_) :: dtinvll
2473 dtresl=real(dtres, fms_svp_kind_)
2474 tminll=real(tminl, fms_svp_kind_)
2475 tepsll=real(tepsl, fms_svp_kind_)
2476 dtinvll=real(dtinvl, fms_svp_kind_)
2479 do j = 1,
size(temp,2)
2480 do i = 1,
size(temp,1)
2481 tmp = temp(i,j)-tminll
2482 ind = int(dtinvll*(tmp+tepsll))
2483 if (ind < 0 .or. ind >= table_siz)
then
2486 del = tmp-dtresl*real(ind,fms_svp_kind_)
2489 esat(i,j) = real(table3(ind+1),fms_svp_kind_) &
2490 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2491 + del*real(d2table3(ind+1),fms_svp_kind_) )
2499 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
2500 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: desat
2501 integer,
intent(out) :: nbad
2502 real(kind=fms_svp_kind_) :: tmp
2503 real(kind=fms_svp_kind_) :: del
2508 real(kind=fms_svp_kind_) :: dtresl
2509 real(kind=fms_svp_kind_) :: tepsll
2510 real(kind=fms_svp_kind_) :: tminll
2511 real(kind=fms_svp_kind_) :: dtinvll
2512 integer,
parameter :: lkind=fms_svp_kind_
2514 dtresl=real(dtres, fms_svp_kind_)
2515 tminll=real(tminl, fms_svp_kind_)
2516 tepsll=real(tepsl, fms_svp_kind_)
2517 dtinvll=real(dtinvl, fms_svp_kind_)
2520 do i = 1,
size(temp,1)
2521 tmp = temp(i)-tminll
2522 ind = int(dtinvll*(tmp+tepsll))
2523 if (ind < 0 .or. ind >= table_siz)
then
2526 del = tmp-dtresl*real(ind,fms_svp_kind_)
2529 desat(i) = real(dtable3(ind+1),fms_svp_kind_) &
2530 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2537 real(kind=fms_svp_kind_),
intent(in),
dimension(:) :: temp
2538 real(kind=fms_svp_kind_),
intent(out),
dimension(:) :: esat
2539 integer,
intent(out) :: nbad
2540 real(kind=fms_svp_kind_) :: tmp
2541 real(kind=fms_svp_kind_) :: del
2546 real(kind=fms_svp_kind_) :: dtresl
2547 real(kind=fms_svp_kind_) :: tepsll
2548 real(kind=fms_svp_kind_) :: tminll
2549 real(kind=fms_svp_kind_) :: dtinvll
2551 dtresl=real(dtres, fms_svp_kind_)
2552 tminll=real(tminl, fms_svp_kind_)
2553 tepsll=real(tepsl, fms_svp_kind_)
2554 dtinvll=real(dtinvl, fms_svp_kind_)
2557 do i = 1,
size(temp,1)
2558 tmp = temp(i)-tminll
2559 ind = int(dtinvll*(tmp+tepsll))
2560 if (ind < 0 .or. ind >= table_siz)
then
2563 del = tmp-dtresl*real(ind,fms_svp_kind_)
2566 esat(i) = real(table3(ind+1),fms_svp_kind_) &
2567 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2568 + del*real(d2table3(ind+1),fms_svp_kind_) )
2575 real(kind=fms_svp_kind_),
intent(in) :: temp
2576 real(kind=fms_svp_kind_),
intent(out) :: desat
2577 integer,
intent(out) :: nbad
2578 real(kind=fms_svp_kind_) :: tmp
2579 real(kind=fms_svp_kind_) :: del
2584 real(kind=fms_svp_kind_) :: dtresl
2585 real(kind=fms_svp_kind_) :: tepsll
2586 real(kind=fms_svp_kind_) :: tminll
2587 real(kind=fms_svp_kind_) :: dtinvll
2588 integer,
parameter :: lkind=fms_svp_kind_
2590 dtresl=real(dtres, fms_svp_kind_)
2591 tminll=real(tminl, fms_svp_kind_)
2592 tepsll=real(tepsl, fms_svp_kind_)
2593 dtinvll=real(dtinvl, fms_svp_kind_)
2597 ind = int(dtinvll*(tmp+tepsll))
2598 if (ind < 0 .or. ind >= table_siz)
then
2601 del = tmp-dtresl*real(ind,fms_svp_kind_)
2604 desat = real(dtable3(ind+1),fms_svp_kind_) &
2605 + 2.0_lkind*del*real(d2table3(ind+1),fms_svp_kind_)
2611 real(kind=fms_svp_kind_),
intent(in) :: temp
2612 real(kind=fms_svp_kind_),
intent(out) :: esat
2613 integer,
intent(out) :: nbad
2614 real(kind=fms_svp_kind_) :: tmp
2615 real(kind=fms_svp_kind_) :: del
2620 real(kind=fms_svp_kind_) :: dtresl
2621 real(kind=fms_svp_kind_) :: tepsll
2622 real(kind=fms_svp_kind_) :: tminll
2623 real(kind=fms_svp_kind_) :: dtinvll
2625 dtresl=real(dtres, fms_svp_kind_)
2626 tminll=real(tminl, fms_svp_kind_)
2627 tepsll=real(tepsl, fms_svp_kind_)
2628 dtinvll=real(dtinvl, fms_svp_kind_)
2632 ind = int(dtinvll*(tmp+tepsll))
2633 if (ind < 0 .or. ind >= table_siz)
then
2636 del = tmp-dtresl*real(ind,fms_svp_kind_)
2639 esat = real(table3(ind+1),fms_svp_kind_) &
2640 + del*( real(dtable3(ind+1),fms_svp_kind_) &
2641 + 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)