Skip to content

Commit f7d577f

Browse files
committed
Read oldTime for intermediate states and fixed the total accuracy.
1 parent 7619067 commit f7d577f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: src/adjoint/DAResidual/DAResidualRhoPimpleFoam.C

+11
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,14 @@ void DAResidualRhoPimpleFoam::updateIntermediateVariables()
239239
// psi = 1/T/R
240240
// see src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H
241241
psi_ = 1.0 / T_ / R;
242+
psi_.oldTime() = 1.0 / T_.oldTime() / R;
243+
psi_.oldTime().oldTime() = 1.0 / T_.oldTime().oldTime() / R;
242244

243245
// rho = psi*p
244246
// see src/thermophysicalModels/basic/psiThermo/psiThermo.C
245247
rho_ = psi_ * p_;
248+
rho_.oldTime() = psi_.oldTime() * p_.oldTime();
249+
rho_.oldTime().oldTime() = psi_.oldTime().oldTime() * p_.oldTime().oldTime();
246250

247251
// **************** NOTE ****************
248252
// need to relax rho to be consistent with the primal solver
@@ -272,14 +276,21 @@ void DAResidualRhoPimpleFoam::updateIntermediateVariables()
272276
if (he_.name() == "e")
273277
{
274278
he_ = Cp * T_ - T_ * R;
279+
he_.oldTime() = Cp * T_.oldTime() - T_.oldTime() * R;
280+
he_.oldTime().oldTime() = Cp * T_.oldTime().oldTime() - T_.oldTime().oldTime() * R;
275281
}
276282
else
277283
{
278284
he_ = Cp * T_;
285+
he_.oldTime() = Cp * T_.oldTime();
286+
he_.oldTime().oldTime() = Cp * T_.oldTime().oldTime();
279287
}
280288
he_.correctBoundaryConditions();
281289

282290
K_ = 0.5 * magSqr(U_);
291+
K_.oldTime() = 0.5 * magSqr(U_.oldTime());
292+
K_.oldTime().oldTime() = 0.5 * magSqr(U_.oldTime().oldTime());
293+
283294
dpdt_ = fvc::ddt(p_);
284295

285296
// NOTE: alphat is updated in the correctNut function in DATurbulenceModel child classes

0 commit comments

Comments
 (0)