26 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
27 |
#include "OBCS.h" |
#include "OBCS.h" |
28 |
#endif |
#endif |
29 |
|
#include "SOLVE_FOR_PRESSURE.h" |
30 |
|
|
31 |
C == Routine arguments == |
C == Routine arguments == |
32 |
C myThid - Number of this instance of SOLVE_FOR_PRESSURE |
C myThid - Number of this instance of SOLVE_FOR_PRESSURE |
33 |
INTEGER myThid |
INTEGER myThid |
34 |
CEndOfInterface |
CEndOfInterface |
35 |
|
|
36 |
C Local variables |
C == Local variables == |
|
C cg2d_x - Conjugate Gradient 2-D solver : Solution vector |
|
|
C cg2d_b - Conjugate Gradient 2-D solver : Right-hand side vector |
|
37 |
INTEGER i,j,k,bi,bj |
INTEGER i,j,k,bi,bj |
38 |
_RS uf(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
_RS uf(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
39 |
_RS vf(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
_RS vf(1-Olx:sNx+Olx,1-Oly:sNy+Oly) |
40 |
_RL cg2d_x(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
_RL firstResidual,lastResidual |
|
_RL cg2d_b(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
|
|
_RL tolerance,residual |
|
41 |
INTEGER numIters |
INTEGER numIters |
42 |
|
|
43 |
C-- Save previous solution & Initialise Vector solution and source term : |
C-- Save previous solution & Initialise Vector solution and source term : |
45 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
46 |
DO j=1-OLy,sNy+OLy |
DO j=1-OLy,sNy+OLy |
47 |
DO i=1-OLx,sNx+OLx |
DO i=1-OLx,sNx+OLx |
|
#ifdef INCLUDE_CD_CODE |
|
48 |
etaNm1(i,j,bi,bj) = etaN(i,j,bi,bj) |
etaNm1(i,j,bi,bj) = etaN(i,j,bi,bj) |
|
#endif |
|
49 |
cg2d_x(i,j,bi,bj) = Bo_surf(i,j,bi,bj)*etaN(i,j,bi,bj) |
cg2d_x(i,j,bi,bj) = Bo_surf(i,j,bi,bj)*etaN(i,j,bi,bj) |
50 |
cg2d_b(i,j,bi,bj) = 0. |
cg2d_b(i,j,bi,bj) = 0. |
51 |
#ifdef USE_NATURAL_BCS |
#ifdef USE_NATURAL_BCS |
138 |
|
|
139 |
C-- Find the surface pressure using a two-dimensional conjugate |
C-- Find the surface pressure using a two-dimensional conjugate |
140 |
C-- gradient solver. |
C-- gradient solver. |
141 |
C see CG2D_INTERNAL.h for the interface to this routine. |
C see CG2D.h for the interface to this routine. |
142 |
tolerance=cg2dTargetResidual |
firstResidual=0. |
143 |
residual=0. |
lastResidual=0. |
144 |
numIters=cg2dMaxIters |
numIters=cg2dMaxIters |
145 |
CALL CG2D( |
CALL CG2D( |
146 |
I cg2d_b, |
U cg2d_b, |
147 |
U cg2d_x, |
U cg2d_x, |
148 |
U tolerance, |
O firstResidual, |
149 |
U residual, |
O lastResidual, |
150 |
U numIters, |
U numIters, |
151 |
I myThid ) |
I myThid ) |
152 |
_EXCH_XY_R8(cg2d_x, myThid ) |
_EXCH_XY_R8(cg2d_x, myThid ) |
153 |
|
|
154 |
_BEGIN_MASTER( myThid ) |
_BEGIN_MASTER( myThid ) |
155 |
WRITE(*,'(A,I6,1PE30.14)') ' CG2D iters, err = ', |
WRITE(*,'(A,I6,1PE30.14)') ' CG2D iters, err = ', |
156 |
& 0, tolerance |
& 0, firstResidual |
157 |
WRITE(*,'(A,I6,1PE30.14)') ' CG2D iters, err = ', |
WRITE(*,'(A,I6,1PE30.14)') ' CG2D iters, err = ', |
158 |
& numIters, residual |
& numIters, lastResidual |
159 |
_END_MASTER( ) |
_END_MASTER( ) |
160 |
|
|
161 |
C-- Transfert the 2D-solution to "etaN" : |
C-- Transfert the 2D-solution to "etaN" : |