Skip to content

Commit

Permalink
Allow skipping a chosen interval in JouleHeatingAux
Browse files Browse the repository at this point in the history
  • Loading branch information
nmnobre committed Sep 11, 2024
1 parent 808a310 commit 826360a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions include/auxkernels/JouleHeatingAux.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class JouleHeatingAux : public AuxKernel
/// The electrical conductivity
const Real _sigma;

/// Time interval after which the kernel starts computing
const Real _skip;

/// Whether to take the time average
const bool _avg;
};
12 changes: 9 additions & 3 deletions src/auxkernels/JouleHeatingAux.C
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ JouleHeatingAux::validParams()
{
InputParameters params = AuxKernel::validParams();
params.addClassDescription("Computes (optionally, the time average of) the differential form of "
"the Joule heating equation (power per unit volume).");
"the Joule heating equation (power per unit volume). "
"The user may specify a time interval only after which the kernel "
"starts computing. If computing the time average, the right endpoint "
"rectangle rule is used for integration.");
params.addCoupledVar("vector_potential", "The vector potential variable");
params.addParam<Real>("sigma", 1, "The electrical conductivity");
params.addParam<Real>("skip", 0, "Time interval after which the kernel starts computing");
params.addParam<bool>("average", true, "Whether to take the time average");
return params;
}
Expand All @@ -18,13 +22,15 @@ JouleHeatingAux::JouleHeatingAux(const InputParameters & parameters)
: AuxKernel(parameters),
_electric_field(coupledVectorDot("vector_potential")),
_sigma(getParam<Real>("sigma")),
_skip(getParam<Real>("skip")),
_avg(getParam<bool>("average"))
{
}

Real
JouleHeatingAux::computeValue()
{
Real beta = _avg ? _dt / _t : 1;
return (1 - beta) * _u[_qp] + (beta * _sigma * _electric_field[_qp] * _electric_field[_qp]);
Real p = _sigma * _electric_field[_qp] * _electric_field[_qp];
Real w = _t > _skip ? _avg ? _dt / (_t - _skip) : 1 : 0;
return (1 - w) * _u[_qp] + w * p;
}

0 comments on commit 826360a

Please sign in to comment.