Skip to content

Commit 7170c18

Browse files
committed
Add support for the localBlended scheme.
- The `UBlend` volScalarField should be exist in the 0 folder. This field can be initialized using setFields or funkySetFields. - Although we only support the localBlended scheme for div(phi,U), it can be easily extent to other variables.
1 parent ed526cc commit 7170c18

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed

applications/solvers/dfLowMachFoam/createFields.H

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ rho = thermo.rho();
115115
Info<< "Creating field kinetic energy K\n" << endl;
116116
volScalarField K("K", 0.5*magSqr(U));
117117

118+
#include "createLocalBlend.H"
119+
118120
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
119121

120122
#include "createMRF.H"
@@ -206,4 +208,4 @@ const Switch splitting = CanteraTorchProperties.lookupOrDefault("splittingStrate
206208
#ifdef USE_LIBTORCH
207209
const Switch log_ = CanteraTorchProperties.subDict("TorchSettings").lookupOrDefault("log", false);
208210
const Switch torch_ = CanteraTorchProperties.subDict("TorchSettings").lookupOrDefault("torch", false);
209-
#endif
211+
#endif
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*---------------------------------------------------------------------------*\
2+
This function is designed to read the UBlendingFactor for localBlended
3+
schemes used by the divSchemes, i.e.:
4+
```
5+
divSchemes
6+
{
7+
div(phi,U) Gauss localBlended linear upwind;
8+
}
9+
```
10+
\*---------------------------------------------------------------------------*/
11+
12+
// Find and parse the divSchemes sub-dictionary
13+
const dictionary& divSchemesDict = mesh.schemesDict().subDict("divSchemes");
14+
15+
Switch foundLocalBlended = false;
16+
17+
// Parse the divSchemes tokens
18+
wordList keys = divSchemesDict.toc();
19+
forAll(keys, i)
20+
{
21+
const word& key = keys[i];
22+
// Convert to string
23+
ITstream& is = divSchemesDict.lookup(key);
24+
OStringStream os;
25+
os << is;
26+
word schemeStr = os.str();
27+
28+
if (schemeStr.find("localBlended") != word::npos)
29+
{
30+
foundLocalBlended = true;
31+
}
32+
}
33+
34+
// Create the localBlendingFactor field only if localBlended scheme is found
35+
if (foundLocalBlended)
36+
{
37+
Info << " Creating UBlendingFactor field for localBlended schemes " << endl;
38+
39+
// Read the scalarField UBlend
40+
volScalarField UBlend
41+
(
42+
IOobject
43+
(
44+
"UBlend",
45+
mesh.time().timeName(),
46+
mesh,
47+
IOobject::MUST_READ,
48+
IOobject::NO_WRITE
49+
),
50+
mesh
51+
)
52+
53+
// Construct the surfaceScalarField UBlendingFactor by interpolating UBlend to cell faces
54+
surfaceScalarField UBlendingFactor
55+
(
56+
IOobject
57+
(
58+
"UBlendingFactor",
59+
mesh.time().timeName(),
60+
mesh,
61+
IOobject::NO_READ,
62+
IOobject::NO_WRITE
63+
),
64+
mesh,
65+
fvc::interpolate(UBlend)
66+
);
67+
}

0 commit comments

Comments
 (0)