diff --git a/code/read_parameter.f90 b/code/read_parameter.f90 index b1dd68e..dbbb736 100644 --- a/code/read_parameter.f90 +++ b/code/read_parameter.f90 @@ -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 diff --git a/code/sample/4pi-IC1/itape b/code/sample/4pi-IC1/itape index cee1c54..ca6eb97 100644 --- a/code/sample/4pi-IC1/itape +++ b/code/sample/4pi-IC1/itape @@ -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 diff --git a/code/ysolve.f90 b/code/ysolve.f90 index 3f09f1b..1792a59 100644 --- a/code/ysolve.f90 +++ b/code/ysolve.f90 @@ -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