Added scalar adjoint advection terms in AdjointSolver
Issue/feature addressed
The scalar (i.e energy equation) adjoint advection terms were omitted in solvers/IncNavierStokesSolver/AdvectionTerms/AdjointAdvection.cpp
, leading to wrong solutions of the adjoint (with scalar advection).
Proposed solution
The scalar adjoint advection terms (-U_j ds/dx_j, where s denotes the scalar) are added in solvers/IncNavierStokesSolver/AdvectionTerms/AdjointAdvection.cpp:181-191
.
Implementation
The implementation is almost similar to solvers/IncNavierStokesSolver/AdvectionTerms/LinearisedAdvection.cpp
except an if-statement
is added in solvers/IncNavierStokesSolver/AdvectionTerms/AdjointAdvection.cpp:147
as a condition to compute the momentum (i < ndim) or scalar (i > ndim) adjoint advection.
Tests
The computation of adjoint and direct eigenvalues of a periodically heated thermal convection problem were added in solvers/IncNavierStokesSolver/Tests
. The eigenvalues were validated with Hossain et. al. (2013) - Instabilities of natural convection in a periodically heated layer.
Specifically, 4 tests were added and they are:
- ThermStab_dir.tst - Direct eigensolver (Modified Arnoldi)
- ThermStab_dir_Ar.tst - Direct eigensolver (Arpack)
- ThermStab_adj.tst - Adjoint eigensolver (Modified Arnoldi)
- ThermStab_adj_Ar.tst - Adjoint eigensolver (Arpack)
These unit tests were tested on fenchurchstreet and my laptop which worked.
Suggested reviewers
Spencer Sherwin
Notes
Checklist
-
Functions and classes, or changes to them, are documented. -
User guide/documentation is updated. -
Changelog is updated. -
Suitable tests added for new functionality. -
Contributed code is correctly formatted. (See the contributing guidelines). [ ] License added to any new files.-
No extraneous files have been added (e.g. compiler output or test data files).