Skip to content
Snippets Groups Projects
Commit 90afa6dd authored by Henry Weller's avatar Henry Weller
Browse files

adjointShapeOptimizationFoam: Added support for fvOptions

parent d7c56992
No related branches found
No related tags found
No related merge requests found
...@@ -5,11 +5,13 @@ EXE_INC = \ ...@@ -5,11 +5,13 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lturbulenceModels \ -lturbulenceModels \
-lincompressibleTurbulenceModels \ -lincompressibleTurbulenceModels \
-lincompressibleTransportModels \ -lincompressibleTransportModels \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools -lmeshTools \
-lfvOptions
...@@ -49,6 +49,7 @@ Description ...@@ -49,6 +49,7 @@ Description
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H" #include "turbulentTransportModel.H"
#include "simpleControl.H" #include "simpleControl.H"
#include "fvIOoptionList.H"
template<class Type> template<class Type>
void zeroCells void zeroCells
...@@ -76,9 +77,12 @@ int main(int argc, char *argv[]) ...@@ -76,9 +77,12 @@ int main(int argc, char *argv[])
simpleControl simple(mesh); simpleControl simple(mesh);
#include "createFields.H" #include "createFields.H"
#include "createFvOptions.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "initAdjointContinuityErrs.H" #include "initAdjointContinuityErrs.H"
turbulence->validate();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
...@@ -108,12 +112,18 @@ int main(int argc, char *argv[]) ...@@ -108,12 +112,18 @@ int main(int argc, char *argv[])
fvm::div(phi, U) fvm::div(phi, U)
+ turbulence->divDevReff(U) + turbulence->divDevReff(U)
+ fvm::Sp(alpha, U) + fvm::Sp(alpha, U)
==
fvOptions(U)
); );
UEqn().relax(); UEqn().relax();
fvOptions.constrain(UEqn());
solve(UEqn() == -fvc::grad(p)); solve(UEqn() == -fvc::grad(p));
fvOptions.correct(U);
volScalarField rAU(1.0/UEqn().A()); volScalarField rAU(1.0/UEqn().A());
volVectorField HbyA("HbyA", U); volVectorField HbyA("HbyA", U);
HbyA = rAU*UEqn().H(); HbyA = rAU*UEqn().H();
...@@ -150,6 +160,7 @@ int main(int argc, char *argv[]) ...@@ -150,6 +160,7 @@ int main(int argc, char *argv[])
// Momentum corrector // Momentum corrector
U = HbyA - rAU*fvc::grad(p); U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
fvOptions.correct(U);
} }
// Adjoint Pressure-velocity SIMPLE corrector // Adjoint Pressure-velocity SIMPLE corrector
...@@ -173,12 +184,18 @@ int main(int argc, char *argv[]) ...@@ -173,12 +184,18 @@ int main(int argc, char *argv[])
- adjointTransposeConvection - adjointTransposeConvection
+ turbulence->divDevReff(Ua) + turbulence->divDevReff(Ua)
+ fvm::Sp(alpha, Ua) + fvm::Sp(alpha, Ua)
==
fvOptions(Ua)
); );
UaEqn().relax(); UaEqn().relax();
fvOptions.constrain(UaEqn());
solve(UaEqn() == -fvc::grad(pa)); solve(UaEqn() == -fvc::grad(pa));
fvOptions.correct(Ua);
volScalarField rAUa(1.0/UaEqn().A()); volScalarField rAUa(1.0/UaEqn().A());
volVectorField HbyAa("HbyAa", Ua); volVectorField HbyAa("HbyAa", Ua);
HbyAa = rAUa*UaEqn().H(); HbyAa = rAUa*UaEqn().H();
...@@ -215,6 +232,7 @@ int main(int argc, char *argv[]) ...@@ -215,6 +232,7 @@ int main(int argc, char *argv[])
// Adjoint momentum corrector // Adjoint momentum corrector
Ua = HbyAa - rAUa*fvc::grad(pa); Ua = HbyAa - rAUa*fvc::grad(pa);
Ua.correctBoundaryConditions(); Ua.correctBoundaryConditions();
fvOptions.correct(Ua);
} }
laminarTransport.correct(); laminarTransport.correct();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment