sub-grid voidfraction dependent viscosity - code check

Submitted by carl on Wed, 12/22/2021 - 21:53

Hey!

I have rewritten the smagorinsky turbulence model to create a sub-grid voidfraction dependent viscosity of the Batchelor-Green viscosity:

https://www.cambridge.org/core/journals/journal-of-fluid-mechanics/artic...

inspitred by B. Blais et al (2016)
https://www.sciencedirect.com/science/article/pii/S0021999116301358?via%...

There is no guides online on changing the viscosity model this way and I have reasons to doubt my results running this model. Can someone please check my code of the redesigned Smagorinsky.C file:

#include "Smagorinsky.H"
#include "fvOptions.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
namespace LESModels
{

// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // Delete?

template
void Smagorinsky::correctNut()
{

this->nut_ = nu_*(a_*(1-voidfraction) + b_*(1-voidfraction)*(1-voidfraction);
this->nut_.correctBoundaryConditions();
fv::options::New(this->mesh_).correct(this->nut_);

BasicTurbulenceModel::correctNut();
}

// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

template
Smagorinsky::Smagorinsky
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const volScalarField& voidfraction,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName,
const word& type
)
:
LESeddyViscosity
(
type,
alpha,
rho,
U,
voidfraction,
alphaRhoPhi,
phi,
transport,
propertiesName
),

nu_
(
dimensioned::lookupOrAddToDict
(
"nu",
transportProperties.lookup("nu")
)
)

a_
(
dimensioned::lookupOrAddToDict
(
"a",
this->coeffDict_,
2.5
)
)

b_
(
dimensioned::lookupOrAddToDict
(
"b",
this->coeffDict_,
7.6
)
)
{
if (type == typeName)
{
this->printCoeffs(type);
}
}

// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

template
bool Smagorinsky::read()
{
if (LESeddyViscosity::read())
{
nu_.readIfPresent(this->coeffDict());
a_.readIfPresent(this->coeffDict());
b_.readIfPresent(this->coeffDict());
return true;
}
else
{
return false;
}
}

template
void Smagorinsky::correct()
{
LESeddyViscosity::correct();
correctNut();
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace LESModels
} // End namespace Foam

I dont seem to be able to change the name of the model, without running into errors. I am not sure it actually can read the fluid viscosity from the transportProperties and I wonder if the command cfdemCompCFDEMall updates the OpenFOAM library.

Thank you!