-
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 #25825 from grmnptr/fvic-25824
Add initial conditions for FV variables
- Loading branch information
Showing
81 changed files
with
1,747 additions
and
131 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
framework/doc/content/source/actions/AddFVInitialConditionAction.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,11 @@ | ||
# AddFVInitialConditionAction | ||
|
||
!syntax description /FVICs/AddFVInitialConditionAction | ||
|
||
Initial conditions for finite volume variables are specified as an object inside the `[FVICs]` block. | ||
This action adds them to the [Problem](syntax/Problem/index.md). | ||
|
||
More information about setting finite colume variable initial conditions can be found on the | ||
[FVICs syntax documentation](syntax/FVICs/index.md). | ||
|
||
!syntax parameters /FVICs/AddFVInitialConditionAction |
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,18 @@ | ||
# FVConstantIC | ||
|
||
!syntax description /FVICs/FVConstantIC | ||
|
||
Sets a constant initial condition described by parameter [!param](/FVICs/FVConstantIC/value). It can be restricted to particular blocks using the [!param](/FVICs/FVConstantIC/block) parameter. | ||
|
||
## Example input syntax | ||
|
||
In this example, a blockwise constant initial condition is set for variable `u`. | ||
Block 1 and 2 are set differently by two `FVConstantIC` objects. | ||
|
||
!listing test/tests/fvics/constant_ic/subdomain_constant_ic.i block=FVICs | ||
|
||
!syntax parameters /FVICs/FVConstantIC | ||
|
||
!syntax inputs /FVICs/FVConstantIC | ||
|
||
!syntax children /FVICs/FVConstantIC |
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 @@ | ||
# FVFunctionIC | ||
|
||
!syntax description /FVICs/FVFunctionIC | ||
|
||
Sets an initial condition via a [Function](syntax/Functions/index.md) described by parameter [!param](/FVICs/FVFunctionIC/function). It can be restricted to particular blocks using the [!param](/FVICs/FVFunctionIC/block) parameter. | ||
|
||
## Example input syntax | ||
|
||
In this example, we set the initial value of variable `u` using a [MooseParsedFunction.md]. | ||
|
||
!listing test/tests/fvics/function_ic/parsed_function.i block=FVICs Functions | ||
|
||
!syntax parameters /FVICs/FVFunctionIC | ||
|
||
!syntax inputs /FVICs/FVFunctionIC | ||
|
||
!syntax children /FVICs/FVFunctionIC |
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,33 @@ | ||
# FVICs System | ||
|
||
## Description | ||
|
||
The `FVICs` block within an input file is used to define the initial (starting) conditions for | ||
the finite volume variables within your simulation. Initial conditions may be applied to both the "unknowns" | ||
(nonlinear) or auxiliary variables. | ||
It computes the values of the variable at the cell centroids. | ||
|
||
## FVICs Block | ||
|
||
The preferred syntax is to create a top-level "FVICs" block with subblocks defining the initial | ||
conditions for one or more variables. | ||
|
||
!listing fvics/function_ic/parsed_function.i block=FVICs | ||
|
||
## FVICs from an Exodus File | ||
|
||
MOOSE contains a shortcut syntax for reading solutions from an Exodus file for the initial | ||
condition from right within the [Variables](Variables/index.html). The name of the variable and the time step from which to read the solution must be supplied. | ||
|
||
!listing fvics/file_ic/file_restart.i block=Variables | ||
|
||
## Sanity checks on FVICs | ||
|
||
- Multiple FV initial conditions may not be applied to the same variable on the same block | ||
- Global initial conditions will conflict with subdomain or boundary restricted ICs on the same variable | ||
|
||
!syntax list /FVICs objects=True actions=False subsystems=False | ||
|
||
!syntax list /FVICs objects=False actions=False subsystems=True | ||
|
||
!syntax list /FVICs 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
- /Variables/InitialCondition | ||
- /AuxVariables/InitialCondition | ||
- /Variables/FVInitialCondition | ||
- /AuxVariables/FVInitialCondition | ||
- /AuxVariables/AuxKernel |
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 @@ | ||
//* 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 | ||
|
||
#include "MooseObjectAction.h" | ||
|
||
class AddFVICAction : public MooseObjectAction | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
AddFVICAction(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//* 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 | ||
|
||
#include "MooseObjectAction.h" | ||
|
||
class AddFVInitialConditionAction : public MooseObjectAction | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
AddFVInitialConditionAction(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//* 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 | ||
|
||
#include "FVInitialConditionTempl.h" | ||
|
||
class InputParameters; | ||
|
||
namespace libMesh | ||
{ | ||
class Point; | ||
} | ||
|
||
/** | ||
* FVConstantIC just returns a constant value for a finite volume variable. | ||
*/ | ||
class FVConstantIC : public FVInitialCondition | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
FVConstantIC(const InputParameters & parameters); | ||
|
||
virtual Real value(const Point & p) override; | ||
|
||
protected: | ||
const Real _value; | ||
}; |
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,54 @@ | ||
//* 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 | ||
|
||
#include "FVInitialConditionTempl.h" | ||
|
||
#include <string> | ||
|
||
class Function; | ||
class InputParameters; | ||
|
||
template <typename T> | ||
InputParameters validParams(); | ||
|
||
/** | ||
* Defines a boundary condition that forces the value to be a user specified | ||
* function at the boundary. | ||
*/ | ||
class FVFunctionIC : public FVInitialCondition | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
FVFunctionIC(const InputParameters & parameters); | ||
|
||
/** | ||
* @returns The function name | ||
*/ | ||
const FunctionName functionName() const; | ||
|
||
protected: | ||
/** | ||
* Evaluate the function at the current quadrature point and time step. | ||
*/ | ||
Real f(); | ||
|
||
/** | ||
* The value of the variable at a point. | ||
*/ | ||
virtual Real value(const Point & p) override; | ||
|
||
/// Function to evaluate to form the initial condition | ||
const Function & _func; | ||
|
||
/// Scaling factor, to be able to use a function with multiple ICs | ||
const Real _scaling; | ||
}; |
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,83 @@ | ||
//* 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 | ||
|
||
#include "MooseObject.h" | ||
#include "FunctionInterface.h" | ||
#include "UserObjectInterface.h" | ||
#include "PostprocessorInterface.h" | ||
#include "Restartable.h" | ||
#include "BlockRestrictable.h" | ||
#include "DependencyResolverInterface.h" | ||
#include "MooseTypes.h" | ||
#include "NonADFunctorInterface.h" | ||
|
||
class SystemBase; | ||
class MooseVariableFieldBase; | ||
namespace libMesh | ||
{ | ||
class Point; | ||
} | ||
|
||
/** | ||
* description | ||
*/ | ||
class FVInitialConditionBase : public MooseObject, | ||
public BlockRestrictable, | ||
public FunctionInterface, | ||
public Restartable, | ||
public DependencyResolverInterface, | ||
public NonADFunctorInterface | ||
{ | ||
public: | ||
/** | ||
* Constructor | ||
* | ||
* @param parameters The parameters object holding data for the class to use. | ||
*/ | ||
FVInitialConditionBase(const InputParameters & parameters); | ||
|
||
virtual ~FVInitialConditionBase(); | ||
|
||
static InputParameters validParams(); | ||
|
||
/** | ||
* retrieves the MOOSE variable that this initial condition acts upon | ||
*/ | ||
virtual MooseVariableFieldBase & variable() = 0; | ||
|
||
/** | ||
* Workhorse method for computing the initial conditions for block-restricted initial | ||
* conditions | ||
*/ | ||
virtual void computeElement(const ElemInfo & elem_info) = 0; | ||
|
||
/** | ||
* Gets called at the beginning of the simulation before this object is asked to do its job. | ||
* Note: This method is normally inherited from SetupInterface. However in this case it makes | ||
* no sense to inherit the other virtuals available in that class so we are adding this virtual | ||
* directly to this class without the extra inheritance. | ||
*/ | ||
virtual void initialSetup() {} | ||
|
||
virtual const std::set<std::string> & getRequestedItems() override { return _depend_vars; } | ||
|
||
virtual const std::set<std::string> & getSuppliedItems() override { return _supplied_vars; } | ||
|
||
protected: | ||
/// The system object | ||
SystemBase & _sys; | ||
|
||
private: | ||
/// Dependent variables | ||
std::set<std::string> _depend_vars; | ||
/// Supplied variables | ||
std::set<std::string> _supplied_vars; | ||
}; |
Oops, something went wrong.