May 11, 2022, 09:42
|
Decomposing a codeStream BC gives token error
|
#1
|
New Member
Dan Padrao
Join Date: Jun 2020
Posts: 14
Rep Power: 4
|
Hi Foamers,
I've got an interesting problem. I want to implement a non-uniform heat flux to the surface of my model to heat up the fluid. To do this, I used a codeStream, with an excerpt of the changeDictionary dict shown below:
Code:
T
{
internalField uniform 323;
boundaryField
{
".*"
{
type zeroGradient;
value $internalField;
}
"procBoundary.*"
{
type processor;
}
"block_to_.*"
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
Tnbr T;
kappaMethod solidThermo;
value $internalField;
}
"maxZ"
{
type externalWallHeatFluxTemperature;
mode flux;
q nonuniform #codeStream
{
codeInclude #{
#include "fvCFD.H"
#};
codeOptions #{
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
#};
codeLibs #{
-lmeshTools \
-lfiniteVolume
#};
code #{
const IOdictionary& d = static_cast<const IOdictionary&>
(
dict.parent().parent()
); // access current directory
const fvMesh& mesh = refCast<const fvMesh>(d.db()); // access mesh database
const label id = mesh.boundary().findPatchID("maxZ"); // label id of patch
const fvPatch& boundaryPatch = mesh.boundary()[id]; // access boundary mesh information using label id
const vectorField& Cf = boundaryPatch.Cf(); // access coordinates of cells
scalarField q(boundaryPatch.size(), 0); // initialise q field
const scalar c0 = 0.015; // definition of the centre x coordinate
const scalar c1 = 0.045; // definition of the centre y coordinate
const scalar rpipe = 0.015;
const scalar Qeff = 1e6; // Effective incident heat flux (W/m2)
forAll(Cf, faceI) // loop over all the patch faces
{
scalar x = Cf[faceI].x(); // x coordinate of the faces i
scalar y = Cf[faceI].y(); // y coordinate of the faces i
scalar radius = pow(pow(x-c0,2)+pow(y-c1,2), 0.5); // compute radius on face i.
q[faceI] = scalar ( Qeff*(0.5+pow(radius/rpipe,2)) ); // define heat flux value value on the face i. This is a test equation.
}
os << q;
#};
};
thicknessLayers ();
kappaLayers ();
kappaMethod solidThermo;
value $internalField;
}
}
}
When solving the model in series it works fine. The issue is if I want to use multiple processors, where I get the following error when decomposing the mesh prior to using the solver:
Code:
Number of processor faces = 81286
Max number of cells = 24355 (21.72641087% above average 20007.98333)
Max number of processor patches = 6 (48.76033058% above average 4.033333333)
Max number of faces between processors = 3552 (31.09268509% above average 2709.533333)
Time = 0
Using #codeStream at line 53 in file "/Specimen_1p00/parallel/0/block/T.boundaryField.maxZ"
Using #codeStream with "/Specimen_1p00/parallel/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_7d92f667a36b3b9d505ee89b569a984a51b7824e.so"
--> FOAM FATAL IO ERROR:
token following 'nonuniform' is not a compound
on patch maxZ of field T in file "/Specimen_1p00/parallel/0/block/T"
file: /Specimen_1p00/parallel/0/block/T.boundaryField.maxZ
From function Foam::genericFvPatchField<Type>::genericFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = double]
in file genericFvPatchField/genericFvPatchField.C at line 117.
FOAM exiting
I've tried removing nonuniform, but then the heat flux is not applied to the model. I've tried adding List<scalar> and other variations but to no avail. Does anyone have any tips or can catch out an error? I'm currently using OpenFOAM v1812.
Thanks in advance!
|
|
|