Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion applications/solvers/dfLowMachFoam/createFields.H
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ rho = thermo.rho();
Info<< "Creating field kinetic energy K\n" << endl;
volScalarField K("K", 0.5*magSqr(U));

#include "createLocalBlend.H"

multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;

#include "createMRF.H"
Expand Down Expand Up @@ -206,4 +208,4 @@ const Switch splitting = CanteraTorchProperties.lookupOrDefault("splittingStrate
#ifdef USE_LIBTORCH
const Switch log_ = CanteraTorchProperties.subDict("TorchSettings").lookupOrDefault("log", false);
const Switch torch_ = CanteraTorchProperties.subDict("TorchSettings").lookupOrDefault("torch", false);
#endif
#endif
73 changes: 73 additions & 0 deletions applications/solvers/dfLowMachFoam/createLocalBlend.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*---------------------------------------------------------------------------*\
This function is designed to read the UBlendingFactor for localBlended
schemes used by the divSchemes, i.e.:
```
divSchemes
{
div(phi,U) Gauss localBlended linear upwind;
}
```
\*---------------------------------------------------------------------------*/

// Find and parse the divSchemes sub-dictionary
const dictionary& divSchemesDict = mesh.schemesDict().subDict("divSchemes");

Switch foundLocalBlended = false;

// Parse the divSchemes tokens
wordList keys = divSchemesDict.toc();
forAll(keys, i)
{
const word& key = keys[i];
// Convert to string
ITstream& is = divSchemesDict.lookup(key);
OStringStream os;
os << is;
word schemeStr = os.str();

if (schemeStr.find("localBlended") != word::npos)
{
foundLocalBlended = true;
}
}

// Declare pointer for UBlendingFactor
autoPtr<surfaceScalarField> UBlendingFactorPtr;

// Create the localBlendingFactor field only if localBlended scheme is found
if (foundLocalBlended)
{
Info << " Creating UBlendingFactor field for localBlended schemes " << endl;

// Read the scalarField UBlend
volScalarField UBlend
(
IOobject
(
"UBlend",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);

// Construct the surfaceScalarField UBlendingFactor by interpolating UBlend to cell faces
UBlendingFactorPtr.reset
(
new surfaceScalarField
(
IOobject
(
"UBlendingFactor",
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
true
),
fvc::interpolate(UBlend)
)
);
}