Skip to content

Commit

Permalink
Updating Acceleration By Shooting Method
Browse files Browse the repository at this point in the history
  • Loading branch information
csdechant committed Nov 7, 2024
1 parent 1973fab commit 2c20476
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 44 deletions.
1 change: 0 additions & 1 deletion include/kernels/EEDFReactionLogForShootMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class EEDFReactionLogForShootMethod : public ADKernel

const ADVariableValue & _electron;
const ADVariableValue & _density;
const ADVariableValue & _energy;

const ADMaterialProperty<Real> & _reaction_coeff;
const Real & _stoichiometric_coeff;
Expand Down
3 changes: 2 additions & 1 deletion include/kernels/ReactionSecondOrderLogForShootMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class ReactionSecondOrderLogForShootMethod : public ADKernel
protected:
virtual ADReal computeQpResidual() override;

const ADMaterialProperty<Real> & _reaction_coeff;
//const ADMaterialProperty<Real> & _reaction_coeff;
const MaterialProperty<Real> & _reaction_coeff;

const ADVariableValue & _density;
unsigned int _density_id;
Expand Down
3 changes: 2 additions & 1 deletion include/kernels/ReactionThirdOrderLogForShootMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class ReactionThirdOrderLogForShootMethod : public ADKernel
protected:
virtual ADReal computeQpResidual();

const ADMaterialProperty<Real> & _reaction_coeff;
//const ADMaterialProperty<Real> & _reaction_coeff;
const MaterialProperty<Real> & _reaction_coeff;

const ADVariableValue & _density;
unsigned int _density_id;
Expand Down
1 change: 0 additions & 1 deletion include/kernels/ShootMethodLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ class ShootMethodLog : public ADKernel
const ADVariableValue & _density_at_end_cycle;
const ADVariableValue & _sensitivity;
const Real & _limit;
ADReal _acceleration;
};
4 changes: 2 additions & 2 deletions src/kernels/CoeffDiffusionForShootMethod.C
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
6 changes: 2 additions & 4 deletions src/kernels/EEDFReactionLogForShootMethod.C
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>("reaction", "The full reaction equation.");
params.addRequiredParam<Real>("coefficient", "The stoichiometric coefficient.");
params.addParam<std::string>(
Expand All @@ -38,7 +37,6 @@ EEDFReactionLogForShootMethod::EEDFReactionLogForShootMethod(const InputParamete
: ADKernel(parameters),
_electron(adCoupledValue("electron")),
_density(adCoupledValue("density")),
_energy(adCoupledValue("energy")),
_reaction_coeff(getADMaterialProperty<Real>("k" + getParam<std::string>("number") + "_" +
getParam<std::string>("reaction"))),
_stoichiometric_coeff(getParam<Real>("coefficient"))
Expand All @@ -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]);
}
20 changes: 10 additions & 10 deletions src/kernels/ReactionSecondOrderLogForShootMethod.C
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ ReactionSecondOrderLogForShootMethod::validParams()
ReactionSecondOrderLogForShootMethod::ReactionSecondOrderLogForShootMethod(
const InputParameters & parameters)
: ADKernel(parameters),
_reaction_coeff(getADMaterialProperty<Real>("k" + getParam<std::string>("number") + "_" +
//_reaction_coeff(getADMaterialProperty<Real>("k" + getParam<std::string>("number") + "_" +
// getParam<std::string>("reaction"))),
_reaction_coeff(getMaterialProperty<Real>("k" + getParam<std::string>("number") + "_" +
getParam<std::string>("reaction"))),

_density(adCoupledValue("density")),
Expand All @@ -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];
}
4 changes: 3 additions & 1 deletion src/kernels/ReactionThirdOrderLogForShootMethod.C
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ ReactionThirdOrderLogForShootMethod::validParams()
ReactionThirdOrderLogForShootMethod::ReactionThirdOrderLogForShootMethod(
const InputParameters & parameters)
: ADKernel(parameters),
_reaction_coeff(getADMaterialProperty<Real>("k" + getParam<std::string>("number") + "_" +
//_reaction_coeff(getADMaterialProperty<Real>("k" + getParam<std::string>("number") + "_" +
// getParam<std::string>("reaction"))),
_reaction_coeff(getMaterialProperty<Real>("k" + getParam<std::string>("number") + "_" +
getParam<std::string>("reaction"))),

_density(adCoupledValue("density")),
Expand Down
28 changes: 5 additions & 23 deletions src/kernels/ShootMethodLog.C
Original file line number Diff line number Diff line change
Expand Up @@ -55,36 +55,18 @@ 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<Real>("growth_limit")),
_acceleration(0.0)
_limit(getParam<Real>("growth_limit"))
{
}

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);
}

0 comments on commit 2c20476

Please sign in to comment.