10 implicit none ;
private
40 function wright_eos_2d(T,S,p)
result(rho)
41 real(kind=8), dimension(:,:),
intent(in) :: t,s
43 real(kind=8), dimension(
size(t,1),
size(t,2)) :: rho
45 real(kind=8) :: a0,a1,a2,b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5
46 real(kind=8) :: al0,lam,p0,i_denom
49 a0 = 7.057924e-4; a1 = 3.480336e-7; a2 = -1.112733e-7
50 b0 = 5.790749e8; b1 = 3.516535e6; b2 = -4.002714e4
51 b3 = 2.084372e2; b4 = 5.944068e5; b5 = -9.643486e3
52 c0 = 1.704853e5; c1 = 7.904722e2; c2 = -7.984422
53 c3 = 5.140652e-2; c4 = -2.302158e2; c5 = -3.079464
57 al0 = a0 + a1*t(i,k) +a2*s(i,k)
58 p0 = b0 + b4*s(i,k) + t(i,k) * (b1 + t(i,k)*(b2 + &
59 b3*t(i,k)) + b5*s(i,k))
60 lam = c0 +c4*s(i,k) + t(i,k) * (c1 + t(i,k)*(c2 + &
61 c3*t(i,k)) + c5*s(i,k))
62 i_denom = 1.0 / (lam + al0*(p+p0))
63 rho(i,k) = (p + p0) * i_denom
68 end function wright_eos_2d
76 function alpha_wright_eos_2d(T,S,p)
result(drho_dT)
77 real(kind=8), dimension(:,:),
intent(in) :: t,s
79 real(kind=8), dimension(
size(t,1),
size(t,2)) :: drho_dt
82 real(kind=8) :: a0,a1,a2,b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5
83 real(kind=8) :: al0,lam,p0,i_denom,i_denom2
86 a0 = 7.057924e-4; a1 = 3.480336e-7; a2 = -1.112733e-7
87 b0 = 5.790749e8; b1 = 3.516535e6; b2 = -4.002714e4
88 b3 = 2.084372e2; b4 = 5.944068e5; b5 = -9.643486e3
89 c0 = 1.704853e5; c1 = 7.904722e2; c2 = -7.984422
90 c3 = 5.140652e-2; c4 = -2.302158e2; c5 = -3.079464
94 al0 = a0 + a1*t(i,k) +a2*s(i,k)
95 p0 = b0 + b4*s(i,k) + t(i,k) * (b1 + t(i,k)*(b2 + &
96 b3*t(i,k)) + b5*s(i,k))
97 lam = c0 +c4*s(i,k) + t(i,k) * (c1 + t(i,k)*(c2 + &
98 c3*t(i,k)) + c5*s(i,k))
99 i_denom = 1.0 / (lam + al0*(p+p0))
100 i_denom2 = i_denom*i_denom
101 drho_dt(i,k) = i_denom2*(lam*(b1+t(i,k)*(2*b2 + &
102 3*b3*t(i,k)) + b5*s(i,k)) - (p+p0)*((p+p0)*a1 + &
103 (c1+t(i,k)*(2*c2 + 3*c3*t(i,k)) + c5*s(i,k))))
108 end function alpha_wright_eos_2d
116 function beta_wright_eos_2d(T,S,p)
result(drho_dS)
117 real(kind=8), dimension(:,:),
intent(in) :: t,s
118 real,
intent(in) :: p
119 real(kind=8), dimension(
size(t,1),
size(t,2)) :: drho_ds
122 real(kind=8) :: a0,a1,a2,b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5
123 real(kind=8) :: al0,lam,p0,i_denom,i_denom2
126 a0 = 7.057924e-4; a1 = 3.480336e-7; a2 = -1.112733e-7
127 b0 = 5.790749e8; b1 = 3.516535e6; b2 = -4.002714e4
128 b3 = 2.084372e2; b4 = 5.944068e5; b5 = -9.643486e3
129 c0 = 1.704853e5; c1 = 7.904722e2; c2 = -7.984422
130 c3 = 5.140652e-2; c4 = -2.302158e2; c5 = -3.079464
134 al0 = a0 + a1*t(i,k) +a2*s(i,k)
135 p0 = b0 + b4*s(i,k) + t(i,k) * (b1 + t(i,k)*(b2 + &
136 b3*t(i,k)) + b5*s(i,k))
137 lam = c0 +c4*s(i,k) + t(i,k) * (c1 + t(i,k)*(c2 + &
138 c3*t(i,k)) + c5*s(i,k))
139 i_denom = 1.0 / (lam + al0*(p+p0))
140 i_denom2 = i_denom*i_denom
141 drho_ds(i,k) = i_denom2*(lam*(b4+b5*t(i,k)) - &
142 (p+p0)*((p+p0)*a2 + (c4+c5*t(i,k))))
147 end function beta_wright_eos_2d
151 function tracer_z_init(tr_in, z_edges, e, nkml, nkbl, land_fill, wet, nlay, nlevs, &
152 debug, i_debug, j_debug, eps_z)
result(tr)
153 real,
dimension(:,:,:),
intent(in) :: tr_in
154 real,
dimension(size(tr_in,3)+1),
intent(in) :: z_edges
156 integer,
intent(in) :: nlay
157 real,
dimension(size(tr_in,1),size(tr_in,2),nlay+1), &
159 integer,
intent(in) :: nkml
160 integer,
intent(in) :: nkbl
161 real,
intent(in) :: land_fill
162 real,
dimension(size(tr_in,1),size(tr_in,2)), &
164 real,
dimension(size(tr_in,1),size(tr_in,2)), &
165 optional,
intent(in) :: nlevs
166 logical,
optional,
intent(in) :: debug
167 integer,
optional,
intent(in) :: i_debug
168 integer,
optional,
intent(in) :: j_debug
169 real,
optional,
intent(in) :: eps_z
170 real,
dimension(size(tr_in,1),size(tr_in,2),nlay) :: tr
173 real,
dimension(size(tr_in,3)) :: tr_1d
174 real,
dimension(nlay+1) :: e_1d
175 real,
dimension(nlay) :: tr_
176 integer,
dimension(size(tr_in,1),size(tr_in,2)) :: nlevs_data
177 integer :: n,i,j,k,l,nx,ny,nz,nt,kz
178 integer :: k_top,k_bot,k_bot_prev,kk,kstart
181 real,
dimension(size(tr_in,3)) :: wt
182 real,
dimension(size(tr_in,3)) :: z1, z2
187 logical :: debug_msg, debug_, debug_pt
189 nx =
size(tr_in,1); ny=
size(tr_in,2); nz =
size(tr_in,3)
191 nlevs_data =
size(tr_in,3)
192 if (
PRESENT(nlevs)) nlevs_data = anint(nlevs)
193 epsln_z = 1.0e-10 ;
if (
PRESENT(eps_z)) epsln_z = eps_z
195 debug_=.false. ;
if (
PRESENT(debug)) debug_ = debug
197 debug_pt = debug_ ;
if (
PRESENT(i_debug) .and.
PRESENT(j_debug)) debug_pt = debug_
201 if (nlevs_data(i,j) == 0 .or. wet(i,j) == 0.)
then
202 tr(i,j,:) = land_fill
207 tr_1d(k) = tr_in(i,j,k)
213 k_bot = 1 ; k_bot_prev = -1
215 if (e_1d(k+1) > z_edges(1))
then
217 elseif (e_1d(k) < z_edges(nlevs_data(i,j)+1))
then
219 print *,
'*** WARNING : Found interface below valid range of z data '
220 print *,
'(i,j,z_bottom,interface)= ',&
221 i,j,z_edges(nlevs_data(i,j)+1),e_1d(k)
222 print *,
'z_edges= ',z_edges
224 print *,
'*** I will extrapolate below using the bottom-most valid values'
227 tr(i,j,k) = tr_1d(nlevs_data(i,j))
231 call find_overlap(z_edges, e_1d(k), e_1d(k+1), nlevs_data(i,j), &
232 kstart, k_top, k_bot, wt, z1, z2)
234 if (debug_pt)
then ;
if ((i == i_debug) .and. (j == j_debug))
then
235 print *,
'0001 k,k_top,k_bot,sum(wt),sum(z2-z1) = ',k,k_top,k_bot,sum(wt),sum(z2-z1)
239 if (kz /= k_bot_prev)
then
241 if ((kz < nlevs_data(i,j)) .and. (kz > 1))
then
245 if (kz > nlevs_data(i,j)) kz = nlevs_data(i,j)
247 tr(i,j,k) = wt(kz) * (tr_1d(kz) + 0.5*sl_tr*(z2(kz) + z1(kz)))
250 if (debug_pt)
then ;
if ((i == i_debug) .and. (j == j_debug))
then
251 print *,
'0002 k,k_top,k_bot,k_bot_prev,sl_tr = ',k,k_top,k_bot,k_bot_prev,sl_tr
254 do kz=k_top+1,k_bot-1
255 tr(i,j,k) = tr(i,j,k) + wt(kz)*tr_1d(kz)
258 if (debug_pt)
then ;
if ((i == i_debug) .and. (j == j_debug))
then
259 print *,
'0003 k,tr = ',k,tr(i,j,k)
262 if (k_bot > k_top)
then
266 if ((kz < nlevs_data(i,j)) .and. (kz > 1))
then
270 tr(i,j,k) = tr(i,j,k) + wt(kz) * &
271 (tr_1d(kz) + 0.5*sl_tr*(z2(kz) + z1(kz)))
275 if (debug_pt)
then ;
if ((i == i_debug) .and. (j == j_debug))
then
276 print *,
'0004 k,kz,nlevs,sl_tr,tr = ',k,kz,nlevs_data(i,j),sl_tr,tr(i,j,k)
277 print *,
'0005 k,kz,tr(kz),tr(kz-1),tr(kz+1) = ',k,kz,tr_1d(kz),tr_1d(kz-1),tr_1d(kz+1),z_edges(kz+2)
287 if (e_1d(k)-e_1d(k+1) <= epsln_z) tr(i,j,k)=tr(i,j,k-1)
302 real,
dimension(:,:),
intent(in) :: a
303 real,
dimension(:),
intent(in) :: x
304 integer,
dimension(size(a,1)),
optional,
intent(in) :: lo
305 integer,
dimension(size(a,1)),
optional,
intent(in) :: hi
306 integer,
dimension(size(a,1),size(x,1)) :: bi_r
308 integer :: mid,num_x,num_a,i
309 integer,
dimension(size(a,1)) :: lo_,hi_,lo0,hi0
312 lo_=1;hi_=
size(a,2);num_x=
size(x,1);bi_r=-1;nprofs=
size(a,1)
314 if (
PRESENT(lo))
then
317 if (
PRESENT(hi))
then
326 do while (lo_(j) < hi_(j))
327 mid = (lo_(j)+hi_(j))/2
328 if (x(i) < a(j,mid))
then
349 real(kind=8), dimension(:,:,:),
intent(inout) :: temp
350 real(kind=8), dimension(:,:,:),
intent(inout) :: salt
351 real(kind=8), dimension(
size(temp,3)),
intent(in) :: r
352 real,
intent(in) :: p_ref
353 integer,
intent(in) :: niter
354 integer,
intent(in) :: k_start
355 real,
intent(in) :: land_fill
356 real(kind=8), dimension(:,:,:),
intent(in) :: h
359 real,
parameter :: t_max = 35.0, t_min = -2.0
364 real,
dimension(:,:,:),
intent(inout) :: temp
365 real,
dimension(:,:,:),
intent(inout) :: salt
366 real,
dimension(size(temp,3)),
intent(in) :: r
367 real,
intent(in) :: p_ref
368 integer,
intent(in) :: niter
369 integer,
intent(in) :: k_start
370 real,
intent(in) :: land_fill
371 real,
dimension(:,:,:),
intent(in) :: h
374 real,
parameter :: t_max = 31.0, t_min = -2.0
377 real(kind=8), dimension(
size(temp,1),
size(temp,3)) :: t, s, dt, ds, rho, hin
378 real(kind=8), dimension(
size(temp,1),
size(temp,3)) :: drho_dt, drho_ds
379 real(kind=8), dimension(
size(temp,1)) :: press
380 integer :: nx, ny, nz, nt, i, j, k, n, itt
382 logical :: adjust_salt, old_fit
383 real,
parameter :: s_min = 0.5, s_max=65.0
384 real,
parameter :: tol=1.e-4, max_t_adj=1.0, max_s_adj = 0.5
390 nx=
size(temp,1) ; ny=
size(temp,2) ; nz=
size(temp,3)
401 iter_loop:
do itt = 1,niter
403 rho=wright_eos_2d(t,s,p_ref)
404 drho_dt=alpha_wright_eos_2d(t,s,p_ref)
408 call calculate_density_derivs(t(:,k), s(:,k), press, drho_dt(:,k), drho_ds(:,k), 1, nx, eos)
411 do k=k_start,nz ;
do i=1,nx
414 if (abs(rho(i,k)-r(k))>tol)
then
416 dt(i,k) = max(min((r(k)-rho(i,k)) / drho_dt(i,k), max_t_adj), -max_t_adj)
417 t(i,k) = max(min(t(i,k)+dt(i,k), t_max), t_min)
419 dt_ds = 10.0 - min(-drho_dt(i,k)/drho_ds(i,k),10.)
422 ds(i,k) = (r(k)-rho(i,k)) / (drho_ds(i,k) - drho_dt(i,k)*dt_ds )
423 dt(i,k) = -dt_ds*ds(i,k)
425 t(i,k) = max(min(t(i,k)+dt(i,k), t_max), t_min)
426 s(i,k) = max(min(s(i,k)+ds(i,k), s_max), s_min)
430 if (maxval(abs(dt)) < tol)
then
431 adjust_salt = .false.
436 if (adjust_salt .and. old_fit)
then ;
do itt = 1,niter
438 rho = wright_eos_2d(t,s,p_ref)
439 drho_ds = beta_wright_eos_2d(t,s,p_ref)
443 call calculate_density_derivs(t(:,k),s(:,k),press,drho_dt(:,k),drho_ds(:,k),1,nx,eos)
446 do k=k_start,nz ;
do i=1,nx
448 if (abs(rho(i,k)-r(k)) > tol)
then
449 ds(i,k) = max(min((r(k)-rho(i,k)) / drho_ds(i,k), max_s_adj), -max_s_adj)
450 s(i,k) = max(min(s(i,k)+ds(i,k), s_max), s_min)
453 if (maxval(abs(ds)) < tol)
exit
467 subroutine find_overlap(e, Z_top, Z_bot, k_max, k_start, k_top, k_bot, wt, z1, z2)
468 real,
dimension(:),
intent(in) :: e
469 real,
intent(in) :: Z_top
470 real,
intent(in) :: Z_bot
471 integer,
intent(in) :: k_max
472 integer,
intent(in) :: k_start
473 integer,
intent(out) :: k_top
474 integer,
intent(out) :: k_bot
475 real,
dimension(:),
intent(out) :: wt
476 real,
dimension(:),
intent(out) :: z1
477 real,
dimension(:),
intent(out) :: z2
480 real :: Ih, e_c, tot_wt, I_totwt
483 wt(:)=0.0 ; z1(:)=0.0 ; z2(:)=0.0
484 k_top = k_start ; k_bot = k_start ; wt(1) = 1.0 ; z1(1) = -0.5 ; z2(1) = 0.5
486 do k=k_start,k_max ;
if (e(k+1) < z_top)
exit ;
enddo
493 if (e(k+1) <= z_bot)
then
494 wt(k) = 1.0 ; k_bot = k
495 ih = 0.0 ;
if (e(k) /= e(k+1)) ih = 1.0 / (e(k)-e(k+1))
496 e_c = 0.5*(e(k)+e(k+1))
497 z1(k) = (e_c - min(e(k), z_top)) * ih
498 z2(k) = (e_c - z_bot) * ih
500 wt(k) = min(e(k),z_top) - e(k+1) ; tot_wt = wt(k)
502 if (e(k) /= e(k+1))
then
503 z1(k) = (0.5*(e(k)+e(k+1)) - min(e(k), z_top)) / (e(k)-e(k+1))
504 else ; z1(k) = -0.5 ;
endif
508 if (e(k+1) <= z_bot)
then
510 wt(k) = e(k) - z_bot ; z1(k) = -0.5
511 if (e(k) /= e(k+1))
then
512 z2(k) = (0.5*(e(k)+e(k+1)) - z_bot) / (e(k)-e(k+1))
513 else ; z2(k) = 0.5 ;
endif
515 wt(k) = e(k) - e(k+1) ; z1(k) = -0.5 ; z2(k) = 0.5
517 tot_wt = tot_wt + wt(k)
521 i_totwt = 0.0 ;
if (tot_wt > 0.0) i_totwt = 1.0 / tot_wt
522 do k=k_top,k_bot ; wt(k) = i_totwt*wt(k) ;
enddo
530 real,
dimension(:),
intent(in) :: val
531 real,
dimension(:),
intent(in) :: e
532 integer,
intent(in) :: k
538 if ((val(k)-val(k-1)) * (val(k)-val(k+1)) >= 0.0)
then
541 d1 = 0.5*(e(k-1)-e(k+1)) ; d2 = 0.5*(e(k)-e(k+2))
542 if (d1*d2 > 0.0)
then
543 slope = ((d1**2)*(val(k+1) - val(k)) + (d2**2)*(val(k) - val(k-1))) * &
544 (e(k) - e(k+1)) / (d1*d2*(d1+d2))
547 amn = min(abs(slope), 2.0*(max(val(k-1), val(k), val(k+1)) - val(k)))
548 cmn = 2.0*(val(k) - min(val(k-1), val(k), val(k+1)))
549 slope = sign(1.0, slope) * min(amn, cmn)
562 function find_interfaces(rho, zin, Rb, depth, nlevs, nkml, nkbl, hml, debug, eps_z, eps_rho)
result(zi)
563 real,
dimension(:,:,:), &
565 real,
dimension(size(rho,3)), &
567 real,
dimension(:),
intent(in) :: rb
568 real,
dimension(size(rho,1),size(rho,2)), &
570 real,
dimension(size(rho,1),size(rho,2)), &
571 optional,
intent(in) :: nlevs
572 logical,
optional,
intent(in) :: debug
573 integer,
optional,
intent(in) :: nkml
574 integer,
optional,
intent(in) :: nkbl
575 real,
optional,
intent(in) :: hml
576 real,
optional,
intent(in) :: eps_z
577 real,
optional,
intent(in) :: eps_rho
578 real,
dimension(size(rho,1),size(rho,2),size(Rb,1)) :: zi
581 real,
dimension(size(rho,1),size(rho,3)) :: rho_
582 real,
dimension(size(rho,1)) :: depth_
585 integer,
dimension(size(rho,1),size(Rb,1)) :: ki_
586 real,
dimension(size(rho,1),size(Rb,1)) :: zi_
587 integer,
dimension(size(rho,1),size(rho,2)) :: nlevs_data
588 integer,
dimension(size(rho,1)) :: lo, hi
589 real :: slope,rsm,drhodz,hml_
590 integer :: n,i,j,k,l,nx,ny,nz,nt
591 integer :: nlay,kk,nkml_,nkbl_
592 logical :: debug_ = .false.
595 real,
parameter :: zoff=0.999
601 if (
PRESENT(debug)) debug_=debug
603 nx =
size(rho,1); ny=
size(rho,2); nz =
size(rho,3)
604 nlevs_data(:,:) =
size(rho,3)
606 nkml_ = 0 ;
if (
PRESENT(nkml)) nkml_ = max(0, nkml)
607 nkbl_ = 0 ;
if (
PRESENT(nkbl)) nkbl_ = max(0, nkbl)
608 hml_ = 0.0 ;
if (
PRESENT(hml)) hml_ = hml
609 epsln_z = 1.0e-10 ;
if (
PRESENT(eps_z)) epsln_z = eps_z
610 epsln_rho = 1.0e-10 ;
if (
PRESENT(eps_rho)) epsln_rho = eps_rho
612 if (
PRESENT(nlevs))
then
613 nlevs_data(:,:) = nlevs(:,:)
617 rho_(:,:) = rho(:,j,:)
620 print *,
'looking for interfaces, i,j,nlevs= ',i,j,nlevs_data(i,j)
621 print *,
'initial density profile= ', rho_(i,:)
628 do k=2,nlevs_data(i,j)-1
629 if (rho_(i,k) - rho_(i,k-1) < 0.0 )
then
631 rho_(i,k-1) = rho_(i,k)-epsln_rho
633 drhodz = (rho_(i,k+1)-rho_(i,k-1)) / (zin(k+1)-zin(k-1))
634 if (drhodz < 0.0) unstable=.true.
635 rho_(i,k) = rho_(i,k-1) + drhodz*zoff*(zin(k)-zin(k-1))
641 do k=nlevs_data(i,j)-1,2,-1
642 if (rho_(i,k+1) - rho_(i,k) < 0.0)
then
643 if (k == nlevs_data(i,j)-1)
then
644 rho_(i,k+1) = rho_(i,k-1)+epsln_rho
646 drhodz = (rho_(i,k+1)-rho_(i,k-1))/(zin(k+1)-zin(k-1))
647 if (drhodz < 0.0) unstable=.true.
648 rho_(i,k) = rho_(i,k+1)-drhodz*(zin(k+1)-zin(k))
656 print *,
'final density profile= ', rho_(i,:)
662 depth_(:) = -1.0*depth(:,j)
664 hi(:) = nlevs_data(:,j)
666 ki_(:,:) = max(1, ki_(:,:)-1)
669 slope = (zin(ki_(i,l)+1) - zin(ki_(i,l))) / max(rho_(i,ki_(i,l)+1) - rho_(i,ki_(i,l)),epsln_rho)
670 zi_(i,l) = -1.0*(zin(ki_(i,l)) + slope*(rb(l)-rho_(i,ki_(i,l))))
671 zi_(i,l) = max(zi_(i,l), depth_(i))
672 zi_(i,l) = min(zi_(i,l), -1.0*hml_)
674 zi_(i,nlay+1) = depth_(i)
676 zi_(i,l) = max(hml_*((1.0-real(l))/real(nkml_)), depth_(i))
679 if (zi_(i,l) < zi_(i,l+1) + epsln_z) zi_(i,l) = zi_(i,l+1) + epsln_z
680 if (zi_(i,l) > -1.0*hml_) zi_(i,l) = max(-1.0*hml_, depth_(i))
690 real,
dimension(:),
intent(in) :: x
691 real,
dimension(:),
intent(in) :: y
692 real,
dimension(size(x,1),size(y,1)),
intent(inout) :: x_t
693 real,
dimension(size(x,1),size(y,1)),
intent(inout) :: y_t
697 ni=
size(x,1);nj=
size(y,1)
717 subroutine smooth_heights(zi,fill,bad,sor,niter,cyclic_x, tripolar_n)
718 real,
dimension(:,:),
intent(inout) :: zi
719 integer,
dimension(size(zi,1),size(zi,2)),
intent(in) :: fill
720 integer,
dimension(size(zi,1),size(zi,2)),
intent(in) :: bad
721 real,
intent(in) :: sor
722 integer,
intent(in) :: niter
723 logical,
intent(in) :: cyclic_x
724 logical,
intent(in) :: tripolar_n
729 real,
dimension(size(zi,1),size(zi,2)) :: res, m
730 integer,
dimension(size(zi,1),size(zi,2),4) :: B
731 real,
dimension(0:size(zi,1)+1,0:size(zi,2)+1) :: mp
732 integer,
dimension(0:size(zi,1)+1,0:size(zi,2)+1) :: nm
736 ni=
size(zi,1); nj=
size(zi,2)
746 if (fill(i,j) == 1)
then
747 b(i,j,1)=1-nm(i+1,j);b(i,j,2)=1-nm(i-1,j)
748 b(i,j,3)=1-nm(i,j+1);b(i,j,4)=1-nm(i,j-1)
756 if (fill(i,j) == 1)
then
757 bsum = real(b(i,j,1)+b(i,j,2)+b(i,j,3)+b(i,j,4))
759 res(i,j)=isum*(b(i,j,1)*mp(i+1,j)+b(i,j,2)*mp(i-1,j)+&
760 b(i,j,3)*mp(i,j+1)+b(i,j,4)*mp(i,j-1)) - mp(i,j)
764 res(:,:)=res(:,:)*sor
768 mp(i,j)=mp(i,j)+res(i,j)
772 zi(:,:)=mp(1:ni,1:nj)
782 integer,
dimension(:,:),
intent(in) :: m
783 logical,
intent(in) :: cyclic_x
784 logical,
intent(in) :: tripolar_n
785 integer,
dimension(0:size(m,1)+1,0:size(m,2)+1) :: mp
787 real,
dimension(size(m,1),size(m,2)) :: m_real
788 real,
dimension(0:size(m,1)+1,0:size(m,2)+1) :: mp_real
802 real,
dimension(:,:),
intent(in) :: m
803 logical,
intent(in) :: cyclic_x
804 logical,
intent(in) :: tripolar_n
805 real,
dimension(0:size(m,1)+1,0:size(m,2)+1) :: mp
809 ni=
size(m,1); nj=
size(m,2)
814 mp(0,1:nj)=m(ni,1:nj)
815 mp(ni+1,1:nj)=m(1,1:nj)
818 mp(ni+1,1:nj)=m(ni,1:nj)
824 mp(i,nj+1)=m(ni-i+1,nj)
827 mp(1:ni,nj+1)=m(1:ni,nj)