Editing lucy mod.F90: Difference between revisions

From Monnier Group Research Wiki
Jump to navigationJump to search
m New page: 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 ( forceL...
 
mNo edit summary
 
Line 40: Line 40:
  |
  |
  |-
  |-
  |       if (myRankIsZero) call writeAMRgrid("lucy_grid_tmp.dat", .false., grid)
  |if (myRankIsZero) call writeAMRgrid("lucy_grid_tmp.dat", .false., grid)
  |-
  |-
|
  |if ((grid%geometry == "ttauri").and.(iIter_grand >= 5)) then
  | if ((grid%geometry == "ttauri").and.(iIter_grand >= 5)) then
  |-
  |-
  |     write(*,'(a, 1p,D13.4,1p,D13.4,1p,D13.4)') 'checking for convergence on cleeves mod', totalEmission,oldTotalEmission, abs(totalEmission-oldTotalEmission)/totalEmission
  |write(*,'(a, 1p,D13.4,1p,D13.4,1p,D13.4)') 'checking for convergence', totalEmission,oldTotalEmission,abs(totalEmission-oldTotalEmission)/oldtotalEmission
  |-
  |-
  |         if (abs(totalEmission-oldTotalEmission)/totalEmission < 1.0d-1) converged = .true.  ! get out at 5% accuracy after niter=4
  |if (abs(totalEmission-oldTotalEmission)/oldtotalEmission < 5.0d-2) converged = .true.  ! get out at 5% accuracy after niter=4
  |-
  |-
  |      endif
  |      endif
  |}
  |}

Latest revision as of 18:52, 24 April 2012

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