From CFD-Wiki
!Sample program for solving Lid-driven cavity flow test using SIMPLE-algorithm
! calculation of covergence criteria modul
! Copyright (C) 2010 Michail Kiričkov
! Copyright (C) 2016 Michail Kiričkov, Kaunas University for Technology
!This program is free software; you can redistribute it and/or
!modify it under the terms of the GNU General Public License
!as published by the Free Software Foundation; either version 2
!of the License, or (at your option) any later version.
!This program is distributed in the hope that it will be useful,
!but WITHOUT ANY WARRANTY; without even the implied warranty of
!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
!GNU General Public License for more details.
!You should have received a copy of the GNU General Public License
!along with this program; if not, write to the Free Software
!Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
!**********************************************************************
Subroutine Convergence_Criteria(NF,res_sum,niter_qq)
include 'icomm_1.f90'
Dimension Res(nx,ny)
integer niter_qq
real D_max_V , D_min_V , D_max_U
integer D_max_V_pr , D_min_V_pr , D_max_U_pr
res = 0.
Res_Sum = 0.
Res_vol = 0.
Do 20 I=2,NXmaxC-1
Do 20 J=2,NYmaxC-1
Res_vol = Ap(i,j,nf) * F(i ,j ,nf) - &
( As(i,j) * F(i ,j-1,nf) + &
An(i,j) * F(i ,j+1,nf) + &
Aw(i,j) * F(i-1,j ,nf) + &
Ae(i,j) * F(i+1,j ,nf) ) &
- Sp(i,j,nf)
res(i,j) = Res_vol
Res_Sum = Res_Sum + Res_vol
20 continue
write(*,*)nf,' - covergence ',Res_Sum,'global iteration Nr. ',N_golbal_iter, &
'internal iteration Nr. ',niter_qq
write(*,*)' istochnik absoliut ',Istoch_nar_abs,' istochnik whole ',Istoch_nar_whole
write(*,*)'------------------------------------------------------'
write(*,*)' max_V: ',max_V,' min_V: ',min_V,' max_U: ',max_U
D_max_V = max_V - 0.3709
D_min_V = min_V - 0.5155
D_max_U = max_U - 0.38290
write(*,*)' D_max_V: ',D_max_V,' D_min_V: ',D_min_V,' D_max_U: ',D_max_U
D_max_V_pr = ( D_max_V / 0.3709 ) * 100
D_min_V_pr = ( D_min_V / 0.5155 ) * 100
D_max_U_pr = ( D_max_U / 0.38290) * 100
write(*,*)' D_max_%: ',D_max_V_pr,' D_min_V%: ',D_min_V_pr,' D_max_U%: ',D_max_U_pr
Return
End