16#include "libmesh/libmesh_common.h"
17#include "libmesh/petsc_nonlinear_solver.h"
37 if (!ptr->inNonlinearTimeWindow())
42 ptr->_linear_time = ptr->_nonlinear_time;
46 ptr->_nonlinear_iter = its;
49 ptr->_on_nonlinear_residual =
true;
65 ptr->_app.getOutputWarehouse().flushConsoleBuffer();
68 ptr->_on_nonlinear_residual =
false;
72 return (PetscErrorCode)0;
87 if (!ptr->inLinearTimeWindow())
95 ptr->_linear_iter = its;
98 ptr->_on_linear_residual =
true;
114 ptr->_app.getOutputWarehouse().flushConsoleBuffer();
117 ptr->_on_linear_residual =
false;
121 return (PetscErrorCode)0;
130 params.
addParam<
bool>(
"output_linear",
132 "Specifies whether output occurs on each PETSc linear residual evaluation");
136 "Specifies whether output occurs on each PETSc nonlinear residual evaluation");
141 "nonlinear_residual_dt_divisor",
143 "Number of divisions applied to time step when outputting non-linear residuals");
145 "linear_residual_dt_divisor",
147 "Number of divisions applied to time step when outputting linear residuals");
151 "linear_residual_start_time",
152 "Specifies a start time to begin output on each linear residual evaluation");
154 "nonlinear_residual_start_time",
155 "Specifies a start time to begin output on each nonlinear residual evaluation");
160 params.
addParam<Real>(
"linear_residual_end_time",
161 "Specifies an end time to begin output on each linear residual evaluation");
163 "nonlinear_residual_end_time",
164 "Specifies an end time to begin output on each nonlinear residual evaluation");
167 "nonlinear_residual_start_time linear_residual_end_time "
168 "nonlinear_residual_end_time nonlinear_residual_dt_divisor "
169 "linear_residual_dt_divisor",
170 "PETSc linear/nonlinear output");
179 _on_linear_residual(false),
180 _on_nonlinear_residual(false),
181 _nonlinear_dt_divisor(getParam<Real>(
"nonlinear_residual_dt_divisor")),
182 _linear_dt_divisor(getParam<Real>(
"linear_residual_dt_divisor")),
183 _nonlinear_start_time(-
std::numeric_limits<Real>::max()),
184 _linear_start_time(-
std::numeric_limits<Real>::max()),
185 _nonlinear_end_time(
std::numeric_limits<Real>::max()),
186 _linear_end_time(
std::numeric_limits<Real>::max())
189 if (getParam<bool>(
"output_linear"))
191 if (getParam<bool>(
"output_nonlinear"))
240 mooseAssert(actions.size() <= 1,
"Should not be more than one CommonOutputAction");
241 const Action * common = actions.empty() ? nullptr : *actions.begin();
253 if (common && common->
getParam<
bool>(
"print_nonlinear_residuals"))
256 if (common && common->
getParam<
bool>(
"print_linear_residuals"))
const ExecFlagType EXEC_LINEAR
const ExecFlagType EXEC_NONLINEAR
Storage for action instances.
std::vector< const T * > getActions()
Retrieve all actions in a specific type ordered by their names.
Meta-action for creating common output object parameters This action serves two purpose,...
NonlinearSystemBase & currentNonlinearSystem()
ActionWarehouse & actionWarehouse()
Return a writable reference to the ActionWarehouse associated with this app.
void registerInterfaceObject(T &interface)
Registers an interface object for accessing with getInterfaceObjects.
const std::vector< T * > & getInterfaceObjects() const
Gets the registered interface objects for a given interface.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
MooseApp & _app
The MOOSE application this is associated with.
void setAdditionalValue(const std::string &names)
Insert operators Operator to insert (push_back) values into the enum.
Nonlinear system to be solved.
Based class for output objects.
ExecFlagEnum _execute_on
The common Execution types; this is used as the default execution type for everything except system i...
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
static InputParameters validParams()
Real & _time_old
The old time.
Real & _dt
Time step delta.
virtual Real time()
Get the output time.
static PetscErrorCode petscLinearOutput(KSP, PetscInt its, PetscReal fnorm, void *void_ptr)
Performs the output onlinear iterations This is the monitor method that PETSc will call on linear ite...
PetscOutputInterface(PetscOutput *obj)
static PetscErrorCode petscNonlinearOutput(SNES, PetscInt its, PetscReal fnorm, void *void_ptr)
Performs the output on non-linear iterations This is the monitor method that PETSc will call on non-l...
PetscOutput * _petsc_output
Adds the ability to output on every nonlinear and/or linear residual.
virtual Real time() override
Get the output time.
Real _nonlinear_start_time
Non-linear residual output start time.
static InputParameters validParams()
Real _linear_end_time
Linear residual output end time.
bool _on_linear_residual
True if current output calls is on the linear residual (used by time())
Real _nonlinear_dt
The pseuedo non-linear time step.
PetscOutput(const InputParameters ¶meters)
Class constructor.
Real _nonlinear_time
The psuedo non-linear time.
virtual Real getOutputTime()
Get the time that will be used for stream/file outputting.
Real _nonlinear_end_time
Non-linear residual output end time.
Real _nonlinear_dt_divisor
Pseudo non-linear timestep divisor.
void solveSetup() override
Internal setup function that executes at the beginning of the time step.
Real _linear_start_time
Linear residual output start time.
Real _linear_time
Psuedo linear time.
Real _linear_dt
Psuedo linear time step.
bool _on_nonlinear_residual
True if current output call is on the non-linear residual (used by time())
Real _linear_dt_divisor
Pseudo linear timestep divisor.
const Parallel::Communicator & _communicator