Calculate gs2_diagnostics_knobs for linear simulations or if run_parameters_knobs is on; otherwise set gs2_diagnostics_knobs and gs2_diagnostics_knobs to zero
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | istep |
The current timestep |
||
logical, | intent(in) | :: | debug |
Turn on some debug messages |
||
logical, | intent(inout) | :: | exit |
Returns true if the simulation has converged (see omegatol) or if a numerical instability has occurred (see gs2_diagnostics_knobs). |
subroutine do_get_omega(istep,debug,exit)
use mp, only: proc0, broadcast
use nonlinear_terms, only: nonlin
use run_parameters, only: ieqzip
implicit none
!> The current timestep
integer, intent(in) :: istep
!> Turn on some debug messages
logical, intent(in) :: debug
!> Returns true if the simulation has converged (see
!> [[gs2_diagnostics_knobs:omegatol]]) or if a numerical instability has
!> occurred (see [[gs2_diagnostics_knobs:omegainst]]).
logical, intent(inout) :: exit
if (nonlin .and. .not. any(ieqzip)) then
!Make sure we've at least initialised the omega arrays
!for any later output etc.
omega = 0.
omegaavg = 0.
else
if (proc0) then
if (debug) write(6,*) "loop_diagnostics: proc0 call get_omegaavg"
call get_omegaavg (istep, exit, omegaavg, debug)
if (debug) write(6,*) "loop_diagnostics: proc0 done called get_omegaavg"
endif
call broadcast (exit)
end if
end subroutine do_get_omega