Implementing variable density for unsteady incompressible flow by tkiymaz · Pull Request #2641 · su2code/SU2 · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
509a608
my changes
Jun 17, 2025
6aeb0a3
my changes
Jun 17, 2025
79e238c
specieschanges
Sep 1, 2025
526b9a1
Remove slurm files from repository
Dec 10, 2025
59979d0
Remove unnecessary blank line in COutput.hpp
tkiymaz Dec 10, 2025
99abfa4
Clean up commented-out density setting code
tkiymaz Dec 10, 2025
bee5a27
Update density retrieval comment for transient handling
tkiymaz Dec 10, 2025
cea69cc
Remove empty line before temperature setter comment
tkiymaz Dec 10, 2025
a721a2e
Clean up whitespace in CIncEulerVariable.hpp
tkiymaz Dec 10, 2025
02c03bb
Clean up blank lines in CVariable.hpp
tkiymaz Dec 10, 2025
0449bb4
Clean up CFlowIncOutput.cpp by removing blank lines
tkiymaz Dec 10, 2025
572291f
Clean up CompleteImplicitIteration and update dRhodT
tkiymaz Dec 10, 2025
c9fd0f6
Revert back the preconditioning to original
tkiymaz Dec 10, 2025
fc33c6a
Remove unnecessary whitespace and debug print statement
tkiymaz Dec 10, 2025
644a543
Clean up blank lines in CIncNSVariable.cpp
tkiymaz Dec 10, 2025
fed4892
Clean up whitespace in CVariable.cpp
tkiymaz Dec 10, 2025
8e09f7f
Fix constructor signature for CSpeciesVariable
tkiymaz Dec 10, 2025
1e5008a
Remove unnecessary blank line in CSpeciesVariable.cpp
tkiymaz Dec 10, 2025
2aebc54
Fix constructor signature for CSpeciesFlameletVariable
tkiymaz Dec 10, 2025
3f19c55
Remove debug output from SetPrimVar method
tkiymaz Dec 10, 2025
f5b3f56
Merge branch 'develop' into fix_inc_unsteady_density
tkiymaz Dec 11, 2025
735c27b
Update SU2_CFD/include/variables/CVariable.hpp
bigfooted Dec 16, 2025
f9f98a0
Update SU2_CFD/include/output/COutput.hpp
bigfooted Dec 16, 2025
adf7581
Update SU2_CFD/include/variables/CIncEulerVariable.hpp
bigfooted Dec 16, 2025
cc06d7e
Update SU2_CFD/include/variables/CEulerVariable.hpp
bigfooted Dec 16, 2025
6f2a8eb
Update SU2_CFD/src/solvers/CIncEulerSolver.cpp
bigfooted Dec 16, 2025
fa318d2
Update SU2_CFD/src/variables/CVariable.cpp
bigfooted Dec 16, 2025
3e1b898
Update SU2_CFD/src/variables/CVariable.cpp
bigfooted Dec 16, 2025
87a3381
Update SU2_CFD/src/variables/CIncNSVariable.cpp
bigfooted Dec 16, 2025
b278ad6
Update SU2_CFD/src/variables/CIncNSVariable.cpp
bigfooted Dec 16, 2025
dda9271
Update SU2_CFD/src/variables/CIncEulerVariable.cpp
bigfooted Dec 16, 2025
ff74a7f
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Dec 16, 2025
c194c4f
Update SU2_CFD/src/variables/CIncEulerVariable.cpp
bigfooted Dec 16, 2025
ac17146
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Dec 16, 2025
35b018f
most of the second order stuff
bigfooted Dec 16, 2025
d14be6e
cleanup for second order method (not tested yet)
bigfooted Dec 16, 2025
6cc4073
merge w. develop
bigfooted Dec 16, 2025
83c3416
Merge branch 'develop' into fix_inc_unsteady_density
Cristopher-Morales Dec 17, 2025
459e3b4
Merge branch 'develop' into fix_inc_unsteady_density
Cristopher-Morales Dec 17, 2025
630856b
Update SU2_CFD/src/solvers/CIncEulerSolver.cpp
tkiymaz Dec 18, 2025
35ad976
Update SU2_CFD/src/solvers/CIncEulerSolver.cpp
tkiymaz Dec 18, 2025
31f8af3
Update SU2_CFD/src/solvers/CIncEulerSolver.cpp
tkiymaz Dec 18, 2025
00ae736
Potential fix for code scanning alert no. 5888: Unused local variable
bigfooted Dec 18, 2025
8a47539
Merge branch 'develop' into fix_inc_unsteady_density
Cristopher-Morales Dec 18, 2025
4f7a656
Merge branch 'develop' into fix_inc_unsteady_density
Cristopher-Morales Dec 18, 2025
df27a84
Update SU2_CFD/src/variables/CIncNSVariable.cpp
bigfooted Dec 24, 2025
51f18af
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Jan 6, 2026
524fd46
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Jan 13, 2026
acfe778
Merge branch 'develop' into fix_flame_init
bigfooted Jan 16, 2026
adedf6b
fix mpi and flame init
bigfooted Jan 16, 2026
69833df
Merge remote-tracking branch 'origin/fix_flame_init' into fix_inc_uns…
bigfooted Jan 16, 2026
89661d4
Merge branch 'fix_flame_init' into fix_inc_unsteady_density
bigfooted Jan 16, 2026
df28101
guards
bigfooted Jan 16, 2026
2308622
revert
bigfooted Jan 16, 2026
d529abe
Apply suggestion from @bigfooted
bigfooted Jan 16, 2026
02c3311
Apply suggestion from @bigfooted
bigfooted Jan 16, 2026
2364e90
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Jan 20, 2026
d4c5d18
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Mar 15, 2026
7899323
Merge branch 'fix_inc_unsteady_density' of https://github.com/su2code…
bigfooted Mar 15, 2026
b355867
update code
bigfooted Mar 15, 2026
76d652c
fix density registration for AD
bigfooted Mar 15, 2026
100c2cb
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Mar 17, 2026
1562607
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Mar 24, 2026
b8e840a
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Apr 4, 2026
ec308a5
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Apr 11, 2026
a7ab5b7
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Apr 21, 2026
4f5cdfa
merge with develop
Apr 21, 2026
0f538ea
update w. develop
bigfooted Apr 24, 2026
d12f7b3
update naming
bigfooted Apr 24, 2026
de4a95b
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Apr 24, 2026
f7775f0
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Apr 30, 2026
7905679
fix bounded scalar
bigfooted Apr 30, 2026
b2a9094
fix restart, add regression
bigfooted Apr 30, 2026
f10305e
point github workflow to temporary testcases branch
bigfooted Apr 30, 2026
f5e0e34
Jacobian update for unsteady density
May 1, 2026
b71c7ff
extension of bounded scalar fix to RANS
May 1, 2026
b359140
change OMP call
bigfooted May 3, 2026
5f7e34d
Update SU2_CFD/include/solvers/CSpeciesSolver.hpp
tkiymaz May 13, 2026
3a7553e
Update SU2_CFD/include/solvers/CTurbSolver.hpp
tkiymaz May 13, 2026
663105f
formating and addition of bool functions
May 13, 2026
c25ac53
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Jun 14, 2026
3573190
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Jun 24, 2026
110d585
Merge branch 'develop' into fix_inc_unsteady_density
bigfooted Jun 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/regression.yml
73 changes: 47 additions & 26 deletions SU2_CFD/include/solvers/CScalarSolver.inl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "../../../Common/include/toolboxes/geometry_toolbox.hpp"
#include "../../include/solvers/CScalarSolver.hpp"
#include "../../include/variables/CFlowVariable.hpp"
#include "../../include/variables/CIncEulerVariable.hpp"

template <class VariableType>
CScalarSolver<VariableType>::CScalarSolver(CGeometry* geometry, CConfig* config, bool conservative)
Expand Down Expand Up @@ -624,9 +625,14 @@ void CScalarSolver<VariableType>::SetResidual_DualTime(CGeometry* geometry, CSol
const bool second_order = (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_2ND);
const bool incompressible = (config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE);

/*--- The bounded-scalar correction is currently only used by the incompressible solvers. ---*/
const bool bounded_scalar = incompressible && ((IsSpeciesSolver() && config->GetBounded_Species()) ||
(IsTurbSolver() && config->GetBounded_Turb()));

/*--- Flow solution, needed to get density. ---*/

CVariable* flowNodes = solver_container[FLOW_SOL]->GetNodes();
auto* incFlowNodes = incompressible ? su2staticcast_p<CIncEulerVariable*>(flowNodes) : nullptr;

/*--- Store the physical time step ---*/

Expand Down Expand Up @@ -655,13 +661,9 @@ void CScalarSolver<VariableType>::SetResidual_DualTime(CGeometry* geometry, CSol
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
if (Conservative) {
if (incompressible) {
/*--- This is temporary and only valid for constant-density problems:
density could also be temperature dependent, but as it is not a part
of the solution vector it's neither stored for previous time steps
nor updated with the solution at the end of each iteration. */
Density_nM1 = flowNodes->GetDensity(iPoint);
Density_n = flowNodes->GetDensity(iPoint);
Density_nP1 = flowNodes->GetDensity(iPoint);
Density_nM1 = incFlowNodes->GetDensity_time_n1(iPoint);
Density_n = incFlowNodes->GetDensity_time_n(iPoint);
Density_nP1 = incFlowNodes->GetDensity(iPoint);
} else {
Density_nM1 = flowNodes->GetSolution_time_n1(iPoint)[0];
Density_n = flowNodes->GetSolution_time_n(iPoint, 0);
Expand All @@ -686,13 +688,20 @@ void CScalarSolver<VariableType>::SetResidual_DualTime(CGeometry* geometry, CSol
time discretization scheme (1st- or 2nd-order).---*/

for (iVar = 0; iVar < nVar; iVar++) {
su2double unsteady_term = 0.0;
if (first_order)
LinSysRes(iPoint, iVar) +=
(Density_nP1 * U_time_nP1[iVar] - Density_n * U_time_n[iVar]) * Volume_nP1 / TimeStep;
unsteady_term = (Density_nP1 * U_time_nP1[iVar] - Density_n * U_time_n[iVar]) * Volume_nP1 / TimeStep;
if (second_order)
LinSysRes(iPoint, iVar) += (3.0 * Density_nP1 * U_time_nP1[iVar] - 4.0 * Density_n * U_time_n[iVar] +
unsteady_term = (3.0 * Density_nP1 * U_time_nP1[iVar] - 4.0 * Density_n * U_time_n[iVar] +
1.0 * Density_nM1 * U_time_nM1[iVar]) *
Volume_nP1 / (2.0 * TimeStep);

if (bounded_scalar) {
if (first_order) unsteady_term -= U_time_nP1[iVar] * (Density_nP1 - Density_n) * Volume_nP1 / TimeStep;
if (second_order) unsteady_term -= U_time_nP1[iVar] * (3.0 * Density_nP1 - 4.0 * Density_n + 1.0 * Density_nM1) * Volume_nP1 / (2.0 * TimeStep);
}

LinSysRes(iPoint, iVar) += unsteady_term;
}

/*--- Compute the Jacobian contribution due to the dual time source term. ---*/
Expand Down Expand Up @@ -721,7 +730,7 @@ void CScalarSolver<VariableType>::SetResidual_DualTime(CGeometry* geometry, CSol

if (Conservative) {
if (incompressible)
Density_n = flowNodes->GetDensity(iPoint); // Temporary fix
Density_n = incFlowNodes->GetDensity_time_n(iPoint);
else
Density_n = flowNodes->GetSolution_time_n(iPoint, 0);
}
Expand Down Expand Up @@ -777,7 +786,7 @@ void CScalarSolver<VariableType>::SetResidual_DualTime(CGeometry* geometry, CSol

if (Conservative) {
if (incompressible)
Density_n = flowNodes->GetDensity(iPoint); // Temporary fix
Density_n = incFlowNodes->GetDensity_time_n(iPoint);
else
Density_n = flowNodes->GetSolution_time_n(iPoint, 0);
}
Expand Down Expand Up @@ -818,13 +827,9 @@ void CScalarSolver<VariableType>::SetResidual_DualTime(CGeometry* geometry, CSol
/*--- If this is the SST model, we need to multiply by the density
in order to get the conservative variables ---*/
if (incompressible) {
/*--- This is temporary and only valid for constant-density problems:
density could also be temperature dependent, but as it is not a part
of the solution vector it's neither stored for previous time steps
nor updated with the solution at the end of each iteration. */
Density_nM1 = flowNodes->GetDensity(iPoint);
Density_n = flowNodes->GetDensity(iPoint);
Density_nP1 = flowNodes->GetDensity(iPoint);
Density_nM1 = incFlowNodes->GetDensity_time_n1(iPoint);
Density_n = incFlowNodes->GetDensity_time_n(iPoint);
Density_nP1 = incFlowNodes->GetDensity(iPoint);
} else {
Density_nM1 = flowNodes->GetSolution_time_n1(iPoint)[0];
Density_n = flowNodes->GetSolution_time_n(iPoint, 0);
Expand All @@ -833,19 +838,35 @@ void CScalarSolver<VariableType>::SetResidual_DualTime(CGeometry* geometry, CSol
}

for (iVar = 0; iVar < nVar; iVar++) {
su2double unsteady_term = 0.0;
if (first_order)
LinSysRes(iPoint, iVar) +=
(Density_nP1 * U_time_nP1[iVar] - Density_n * U_time_n[iVar]) * (Volume_nP1 / TimeStep);
unsteady_term = (Density_nP1 * U_time_nP1[iVar] - Density_n * U_time_n[iVar]) * (Volume_nP1 / TimeStep);
if (second_order)
LinSysRes(iPoint, iVar) +=
(Density_nP1 * U_time_nP1[iVar] - Density_n * U_time_n[iVar]) * (3.0 * Volume_nP1 / (2.0 * TimeStep)) +
unsteady_term = (Density_nP1 * U_time_nP1[iVar] - Density_n * U_time_n[iVar]) * (3.0 * Volume_nP1 / (2.0 * TimeStep)) +
(Density_nM1 * U_time_nM1[iVar] - Density_n * U_time_n[iVar]) * (Volume_nM1 / (2.0 * TimeStep));

if (bounded_scalar) {
if (first_order) unsteady_term -= U_time_nP1[iVar] * (Density_nP1 - Density_n) * (Volume_nP1 / TimeStep);
if (second_order) unsteady_term -= U_time_nP1[iVar] * ((Density_nP1 - Density_n) * (3.0 * Volume_nP1 / (2.0 * TimeStep)) +
(Density_nM1 - Density_n) * (Volume_nM1 / (2.0 * TimeStep)));
}

LinSysRes(iPoint, iVar) += unsteady_term;
}

/*--- Compute the Jacobian contribution due to the dual time source term. ---*/
if (implicit) {
if (first_order) Jacobian.AddVal2Diag(iPoint, Volume_nP1 / TimeStep);
if (second_order) Jacobian.AddVal2Diag(iPoint, (Volume_nP1 * 3.0) / (2.0 * TimeStep));
su2double diag_factor = 1.0;
if (Conservative) {
if (bounded_scalar) {
if (first_order) diag_factor = Density_n;
if (second_order) diag_factor = (4.0 * Density_n - Density_nM1) / 3.0;
} else {
diag_factor = Density_nP1;
}
}
if (first_order) Jacobian.AddVal2Diag(iPoint, diag_factor * Volume_nP1 / TimeStep);
if (second_order) Jacobian.AddVal2Diag(iPoint, diag_factor * 3.0 * Volume_nP1 / (2.0 * TimeStep));
}
}
END_SU2_OMP_FOR
Expand Down Expand Up @@ -884,4 +905,4 @@ void CScalarSolver<VariableType>::PushSolutionBackInTime(unsigned long TimeIter,
nodes->Set_Solution_time_n();
}
}
}
}
10 changes: 10 additions & 0 deletions SU2_CFD/include/solvers/CSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,16 @@ class CSolver {
*/
inline virtual CFluidModel* GetFluidModel(void) const { return nullptr;}

/*!
* \brief Virtual function returning whether this is the species solver.
*/
inline virtual bool IsSpeciesSolver() const { return false; }

/*!
* \brief Virtual function returning whether this is the turbulent solver.
*/
inline virtual bool IsTurbSolver() const { return false; }

/*!
* \brief Get number of linear solver iterations.
* \return Number of linear solver iterations.
Expand Down
5 changes: 5 additions & 0 deletions SU2_CFD/include/solvers/CSpeciesSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ class CSpeciesSolver : public CScalarSolver<CSpeciesVariable> {

void Initialize(CGeometry* geometry, CConfig* config, unsigned short iMesh, unsigned short nVar);

/*!
* \brief Virtual function returning whether this is the species solver.
*/
inline bool IsSpeciesSolver() const final { return true; }

/*!
* \brief Restart residual and compute gradients.
* \param[in] geometry - Geometrical definition of the problem.
Expand Down
7 changes: 6 additions & 1 deletion SU2_CFD/include/solvers/CTurbSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ class CTurbSolver : public CScalarSolver<CTurbVariable> {
*/
CTurbSolver(CGeometry* geometry, CConfig *config, bool conservative);

/*!
* \brief Virtual function returning whether this is the turbulent solver.
*/
inline bool IsTurbSolver() const final { return true; }

/*!
* \brief Impose via the residual the Euler wall boundary condition.
* \param[in] geometry - Geometrical definition of the problem.
Expand Down Expand Up @@ -147,7 +152,7 @@ class CTurbSolver : public CScalarSolver<CTurbVariable> {
* \returns The number of extra variables.
*/
unsigned long RegisterSolutionExtra(bool input, const CConfig* config) final;

/*!
* \brief Compute a suitable under-relaxation parameter to limit the change in the solution variables over
* a nonlinear iteration for stability.
Expand Down
76 changes: 76 additions & 0 deletions SU2_CFD/include/variables/CIncEulerVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class CIncEulerVariable : public CFlowVariable {

VectorType Streamwise_Periodic_RecoveredPressure, /*!< \brief Recovered/Physical pressure [Pa] for streamwise periodic flow. */
Streamwise_Periodic_RecoveredTemperature; /*!< \brief Recovered/Physical temperature [K] for streamwise periodic flow. */
VectorType Density_time_n, /*!< \brief Density at time n for dual-time stepping. */
Density_time_n1; /*!< \brief Density at time n-1 for dual-time stepping. */
Comment on lines +74 to +75

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to recompute the old densities on the fly from the old solution variables instead of storing?
This would avoid the issues with restart files, adjoints, etc.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear Pedro, thanks for the advice, but I'd keep storing it here due to runtime. In the flamelet path ρ isn't a closed-form EoS; it's a multi-dimensional LUT interpolation (one of the most expensive per-node ops in the solver). ρⁿ/ρⁿ⁻¹ are frozen over the whole physical time step, but the dual-time residual is assembled every inner iteration (and it gets even more computationally costly with high inner iteration number), so storing evaluates each old density once per step while recomputing from the old state would redo the identical LUT lookup. It also mirrors the existing scheme: we already store Solution_time_n/_n1 rather than reconstructing old states on the fly. There is no problem with the restart right now. Regarding adjoints, I can do a future work on it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pcarruscag : do you mean only recompute the density when doing a restart or always recompute from the EoS? Because at restart that would be beneficial in the sense that it saves (or actually it does not save) 2 restart fields.
@tkiymaz we have the possibility to use the ideal gas law instead of lookup for the steady state flamelet solver. Do we re-evaluate the EoS every inner iteration with this approach?

su2double TemperatureLimits[2]; /*!< \brief Temperature limits [K]. */
public:
/*!
Expand All @@ -87,6 +89,16 @@ class CIncEulerVariable : public CFlowVariable {
CIncEulerVariable(su2double pressure, const su2double *velocity, su2double enthalpy,
unsigned long npoint, unsigned long ndim, unsigned long nvar, const CConfig *config);

/*!
* \brief Set all the solution at time level n to the current solution value (including density).
*/
void Set_Solution_time_n() override;

/*!
* \brief Set all the solution at time level n-1 to the solution at time level n (including density).
*/
void Set_Solution_time_n1() override;

/*!
* \brief Set the value of the pressure.
* \param[in] iPoint - Point index.
Expand Down Expand Up @@ -291,4 +303,68 @@ class CIncEulerVariable : public CFlowVariable {
for (unsigned long iDim = 0; iDim < nDim; iDim++) Solution(iPoint, iDim+1) = val_vector[iDim];
}

/*!
* \brief Get the density at time level n for dual-time stepping.
* \param[in] iPoint - Point index.
* \return Density at time level n.
*/
inline su2double GetDensity_time_n(unsigned long iPoint) const { return Density_time_n(iPoint); }

/*!
* \brief Get the density at time level n-1 for dual-time stepping.
* \param[in] iPoint - Point index.
* \return Density at time level n-1.
*/
inline su2double GetDensity_time_n1(unsigned long iPoint) const { return Density_time_n1(iPoint); }

/*!
* \brief Set the density at time level n for dual-time stepping.
* \param[in] iPoint - Point index.
* \param[in] val_density - Density value.
*/
inline void SetDensity_time_n(unsigned long iPoint, su2double val_density) { Density_time_n(iPoint) = val_density; }

/*!
* \brief Set the density at time level n-1 for dual-time stepping.
* \param[in] iPoint - Point index.
* \param[in] val_density - Density value.
*/
inline void SetDensity_time_n1(unsigned long iPoint, su2double val_density) { Density_time_n1(iPoint) = val_density; }

/*!
* \brief Register the density at time n as an AD input variable (for discrete adjoint unsteady).
*/
void RegisterDensity_time_n() override;

/*!
* \brief Register the density at time n-1 as an AD input variable (for discrete adjoint unsteady).
*/
void RegisterDensity_time_n1() override;

/*!
* \brief Get the adjoint of density at time n.
* Simplified version: directly extracts the AD derivative of Density_time_n,
* analogous to GetAdjointSolution_time_n for the solution vector.
* The chain-rule contribution d(rho)/d(h) is currently not applied (TODO).
* \param[in] iPoint - Point index.
* \return Adjoint of the density at time n.
*/
inline su2double GetAdjointDensity_time_n(unsigned long iPoint) const override {
AD::Identifier index = AD::GetPassiveIndex();
AD::SetIndex(index, Density_time_n(iPoint));
return AD::GetDerivative(index);
}

/*!
* \brief Get the adjoint of density at time n-1.
* See GetAdjointDensity_time_n.
* \param[in] iPoint - Point index.
* \return Adjoint of the density at time n-1.
*/
inline su2double GetAdjointDensity_time_n1(unsigned long iPoint) const override {
AD::Identifier index = AD::GetPassiveIndex();
AD::SetIndex(index, Density_time_n1(iPoint));
return AD::GetDerivative(index);
}

};
46 changes: 44 additions & 2 deletions SU2_CFD/include/variables/CVariable.hpp
Loading
Loading