forked from arfc/moltres
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create function-based inlet and outlet BCs, and fix PrecursorAction. F…
…ixes arfc#183
- Loading branch information
Showing
3 changed files
with
77 additions
and
5 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,22 @@ | ||
#pragma once | ||
|
||
#include "IntegratedBC.h" | ||
|
||
class PostprocessorFunctionInflowBC : public IntegratedBC | ||
{ | ||
public: | ||
PostprocessorFunctionInflowBC(const InputParameters & parameters); | ||
|
||
static InputParameters validParams(); | ||
|
||
protected: | ||
virtual Real computeQpResidual() override; | ||
virtual Real computeQpJacobian() override; | ||
|
||
const Function & _vel_x_func; | ||
const Function & _vel_y_func; | ||
const Function & _vel_z_func; | ||
const PostprocessorValue & _pp_value; | ||
const Real & _scale; | ||
const Real & _offset; | ||
}; |
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,47 @@ | ||
#include "PostprocessorFunctionInflowBC.h" | ||
#include "Function.h" | ||
|
||
registerMooseObject("MoltresApp", PostprocessorFunctionInflowBC); | ||
|
||
InputParameters | ||
PostprocessorFunctionInflowBC::validParams() | ||
{ | ||
InputParameters params = IntegratedBC::validParams(); | ||
params.addRequiredParam<FunctionName>("vel_x_func", "The x velocity function"); | ||
params.addRequiredParam<FunctionName>("vel_y_func", "The y velocity function"); | ||
params.addRequiredParam<FunctionName>("vel_z_func", "The z velocity function"); | ||
params.addRequiredParam<PostprocessorName>( | ||
"postprocessor", "The postprocessor from which to derive the inlet concentration."); | ||
params.addParam<Real>("scale", 1, "The amount to scale the postprocessor value by"); | ||
params.addParam<Real>("offset", 0, "The amount to offset the scaled postprocessor by"); | ||
return params; | ||
} | ||
|
||
PostprocessorFunctionInflowBC::PostprocessorFunctionInflowBC(const InputParameters & parameters) | ||
: IntegratedBC(parameters), | ||
_vel_x_func(getFunction("vel_x_func")), | ||
_vel_y_func(getFunction("vel_y_func")), | ||
_vel_z_func(getFunction("vel_z_func")), | ||
_pp_value(getPostprocessorValue("postprocessor")), | ||
_scale(getParam<Real>("scale")), | ||
_offset(getParam<Real>("offset")) | ||
{ | ||
} | ||
|
||
Real | ||
PostprocessorFunctionInflowBC::computeQpResidual() | ||
{ | ||
RealVectorValue v = {_vel_x_func.value(_t, _q_point[_qp]), | ||
_vel_y_func.value(_t, _q_point[_qp]), | ||
_vel_z_func.value(_t, _q_point[_qp])}; | ||
Real vdotn = v * _normals[_qp]; | ||
Real inlet_conc = _scale * _pp_value + _offset; | ||
|
||
return _test[_i][_qp] * inlet_conc * vdotn; | ||
} | ||
|
||
Real | ||
PostprocessorFunctionInflowBC::computeQpJacobian() | ||
{ | ||
return 0.; | ||
} |