add residual log print

This commit is contained in:
ignis 2019-09-15 03:33:12 +09:00
parent 2ca691010f
commit e87d137a88
3 changed files with 28 additions and 6 deletions

View file

@ -19,3 +19,14 @@ subroutine read_real (x)
WRITE(otape,*) cdum,x
end subroutine read_real
subroutine read_string (x)
use m_parameters
implicit none
character(len=*) :: x
READ(itape,*) cdum,x
WRITE(otape,*) cdum,x
end subroutine read_string

View file

@ -2,7 +2,7 @@
l_0 4. !3[pi]
int_pr 400
tar_lo 0.60
dt 0.001
dt 0.0005
sc 0.75
vis 0.020 !2pi(162)ref !2pi(256)mid !2pi(256)Max !2p(162)Low
pre 2.10E+4 !185.75 !185.75 !316.88 !440.5 !102.69

View file

@ -62,13 +62,21 @@
!------------------------------------------------------------------------
REAL FUNCTION residual (x0, x1)
REAL, DIMENSION(:,:) :: x0, x1
residual = sum(abs(x0-x1))
END FUNCTION residual
LOGICAL FUNCTION converged (x0, x1)
REAL, DIMENSION(:,:) :: x0, x1
REAL :: residual = 0.
REAL :: r = 0.
residual = sum(abs(x0-x1))
converged = residual < absolute_tolerence
r = residual(x0 ,x1)
converged = r < absolute_tolerence
END FUNCTION converged
@ -78,6 +86,7 @@
INTEGER :: i,j,k,savenum
REAL :: pflame,pflold,delf=0.
REAL :: residue = 0.
CALL SET_IC
@ -88,6 +97,8 @@
IF (t_now.ge.tf) EXIT
residue = residual(yold, y1)
IF (converged(yold, y1)) EXIT
ncyc=ncyc+1
@ -117,9 +128,9 @@
u=u+0.5*(hx*REAL(nx)*tar_lo-pflame)+0.5*(pflold-pflame)
t_uf=0.
WRITE(*,'(a3,f8.3,a10,f6.3,a10,f6.3,a10,f7.4,a10,f7.4,a8,f7.4)') &
WRITE(*,'(a3,f8.3,a10,f6.3,a10,f6.3,a10,f7.4,a10,f7.4,a8,f7.4,a6,e10.4)') &
' T:',t_now,' // Tar_L:',l_0*tar_lo,' // cur_L:',pflame/hx/REAL(nx)*l_0, &
' // Old_U:',oldu,' // New_U:',u(1),' // L_f:',delf
' // Old_U:',oldu,' // New_U:',u(1),' // L_f:',delf,' // R:',residue
ENDIF