OF-POSTECH-1/solvers_post/LagrangianCMCFoam/createLinearMesh.H

145 lines
2.9 KiB
C

Info<< "Constructing single cell mesh" << nl << endl;
LinearMesh lMesh(0, 1, 100);
pointField CMCPoints(lMesh.points());
faceList CMCFaces(lMesh.faces());
labelList CMCOwners(lMesh.owner());
labelList CMCNeighbors(lMesh.neighbour());
fvMesh mfMesh
(
IOobject
(
"mfSpace",
runTime.timeName(),
runTime,
IOobject::READ_IF_PRESENT
),
xferMove<Field<vector>>(CMCPoints),
CMCFaces.xfer(),
CMCOwners.xfer(),
CMCNeighbors.xfer()
);
if (mfMesh.boundaryMesh().empty())
{
List<polyPatch*> mfPatches(3);
mfPatches[0] = new polyPatch
(
lMesh.patchName(0),
lMesh.patchSize(0),
lMesh.patchStartIndex(0),
0,
mfMesh.boundaryMesh(),
polyPatch::typeName
);
mfPatches[1] = new polyPatch
(
lMesh.patchName(1),
lMesh.patchSize(1),
lMesh.patchStartIndex(1),
1,
mfMesh.boundaryMesh(),
polyPatch::typeName
);
mfPatches[2] = new emptyPolyPatch
(
lMesh.patchName(2),
lMesh.patchSize(2),
lMesh.patchStartIndex(2),
2,
mfMesh.boundaryMesh(),
emptyPolyPatch::typeName
);
mfMesh.addFvPatches(mfPatches);
}
IStringStream tempStream("3(fixedValue fixedValue empty)");
wordList testEtaPatchTypeNames(tempStream);
volScalarField testEtaMesh
(
IOobject
(
"testEtaMesh",
runTime.timeName(),
mfMesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mfMesh,
dimensionedScalar("testEtaMesh", dimless, 1.0),
testEtaPatchTypeNames
);
const volVectorField &cEtaMesh(mfMesh.C());
forAll(cEtaMesh, celli)
{
const scalar x = cEtaMesh[celli].x();
if (x > 0.5)
{
testEtaMesh[celli] = 1.0;
}
else
{
testEtaMesh[celli] = 0.0;
}
}
volScalarField DQi
(
IOobject
(
"DQi",
runTime.timeName(),
mfMesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mfMesh,
dimensionedScalar("DQi", dimArea/dimTime, 0.01),
testEtaPatchTypeNames
);
PtrList<PtrList<volScalarField> > FStruct (nf);
for(label k = 0 ; k < nf ; k++)
{
FStruct.set (k, new PtrList<volScalarField> (Ysize+3));
PtrList<volScalarField> &Fk(FStruct[k]);
Info << Fk.size() << endl;
for (label i = 0; i < Ysize + 3; i++)
{
Fk.set (i,
new volScalarField
(
IOobject
(
"test",
runTime.timeName(),
mfMesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mfMesh,
dimensionedScalar("test", dimless, 0.0),
testEtaPatchTypeNames
)
);
}
}
for(label k = 0 ; k < nf ; k++)
{
for (label i = 0; i < Ysize + 3; i++)
{
FStruct[k][i].rename("test."+name(k)+"."+name(i));
}
}