Editing lucy mod.F90

From Monnier Group Research Wiki
Revision as of 18:52, 24 April 2012 by Monnierast (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Here is an example of how to edit lucy_mod.F90 for customized convergence criteria. The default is to

! forceLucyConv is set in the parameters.dat file if required
if ( forceLucyConv ) then
converged = .true.
if (myRankIsZero) write(*,*) "FORCING CONVERGENCE FOR TESTS!!!!"
end if
if (multiLucyFiles) then
write(tfilename, '(a,i2.2,a)') "lucy",iIter_grand,".vtk"
else
tfilename = "lucy.vtk"
endif
call writeVtkFile(grid, tfilename, &
valueTypeString=(/"rho ", "temperature", "tau ", "crossings ", "etacont " , &
"dust1 ", "deltaT ", "etaline ","fixedtemp ", "inflow "/))
!  !
!  ! Write grid structure to a tmp file.
!  !
if (myRankIsZero) call writeAMRgrid("lucy_grid_tmp.dat", .false., grid)
if ((grid%geometry == "ttauri").and.(iIter_grand >= 5)) then
write(*,'(a, 1p,D13.4,1p,D13.4,1p,D13.4)') 'checking for convergence', totalEmission,oldTotalEmission,abs(totalEmission-oldTotalEmission)/oldtotalEmission
if (abs(totalEmission-oldTotalEmission)/oldtotalEmission < 5.0d-2) converged = .true.  ! get out at 5% accuracy after niter=4
endif