SolutionInvalidInterface
The SolutionInvalidInterface defines the method used to mark a solution as "invalid". An invalid solution means that the solution somehow does not satisfy requirements such as a value being out of bounds of a correlation. Solutions are allowed to be invalid _during_ the nonlinear solve - but are not allowed to invalid once it converges. A "converged" solution that is marked as invalid will cause MOOSE to behave as if the solution did NOT converge - including cutting back timesteps, etc.
This can be overriden by setting Problem/allow_invalid_solution=true
.
#pragma once
// MOOSE includes
#include "Moose.h"
#include "SolutionInvalidity.h"
#include "FEProblemBase.h"
// Forward declarations
class MooseObject;
#define flagInvalidSolution(message) \
do \
{ \
static const auto __invalid_id = this->registerInvalidSolutionInternal(message); \
this->flagInvalidSolutionInternal(__invalid_id); \
} while (0)
/**
* An interface that allows the marking of invalid solutions during a solve
*/
class SolutionInvalidInterface
{
public:
SolutionInvalidInterface(MooseObject * const moose_object);
protected:
void flagInvalidSolutionInternal(InvalidSolutionID _invalid_solution_id) const;
// Register invalid solution with a message
InvalidSolutionID registerInvalidSolutionInternal(const std::string & message) const;
private:
/// The MooseObject that owns this interface
MooseObject & _si_moose_object;
/// A reference to FEProblem base
FEProblemBase & _si_problem;
};
(moose/framework/include/interfaces/SolutionInvalidInterface.h)