Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/common/m_phase_change.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module m_phase_change

!> @name Parameters for the first order transition phase change
!> @{
integer, parameter :: max_iter = 1e8_wp !< max # of iterations
integer, parameter :: max_iter = 100000 !< max Newton iterations before accepting the last iterate
real(wp), parameter :: pCr = 4.94e7_wp !< Critical pressure of water [Pa]
real(wp), parameter :: TCr = 385.05_wp + 273.15_wp !< Critical temperature of water [K]
real(wp), parameter :: mixM = 1.0e-8_wp !< Mixture mass fraction threshold for triggering phase change
Expand Down Expand Up @@ -320,6 +320,8 @@ contains
do while ((abs(pS - pO) > palpha_eps) .and. (abs((pS - pO)/pO) > palpha_eps/1.e4_wp) .or. (ns == 0))
! increasing counter
ns = ns + 1
! guard against non-convergence: accept the last iterate rather than looping forever
if (ns >= max_iter) exit

! updating old pressure
pO = pS
Expand Down Expand Up @@ -395,6 +397,8 @@ contains

! Updating counter for the iterative procedure
ns = ns + 1
! guard against non-convergence: accept the last iterate rather than looping forever
if (ns >= max_iter) exit

! Auxiliary variables to help in the calculation of the residue
mCP = 0.0_wp; mCPD = 0.0_wp; mCVGP = 0.0_wp; mCVGP2 = 0.0_wp; mQ = 0.0_wp; mQD = 0.0_wp
Expand Down Expand Up @@ -591,6 +595,8 @@ contains
do while ((abs(FT) > ptgalpha_eps) .or. (ns == 0))
! increasing counter
ns = ns + 1
! guard against non-convergence: accept the last iterate rather than looping forever
if (ns >= max_iter) exit

! calculating residual
FT = TSat*((cvs(lp)*gs_min(lp) - cvs(vp)*gs_min(vp))*(1 - log(TSat)) - (qvps(lp) - qvps(vp)) + cvs(lp)*(gs_min(lp) &
Expand Down
Loading