Skip to content

Commit 5dfaae1

Browse files
authored
Merge pull request #31196 from GiudGiud/PR_aux_non_AD
Move NS auxkernels away from AD
2 parents e209ac7 + 0e11d56 commit 5dfaae1

17 files changed

Lines changed: 87 additions & 81 deletions

modules/navier_stokes/include/auxkernels/HasPorosityJumpFace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ class HasPorosityJumpFace : public AuxKernel
2525
Real computeValue() override;
2626

2727
/// The porosity
28-
const Moose::Functor<ADReal> & _eps;
28+
const Moose::Functor<Real> & _eps;
2929
};

modules/navier_stokes/include/auxkernels/NSLiquidFractionAux.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class NSLiquidFractionAux : public AuxKernel
2525
virtual Real computeValue();
2626

2727
/// The temperature
28-
const Moose::Functor<ADReal> & _T;
28+
const Moose::Functor<Real> & _T;
2929
/// The solidus temperature
30-
const Moose::Functor<ADReal> & _T_solidus;
30+
const Moose::Functor<Real> & _T_solidus;
3131
/// The liquidus temperture
32-
const Moose::Functor<ADReal> & _T_liquidus;
32+
const Moose::Functor<Real> & _T_liquidus;
3333
};

modules/navier_stokes/include/auxkernels/PecletNumberFunctorAux.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class PecletNumberFunctorAux : public AuxKernel
2525
Real computeValue() override;
2626

2727
/// The fluid speed
28-
const Moose::Functor<ADReal> & _speed;
28+
const Moose::Functor<Real> & _speed;
2929
/// The fluid thermal diffusivity or mass diffusivity. Should have units of length^2/time
30-
const Moose::Functor<ADReal> & _alpha;
30+
const Moose::Functor<Real> & _alpha;
3131
/// Whether to use a quadrature-based argument to evaluate the functors
3232
const bool _use_qp_arg;
3333
};

modules/navier_stokes/include/auxkernels/ReynoldsNumberFunctorAux.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ class ReynoldsNumberFunctorAux : public AuxKernel
2525
Real computeValue() override;
2626

2727
/// The fluid speed
28-
const Moose::Functor<ADReal> & _speed;
28+
const Moose::Functor<Real> & _speed;
2929
/// The fluid density
30-
const Moose::Functor<ADReal> & _rho;
30+
const Moose::Functor<Real> & _rho;
3131
/// The fluid dynamic viscosity
32-
const Moose::Functor<ADReal> & _mu;
32+
const Moose::Functor<Real> & _mu;
3333
/// Whether to use a quadrature-based argument to evaluate the functors
3434
const bool _use_qp_arg;
3535
};

modules/navier_stokes/include/auxkernels/TurbulentConductivityAux.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ class TurbulentConductivityAux : public AuxKernel
2929
virtual Real computeValue() override;
3030

3131
/// Specific heat at Constant Pressure
32-
const Moose::Functor<ADReal> & _cp;
32+
const Moose::Functor<Real> & _cp;
3333

3434
/// Turbulent Prandtl number
35-
const Moose::Functor<ADReal> & _Pr_t;
35+
const Moose::Functor<Real> & _Pr_t;
3636

3737
/// Turbulent viscosity
38-
const Moose::Functor<ADReal> & _mu_t;
38+
const Moose::Functor<Real> & _mu_t;
3939
};

modules/navier_stokes/include/auxkernels/WallFunctionWallShearStressAux.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ class WallFunctionWallShearStressAux : public AuxKernel
3636
const INSFVVelocityVariable * const _w_var;
3737

3838
/// Density
39-
const Moose::Functor<ADReal> & _rho;
39+
const Moose::Functor<Real> & _rho;
4040

4141
/// Dynamic viscosity
42-
const Moose::Functor<ADReal> & _mu;
42+
const Moose::Functor<Real> & _mu;
4343

4444
/// Wall boundaries
4545
const std::vector<BoundaryName> & _wall_boundary_names;

modules/navier_stokes/include/auxkernels/WallFunctionYPlusAux.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ class WallFunctionYPlusAux : public AuxKernel
3636
const INSFVVelocityVariable * const _w_var;
3737

3838
/// Density
39-
const Moose::Functor<ADReal> & _rho;
39+
const Moose::Functor<Real> & _rho;
4040

4141
/// Dynamic viscosity
42-
const Moose::Functor<ADReal> & _mu;
42+
const Moose::Functor<Real> & _mu;
4343

4444
/// Wall boundaries
4545
const std::vector<BoundaryName> & _wall_boundary_names;

modules/navier_stokes/include/utils/NSFVUtils.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@ namespace NS
4848
* the porosity value on the "element" side of the face, and the second member is the porosity value
4949
* on the "neighbor" side of the face
5050
*/
51-
std::tuple<bool, ADReal, ADReal> isPorosityJumpFace(const Moose::Functor<ADReal> & porosity,
52-
const FaceInfo & fi,
53-
const Moose::StateArg & time);
51+
template <class T>
52+
std::tuple<bool, T, T> isPorosityJumpFace(const Moose::FunctorBase<T> & porosity,
53+
const FaceInfo & fi,
54+
const Moose::StateArg & time);
55+
56+
extern template std::tuple<bool, Real, Real> isPorosityJumpFace<Real>(
57+
const Moose::FunctorBase<Real> & porosity, const FaceInfo & fi, const Moose::StateArg & time);
58+
extern template std::tuple<bool, ADReal, ADReal> isPorosityJumpFace<ADReal>(
59+
const Moose::FunctorBase<ADReal> & porosity, const FaceInfo & fi, const Moose::StateArg & time);
5460
}

modules/navier_stokes/src/auxkernels/HasPorosityJumpFace.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ HasPorosityJumpFace::validParams()
2424
}
2525

2626
HasPorosityJumpFace::HasPorosityJumpFace(const InputParameters & parameters)
27-
: AuxKernel(parameters), _eps(getFunctor<ADReal>(NS::porosity))
27+
: AuxKernel(parameters), _eps(getFunctor<Real>(NS::porosity))
2828
{
2929
if (isNodal())
3030
mooseError("This AuxKernel only supports Elemental fields");

modules/navier_stokes/src/auxkernels/INSFVMixingLengthTurbulentViscosityAux.C

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ INSFVMixingLengthTurbulentViscosityAux::computeValue()
5858
const Elem & elem = *_current_elem;
5959
const auto state = determineState();
6060

61-
const auto & grad_u = _u_var->adGradSln(&elem, state);
62-
ADReal symmetric_strain_tensor_norm = 2.0 * Utility::pow<2>(grad_u(0));
61+
const auto grad_u = MetaPhysicL::raw_value(_u_var->adGradSln(&elem, state));
62+
Real symmetric_strain_tensor_norm = 2.0 * Utility::pow<2>(grad_u(0));
6363
if (_dim >= 2)
6464
{
65-
const auto & grad_v = _v_var->adGradSln(&elem, state);
65+
const auto grad_v = MetaPhysicL::raw_value(_v_var->adGradSln(&elem, state));
6666
symmetric_strain_tensor_norm +=
6767
2.0 * Utility::pow<2>(grad_v(1)) + Utility::pow<2>(grad_v(0) + grad_u(1));
6868
if (_dim >= 3)
6969
{
70-
const auto & grad_w = _w_var->adGradSln(&elem, state);
70+
const auto grad_w = MetaPhysicL::raw_value(_w_var->adGradSln(&elem, state));
7171
symmetric_strain_tensor_norm += 2.0 * Utility::pow<2>(grad_w(2)) +
7272
Utility::pow<2>(grad_u(2) + grad_w(0)) +
7373
Utility::pow<2>(grad_v(2) + grad_w(1));
@@ -77,8 +77,8 @@ INSFVMixingLengthTurbulentViscosityAux::computeValue()
7777
symmetric_strain_tensor_norm = std::sqrt(symmetric_strain_tensor_norm + offset);
7878

7979
// Compute the eddy diffusivitiy
80-
ADReal eddy_diff = symmetric_strain_tensor_norm * _mixing_len[_qp] * _mixing_len[_qp];
80+
const Real eddy_diff = symmetric_strain_tensor_norm * _mixing_len[_qp] * _mixing_len[_qp];
8181

8282
// Return the turbulent stress contribution to the momentum equation
83-
return eddy_diff.value();
83+
return eddy_diff;
8484
}

0 commit comments

Comments
 (0)