From 826360aad4adf5f8ed7532d7e08a40dd94842b79 Mon Sep 17 00:00:00 2001 From: Nuno Nobre Date: Wed, 11 Sep 2024 10:10:29 +0100 Subject: [PATCH] Allow skipping a chosen interval in JouleHeatingAux --- include/auxkernels/JouleHeatingAux.h | 3 +++ src/auxkernels/JouleHeatingAux.C | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/auxkernels/JouleHeatingAux.h b/include/auxkernels/JouleHeatingAux.h index 32ab2ef..516455d 100644 --- a/include/auxkernels/JouleHeatingAux.h +++ b/include/auxkernels/JouleHeatingAux.h @@ -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; }; diff --git a/src/auxkernels/JouleHeatingAux.C b/src/auxkernels/JouleHeatingAux.C index d3f41c4..c826ecc 100644 --- a/src/auxkernels/JouleHeatingAux.C +++ b/src/auxkernels/JouleHeatingAux.C @@ -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("sigma", 1, "The electrical conductivity"); + params.addParam("skip", 0, "Time interval after which the kernel starts computing"); params.addParam("average", true, "Whether to take the time average"); return params; } @@ -18,6 +22,7 @@ JouleHeatingAux::JouleHeatingAux(const InputParameters & parameters) : AuxKernel(parameters), _electric_field(coupledVectorDot("vector_potential")), _sigma(getParam("sigma")), + _skip(getParam("skip")), _avg(getParam("average")) { } @@ -25,6 +30,7 @@ JouleHeatingAux::JouleHeatingAux(const InputParameters & parameters) 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; }