Skip to content

Commit

Permalink
1. Add rhs related residual estimation in pbicg linear solver
Browse files Browse the repository at this point in the history
2. Modify some codes in read config and flux boundary
  • Loading branch information
sdhzhs committed Dec 16, 2023
1 parent 0453bee commit e504b6b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/Condiff.f03
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ Subroutine Condiff(scalar)
end if
!if(scalar=='Tn') aP=aP+rho(i,j)*Cw1*fw1(i,j)*Tn(i,j)/d(i,j)**2*Jg(i,j)*dx*dy
if(scalar=='Tk') aP=aP+rho(i,j)*betastar(i,j)*Tw(i,j)*Jg(i,j)*dx*dy
if(scalar=='T'.and.Tmptype=='flux') aP=aP-2*Ds(i,j)
else if(Turmod=='sa'.and.Walltreat=='wf'.or.(Turmod=='sst'.and.Walltreat=='wf').or.Turmod=='ke') then
if(scalar=='U') then
if(wallfunutype=='parvel') then
Expand Down
16 changes: 12 additions & 4 deletions lib/Linearsolver.f03
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ end Subroutine sor
Subroutine CGSTAB(aM,b,F,F0,a,Ic,Jc,Ib1,Ib2,scalar)
implicit none
integer maxl,k,Ic,Jc,Ib1,Ib2,iter
real(8) err,a
real(8) err,a,normb
real(8) aM(5,Ic,Jc),b(Ic,Jc),F(Ic,Jc),F0(Ic,Jc)
real(8) alpha,beta,rho,omega,rho0,sumrmsi,sumvrms,sumptz,sumpts
real(8) alpha,beta,rho,omega,rho0,sumrmsi,sumvrms,sumptz,sumpts,sumrms
real(8) rmsi(Ic,Jc),rms(Ic,Jc),p(Ic,Jc),v(Ic,Jc),s(Ic,Jc),t(Ic,Jc),pt(Ic,Jc),y(Ic,Jc),z(Ic,Jc),aD(Ic,Jc),vec0(Ic,Jc)
character(*) scalar
character(4) pretype
Expand All @@ -82,6 +82,7 @@ Subroutine CGSTAB(aM,b,F,F0,a,Ic,Jc,Ib1,Ib2,scalar)
p=0
v=p
aD=aM(1,:,:)
normb=sum(abs(b))
!$OMP END WORKSHARE
if(pretype=='ILU') then
Call DILU(aM,aD,Ic,Jc,Ib2)
Expand Down Expand Up @@ -156,13 +157,20 @@ Subroutine CGSTAB(aM,b,F,F0,a,Ic,Jc,Ib1,Ib2,scalar)
F=F+alpha*y+omega*z
rms=s-omega*t
!$OMP END WORKSHARE
!$OMP WORKSHARE
sumrms=sum(abs(rms))
!$OMP END WORKSHARE
!!$OMP SINGLE
!iter=k
!!$OMP END SINGLE
if(sum(abs(rms))/(Ic*Jc)<err) exit
!if(normb==0) then
if(sumrms/(Ic*Jc)<err) exit
!else
! if(sumrms/normb<err) exit
!end if
end DO
!$OMP END PARALLEL
!print *,sum(abs(rms))/(Ic*Jc),iter
!print *,sumrms/(Ic*Jc),iter

contains

Expand Down
3 changes: 2 additions & 1 deletion lib/Readpara.f03
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Subroutine Readpara(libmod,scptname)
character(128) ioerrmsg
integer stat
if(libmod=='S'.or.libmod=='M') then
open(unit=10,file=scptname,status='old')
open(unit=10,file=scptname,status='old',IOSTAT=stat,IOMSG=ioerrmsg)
if(stat>0) stop ioerrmsg
read(10,*) ch
read(10,*) filename(1)
read(10,*) ch
Expand Down

0 comments on commit e504b6b

Please sign in to comment.