-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28338 from kyleeswanson/Correcters
Add `Correctors` syntax
- Loading branch information
Showing
26 changed files
with
143 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# AddCorrectorAction | ||
|
||
Adds `Corrector` objects to the simulation that are listed under `Correctors/` in the input file. | ||
This action adds them to the [Problem](FEProblem.md). | ||
|
||
!syntax parameters /Correctors/AddCorrectorAction |
21 changes: 21 additions & 0 deletions
21
framework/doc/content/source/correctors/PointwiseRenormalizeVector.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# PointwiseRenormalizeVector | ||
|
||
!syntax description /Correctors/PointwiseRenormalizeVector | ||
|
||
This `Corrector` can pointwise renormalize the solution for a set of variables, taking each variable as the component of a vector and scaling the variables to obtain the user specified L2-norm. | ||
|
||
## Applications | ||
|
||
For example in a micromagnetics simulation the magnetization director field is a vector field that should stay normalized, however the evolution equations might not be strictly norm conserving, requiring a renormalization at the end of each time step to avoid drift on the norm. | ||
|
||
## Design | ||
|
||
The PointwiseRenormalizeVector corrector is derived from `GeneralUserObject` and iterates over all active local elements. On each element the DOF indices for all coupled variables are obtained. Starting with the first index for each variable we check of the DOF is local to the current processor and assemble the corresponding value from each variable into a vector. The L2-norm is calculated and the vector renormalized for the norm to match [!param](/Correctors/PointwiseRenormalizeVector/norm), unless all solution values are zero. This is repeated for all remaining DOF indices and for the old and older solution states. | ||
|
||
!syntax parameters /Correctors/PointwiseRenormalizeVector | ||
|
||
!syntax inputs /Correctors/PointwiseRenormalizeVector | ||
|
||
!syntax children /Correctors/PointwiseRenormalizeVector | ||
|
||
!bibtex bibliography |
21 changes: 0 additions & 21 deletions
21
framework/doc/content/source/userobjects/PointwiseRenormalizeVector.md
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Correctors | ||
|
||
The `Correctors` system is designed to modify the values of nonlinear variable solutions. | ||
This can be as part of a predictor-corrector time integration scheme for example. | ||
|
||
!alert note | ||
Correctors are [UserObjects](UserObjects/index.md) behind the scene. They simply have a dedicated role and syntax. | ||
|
||
!alert note | ||
Please let us know on [GitHub Discussions](https://github.com/idaholab/moose/discussions) | ||
how you are using the `Correctors` system so we can include your techniques on this page! | ||
|
||
!syntax list /Correctors objects=True actions=False subsystems=False | ||
|
||
!syntax list /Correctors objects=False actions=False subsystems=True | ||
|
||
!syntax list /Correctors objects=False actions=True subsystems=False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#pragma once | ||
|
||
// MOOSE includes | ||
#include "MooseObjectAction.h" | ||
|
||
/** | ||
* Action for creating Corrector, a UserObject | ||
* designed for modifying nonlinear variable solutions, for example outside of the nonlinear solve | ||
*/ | ||
class AddCorrectorAction : public MooseObjectAction | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
AddCorrectorAction(const InputParameters & params); | ||
|
||
virtual void act() override; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#include "AddCorrectorAction.h" | ||
#include "FEProblem.h" | ||
|
||
registerMooseAction("MooseApp", AddCorrectorAction, "add_corrector"); | ||
|
||
InputParameters | ||
AddCorrectorAction::validParams() | ||
{ | ||
InputParameters params = MooseObjectAction::validParams(); | ||
params.addClassDescription("Add a Corrector object to the simulation."); | ||
return params; | ||
} | ||
|
||
AddCorrectorAction::AddCorrectorAction(const InputParameters & params) : MooseObjectAction(params) | ||
{ | ||
} | ||
|
||
void | ||
AddCorrectorAction::act() | ||
{ | ||
// Correctors are user objects in the backend | ||
_problem->addUserObject(_type, _name, _moose_object_pars); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
modules/navier_stokes/doc/content/source/correctors/NSPressurePin.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# NSPressurePin | ||
|
||
!syntax description /Correctors/NSPressurePin | ||
|
||
## Overview | ||
|
||
The `NSPressurePin` can pin the pressure in two modes: | ||
|
||
- by offsetting the pressure variable to make it have an average equal to the [!param](/Correctors/NSPressurePin/phi0) parameter value | ||
- by offsetting the pressure variable to make its value equal to the [!param](/Correctors/NSPressurePin/phi0) parameter value in the element | ||
containing the point specified by the [!param](/Correctors/NSPressurePin/point) parameter. | ||
|
||
|
||
!alert note | ||
In the [NSFVAction.md], a `NSPressurePin` can be used by setting the [!param](/Modules/NavierStokesFV/pinned_pressure_type) parameter | ||
to `average-uo` or `point-value-uo` respectively. | ||
|
||
!syntax parameters /Correctors/NSPressurePin | ||
|
||
!syntax inputs /Correctors/NSPressurePin | ||
|
||
!syntax children /Correctors/NSPressurePin |
22 changes: 0 additions & 22 deletions
22
modules/navier_stokes/doc/content/source/userobjects/NSPressurePin.md
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters