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 #13161 from jiangwen84/inclined_bc_action
Add inclined no displacement bc ACTION
- Loading branch information
Showing
13 changed files
with
303 additions
and
134 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...s/tensor_mechanics/doc/content/source/actions/InclinedNoDisplacementBCAction.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
# InclinedNoDisplacementBC Action | |||
|
|||
## Description | |||
|
|||
The `InclinedNoDisplacementBC` Action is used to create a set of InclinedNoDisplacementBC for a string of displacement variables. See the description, example use, and parameters on the [InclinedNoDisplacementBC](/InclinedNoDisplacementBC/index.md) action system page. |
21 changes: 0 additions & 21 deletions
21
modules/tensor_mechanics/doc/content/source/bcs/PenaltyInclinedBC.md
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
modules/tensor_mechanics/doc/content/source/bcs/PenaltyInclinedNoDisplacementBC.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,11 @@ | |||
# PenaltyInclinedNoDisplacementBC | |||
|
|||
!syntax description /BCs/PenaltyInclinedNoDisplacementBC | |||
|
|||
## Description | |||
|
|||
`PenaltyInclinedNoDisplacementBC` is a `IntegratedBC` used for enforcing inclined boundary conditions $\mathbf{u}\cdot \mathbf{normal} = 0$ for mechanics problems. With a penalty method, the residual is given as | |||
\begin{equation} | |||
\mathcal{R}_i = \alpha(\mathbf{u}\cdot \mathbf{normal})\mathbf{normal}(\text{component})\psi_i | |||
\end{equation} | |||
where $\alpha$ is the penalty parameter and `component` corresponds to the direction in which to apply the residual. The normal directly comes from the surface normal defined in a mesh. |
21 changes: 21 additions & 0 deletions
21
modules/tensor_mechanics/doc/content/syntax/BCs/InclinedNoDisplacementBC/index.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,21 @@ | |||
# Inclined No Displacement Boundary Condition Action System | |||
|
|||
!syntax description /BCs/InclinedNoDisplacementBC/InclinedNoDisplacementBCAction | |||
|
|||
## Description | |||
|
|||
The InclinedNoDisplacementBCAction Action, given in the input file as simply `InclinedNoDisplacementBC`, is designed to simplify the input file when several variables have the same inclined no displacement boundary condition [Inclined no displacement boundary condition](PenaltyInclinedNoDisplacementBC.md) applied in the normal component. | |||
|
|||
## Example Input Syntax | |||
|
|||
!listing modules/tensor_mechanics/test/tests/inclined_bc/inclined_bc_action.i block=BCs/InclinedNoDisplacementBC | |||
|
|||
!syntax parameters /BCs/InclinedNoDisplacementBC/InclinedNoDisplacementBCAction | |||
|
|||
## Associated Actions | |||
|
|||
!syntax list /BCs/InclinedNoDisplacementBC objects=True actions=False subsystems=False | |||
|
|||
!syntax list /BCs/InclinedNoDisplacementBC objects=False actions=False subsystems=True | |||
|
|||
!syntax list /BCs/InclinedNoDisplacementBC objects=False actions=True subsystems=False |
36 changes: 36 additions & 0 deletions
36
modules/tensor_mechanics/include/actions/InclinedNoDisplacementBCAction.h
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,36 @@ | |||
//* 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 | |||
|
|||
#ifndef INCLINEDNODISPLACEMENTBCACTION_H | |||
#define INCLINEDNODISPLACEMENTBCACTION_H | |||
|
|||
#include "Action.h" | |||
|
|||
class InclinedNoDisplacementBCAction : public Action | |||
{ | |||
public: | |||
InclinedNoDisplacementBCAction(const InputParameters & params); | |||
|
|||
virtual void act() override; | |||
|
|||
protected: | |||
/// displacement variables | |||
std::vector<VariableName> _displacements; | |||
|
|||
/// number of displacement variables | |||
unsigned int _ndisp; | |||
|
|||
/// auxvariables to save residuals | |||
std::vector<AuxVariableName> _save_in; | |||
}; | |||
|
|||
template <> | |||
InputParameters validParams<InclinedNoDisplacementBCAction>(); | |||
|
|||
#endif // INCLINEDNODISPLACEMENTBCACTION_H |
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
72 changes: 72 additions & 0 deletions
72
modules/tensor_mechanics/src/actions/InclinedNoDisplacementBCAction.C
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,72 @@ | |||
//* 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 "InclinedNoDisplacementBCAction.h" | |||
#include "Factory.h" | |||
#include "FEProblem.h" | |||
#include "Conversion.h" | |||
|
|||
registerMooseAction("TensorMechanicsApp", InclinedNoDisplacementBCAction, "add_bc"); | |||
|
|||
template <> | |||
InputParameters | |||
validParams<InclinedNoDisplacementBCAction>() | |||
{ | |||
InputParameters params = validParams<Action>(); | |||
params.addClassDescription("Set up inclined no displacement boundary conditions"); | |||
|
|||
params.addRequiredParam<std::vector<BoundaryName>>( | |||
"boundary", "The list of boundary IDs from the mesh where the pressure will be applied"); | |||
|
|||
params.addParam<std::vector<VariableName>>( | |||
"displacements", | |||
"The displacements appropriate for the simulation geometry and coordinate system"); | |||
params.addParam<std::vector<AuxVariableName>>("save_in", "The displacement residuals"); | |||
|
|||
params.addRequiredParam<Real>("penalty", "Penalty parameter"); | |||
return params; | |||
} | |||
|
|||
InclinedNoDisplacementBCAction::InclinedNoDisplacementBCAction(const InputParameters & params) | |||
: Action(params), | |||
_displacements(getParam<std::vector<VariableName>>("displacements")), | |||
_ndisp(_displacements.size()), | |||
_save_in(getParam<std::vector<AuxVariableName>>("save_in")) | |||
{ | |||
if (_ndisp == 1) | |||
mooseError("InclinedNoDisplacementBC is specific to 2D and 3D models."); | |||
|
|||
if (_save_in.size() != 0 && _save_in.size() != _ndisp) | |||
mooseError("Number of save_in variables should equal to the number of displacement variables ", | |||
_displacements.size()); | |||
} | |||
|
|||
void | |||
InclinedNoDisplacementBCAction::act() | |||
{ | |||
const std::string kernel_name = "PenaltyInclinedNoDisplacementBC"; | |||
|
|||
// Create pressure BCs | |||
for (unsigned int i = 0; i < _ndisp; ++i) | |||
{ | |||
// Create unique kernel name for each of the components | |||
std::string unique_kernel_name = kernel_name + "_" + _name + "_" + Moose::stringify(i); | |||
|
|||
InputParameters params = _factory.getValidParams(kernel_name); | |||
params.applyParameters(parameters()); | |||
params.set<bool>("use_displaced_mesh") = false; | |||
params.set<unsigned int>("component") = i; | |||
params.set<NonlinearVariableName>("variable") = _displacements[i]; | |||
|
|||
if (_save_in.size() == _ndisp) | |||
params.set<std::vector<AuxVariableName>>("save_in") = {_save_in[i]}; | |||
|
|||
_problem->addBoundaryCondition(kernel_name, unique_kernel_name, params); | |||
} | |||
} |
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
Oops, something went wrong.