-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add source for LinearFVTimeDerivative. (#29149)
- Loading branch information
Showing
2 changed files
with
68 additions
and
4 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
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,59 @@ | ||
//* 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 "LinearFVTimeDerivative.h" | ||
|
||
registerMooseObject("MooseApp", LinearFVTimeDerivative); | ||
|
||
InputParameters | ||
LinearFVTimeDerivative::validParams() | ||
{ | ||
InputParameters params = LinearFVElementalKernel::validParams(); | ||
params.addClassDescription("Represents the matrix and right hand side contributions of a " | ||
"time derivative term in a partial differential equation."); | ||
params.addParam<MooseFunctorName>( | ||
"factor", 1.0, "A multiplier on the variable within the time derivative."); | ||
return params; | ||
} | ||
|
||
LinearFVTimeDerivative::LinearFVTimeDerivative(const InputParameters & params) | ||
: LinearFVElementalKernel(params), | ||
_factor(getFunctor<Real>("factor")), | ||
_time_integrator(_sys.getTimeIntegrator(_var_num)), | ||
_factor_history(_time_integrator.numStatesRequired(), 0.0), | ||
_state_args(_time_integrator.numStatesRequired(), determineState()) | ||
{ | ||
// In case we need older states | ||
for (const auto i : index_range(_state_args)) | ||
_state_args[i] = Moose::StateArg(i, Moose::SolutionIterationType::Time); | ||
} | ||
|
||
Real | ||
LinearFVTimeDerivative::computeMatrixContribution() | ||
{ | ||
const auto elem_arg = makeElemArg(_current_elem_info->elem()); | ||
return _factor(elem_arg, _state_args[0]) * /*_time_integrator.matrixContribution() */ | ||
_current_elem_volume; | ||
} | ||
|
||
Real | ||
LinearFVTimeDerivative::computeRightHandSideContribution() | ||
{ | ||
return /*_time_integrator.rhsContribution(_dof_id, _factor_history) */ _current_elem_volume; | ||
} | ||
|
||
void | ||
LinearFVTimeDerivative::setCurrentElemInfo(const ElemInfo * elem_info) | ||
{ | ||
LinearFVElementalKernel::setCurrentElemInfo(elem_info); | ||
|
||
const auto elem_arg = makeElemArg(_current_elem_info->elem()); | ||
for (const auto i : index_range(_factor_history)) | ||
_factor_history[i] = _factor(elem_arg, _state_args[i]); | ||
} |