From 2c204768dea27255124a8c049d3e840a29f688b1 Mon Sep 17 00:00:00 2001 From: Corey Date: Tue, 8 Jun 2021 18:53:47 -0400 Subject: [PATCH] Updating Acceleration By Shooting Method --- .../kernels/EEDFReactionLogForShootMethod.h | 1 - .../ReactionSecondOrderLogForShootMethod.h | 3 +- .../ReactionThirdOrderLogForShootMethod.h | 3 +- include/kernels/ShootMethodLog.h | 1 - src/kernels/CoeffDiffusionForShootMethod.C | 4 +-- src/kernels/EEDFReactionLogForShootMethod.C | 6 ++-- .../ReactionSecondOrderLogForShootMethod.C | 20 ++++++------- .../ReactionThirdOrderLogForShootMethod.C | 4 ++- src/kernels/ShootMethodLog.C | 28 ++++--------------- 9 files changed, 26 insertions(+), 44 deletions(-) diff --git a/include/kernels/EEDFReactionLogForShootMethod.h b/include/kernels/EEDFReactionLogForShootMethod.h index bb2c1ccd9b6..b67861ff12a 100644 --- a/include/kernels/EEDFReactionLogForShootMethod.h +++ b/include/kernels/EEDFReactionLogForShootMethod.h @@ -24,7 +24,6 @@ class EEDFReactionLogForShootMethod : public ADKernel const ADVariableValue & _electron; const ADVariableValue & _density; - const ADVariableValue & _energy; const ADMaterialProperty & _reaction_coeff; const Real & _stoichiometric_coeff; diff --git a/include/kernels/ReactionSecondOrderLogForShootMethod.h b/include/kernels/ReactionSecondOrderLogForShootMethod.h index 6a982301c69..cbc8f19b493 100644 --- a/include/kernels/ReactionSecondOrderLogForShootMethod.h +++ b/include/kernels/ReactionSecondOrderLogForShootMethod.h @@ -22,7 +22,8 @@ class ReactionSecondOrderLogForShootMethod : public ADKernel protected: virtual ADReal computeQpResidual() override; - const ADMaterialProperty & _reaction_coeff; + //const ADMaterialProperty & _reaction_coeff; + const MaterialProperty & _reaction_coeff; const ADVariableValue & _density; unsigned int _density_id; diff --git a/include/kernels/ReactionThirdOrderLogForShootMethod.h b/include/kernels/ReactionThirdOrderLogForShootMethod.h index c01f802e824..85ec09b9ded 100644 --- a/include/kernels/ReactionThirdOrderLogForShootMethod.h +++ b/include/kernels/ReactionThirdOrderLogForShootMethod.h @@ -22,7 +22,8 @@ class ReactionThirdOrderLogForShootMethod : public ADKernel protected: virtual ADReal computeQpResidual(); - const ADMaterialProperty & _reaction_coeff; + //const ADMaterialProperty & _reaction_coeff; + const MaterialProperty & _reaction_coeff; const ADVariableValue & _density; unsigned int _density_id; diff --git a/include/kernels/ShootMethodLog.h b/include/kernels/ShootMethodLog.h index 0f8addd8238..8b54c220662 100644 --- a/include/kernels/ShootMethodLog.h +++ b/include/kernels/ShootMethodLog.h @@ -26,5 +26,4 @@ class ShootMethodLog : public ADKernel const ADVariableValue & _density_at_end_cycle; const ADVariableValue & _sensitivity; const Real & _limit; - ADReal _acceleration; }; diff --git a/src/kernels/CoeffDiffusionForShootMethod.C b/src/kernels/CoeffDiffusionForShootMethod.C index 5af0c4ff945..7a163de4f51 100644 --- a/src/kernels/CoeffDiffusionForShootMethod.C +++ b/src/kernels/CoeffDiffusionForShootMethod.C @@ -35,6 +35,6 @@ CoeffDiffusionForShootMethod::CoeffDiffusionForShootMethod(const InputParameters ADReal CoeffDiffusionForShootMethod::computeQpResidual() { - return -_diffusivity[_qp] * (_grad_test[_i][_qp] * _r_units) * -_grad_test[_i][_qp] * _r_units * - _u[_qp]; + return _grad_test[_i][_qp] * _r_units * _diffusivity[_qp] * + _grad_u[_qp] * _r_units; } diff --git a/src/kernels/EEDFReactionLogForShootMethod.C b/src/kernels/EEDFReactionLogForShootMethod.C index e53ac150668..b834ae4157c 100644 --- a/src/kernels/EEDFReactionLogForShootMethod.C +++ b/src/kernels/EEDFReactionLogForShootMethod.C @@ -18,7 +18,6 @@ EEDFReactionLogForShootMethod::validParams() InputParameters params = ADKernel::validParams(); params.addRequiredCoupledVar("electron", "The electron species variable."); params.addRequiredCoupledVar("density", "The accelerated density variable."); - params.addRequiredCoupledVar("energy", "The energy variable."); params.addRequiredParam("reaction", "The full reaction equation."); params.addRequiredParam("coefficient", "The stoichiometric coefficient."); params.addParam( @@ -38,7 +37,6 @@ EEDFReactionLogForShootMethod::EEDFReactionLogForShootMethod(const InputParamete : ADKernel(parameters), _electron(adCoupledValue("electron")), _density(adCoupledValue("density")), - _energy(adCoupledValue("energy")), _reaction_coeff(getADMaterialProperty("k" + getParam("number") + "_" + getParam("reaction"))), _stoichiometric_coeff(getParam("coefficient")) @@ -48,6 +46,6 @@ EEDFReactionLogForShootMethod::EEDFReactionLogForShootMethod(const InputParamete ADReal EEDFReactionLogForShootMethod::computeQpResidual() { - return -_test[_i][_qp] * _stoichiometric_coeff * _reaction_coeff[_qp] * 1.0 * - std::exp(_electron[_qp]) * _u[_qp]; + return -_test[_i][_qp] * _stoichiometric_coeff * _reaction_coeff[_qp] * + _u[_qp] * std::exp(_electron[_qp]); } diff --git a/src/kernels/ReactionSecondOrderLogForShootMethod.C b/src/kernels/ReactionSecondOrderLogForShootMethod.C index 5bf1f3be020..0159d3b59ef 100644 --- a/src/kernels/ReactionSecondOrderLogForShootMethod.C +++ b/src/kernels/ReactionSecondOrderLogForShootMethod.C @@ -36,7 +36,9 @@ ReactionSecondOrderLogForShootMethod::validParams() ReactionSecondOrderLogForShootMethod::ReactionSecondOrderLogForShootMethod( const InputParameters & parameters) : ADKernel(parameters), - _reaction_coeff(getADMaterialProperty("k" + getParam("number") + "_" + + //_reaction_coeff(getADMaterialProperty("k" + getParam("number") + "_" + + // getParam("reaction"))), + _reaction_coeff(getMaterialProperty("k" + getParam("number") + "_" + getParam("reaction"))), _density(adCoupledValue("density")), @@ -51,14 +53,12 @@ ReactionSecondOrderLogForShootMethod::ReactionSecondOrderLogForShootMethod( ADReal ReactionSecondOrderLogForShootMethod::computeQpResidual() { + Real power; + + power = 1.; if (_v_id == _density_id) - { - return -_test[_i][_qp] * _stoichiometric_coeff * _reaction_coeff[_qp] * 2.0 * - std::exp(_v[_qp]) * _u[_qp]; - } - else - { - return -_test[_i][_qp] * _stoichiometric_coeff * _reaction_coeff[_qp] * 1.0 * - std::exp(_v[_qp]) * _u[_qp]; - } + power += 1.; + + return -_test[_i][_qp] * _stoichiometric_coeff * _reaction_coeff[_qp] * power * + std::exp(_v[_qp]) * _u[_qp]; } diff --git a/src/kernels/ReactionThirdOrderLogForShootMethod.C b/src/kernels/ReactionThirdOrderLogForShootMethod.C index 7fad3bcfd23..d76b53e86b6 100644 --- a/src/kernels/ReactionThirdOrderLogForShootMethod.C +++ b/src/kernels/ReactionThirdOrderLogForShootMethod.C @@ -37,7 +37,9 @@ ReactionThirdOrderLogForShootMethod::validParams() ReactionThirdOrderLogForShootMethod::ReactionThirdOrderLogForShootMethod( const InputParameters & parameters) : ADKernel(parameters), - _reaction_coeff(getADMaterialProperty("k" + getParam("number") + "_" + + //_reaction_coeff(getADMaterialProperty("k" + getParam("number") + "_" + + // getParam("reaction"))), + _reaction_coeff(getMaterialProperty("k" + getParam("number") + "_" + getParam("reaction"))), _density(adCoupledValue("density")), diff --git a/src/kernels/ShootMethodLog.C b/src/kernels/ShootMethodLog.C index 62825f91675..bdebb041fb6 100644 --- a/src/kernels/ShootMethodLog.C +++ b/src/kernels/ShootMethodLog.C @@ -55,8 +55,7 @@ ShootMethodLog::ShootMethodLog(const InputParameters & parameters) _density_at_start_cycle(adCoupledValue("density_at_start_cycle")), _density_at_end_cycle(adCoupledValue("density_at_end_cycle")), _sensitivity(adCoupledValue("sensitivity_variable")), - _limit(getParam("growth_limit")), - _acceleration(0.0) + _limit(getParam("growth_limit")) { } @@ -64,27 +63,10 @@ ADReal ShootMethodLog::computeQpResidual() { - ADReal _acceleration_growth = std::pow((1. - _sensitivity[_qp]), -1.); - - if (_limit == 0.0) - { - _acceleration = _acceleration_growth * - (std::exp(_density_at_start_cycle[_qp]) - std::exp(_density_at_end_cycle[_qp])); - } - else - { - if (_acceleration_growth > _limit) - { - _acceleration = - _limit * (std::exp(_density_at_start_cycle[_qp]) - std::exp(_density_at_end_cycle[_qp])); - } - else - { - _acceleration = _acceleration_growth * (std::exp(_density_at_start_cycle[_qp]) - - std::exp(_density_at_end_cycle[_qp])); - } - } + ADReal Scaling = 1.0 / ((1. - _sensitivity[_qp]) + (1. / _limit)); return _test[_i][_qp] * - (std::exp(_u[_qp]) - std::exp(_density_at_start_cycle[_qp]) + _acceleration); + (std::exp(_u[_qp]) - std::exp(_density_at_start_cycle[_qp]) + + (std::exp(_density_at_start_cycle[_qp]) - + std::exp(_density_at_end_cycle[_qp])) * Scaling); }