Skip to content
Browse files

Merge pull request #13413 from aeslaughter/auto-smp-13411

Add SMP with full=True when using NEWTON
  • Loading branch information...
permcody committed May 17, 2019
2 parents 7da1523 + f45e5c2 commit 63def39eeb801a00e8e2d009559f1a78f7d63448
@@ -13,13 +13,29 @@ detailed information about these options.

MOOSE provides Picard iterations in all its executioners for tightly-coupled multiphysics simulations.
MultiApps of two groups of before and after master app and master app are solved sequentially within one Picard iteration.
The execution order of MutlApps within one group is undefined.
The execution order of MutliApps within one group is undefined.
Relevant data transfers happen before and after each of the two groups of MultiApps runs.
Because MultiApp allows wrapping another levels of MultiApps, the design enables multi-level Picard iterations automatically.
Picard iterations can be relaxed to improve the stabilitity of the convergence.
Picard iterations can be relaxed to improve the stability of the convergence.
When a MultiApp is a subapp of a master and a master of its own subapps, MOOSE allows relaxation of the MultiApp solution
within the master Picard iterations and within the Picard iterations, where the MultiApp is the master, independently.

## Automatic and Default Preconditioning

For most simulations there are two types of solve types that will be used: Newton or Preconditioned
Jacobian Free Newton Krylov (PJFNK). The type is specified using the "solve_type" parameter withing the
Executioner block.

Regardless of solve type, NEWTON or PJFNK, preconditioning is an import part of any simulation
(see [Preconditioning/]). By default block diagonal preconditioning is used for all
solves, with one exception. If "solve_type" is set to NEWTON and the Preconditioning block is
not defined, single matrix preconditioning (SMP) is used (see [])
with all entries enabled ("full=true"). For NEWTON solves, the auto creation of an SMP objects can be disabled by setting
"auto_preconditioning=false" within the Executioner block (see []).

!syntax list /Executioner objects=True actions=False subsystems=False

!syntax list /Executioner objects=False actions=False subsystems=True
@@ -22,5 +22,10 @@ class CreateExecutionerAction : public MooseObjectAction
CreateExecutionerAction(InputParameters params);

virtual void act() override;

virtual void setupAutoPreconditioning();

const bool _auto_preconditioning;
@@ -53,4 +53,3 @@ class MoosePreconditioner : public MooseObject, public Restartable, public PerfG
/// Subproblem this preconditioner is part of
FEProblemBase & _fe_problem;

@@ -411,6 +411,7 @@ class NonlinearSystemBase : public SystemBase,
* @param pc The preconditioner to be set
void setPreconditioner(std::shared_ptr<MoosePreconditioner> pc);
MoosePreconditioner const * getPreconditioner() const;

* If called with true this system will use a finite differenced form of
@@ -872,4 +873,3 @@ class NonlinearSystemBase : public SystemBase,

@@ -23,11 +23,16 @@ InputParameters
InputParameters params = validParams<MooseObjectAction>();

"When true and a [Preconditioning] block does not exist, the application will attempt to use "
"the correct preconditioning given the Executioner settings.");
return params;

CreateExecutionerAction::CreateExecutionerAction(InputParameters params) : MooseObjectAction(params)
CreateExecutionerAction::CreateExecutionerAction(InputParameters params)
: MooseObjectAction(params), _auto_preconditioning(getParam<bool>("auto_preconditioning"))

@@ -48,5 +53,32 @@ CreateExecutionerAction::act()
mooseError("Executioner is not consistent with each other; EigenExecutioner needs an "
"EigenProblem, and Steady and Transient need a FEProblem");

// If enabled, automatically create a Preconditioner if the [Preconditioning] block is not found
if (_auto_preconditioning && !_awh.hasActions("add_preconditioning"))


// If using NEWTON then automatically create SingleMatrixPreconditioner object with full=true
if (_moose_object_pars.get<MooseEnum>("solve_type") == "NEWTON")
// Action Parameters
InputParameters params = _action_factory.getValidParams("SetupPreconditionerAction");
params.set<std::string>("type") = "SMP";

// Create the Action that will build the Preconditioner object
std::shared_ptr<Action> ptr =
_action_factory.create("SetupPreconditionerAction", "_moose_auto", params);

// Set 'full=true'
std::shared_ptr<MooseObjectAction> moa_ptr = std::static_pointer_cast<MooseObjectAction>(ptr);
InputParameters & mo_params = moa_ptr->getObjectParams();
mo_params.set<bool>("full") = true;

@@ -13,6 +13,7 @@
#include "AuxiliarySystem.h"
#include "Conversion.h"
#include "Executioner.h"
#include "MoosePreconditioner.h"
#include "FEProblem.h"
#include "MooseApp.h"
#include "MooseMesh.h"
@@ -260,7 +261,17 @@ outputExecutionInformation(const MooseApp & app, FEProblemBase & problem)

const std::string & pc_desc = problem.getPetscOptions().pc_description;
if (!pc_desc.empty())
oss << std::setw(console_field_width) << " Preconditioner: " << pc_desc << '\n';
oss << std::setw(console_field_width) << " PETSc Preconditioner: " << pc_desc << '\n';

MoosePreconditioner const * mpc = problem.getNonlinearSystemBase().getPreconditioner();
if (mpc)
oss << std::setw(console_field_width)
<< " MOOSE Preconditioner: " << mpc->getParam<std::string>("_type");
if (mpc->name() == "_moose_auto")
oss << " (auto)";
oss << '\n';
oss << '\n';

return oss.str();
@@ -2891,6 +2891,12 @@ NonlinearSystemBase::setPreconditioner(std::shared_ptr<MoosePreconditioner> pc)
_preconditioner = pc;

MoosePreconditioner const *
NonlinearSystemBase::getPreconditioner() const
return _preconditioner.get();

@@ -25,7 +25,7 @@ computations are not carried out, saving substantial expense.
More documentation will be added as AD percolates through the framework
(e.g. addition of `ADInterfaceKernel`, `ADDGKernel`, `ADIntegratedBC`, `ADNodalBC`). For
now the best documentation is the existing tests. Some example input files include:
[ad_material.i], [ad_coupled_convection.i], and [ad_simple_diffusion.i]. For
[ad_material.i], [ad_coupled_convection/ad_coupled_convection.i], and [ad_simple_diffusion.i]. For
examples of writing `ADKernels`, see [ADCoupledConvection.h], [ADMatDiffusionTest.h]
headers and [ADCoupledConvection.C], [ADMatDiffusionTest.C] source files. An example
of an `ADMaterial` can be found in [ADCoupledMaterial.h], [ADCoupledMaterial.C].
@@ -46,14 +46,14 @@ capabilities
## Grain Tracker Enhancements

The GrainTracker continues to be improved upon, with robustness
enhacements and new functionality in several areas. The GrainTracker
has been updated to utilize the latest improvments added to the Relationship
Manager system. The GrainTracker now creates separate Geomateric and Algebraic
enhancements and new functionality in several areas. The GrainTracker
has been updated to utilize the latest improvements added to the Relationship
Manager system. The GrainTracker now creates separate Geometric and Algebraic
Relationship Managers to ensure the proper amount of solution information
is necessary in distributed simulations for stitching together separate
grain regions.

Other Grain Tracker enhancments added in October:
Other Grain Tracker enhancements added in October:

- The GrainTracker has been enhanced to support "melt pool" simulations
where the simulation may begin with zero grains. Previously the GrainTracker
@@ -85,7 +85,7 @@ discovered that these Actions could be simplified by being converted into normal
MooseObjectActions (more direct).

## New Enhacements
## New Enhancements

- Enable Mac OS 10.14 (Mojave) support and debugging through code signing (entitlements)
- (CSVDiff Tester) can now compare a subset of columns (more enhancements coming)
@@ -94,7 +94,7 @@ MooseObjectActions (more direct).

## Bug Fixes

- Avoid unecessary data structure copies (multiple) in SystemBase
- Explicity set the current subdomain in ElementalVariableValue postprocessor (avoid assertion)
- Avoid unnecessary data structure copies (multiple) in SystemBase
- Explicitly set the current subdomain in ElementalVariableValue postprocessor (avoid assertion)
- Avoid duplicate runs of mesh adaptivity and mesh modifiers when running MOOSE using a pre-split
mesh fixes ( and
@@ -34,5 +34,6 @@ class ADCoupledConvection : public ADKernel<compute_stage>

const ADVariableGradient & _velocity_vector;

const Real & _scale;
@@ -13,18 +13,21 @@ registerADMooseObject("MooseTestApp", ADCoupledConvection);

params.addParam<Real>("scale", 1, "Scaling coefficient");
"Velocity Vector for the Convection ADKernel"););

template <ComputeStage compute_stage>
ADCoupledConvection<compute_stage>::ADCoupledConvection(const InputParameters & parameters)
: ADKernel<compute_stage>(parameters), _velocity_vector(adCoupledGradient("velocity_vector"))
: ADKernel<compute_stage>(parameters),

template <ComputeStage compute_stage>
return _test[_i][_qp] * _velocity_vector[_qp] * _grad_u[_qp];
return _scale * _test[_i][_qp] * _velocity_vector[_qp] * _grad_u[_qp];
Binary file not shown.
@@ -0,0 +1,72 @@
type = GeneratedMesh
dim = 2
nx = 4
ny = 4


type = ADDiffusion
variable = u
type = ADCoupledConvection
variable = u
velocity_vector = v
scale = 100
type = ADDiffusion
variable = v

type = DirichletBC
variable = u
boundary = left
value = 0
type = DirichletBC
variable = u
boundary = right
value = 1
type = DirichletBC
variable = v
boundary = left
value = 0
type = DirichletBC
variable = v
boundary = right
value = 1

# this block is part of what is being tested, see "tests" file
type = SMP
full = true

type = Steady
solve_type = NEWTON
nl_abs_tol = 1e-10 # needed to get non-preconditioned version to fail
auto_preconditioning = false # this is part of what is being tested, see "tests" file

exodus = true
Binary file not shown.
@@ -0,0 +1,27 @@
design = ""
issues = "#13411"
type = 'Exodiff'
input = 'ad_coupled_convection.i'
exodiff = 'ad_coupled_convection_out.e'
expect_out = 'MOOSE Preconditioner:\s+SMP'
requirement = "The system shall support the disabling of an automatically created preconditioning object when preforming a Newton solve."
type = 'Exodiff'
input = 'ad_coupled_convection.i'
exodiff = 'ad_coupled_convection_out.e'
cli_args = "Preconditioning/active='' Executioner/auto_preconditioning=true"
expect_out = 'MOOSE Preconditioner:\s+SMP\s+\(auto\)'
requirement = "The system shall automatically create the correct preconditioning object when preforming a Newton solve."
prereq = manual
type = 'RunApp'
input = 'ad_coupled_convection.i'
cli_args = "Preconditioning/active='' Executioner/auto_preconditioning=false Outputs/exodus=false"
requirement = "The system shall not automatically create a preconditioning object when preforming a Newton solve if the auto preconditioning capability is disabled."
expect_out = "Solve Did NOT Converge"

0 comments on commit 63def39

Please sign in to comment.
You can’t perform that action at this time.