35 |
C == Local variables == |
C == Local variables == |
36 |
INTEGER i,j |
INTEGER i,j |
37 |
_RL cfl,Psi |
_RL cfl,Psi |
38 |
_RL uLoc,Fac,Del,DelIp,DelI,Phi,Eps,rp1h,Msk |
_RL uLoc,Fac,Del,DelIp,DelI,Phi,Eps,rp1h,rp1h_cfl,Msk |
39 |
_RL Qippp,Qipp,Qip,Qi,Qim,Qimm,Qimmm |
_RL Qippp,Qipp,Qip,Qi,Qim,Qimm,Qimmm |
40 |
_RL MskIpp,MskIp,MskI,MskIm,MskImm,MskImmm |
_RL MskIpp,MskIp,MskI,MskIm,MskImm,MskImmm |
41 |
_RL d2,d2p1,d2m1,A,B,C,D |
_RL d2,d2p1,d2m1,A,B,C,D |
57 |
cfl = uLoc |
cfl = uLoc |
58 |
IF ( calcCFL ) cfl = abs(uLoc*deltaTloc*recip_dxC(i,j,bi,bj)) |
IF ( calcCFL ) cfl = abs(uLoc*deltaTloc*recip_dxC(i,j,bi,bj)) |
59 |
|
|
60 |
IF (uLoc.gt.0.) THEN |
IF (uTrans(i,j).gt.0.) THEN |
61 |
Qippp = Q(i+2,j) |
Qippp = Q(i+2,j) |
62 |
Qipp = Q(i+1,j) |
Qipp = Q(i+1,j) |
63 |
Qip = Q(i,j) |
Qip = Q(i,j) |
72 |
MskIm = maskLocW(i-1,j) |
MskIm = maskLocW(i-1,j) |
73 |
MskImm = maskLocW(i-2,j) |
MskImm = maskLocW(i-2,j) |
74 |
MskImmm = maskLocW(i-3,j) |
MskImmm = maskLocW(i-3,j) |
75 |
ELSEIF (uLoc.lt.0.) THEN |
ELSEIF (uTrans(i,j).lt.0.) THEN |
76 |
Qippp = Q(i-3,j) |
Qippp = Q(i-3,j) |
77 |
Qipp = Q(i-2,j) |
Qipp = Q(i-2,j) |
78 |
Qip = Q(i-1,j) |
Qip = Q(i-1,j) |
89 |
MskImmm = maskLocW(i+3,j) |
MskImmm = maskLocW(i+3,j) |
90 |
ENDIF |
ENDIF |
91 |
|
|
92 |
IF (uLoc.ne.0.) THEN |
IF (uTrans(i,j).ne.0.) THEN |
93 |
C 2nd order correction [i i-1] |
C 2nd order correction [i i-1] |
94 |
Fac = 1. |
Fac = 1. |
95 |
Del = Qip-Qi |
Del = Qip-Qi |
128 |
DelI = ( Qi - Qim ) * MskIm |
DelI = ( Qi - Qim ) * MskIm |
129 |
rp1h =sign(1. _d 0,DelI)*sign(1. _d 0,DelIp) |
rp1h =sign(1. _d 0,DelI)*sign(1. _d 0,DelIp) |
130 |
& *abs(DelI+Eps)/abs(DelIp+Eps) |
& *abs(DelI+Eps)/abs(DelIp+Eps) |
131 |
|
rp1h_cfl = rp1h/(cfl+Eps) |
132 |
|
|
133 |
C TVD limiter |
C TVD limiter |
134 |
! Phi = max(0. _d 0, min( 2./(1-cfl), Phi, 2.*rp1h/cfl ) ) |
! Phi = max(0. _d 0, min( 2./(1-cfl), Phi, 2.*rp1h_cfl ) ) |
135 |
|
|
136 |
C MP limiter |
C MP limiter |
137 |
d2 = ( ( Qip + Qim ) - 2.*Qi ) * MskI * MskIm |
d2 = ( ( Qip + Qim ) - 2.*Qi ) * MskI * MskIm |
148 |
D = d2; |
D = d2; |
149 |
dm1h = max(min(A,B,C,D),0. _d 0)+min(max(A,B,C,D),0. _d 0) |
dm1h = max(min(A,B,C,D),0. _d 0)+min(max(A,B,C,D),0. _d 0) |
150 |
qMD = 0.5*( ( Qi + Qip ) - dp1h ) |
qMD = 0.5*( ( Qi + Qip ) - dp1h ) |
151 |
qUL = Qi + (1.-cfl)/cfl*( Qi-Qim ) |
qUL = Qi + (1.-cfl)/(cfl+Eps)*( Qi-Qim ) |
152 |
qLC = Qi + 0.5*( 1.+dm1h/(Qi-Qim+Eps) )*(qUL-Qi) |
qLC = Qi + 0.5*( 1.+dm1h/(Qi-Qim+Eps) )*(qUL-Qi) |
153 |
PhiMD = 2./(1.-cfl)*(qMD-Qi+Eps)/(Qip-Qi+Eps) |
PhiMD = 2./(1.-cfl)*(qMD-Qi+Eps)/(Qip-Qi+Eps) |
154 |
PhiLC = 2.*rp1h/cfl*(qLC-Qi+Eps)/(qUL-Qi+Eps) |
PhiLC = 2.*rp1h_cfl*(qLC-Qi+Eps)/(qUL-Qi+Eps) |
155 |
PhiMin = max(min(0. _d 0,PhiMD), |
PhiMin = max(min(0. _d 0,PhiMD), |
156 |
& min(0. _d 0,2.*rp1h/cfl,PhiLC)) |
& min(0. _d 0,2.*rp1h_cfl,PhiLC)) |
157 |
PhiMax = min(max(2. _d 0/(1.-cfl),PhiMD), |
PhiMax = min(max(2. _d 0/(1.-cfl),PhiMD), |
158 |
& max(0. _d 0,2.*rp1h/cfl,PhiLC)) |
& max(0. _d 0,2.*rp1h_cfl,PhiLC)) |
159 |
Phi = max(PhiMin,min(Phi,PhiMax)) |
Phi = max(PhiMin,min(Phi,PhiMax)) |
160 |
|
|
161 |
Psi = Phi * 0.5 * (1. - cfl) |
Psi = Phi * 0.5 * (1. - cfl) |