https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
PetscOutputInterface Class Reference

#include <PetscOutput.h>

Inheritance diagram for PetscOutputInterface:
[legend]

Public Member Functions

 PetscOutputInterface (PetscOutput *obj)
 

Static Protected Member Functions

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-linear iterations.
 
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 iterations.
 

Protected Attributes

PetscOutput_petsc_output
 

Detailed Description

Definition at line 17 of file PetscOutput.h.

Constructor & Destructor Documentation

◆ PetscOutputInterface()

PetscOutputInterface::PetscOutputInterface ( PetscOutput obj)

Definition at line 19 of file PetscOutput.C.

19 : _petsc_output(obj)
20{
21 // register petsc output interface
23}
void registerInterfaceObject(T &interface)
Registers an interface object for accessing with getInterfaceObjects.
Definition MooseApp.h:1779
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
Definition MooseBase.h:87
PetscOutput * _petsc_output
Definition PetscOutput.h:23

Member Function Documentation

◆ petscLinearOutput()

PetscErrorCode PetscOutputInterface::petscLinearOutput ( KSP  ,
PetscInt  its,
PetscReal  fnorm,
void *  void_ptr 
)
staticprotected

Performs the output onlinear iterations This is the monitor method that PETSc will call on linear iterations.

This is one of three locations where we explicitly flush the output buffers during a simulation: PetscOutput::petscNonlinearOutput() PetscOutput::petscLinearOutput() OutputWarehouse::outputStep()

All other Console output should be using newlines to avoid covering buffer errors and to avoid excessive I/O. This call is necessary. In the PETSc callback the context bypasses the OutputWarehouse.

Definition at line 76 of file PetscOutput.C.

77{
78 // Get the primary outputter object
79 PetscOutput * primary_ptr = static_cast<PetscOutput *>(void_ptr);
80
81 // loop over all interface objects
82 for (const auto poi_ptr : primary_ptr->getMooseApp().getInterfaceObjects<PetscOutputInterface>())
83 {
84 auto ptr = poi_ptr->_petsc_output;
85
86 // check time
87 if (!ptr->inLinearTimeWindow())
88 continue;
89
90 // Update the pseudo time
91 ptr->_linear_time += ptr->_linear_dt;
92
93 // Set the current norm and iteration number
94 ptr->_norm = norm;
95 ptr->_linear_iter = its;
96
97 // Set the flag indicating that output is occurring on the non-linear residual
98 ptr->_on_linear_residual = true;
99
100 // Perform the output
101 ptr->outputStep(EXEC_LINEAR);
102
114 ptr->_app.getOutputWarehouse().flushConsoleBuffer();
115
116 // Reset the linear output flag and the simulation time
117 ptr->_on_linear_residual = false;
118 }
119
120 // Done
121 return (PetscErrorCode)0;
122}
const ExecFlagType EXEC_LINEAR
Definition Moose.C:31
Adds the ability to output on every nonlinear and/or linear residual.
Definition PetscOutput.h:42
Real _linear_time
Psuedo linear time.
auto norm(const T &a)

Referenced by PetscOutput::solveSetup().

◆ petscNonlinearOutput()

PetscErrorCode PetscOutputInterface::petscNonlinearOutput ( SNES  ,
PetscInt  its,
PetscReal  fnorm,
void *  void_ptr 
)
staticprotected

Performs the output on non-linear iterations This is the monitor method that PETSc will call on non-linear iterations.

This is one of three locations where we explicitly flush the output buffers during a simulation: PetscOutput::petscNonlinearOutput() PetscOutput::petscLinearOutput() OutputWarehouse::outputStep()

All other Console output should be using newlines to avoid covering buffer errors and to avoid excessive I/O. This call is necessary. In the PETSc callback the context bypasses the OutputWarehouse.

Definition at line 26 of file PetscOutput.C.

27{
28 // Get the primary outputter object
29 PetscOutput * primary_ptr = static_cast<PetscOutput *>(void_ptr);
30
31 // loop over all interface objects
32 for (const auto poi_ptr : primary_ptr->getMooseApp().getInterfaceObjects<PetscOutputInterface>())
33 {
34 auto ptr = poi_ptr->_petsc_output;
35
36 // check time
37 if (!ptr->inNonlinearTimeWindow())
38 continue;
39
40 // Update the pseudo times
41 ptr->_nonlinear_time += ptr->_nonlinear_dt;
42 ptr->_linear_time = ptr->_nonlinear_time;
43
44 // Set the current norm and iteration number
45 ptr->_norm = norm;
46 ptr->_nonlinear_iter = its;
47
48 // Set the flag indicating that output is occurring on the non-linear residual
49 ptr->_on_nonlinear_residual = true;
50
51 // Perform the output
52 ptr->outputStep(EXEC_NONLINEAR);
53
65 ptr->_app.getOutputWarehouse().flushConsoleBuffer();
66
67 // Reset the non-linear output flag and the simulation time
68 ptr->_on_nonlinear_residual = false;
69 }
70
71 // Done
72 return (PetscErrorCode)0;
73}
const ExecFlagType EXEC_NONLINEAR
Definition Moose.C:33
Real _nonlinear_time
The psuedo non-linear time.

Referenced by PetscOutput::solveSetup().

Member Data Documentation

◆ _petsc_output

PetscOutput* PetscOutputInterface::_petsc_output
protected

Definition at line 23 of file PetscOutput.h.

Referenced by petscLinearOutput(), and petscNonlinearOutput().


The documentation for this class was generated from the following files: