Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Do not allow linear solver fail feature #3274

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
10 changes: 10 additions & 0 deletions src/coreComponents/physicsSolvers/SolverBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "Write matrix, rhs, solution to screen ( = 1) or file ( = 2)." );

registerWrapper( viewKeyStruct::noLinearSolveFailString(), &m_noLinearSolveFail ).
setApplyDefaultValue( 0 ).
setInputFlag( InputFlags::OPTIONAL ).
setRestartFlags( RestartFlags::WRITE_AND_READ ).
setDescription( "Cut time step if linear solution fail without going until max nonlinear iterations." );

registerGroup( groupKeyStruct::linearSolverParametersString(), &m_linearSolverParameters );
registerGroup( groupKeyStruct::nonlinearSolverParametersString(), &m_nonlinearSolverParameters );
registerGroup( groupKeyStruct::solverStatisticsString(), &m_solverStatistics );
Expand Down Expand Up @@ -1015,6 +1021,10 @@

// Output the linear system solution for debugging purposes
debugOutputSolution( time_n, cycleNumber, newtonIter, m_solution );

// Do not allow non converged linear solver - cut time step
if( m_noLinearSolveFail && m_linearSolverResult.status == LinearSolverResult::Status::NotConverged )
return false;

Check warning on line 1027 in src/coreComponents/physicsSolvers/SolverBase.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/physicsSolvers/SolverBase.cpp#L1027

Added line #L1027 was not covered by tests
}

{
Expand Down
4 changes: 4 additions & 0 deletions src/coreComponents/physicsSolvers/SolverBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ class SolverBase : public ExecutableGroup
static constexpr char const * targetRegionsString() { return "targetRegions"; }
static constexpr char const * meshTargetsString() { return "meshTargets"; }
static constexpr char const * writeLinearSystemString() { return "writeLinearSystem"; }
static constexpr char const * noLinearSolveFailString() { return "noLinearSolveFail"; }
paveltomin marked this conversation as resolved.
Show resolved Hide resolved
};

struct groupKeyStruct
Expand Down Expand Up @@ -786,6 +787,9 @@ class SolverBase : public ExecutableGroup
real64 m_maxStableDt;
real64 m_nextDt;

/// behavior in case of linear solver failure
integer m_noLinearSolveFail;

/// name of the FV discretization object in the data repository
string m_discretizationName;

Expand Down
Loading