Skip to content

Commit

Permalink
Made the calcForce util indepent of turbulence model. (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
friedenhe authored Nov 1, 2023
1 parent dfc14a0 commit 2e981bd
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ EXE_INC = \
-Wno-deprecated-copy \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
Expand All @@ -16,8 +14,6 @@ EXE_LIBS = \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-lfiniteVolume \
-lsampling \
-lmeshTools \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "simpleControl.H"
#include "fvOptions.H"
#include "fluidThermo.H"
#include "turbulentFluidThermoModel.H"

using namespace Foam;

Expand Down Expand Up @@ -105,13 +104,26 @@ int main(int argc, char* argv[])
const surfaceVectorField::Boundary& Sfb = mesh.Sf().boundaryField();
const surfaceScalarField::Boundary& magSfb = mesh.magSf().boundaryField();

tmp<volSymmTensorField> tdevRhoReff = turbulence->devRhoReff();
const volSymmTensorField::Boundary& devRhoReffb = tdevRhoReff().boundaryField();
volSymmTensorField devRhoReff(
IOobject(
IOobject::groupName("devRhoReff", U.group()),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE),
(-rho * nuEff) * dev(twoSymm(fvc::grad(U))));

const volSymmTensorField::Boundary& devRhoReffb = devRhoReff.boundaryField();

forAll(patchNames, cI)
{
// get the patch id label
label patchI = mesh.boundaryMesh().findPatchID(patchNames[cI]);
if (patchI < 0)
{
Info << "ERROR: Patch name " << patchNames[cI] << " not found in constant/polyMesh/boundary! Exit!" << endl;
return 1;
}
// create a shorter handle for the boundary patch
const fvPatch& patch = mesh.boundary()[patchI];
// normal force
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,22 @@ volVectorField U
mesh
);

#include "compressibleCreatePhi.H"

autoPtr<compressible::turbulenceModel> turbulence
Info<< "Reading field nut\n" << endl;
volScalarField nut
(
compressible::turbulenceModel::New
IOobject
(
rho,
U,
phi,
thermo
)
"nut",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

volScalarField nuEff = nut + thermo.nu();

#include "compressibleCreatePhi.H"


Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ EXE_INC = \
-Wno-old-style-cast \
-Wno-conversion-null \
-Wno-deprecated-copy \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
Expand All @@ -14,7 +12,6 @@ EXE_INC = \

EXE_LIBS = \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lfiniteVolume \
-lmeshTools \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "simpleControl.H"
#include "fvOptions.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"

using namespace Foam;

Expand Down Expand Up @@ -105,13 +104,26 @@ int main(int argc, char* argv[])
const surfaceVectorField::Boundary& Sfb = mesh.Sf().boundaryField();
const surfaceScalarField::Boundary& magSfb = mesh.magSf().boundaryField();

tmp<volSymmTensorField> tdevRhoReff = turbulence->devRhoReff();
const volSymmTensorField::Boundary& devRhoReffb = tdevRhoReff().boundaryField();
volSymmTensorField devRhoReff(
IOobject(
IOobject::groupName("devRhoReff", U.group()),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE),
-nuEff * dev(twoSymm(fvc::grad(U))));

const volSymmTensorField::Boundary& devRhoReffb = devRhoReff.boundaryField();

forAll(patchNames, cI)
{
// get the patch id label
label patchI = mesh.boundaryMesh().findPatchID(patchNames[cI]);
if (patchI < 0)
{
Info << "ERROR: Patch name " << patchNames[cI] << " not found in constant/polyMesh/boundary! Exit!" << endl;
return 1;
}
// create a shorter handle for the boundary patch
const fvPatch& patch = mesh.boundary()[patchI];
// normal force
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,23 @@ volVectorField U
mesh
);

Info<< "Reading field nut\n" << endl;
volScalarField nut
(
IOobject
(
"nut",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

#include "createPhi.H"

singlePhaseTransportModel laminarTransport(U, phi);

autoPtr<incompressible::turbulenceModel> turbulence
(
incompressible::turbulenceModel::New(U, phi, laminarTransport)
);

volScalarField nuEff = nut + laminarTransport.nu();

0 comments on commit 2e981bd

Please sign in to comment.