14 integer(I4B) :: tmr_convergence = -1
15 integer(I4B) :: tmr_pkg_cnvg = -1
16 integer(I4B) :: tmr_sync_nur = -1
17 integer(I4B) :: tmr_nur_cnvg = -1
18 integer(I4B) :: tmr_calcptc = -1
19 integer(I4B) :: tmr_underrelax = -1
20 integer(I4B) :: tmr_backtracking = -1
41 logical(LGP) :: has_converged
43 real(dp) :: global_max_dvc
44 real(dp) :: abs_max_dvc
48 call g_prof%start(
"Parallel Solution (cnvg check)", this%tmr_convergence)
52 has_converged = .false.
53 abs_max_dvc = abs(max_dvc)
54 call mpi_allreduce(abs_max_dvc, global_max_dvc, 1, mpi_double_precision, &
55 mpi_max, mpi_world%comm, ierr)
57 if (global_max_dvc <= this%dvclose)
then
58 has_converged = .true.
61 call g_prof%stop(this%tmr_convergence)
68 real(dp),
intent(in) :: dpak
69 character(len=LENPAKLOC),
intent(in) :: cpakout
70 integer(I4B),
intent(in) :: iend
72 integer(I4B) :: icnvg_global
73 integer(I4B) :: icnvg_local
77 call g_prof%start(
"Parallel Solution (package cnvg)", this%tmr_pkg_cnvg)
82 this%NumericalSolutionType%sln_package_convergence(dpak, cpakout, iend)
84 call mpi_allreduce(icnvg_local, icnvg_global, 1, mpi_integer, &
85 mpi_min, mpi_world%comm, ierr)
88 call g_prof%stop(this%tmr_pkg_cnvg)
94 integer(I4B),
intent(in) :: inewtonur
96 integer(I4B) :: ivalue
100 call g_prof%start(
"Parallel Solution (NUR)", this%tmr_sync_nur)
103 call mpi_allreduce(inewtonur, ivalue, 1, mpi_integer, &
104 mpi_max, mpi_world%comm, ierr)
107 call g_prof%stop(this%tmr_sync_nur)
112 result(has_converged)
114 real(dp),
intent(in) :: dxold_max
115 real(dp),
intent(in) :: hncg
116 logical(LGP) :: has_converged
118 integer(I4B) :: icnvg_local
119 integer(I4B) :: icnvg_global
123 call g_prof%start(
"Parallel Solution (NUR cnvg)", this%tmr_nur_cnvg)
127 has_converged = .false.
129 if (this%NumericalSolutionType%sln_nur_has_converged( &
130 dxold_max, hncg))
then
134 call mpi_allreduce(icnvg_local, icnvg_global, 1, mpi_integer, &
135 mpi_min, mpi_world%comm, ierr)
137 if (icnvg_global == 1) has_converged = .true.
139 call g_prof%stop(this%tmr_nur_cnvg)
150 integer(I4B) :: iptc_loc
151 real(DP) :: ptcf_loc, ptcf_glo_max
155 call g_prof%start(
"Parallel Solution (PTC calc)", this%tmr_calcptc)
158 call this%NumericalSolutionType%sln_calc_ptc(iptc_loc, ptcf_loc)
159 if (iptc_loc == 0) ptcf_loc =
dzero
162 call mpi_allreduce(ptcf_loc, ptcf_glo_max, 1, mpi_double_precision, &
163 mpi_max, mpi_world%comm, ierr)
168 if (ptcf_glo_max >
dzero)
then
173 call g_prof%stop(this%tmr_calcptc)
181 integer(I4B),
intent(in) :: kiter
182 real(DP),
intent(in) :: bigch
183 integer(I4B),
intent(in) :: neq
184 integer(I4B),
dimension(neq),
intent(in) :: active
185 real(DP),
dimension(neq),
intent(inout) :: x
186 real(DP),
dimension(neq),
intent(in) :: xtemp
188 real(DP) :: dvc_global_max, dvc_global_min
192 call g_prof%start(
"Parallel Solution (underrelax)", this%tmr_underrelax)
197 call mpi_allreduce(bigch, dvc_global_max, 1, mpi_double_precision, &
198 mpi_max, mpi_world%comm, ierr)
200 call mpi_allreduce(bigch, dvc_global_min, 1, mpi_double_precision, &
201 mpi_min, mpi_world%comm, ierr)
204 if (abs(dvc_global_min) > abs(dvc_global_max))
then
205 dvc_global_max = dvc_global_min
209 call this%NumericalSolutionType%sln_underrelax(kiter, dvc_global_max, &
210 neq, active, x, xtemp)
212 call g_prof%stop(this%tmr_underrelax)
221 integer(I4B),
intent(inout) :: bt_flag
223 integer(I4B) :: btflag_local
227 call g_prof%start(
"Parallel Solution (backtrack)", this%tmr_backtracking)
232 btflag_local = this%NumericalSolutionType%get_backtracking_flag()
235 call mpi_allreduce(btflag_local, bt_flag, 1, mpi_integer, &
236 mpi_max, mpi_world%comm, ierr)
240 if (bt_flag > 0)
then
241 call this%NumericalSolutionType%apply_backtracking()
244 call g_prof%stop(this%tmr_backtracking)
This module contains simulation constants.
integer(i4b), parameter lenpakloc
maximum length of a package location
real(dp), parameter dzero
real constant zero
real(dp), parameter done
real constant 1
This module defines variable data types.
type(mpiworldtype) function, pointer, public get_mpi_world()
subroutine, public check_mpi(mpi_error_code)
Check the MPI error code, report, and.
logical(lgp) function par_has_converged(this, max_dvc)
Check global convergence. The local maximum dependent variable change is reduced over MPI with all ot...
integer(i4b) function par_package_convergence(this, dpak, cpakout, iend)
logical(lgp) function par_nur_has_converged(this, dxold_max, hncg)
integer(i4b) function par_sync_newtonur_flag(this, inewtonur)
subroutine par_underrelax(this, kiter, bigch, neq, active, x, xtemp)
apply under-relaxation in sync over all processes
subroutine par_backtracking_xupdate(this, bt_flag)
synchronize backtracking flag over processes
subroutine par_calc_ptc(this, iptc, ptcf)
Calculate pseudo-transient continuation factor.
type(profilertype), public g_prof
the global timer object (to reduce trivial lines of code)