Compare commits
2 Commits
feature-cl
...
feature-sp
| Author | SHA1 | Date | |
|---|---|---|---|
| 0503f66c90 | |||
| 25ff1d7d6f |
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -196,23 +196,19 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
SortList<scalar> sorter1(list1);
|
SortList<scalar> sorter1(list1);
|
||||||
|
|
||||||
Info<< nl << "Sorted: " << flatOutput(sorter1) << nl;
|
|
||||||
Info<< nl << "Sort indices: " << flatOutput(sorter1.indices()) << nl;
|
Info<< nl << "Sort indices: " << flatOutput(sorter1.indices()) << nl;
|
||||||
|
|
||||||
// Reverses indices
|
Info<< nl << "Reverse indices: " << flatOutput(sorter1.indices()) << nl;
|
||||||
|
|
||||||
sorter1.reverse();
|
sorter1.reverse();
|
||||||
|
|
||||||
Info<< nl << "Reverse: " << flatOutput(sorter1.indices()) << nl;
|
Info<< nl << "Again indices: " << flatOutput(sorter1.indices()) << nl;
|
||||||
|
|
||||||
sorter1.reset();
|
|
||||||
|
|
||||||
Info<< nl << "Reset indices: " << flatOutput(sorter1.indices()) << nl;
|
|
||||||
|
|
||||||
sorter1.reverseSort();
|
sorter1.reverseSort();
|
||||||
|
|
||||||
Info<< nl << "Reverse indices: " << flatOutput(sorter1.indices()) << nl;
|
Info<< nl << "Reverse indices: " << flatOutput(sorter1.indices()) << nl;
|
||||||
|
|
||||||
Info<< nl << "Reverse sorted: " << flatOutput(sorter1) << nl;
|
Info<< nl << "Sorted : " << flatOutput(sorter1) << nl;
|
||||||
|
|
||||||
sorter1.sort(std::greater<scalar>());
|
sorter1.sort(std::greater<scalar>());
|
||||||
|
|
||||||
|
|||||||
@ -1015,10 +1015,7 @@ Foam::label Foam::checkGeometry
|
|||||||
|
|
||||||
const fileName outputDir
|
const fileName outputDir
|
||||||
(
|
(
|
||||||
mesh.time().globalPath()
|
mesh.time().globalPath()/functionObject::outputPrefix/"checkMesh"
|
||||||
/functionObject::outputPrefix
|
|
||||||
/(mesh.name() == polyMesh::defaultRegion ? word::null : mesh.name())
|
|
||||||
/"checkMesh"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll(pbm, patchi)
|
forAll(pbm, patchi)
|
||||||
@ -1034,6 +1031,7 @@ Foam::label Foam::checkGeometry
|
|||||||
<< cpp.name() << " and neighbour patch: "
|
<< cpp.name() << " and neighbour patch: "
|
||||||
<< cpp.neighbPatch().name() << endl;
|
<< cpp.neighbPatch().name() << endl;
|
||||||
|
|
||||||
|
const word pName("patch" + Foam::name(cpp.index()));
|
||||||
const AMIPatchToPatchInterpolation& ami = cpp.AMI();
|
const AMIPatchToPatchInterpolation& ami = cpp.AMI();
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -1046,7 +1044,7 @@ Foam::label Foam::checkGeometry
|
|||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
wr,
|
wr,
|
||||||
outputDir / cpp.name() + "-src_" + tmName,
|
outputDir / pName + "-src_" + tmName,
|
||||||
ami.srcWeightsSum(),
|
ami.srcWeightsSum(),
|
||||||
cpp.localFaces(),
|
cpp.localFaces(),
|
||||||
cpp.meshPoints(),
|
cpp.meshPoints(),
|
||||||
@ -1072,7 +1070,7 @@ Foam::label Foam::checkGeometry
|
|||||||
(
|
(
|
||||||
mergedPoints,
|
mergedPoints,
|
||||||
mergedFaces,
|
mergedFaces,
|
||||||
(outputDir / cpp.name() + "-src_" + tmName),
|
(outputDir / pName + "-src_" + tmName),
|
||||||
false // serial - already merged
|
false // serial - already merged
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1082,8 +1080,6 @@ Foam::label Foam::checkGeometry
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const auto& nbrPp = cpp.neighbPatch();
|
|
||||||
|
|
||||||
// Collect geometry
|
// Collect geometry
|
||||||
faceList mergedFaces;
|
faceList mergedFaces;
|
||||||
pointField mergedPoints;
|
pointField mergedPoints;
|
||||||
@ -1093,14 +1089,11 @@ Foam::label Foam::checkGeometry
|
|||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
wr,
|
wr,
|
||||||
(
|
outputDir / pName + "-tgt_" + tmName,
|
||||||
outputDir
|
|
||||||
/ nbrPp.name() + "-tgt_" + tmName
|
|
||||||
),
|
|
||||||
ami.tgtWeightsSum(),
|
ami.tgtWeightsSum(),
|
||||||
nbrPp.localFaces(),
|
cpp.neighbPatch().localFaces(),
|
||||||
nbrPp.meshPoints(),
|
cpp.neighbPatch().meshPoints(),
|
||||||
nbrPp.meshPointMap(),
|
cpp.neighbPatch().meshPointMap(),
|
||||||
|
|
||||||
mergedFaces,
|
mergedFaces,
|
||||||
mergedPoints,
|
mergedPoints,
|
||||||
@ -1125,10 +1118,7 @@ Foam::label Foam::checkGeometry
|
|||||||
(
|
(
|
||||||
mergedPoints,
|
mergedPoints,
|
||||||
mergedFaces,
|
mergedFaces,
|
||||||
(
|
(outputDir / pName + "-tgt_" + tmName),
|
||||||
outputDir
|
|
||||||
/ nbrPp.name() + "-tgt_" + tmName
|
|
||||||
),
|
|
||||||
false // serial - already merged
|
false // serial - already merged
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1145,6 +1135,8 @@ Foam::label Foam::checkGeometry
|
|||||||
const auto& cpp = refCast<const mappedPatchBase>(pp);
|
const auto& cpp = refCast<const mappedPatchBase>(pp);
|
||||||
const AMIPatchToPatchInterpolation& ami = cpp.AMI();
|
const AMIPatchToPatchInterpolation& ami = cpp.AMI();
|
||||||
|
|
||||||
|
const word pName("patch" + Foam::name(patchi));
|
||||||
|
|
||||||
// Collect geometry
|
// Collect geometry
|
||||||
faceList mergedFaces;
|
faceList mergedFaces;
|
||||||
pointField mergedPoints;
|
pointField mergedPoints;
|
||||||
@ -1154,7 +1146,7 @@ Foam::label Foam::checkGeometry
|
|||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
wr,
|
wr,
|
||||||
outputDir / pp.name() + "-src_" + tmName,
|
outputDir / pName + "-src_" + tmName,
|
||||||
ami.srcWeightsSum(),
|
ami.srcWeightsSum(),
|
||||||
pp.localFaces(),
|
pp.localFaces(),
|
||||||
pp.meshPoints(),
|
pp.meshPoints(),
|
||||||
@ -1181,7 +1173,7 @@ Foam::label Foam::checkGeometry
|
|||||||
(
|
(
|
||||||
cpp.sampleMesh(),
|
cpp.sampleMesh(),
|
||||||
wr,
|
wr,
|
||||||
outputDir / nbrPp.name() + "-tgt_" + tmName,
|
outputDir / pName + "-tgt_" + tmName,
|
||||||
ami.tgtWeightsSum(),
|
ami.tgtWeightsSum(),
|
||||||
nbrPp.localFaces(),
|
nbrPp.localFaces(),
|
||||||
nbrPp.meshPoints(),
|
nbrPp.meshPoints(),
|
||||||
|
|||||||
@ -98,13 +98,11 @@ void matchPatchFaces
|
|||||||
const labelList& patchesj,
|
const labelList& patchesj,
|
||||||
|
|
||||||
DynamicList<labelList>& interfaceMesh0,
|
DynamicList<labelList>& interfaceMesh0,
|
||||||
DynamicList<label>& interfaceSource0,
|
|
||||||
DynamicList<labelList>& interfacePatch0,
|
DynamicList<labelList>& interfacePatch0,
|
||||||
DynamicList<wordList>& interfaceNames0,
|
DynamicList<wordList>& interfaceNames0,
|
||||||
DynamicList<List<DynamicList<label>>>& interfaceFaces0,
|
DynamicList<List<DynamicList<label>>>& interfaceFaces0,
|
||||||
|
|
||||||
DynamicList<labelList>& interfaceMesh1,
|
DynamicList<labelList>& interfaceMesh1,
|
||||||
DynamicList<label>& interfaceSource1,
|
|
||||||
DynamicList<labelList>& interfacePatch1,
|
DynamicList<labelList>& interfacePatch1,
|
||||||
DynamicList<wordList>& interfaceNames1,
|
DynamicList<wordList>& interfaceNames1,
|
||||||
DynamicList<List<DynamicList<label>>>& interfaceFaces1
|
DynamicList<List<DynamicList<label>>>& interfaceFaces1
|
||||||
@ -138,10 +136,8 @@ void matchPatchFaces
|
|||||||
|
|
||||||
Info<< "Introducing interface " << inti << " between"
|
Info<< "Introducing interface " << inti << " between"
|
||||||
<< " mesh " << meshes[meshi].name()
|
<< " mesh " << meshes[meshi].name()
|
||||||
//<< " source:" << sourcei
|
|
||||||
<< " patch " << ppi.name()
|
<< " patch " << ppi.name()
|
||||||
<< " and mesh " << meshes[meshj].name()
|
<< " and mesh " << meshes[meshj].name()
|
||||||
//<< " source:" << sourcej
|
|
||||||
<< " patch " << ppj.name()
|
<< " patch " << ppj.name()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
@ -153,8 +149,6 @@ void matchPatchFaces
|
|||||||
intMesh0.setSize(nSourcei, -1);
|
intMesh0.setSize(nSourcei, -1);
|
||||||
intMesh0[sourcei] = meshi;
|
intMesh0[sourcei] = meshi;
|
||||||
|
|
||||||
interfaceSource0.append(sourcei);
|
|
||||||
|
|
||||||
interfacePatch0.append(labelList());
|
interfacePatch0.append(labelList());
|
||||||
auto& intPatch0 = interfacePatch0.last();
|
auto& intPatch0 = interfacePatch0.last();
|
||||||
intPatch0.setSize(nSourcei, -1);
|
intPatch0.setSize(nSourcei, -1);
|
||||||
@ -163,11 +157,15 @@ void matchPatchFaces
|
|||||||
interfaceNames0.append(wordList());
|
interfaceNames0.append(wordList());
|
||||||
auto& intNames0 = interfaceNames0.last();
|
auto& intNames0 = interfaceNames0.last();
|
||||||
intNames0.setSize(nSourcei);
|
intNames0.setSize(nSourcei);
|
||||||
|
//intNames0[sourcei] =
|
||||||
|
// meshes[meshi].name()
|
||||||
|
// + "_to_"
|
||||||
|
// + meshes[meshj].name();
|
||||||
intNames0[sourcei] =
|
intNames0[sourcei] =
|
||||||
patchName(entryName, meshes[meshi], meshes[meshj]);
|
patchName(entryName, meshes[meshi], meshes[meshj]);
|
||||||
|
|
||||||
|
|
||||||
// Mesh 1
|
// Mesh 0
|
||||||
//~~~~~~~
|
//~~~~~~~
|
||||||
|
|
||||||
interfaceMesh1.append(labelList());
|
interfaceMesh1.append(labelList());
|
||||||
@ -175,8 +173,6 @@ void matchPatchFaces
|
|||||||
intMesh1.setSize(nSourcej, -1);
|
intMesh1.setSize(nSourcej, -1);
|
||||||
intMesh1[sourcej] = meshj;
|
intMesh1[sourcej] = meshj;
|
||||||
|
|
||||||
interfaceSource1.append(sourcej);
|
|
||||||
|
|
||||||
interfacePatch1.append(labelList());
|
interfacePatch1.append(labelList());
|
||||||
auto& intPatch1 = interfacePatch1.last();
|
auto& intPatch1 = interfacePatch1.last();
|
||||||
intPatch1.setSize(nSourcej, -1);
|
intPatch1.setSize(nSourcej, -1);
|
||||||
@ -185,6 +181,10 @@ void matchPatchFaces
|
|||||||
interfaceNames1.append(wordList());
|
interfaceNames1.append(wordList());
|
||||||
auto& intNames1 = interfaceNames1.last();
|
auto& intNames1 = interfaceNames1.last();
|
||||||
intNames1.setSize(nSourcej);
|
intNames1.setSize(nSourcej);
|
||||||
|
//intNames1[sourcej] =
|
||||||
|
// meshes[meshj].name()
|
||||||
|
// + "_to_"
|
||||||
|
// + meshes[meshi].name();
|
||||||
intNames1[sourcej] =
|
intNames1[sourcej] =
|
||||||
patchName(entryName, meshes[meshj], meshes[meshi]);
|
patchName(entryName, meshes[meshj], meshes[meshi]);
|
||||||
|
|
||||||
@ -283,13 +283,11 @@ void matchPatchFaces
|
|||||||
List<PtrList<dictionary>> patchInfoDicts,
|
List<PtrList<dictionary>> patchInfoDicts,
|
||||||
|
|
||||||
DynamicList<labelList>& interfaceMesh0,
|
DynamicList<labelList>& interfaceMesh0,
|
||||||
DynamicList<label>& interfaceSource0,
|
|
||||||
DynamicList<labelList>& interfacePatch0,
|
DynamicList<labelList>& interfacePatch0,
|
||||||
DynamicList<List<DynamicList<label>>>& interfaceFaces0,
|
DynamicList<List<DynamicList<label>>>& interfaceFaces0,
|
||||||
DynamicList<wordList>& interfaceNames0,
|
DynamicList<wordList>& interfaceNames0,
|
||||||
|
|
||||||
DynamicList<labelList>& interfaceMesh1,
|
DynamicList<labelList>& interfaceMesh1,
|
||||||
DynamicList<label>& interfaceSource1,
|
|
||||||
DynamicList<labelList>& interfacePatch1,
|
DynamicList<labelList>& interfacePatch1,
|
||||||
DynamicList<List<DynamicList<label>>>& interfaceFaces1,
|
DynamicList<List<DynamicList<label>>>& interfaceFaces1,
|
||||||
DynamicList<wordList>& interfaceNames1
|
DynamicList<wordList>& interfaceNames1
|
||||||
@ -340,13 +338,11 @@ void matchPatchFaces
|
|||||||
patchesj,
|
patchesj,
|
||||||
|
|
||||||
interfaceMesh0,
|
interfaceMesh0,
|
||||||
interfaceSource0,
|
|
||||||
interfacePatch0,
|
interfacePatch0,
|
||||||
interfaceNames0,
|
interfaceNames0,
|
||||||
interfaceFaces0,
|
interfaceFaces0,
|
||||||
|
|
||||||
interfaceMesh1,
|
interfaceMesh1,
|
||||||
interfaceSource1,
|
|
||||||
interfacePatch1,
|
interfacePatch1,
|
||||||
interfaceNames1,
|
interfaceNames1,
|
||||||
interfaceFaces1
|
interfaceFaces1
|
||||||
@ -417,23 +413,10 @@ void changePatchID
|
|||||||
|
|
||||||
if (!isRepatchedBoundary.set(facei-mesh.nInternalFaces()))
|
if (!isRepatchedBoundary.set(facei-mesh.nInternalFaces()))
|
||||||
{
|
{
|
||||||
static label nWarnings = 0;
|
FatalErrorInFunction
|
||||||
if (nWarnings == 0)
|
<< "Face " << facei << " is already marked to be moved"
|
||||||
{
|
<< " to patch " << meshMod.region()[facei]
|
||||||
const label newPatchi = meshMod.region()[facei];
|
<< exit(FatalError);
|
||||||
//FatalErrorInFunction
|
|
||||||
WarningInFunction
|
|
||||||
<< "Face " << facei
|
|
||||||
<< " at " << mesh.faceCentres()[facei]
|
|
||||||
<< " marked for patch " << patchID
|
|
||||||
<< " name " << mesh.boundaryMesh()[patchID].name()
|
|
||||||
<< " is already marked for patch " << newPatchi
|
|
||||||
<< " name " << mesh.boundaryMesh()[newPatchi].name()
|
|
||||||
<< ". Suppressing further warnings"
|
|
||||||
//<< exit(FatalError);
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
nWarnings++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changePatchID(mesh, facei, patchID, meshMod);
|
changePatchID(mesh, facei, patchID, meshMod);
|
||||||
@ -738,6 +721,7 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
|
|
||||||
#include "addOverwriteOption.H"
|
#include "addOverwriteOption.H"
|
||||||
|
//#include "addRegionOption.H"
|
||||||
#include "addAllRegionOptions.H"
|
#include "addAllRegionOptions.H"
|
||||||
|
|
||||||
argList::addOption("dict", "file", "Alternative createPatchDict");
|
argList::addOption("dict", "file", "Alternative createPatchDict");
|
||||||
@ -796,25 +780,17 @@ int main(int argc, char *argv[])
|
|||||||
forAll(patchSources, sourcei)
|
forAll(patchSources, sourcei)
|
||||||
{
|
{
|
||||||
const auto& pDict = patchSources[sourcei];
|
const auto& pDict = patchSources[sourcei];
|
||||||
patchNames[meshi][sourcei] = pDict.getOrDefault<word>
|
patchNames[meshi][sourcei] = pDict.get<word>("name");
|
||||||
(
|
|
||||||
"name",
|
|
||||||
word::null,
|
|
||||||
keyType::LITERAL
|
|
||||||
);
|
|
||||||
|
|
||||||
patchInfoDicts[meshi].set
|
patchInfoDicts[meshi].set
|
||||||
(
|
(
|
||||||
sourcei,
|
sourcei,
|
||||||
new dictionary(pDict.subDict("patchInfo"))
|
new dictionary(pDict.subDict("patchInfo"))
|
||||||
);
|
);
|
||||||
dictionary& patchDict = patchInfoDicts[meshi][sourcei];
|
const dictionary& patchDict = patchInfoDicts[meshi][sourcei];
|
||||||
if (patchDict.found("AMIMethod"))
|
if (patchDict.found("AMIMethod"))
|
||||||
{
|
{
|
||||||
matchMethods[meshi][sourcei] = patchDict.get<word>("AMIMethod");
|
matchMethods[meshi][sourcei] = patchDict.get<word>("AMIMethod");
|
||||||
// Disable full matching since we're trying to use AMIMethod to
|
|
||||||
// find out actual overlap
|
|
||||||
patchDict.add("requireMatch", false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wordRes matchNames;
|
wordRes matchNames;
|
||||||
@ -841,11 +817,9 @@ int main(int argc, char *argv[])
|
|||||||
// It matches all mesh against each other. Lower numbered mesh gets
|
// It matches all mesh against each other. Lower numbered mesh gets
|
||||||
// postfix 0, higher numbered mesh postfix 1.
|
// postfix 0, higher numbered mesh postfix 1.
|
||||||
|
|
||||||
// Per interface, per patchSource:
|
// Per interface, per mesh, per patchSource:
|
||||||
// 1. the lower numbered mesh
|
// 1. the lower numbered mesh
|
||||||
DynamicList<labelList> interfaceMesh0;
|
DynamicList<labelList> interfaceMesh0;
|
||||||
// 1b. the source index (i.e. the patch dictionary)
|
|
||||||
DynamicList<label> interfaceSource0;
|
|
||||||
// 2. the patch on the interfaceMesh0
|
// 2. the patch on the interfaceMesh0
|
||||||
DynamicList<labelList> interfacePatch0;
|
DynamicList<labelList> interfacePatch0;
|
||||||
// 3. the facelabels on the interfaceMesh0
|
// 3. the facelabels on the interfaceMesh0
|
||||||
@ -855,7 +829,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Same for the higher numbered mesh
|
// Same for the higher numbered mesh
|
||||||
DynamicList<labelList> interfaceMesh1;
|
DynamicList<labelList> interfaceMesh1;
|
||||||
DynamicList<label> interfaceSource1;
|
|
||||||
DynamicList<labelList> interfacePatch1;
|
DynamicList<labelList> interfacePatch1;
|
||||||
DynamicList<List<DynamicList<label>>> interfaceFaces1;
|
DynamicList<List<DynamicList<label>>> interfaceFaces1;
|
||||||
DynamicList<wordList> interfaceNames1;
|
DynamicList<wordList> interfaceNames1;
|
||||||
@ -870,17 +843,15 @@ int main(int argc, char *argv[])
|
|||||||
interRegionSources,
|
interRegionSources,
|
||||||
patchNames,
|
patchNames,
|
||||||
matchPatchIDs,
|
matchPatchIDs,
|
||||||
matchMethods,
|
matchMethods, //faceAreaWeightAMI2D::typeName,
|
||||||
patchInfoDicts,
|
patchInfoDicts,
|
||||||
|
|
||||||
interfaceMesh0,
|
interfaceMesh0,
|
||||||
interfaceSource0,
|
|
||||||
interfacePatch0,
|
interfacePatch0,
|
||||||
interfaceFaces0,
|
interfaceFaces0,
|
||||||
interfaceNames0,
|
interfaceNames0,
|
||||||
|
|
||||||
interfaceMesh1,
|
interfaceMesh1,
|
||||||
interfaceSource1,
|
|
||||||
interfacePatch1,
|
interfacePatch1,
|
||||||
interfaceFaces1,
|
interfaceFaces1,
|
||||||
interfaceNames1
|
interfaceNames1
|
||||||
@ -888,7 +859,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Read fields
|
// Read fields
|
||||||
List<PtrList<volScalarField>> vsFlds(meshes.size());
|
List<PtrList<volScalarField>> vsFlds(meshes.size());
|
||||||
List<PtrList<volVectorField>> vvFlds(meshes.size());
|
List<PtrList<volVectorField>> vvFlds(meshes.size());
|
||||||
@ -944,9 +914,6 @@ int main(int argc, char *argv[])
|
|||||||
forAll(meshes, meshi)
|
forAll(meshes, meshi)
|
||||||
{
|
{
|
||||||
fvMesh& mesh = meshes[meshi];
|
fvMesh& mesh = meshes[meshi];
|
||||||
|
|
||||||
Info<< "\n\nAdding patches to mesh " << mesh.name() << nl << endl;
|
|
||||||
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
const dictionary& dict = dicts[meshi];
|
const dictionary& dict = dicts[meshi];
|
||||||
|
|
||||||
@ -966,20 +933,11 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
const dictionary& dict = patchSources[sourcei];
|
const dictionary& dict = patchSources[sourcei];
|
||||||
const word sourceType(dict.get<word>("constructFrom"));
|
const word sourceType(dict.get<word>("constructFrom"));
|
||||||
const word patchName
|
const word patchName(dict.get<word>("name"));
|
||||||
(
|
|
||||||
dict.getOrDefault<word>
|
|
||||||
(
|
|
||||||
"name",
|
|
||||||
word::null,
|
|
||||||
keyType::LITERAL
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionary patchDict(patchInfoDicts[meshi][sourcei]);
|
dictionary patchDict(dict.subDict("patchInfo"));
|
||||||
patchDict.set("nFaces", 0);
|
patchDict.set("nFaces", 0);
|
||||||
patchDict.set("startFace", 0); // Gets overwritten
|
patchDict.set("startFace", 0); //startFacei);
|
||||||
|
|
||||||
|
|
||||||
if (sourceType == "autoPatch")
|
if (sourceType == "autoPatch")
|
||||||
{
|
{
|
||||||
@ -993,45 +951,42 @@ int main(int argc, char *argv[])
|
|||||||
const labelList& allMeshes1 = interfaceMesh1[inti];
|
const labelList& allMeshes1 = interfaceMesh1[inti];
|
||||||
const wordList& allNames1 = interfaceNames1[inti];
|
const wordList& allNames1 = interfaceNames1[inti];
|
||||||
|
|
||||||
if
|
forAll(allMeshes0, sourcei)
|
||||||
(
|
|
||||||
interfaceSource0[inti] == sourcei
|
|
||||||
&& allMeshes0[sourcei] == meshi
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// Current mesh is mesh0. mesh1 is the remote mesh.
|
if (allMeshes0[sourcei] == meshi)
|
||||||
const label sourcej = interfaceSource1[inti];
|
|
||||||
const word& patchName = allNames0[sourcei];
|
|
||||||
if (patches.findPatchID(patchName) == -1)
|
|
||||||
{
|
{
|
||||||
dictionary allDict(patchDict);
|
const auto& mesh1 = meshes[allMeshes1[sourcei]];
|
||||||
const auto& mesh1 = meshes[allMeshes1[sourcej]];
|
const word& patchName = allNames0[sourcei];
|
||||||
allDict.set("sampleRegion", mesh1.name());
|
if (patches.findPatchID(patchName) == -1)
|
||||||
const auto& destPatch = allNames1[sourcej];
|
{
|
||||||
allDict.set("samplePatch", destPatch);
|
dictionary allDict(patchDict);
|
||||||
allDict.set("neighbourPatch", destPatch);
|
allDict.set("sampleRegion", mesh1.name());
|
||||||
|
const auto& destPatch = allNames1[sourcei];
|
||||||
|
allDict.set("samplePatch", destPatch);
|
||||||
|
allDict.set("neighbourPatch", destPatch);
|
||||||
|
|
||||||
Info<< "Adding new patch " << patchName
|
Info<< "Adding new patch " << patchName
|
||||||
<< " from " << allDict << endl;
|
<< " from " << allDict << endl;
|
||||||
|
|
||||||
autoPtr<polyPatch> ppPtr
|
autoPtr<polyPatch> ppPtr
|
||||||
(
|
|
||||||
polyPatch::New
|
|
||||||
(
|
(
|
||||||
patchName,
|
polyPatch::New
|
||||||
allDict,
|
(
|
||||||
0, // overwritten
|
patchName,
|
||||||
patches
|
allDict,
|
||||||
)
|
0, // overwritten
|
||||||
);
|
patches
|
||||||
fvMeshTools::addPatch
|
)
|
||||||
(
|
);
|
||||||
mesh,
|
fvMeshTools::addPatch
|
||||||
ppPtr(),
|
(
|
||||||
patchDict.subOrEmptyDict("patchFields"),
|
mesh,
|
||||||
calculatedFvPatchScalarField::typeName,
|
ppPtr(),
|
||||||
true
|
patchDict.subOrEmptyDict("patchFields"),
|
||||||
);
|
calculatedFvPatchScalarField::typeName,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1043,46 +998,42 @@ int main(int argc, char *argv[])
|
|||||||
const labelList& allMeshes1 = interfaceMesh1[inti];
|
const labelList& allMeshes1 = interfaceMesh1[inti];
|
||||||
const wordList& allNames1 = interfaceNames1[inti];
|
const wordList& allNames1 = interfaceNames1[inti];
|
||||||
|
|
||||||
if
|
forAll(allMeshes1, sourcei)
|
||||||
(
|
|
||||||
interfaceSource1[inti] == sourcei
|
|
||||||
&& allMeshes1[sourcei] == meshi
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// Current mesh is mesh1. mesh0 is the remote mesh.
|
if (allMeshes1[sourcei] == meshi)
|
||||||
|
|
||||||
const label sourcej = interfaceSource0[inti];
|
|
||||||
const word& patchName = allNames1[sourcei];
|
|
||||||
if (patches.findPatchID(patchName) == -1)
|
|
||||||
{
|
{
|
||||||
dictionary allDict(patchDict);
|
const auto& mesh0 = meshes[allMeshes0[sourcei]];
|
||||||
const auto& destPatch = allNames0[sourcej];
|
const word& patchName = allNames1[sourcei];
|
||||||
const auto& mesh0 = meshes[allMeshes0[sourcej]];
|
if (patches.findPatchID(patchName) == -1)
|
||||||
allDict.set("sampleRegion", mesh0.name());
|
{
|
||||||
allDict.set("samplePatch", destPatch);
|
dictionary allDict(patchDict);
|
||||||
allDict.set("neighbourPatch", destPatch);
|
const auto& destPatch = allNames0[sourcei];
|
||||||
|
allDict.set("sampleRegion", mesh0.name());
|
||||||
|
allDict.set("samplePatch", destPatch);
|
||||||
|
allDict.set("neighbourPatch", destPatch);
|
||||||
|
|
||||||
Info<< "Adding new patch " << patchName
|
Info<< "Adding new patch " << patchName
|
||||||
<< " from " << allDict << endl;
|
<< " from " << allDict << endl;
|
||||||
|
|
||||||
autoPtr<polyPatch> ppPtr
|
autoPtr<polyPatch> ppPtr
|
||||||
(
|
|
||||||
polyPatch::New
|
|
||||||
(
|
(
|
||||||
patchName,
|
polyPatch::New
|
||||||
allDict,
|
(
|
||||||
0, // overwritten
|
patchName,
|
||||||
patches
|
allDict,
|
||||||
)
|
0, // overwritten
|
||||||
);
|
patches
|
||||||
fvMeshTools::addPatch
|
)
|
||||||
(
|
);
|
||||||
mesh,
|
fvMeshTools::addPatch
|
||||||
ppPtr(),
|
(
|
||||||
patchDict.subOrEmptyDict("patchFields"),
|
mesh,
|
||||||
calculatedFvPatchScalarField::typeName,
|
ppPtr(),
|
||||||
true
|
patchDict.subOrEmptyDict("patchFields"),
|
||||||
);
|
calculatedFvPatchScalarField::typeName,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1126,10 +1077,6 @@ int main(int argc, char *argv[])
|
|||||||
forAll(meshes, meshi)
|
forAll(meshes, meshi)
|
||||||
{
|
{
|
||||||
fvMesh& mesh = meshes[meshi];
|
fvMesh& mesh = meshes[meshi];
|
||||||
|
|
||||||
Info<< "\n\nRepatching mesh " << mesh.name() << nl << endl;
|
|
||||||
|
|
||||||
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
const dictionary& dict = dicts[meshi];
|
const dictionary& dict = dicts[meshi];
|
||||||
|
|
||||||
@ -1149,15 +1096,7 @@ int main(int argc, char *argv[])
|
|||||||
forAll(patchSources, sourcei)
|
forAll(patchSources, sourcei)
|
||||||
{
|
{
|
||||||
const dictionary& dict = patchSources[sourcei];
|
const dictionary& dict = patchSources[sourcei];
|
||||||
const word patchName
|
const word patchName(dict.get<word>("name"));
|
||||||
(
|
|
||||||
dict.getOrDefault<word>
|
|
||||||
(
|
|
||||||
"name",
|
|
||||||
word::null,
|
|
||||||
keyType::LITERAL
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const word sourceType(dict.get<word>("constructFrom"));
|
const word sourceType(dict.get<word>("constructFrom"));
|
||||||
|
|
||||||
if (sourceType == "autoPatch")
|
if (sourceType == "autoPatch")
|
||||||
@ -1172,57 +1111,49 @@ int main(int argc, char *argv[])
|
|||||||
const wordList& allNames1 = interfaceNames1[inti];
|
const wordList& allNames1 = interfaceNames1[inti];
|
||||||
const auto& allFaces1 = interfaceFaces1[inti];
|
const auto& allFaces1 = interfaceFaces1[inti];
|
||||||
|
|
||||||
if
|
forAll(allMeshes0, sourcei)
|
||||||
(
|
|
||||||
interfaceSource0[inti] == sourcei
|
|
||||||
&& allMeshes0[sourcei] == meshi
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// Current mesh is mesh0. mesh1 is the remote mesh.
|
if (allMeshes0[sourcei] == meshi)
|
||||||
|
{
|
||||||
|
const label destPatchi =
|
||||||
|
patches.findPatchID(allNames0[sourcei], false);
|
||||||
|
|
||||||
const label destPatchi =
|
Pout<< "Matched mesh:" << mesh.name()
|
||||||
patches.findPatchID(allNames0[sourcei], false);
|
<< " to mesh:"
|
||||||
|
<< meshes[allMeshes1[sourcei]].name()
|
||||||
|
<< " through:" << allNames0[sourcei] << endl;
|
||||||
|
|
||||||
//const auto& mesh1 =
|
changePatchID
|
||||||
// meshes[allMeshes1[interfaceSource1[inti]]];
|
(
|
||||||
//Pout<< "Matched mesh:" << mesh.name()
|
mesh,
|
||||||
// << " to mesh:" << mesh1.name()
|
allFaces0[sourcei],
|
||||||
// << " through:" << allNames0[sourcei] << endl;
|
destPatchi,
|
||||||
|
isRepatchedBoundary,
|
||||||
changePatchID
|
meshMod
|
||||||
(
|
);
|
||||||
mesh,
|
}
|
||||||
allFaces0[sourcei],
|
|
||||||
destPatchi,
|
|
||||||
isRepatchedBoundary,
|
|
||||||
meshMod
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if
|
forAll(allMeshes1, sourcei)
|
||||||
(
|
|
||||||
interfaceSource1[inti] == sourcei
|
|
||||||
&& allMeshes1[sourcei] == meshi
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// Current mesh is mesh1. mesh0 is the remote mesh.
|
if (allMeshes1[sourcei] == meshi)
|
||||||
|
{
|
||||||
|
const label destPatchi =
|
||||||
|
patches.findPatchID(allNames1[sourcei], false);
|
||||||
|
|
||||||
const label destPatchi =
|
Pout<< "Matched mesh:" << mesh.name()
|
||||||
patches.findPatchID(allNames1[sourcei], false);
|
<< " to mesh:"
|
||||||
|
<< meshes[allMeshes0[sourcei]].name()
|
||||||
|
<< " through:" << allNames1[sourcei] << endl;
|
||||||
|
|
||||||
//const auto& mesh0 =
|
changePatchID
|
||||||
// meshes[allMeshes0[interfaceSource0[inti]]];
|
(
|
||||||
//Pout<< "Matched mesh:" << mesh.name()
|
mesh,
|
||||||
// << " to mesh:" << mesh0.name()
|
allFaces1[sourcei],
|
||||||
// << " through:" << allNames1[sourcei] << endl;
|
destPatchi,
|
||||||
|
isRepatchedBoundary,
|
||||||
changePatchID
|
meshMod
|
||||||
(
|
);
|
||||||
mesh,
|
}
|
||||||
allFaces1[sourcei],
|
|
||||||
destPatchi,
|
|
||||||
isRepatchedBoundary,
|
|
||||||
meshMod
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1282,6 +1213,7 @@ int main(int argc, char *argv[])
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Info<< endl;
|
||||||
|
|
||||||
|
|
||||||
// Change mesh, use inflation to reforce calculation of transformation
|
// Change mesh, use inflation to reforce calculation of transformation
|
||||||
@ -1466,6 +1398,10 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
dumpCyclicMatch("final_", mesh);
|
dumpCyclicMatch("final_", mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set the precision of the points data to 10
|
||||||
|
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!overwrite)
|
if (!overwrite)
|
||||||
@ -1482,14 +1418,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the precision of the points data to 10
|
|
||||||
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
|
||||||
|
|
||||||
// Write resulting mesh
|
// Write resulting mesh
|
||||||
forAll(meshes, meshi)
|
forAll(meshes, meshi)
|
||||||
{
|
{
|
||||||
fvMesh& mesh = meshes[meshi];
|
fvMesh& mesh = meshes[meshi];
|
||||||
Info<< "\n\nWriting repatched mesh " << mesh.name()
|
Info<< "Writing repatched mesh " << mesh.name()
|
||||||
<< " to " << runTime.timeName() << nl << endl;
|
<< " to " << runTime.timeName() << nl << endl;
|
||||||
mesh.clearOut(); // remove meshPhi
|
mesh.clearOut(); // remove meshPhi
|
||||||
mesh.write();
|
mesh.write();
|
||||||
|
|||||||
@ -43,8 +43,9 @@ Description
|
|||||||
- volScalarField with regions as different scalars (-detectOnly)
|
- volScalarField with regions as different scalars (-detectOnly)
|
||||||
or
|
or
|
||||||
- mesh with multiple regions and mapped patches. These patches
|
- mesh with multiple regions and mapped patches. These patches
|
||||||
either cover the whole interface between two region (default) or
|
either cover the whole interface between two region (default),
|
||||||
only part according to faceZones (-useFaceZones)
|
only part according to faceZones (-useFaceZones) or be auto-generated
|
||||||
|
according to an AMI method (see below)
|
||||||
or
|
or
|
||||||
- mesh with cells put into cellZones (-makeCellZones)
|
- mesh with cells put into cellZones (-makeCellZones)
|
||||||
|
|
||||||
@ -98,6 +99,14 @@ Description
|
|||||||
- boundaryRegionAddressing : for every patch in this region the
|
- boundaryRegionAddressing : for every patch in this region the
|
||||||
patch in the original mesh (or -1 if added patch)
|
patch in the original mesh (or -1 if added patch)
|
||||||
|
|
||||||
|
- auto-generate patches using AMI area-overlap detection. This requires a
|
||||||
|
patchSet to apply it to and an optional AMIMethod (default is
|
||||||
|
faceAreaWeightAMI2D).
|
||||||
|
-autoPatch '("solid*")'
|
||||||
|
-AMIMethod faceAreaWeightAMI2D
|
||||||
|
Any mapped patch thus generated should probably use the
|
||||||
|
nearestPatchFaceAMI sampling method.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
@ -116,6 +125,7 @@ Description
|
|||||||
#include "fvMeshTools.H"
|
#include "fvMeshTools.H"
|
||||||
#include "zeroGradientFvPatchFields.H"
|
#include "zeroGradientFvPatchFields.H"
|
||||||
#include "processorMeshes.H"
|
#include "processorMeshes.H"
|
||||||
|
#include "faceAreaWeightAMI2D.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -317,12 +327,115 @@ void addToInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
labelList getMinBoundaryValue
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const word& AMIMethod,
|
||||||
|
const labelList& matchPatchIDs,
|
||||||
|
const labelList& cellRegion
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Neighbour cellRegion.
|
||||||
|
labelList coupledRegion(mesh.nBoundaryFaces());
|
||||||
|
|
||||||
|
forAll(coupledRegion, i)
|
||||||
|
{
|
||||||
|
label celli = mesh.faceOwner()[i+mesh.nInternalFaces()];
|
||||||
|
coupledRegion[i] = cellRegion[celli];
|
||||||
|
}
|
||||||
|
syncTools::swapBoundaryFaceList(mesh, coupledRegion);
|
||||||
|
|
||||||
|
// Add approximate matches
|
||||||
|
forAll(matchPatchIDs, i)
|
||||||
|
{
|
||||||
|
const label patchi = matchPatchIDs[i];
|
||||||
|
const auto& pp = mesh.boundaryMesh()[patchi];
|
||||||
|
|
||||||
|
for (label j = i+1; j < matchPatchIDs.size(); ++j)
|
||||||
|
{
|
||||||
|
const label nbrPatchi = matchPatchIDs[j];
|
||||||
|
const auto& nbrPp = mesh.boundaryMesh()[nbrPatchi];
|
||||||
|
|
||||||
|
// Use AMI to try and find matches
|
||||||
|
auto AMPtr(AMIInterpolation::New(AMIMethod));
|
||||||
|
|
||||||
|
AMPtr->calculate(pp, nbrPp, nullptr);
|
||||||
|
if
|
||||||
|
(
|
||||||
|
gAverage(AMPtr->tgtWeightsSum()) > SMALL
|
||||||
|
|| gAverage(AMPtr->srcWeightsSum()) > SMALL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Pull remote data local
|
||||||
|
labelList thisDecomp(pp.size(), labelMax);
|
||||||
|
AMPtr->interpolateToSource
|
||||||
|
(
|
||||||
|
labelList(cellRegion, nbrPp.faceCells()),
|
||||||
|
[]
|
||||||
|
(
|
||||||
|
label& res,
|
||||||
|
const label facei,
|
||||||
|
const label& fld,
|
||||||
|
const scalar& w
|
||||||
|
)
|
||||||
|
{
|
||||||
|
res = min(res, fld);
|
||||||
|
},
|
||||||
|
thisDecomp,
|
||||||
|
thisDecomp // used in case of low-weight-corr
|
||||||
|
);
|
||||||
|
|
||||||
|
// Put thisDecomp into coupledRegion. Check for unmatched faces.
|
||||||
|
forAll(thisDecomp, i)
|
||||||
|
{
|
||||||
|
if (thisDecomp[i] != labelMax)
|
||||||
|
{
|
||||||
|
coupledRegion[pp.offset()+i] = thisDecomp[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
labelList nbrDecomp(nbrPp.size(), labelMax);
|
||||||
|
AMPtr->interpolateToTarget
|
||||||
|
(
|
||||||
|
labelList(cellRegion, pp.faceCells()), //thisDecomp,
|
||||||
|
[]
|
||||||
|
(
|
||||||
|
label& res,
|
||||||
|
const label facei,
|
||||||
|
const label& fld,
|
||||||
|
const scalar& w
|
||||||
|
)
|
||||||
|
{
|
||||||
|
res = min(res, fld);
|
||||||
|
},
|
||||||
|
nbrDecomp,
|
||||||
|
nbrDecomp // used in case of low-weight-corr
|
||||||
|
);
|
||||||
|
|
||||||
|
// Put nbrDecomp into coupledRegion. Check for unmatched faces/
|
||||||
|
forAll(nbrDecomp, i)
|
||||||
|
{
|
||||||
|
if (nbrDecomp[i] != labelMax)
|
||||||
|
{
|
||||||
|
coupledRegion[nbrPp.offset()+i] = nbrDecomp[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return coupledRegion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get region-region interface name and sizes.
|
// Get region-region interface name and sizes.
|
||||||
// Returns interfaces as straight list for looping in identical order.
|
// Returns interfaces as straight list for looping in identical order.
|
||||||
void getInterfaceSizes
|
void getInterfaceSizes
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const bool useFaceZones,
|
const bool useFaceZones,
|
||||||
|
const word& AMIMethod,
|
||||||
|
const labelList& matchPatchIDs,
|
||||||
const labelList& cellRegion,
|
const labelList& cellRegion,
|
||||||
const wordList& regionNames,
|
const wordList& regionNames,
|
||||||
|
|
||||||
@ -361,15 +474,16 @@ void getInterfaceSizes
|
|||||||
// Boundary faces
|
// Boundary faces
|
||||||
// ~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~
|
||||||
|
|
||||||
// Neighbour cellRegion.
|
const labelList coupledRegion
|
||||||
labelList coupledRegion(mesh.nBoundaryFaces());
|
(
|
||||||
|
getMinBoundaryValue
|
||||||
forAll(coupledRegion, i)
|
(
|
||||||
{
|
mesh,
|
||||||
label celli = mesh.faceOwner()[i+mesh.nInternalFaces()];
|
AMIMethod,
|
||||||
coupledRegion[i] = cellRegion[celli];
|
matchPatchIDs,
|
||||||
}
|
cellRegion
|
||||||
syncTools::swapBoundaryFaceList(mesh, coupledRegion);
|
)
|
||||||
|
);
|
||||||
|
|
||||||
forAll(coupledRegion, i)
|
forAll(coupledRegion, i)
|
||||||
{
|
{
|
||||||
@ -583,6 +697,8 @@ autoPtr<mapPolyMesh> createRegionMesh
|
|||||||
const labelList& cellRegion,
|
const labelList& cellRegion,
|
||||||
const label regionI,
|
const label regionI,
|
||||||
const word& regionName,
|
const word& regionName,
|
||||||
|
const word& AMIMethod,
|
||||||
|
const labelList& matchPatchIDs,
|
||||||
// Interface info
|
// Interface info
|
||||||
const labelList& interfacePatches,
|
const labelList& interfacePatches,
|
||||||
const labelList& faceToInterface,
|
const labelList& faceToInterface,
|
||||||
@ -594,15 +710,16 @@ autoPtr<mapPolyMesh> createRegionMesh
|
|||||||
fvMeshTools::createDummyFvMeshFiles(mesh, regionName, true);
|
fvMeshTools::createDummyFvMeshFiles(mesh, regionName, true);
|
||||||
|
|
||||||
// Neighbour cellRegion.
|
// Neighbour cellRegion.
|
||||||
labelList coupledRegion(mesh.nBoundaryFaces());
|
const labelList coupledRegion
|
||||||
|
(
|
||||||
forAll(coupledRegion, i)
|
getMinBoundaryValue
|
||||||
{
|
(
|
||||||
label celli = mesh.faceOwner()[i+mesh.nInternalFaces()];
|
mesh,
|
||||||
coupledRegion[i] = cellRegion[celli];
|
AMIMethod,
|
||||||
}
|
matchPatchIDs,
|
||||||
syncTools::swapBoundaryFaceList(mesh, coupledRegion);
|
cellRegion
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Topology change container. Start off from existing mesh.
|
// Topology change container. Start off from existing mesh.
|
||||||
polyTopoChange meshMod(mesh);
|
polyTopoChange meshMod(mesh);
|
||||||
@ -621,20 +738,16 @@ autoPtr<mapPolyMesh> createRegionMesh
|
|||||||
labelList exposedPatchIDs(exposedFaces.size());
|
labelList exposedPatchIDs(exposedFaces.size());
|
||||||
forAll(exposedFaces, i)
|
forAll(exposedFaces, i)
|
||||||
{
|
{
|
||||||
label facei = exposedFaces[i];
|
const label facei = exposedFaces[i];
|
||||||
label interfacei = faceToInterface[facei];
|
const label interfacei = faceToInterface[facei];
|
||||||
|
|
||||||
label ownRegion = cellRegion[mesh.faceOwner()[facei]];
|
const label ownRegion = cellRegion[mesh.faceOwner()[facei]];
|
||||||
label neiRegion = -1;
|
const label neiRegion
|
||||||
|
(
|
||||||
if (mesh.isInternalFace(facei))
|
mesh.isInternalFace(facei)
|
||||||
{
|
? cellRegion[mesh.faceNeighbour()[facei]]
|
||||||
neiRegion = cellRegion[mesh.faceNeighbour()[facei]];
|
: coupledRegion[facei-mesh.nInternalFaces()]
|
||||||
}
|
);
|
||||||
else
|
|
||||||
{
|
|
||||||
neiRegion = coupledRegion[facei-mesh.nInternalFaces()];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Check which side is being kept - determines which of the two
|
// Check which side is being kept - determines which of the two
|
||||||
@ -681,6 +794,62 @@ autoPtr<mapPolyMesh> createRegionMesh
|
|||||||
meshMod
|
meshMod
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Do re-patching on non-removed cells ourselves. These are not exposed
|
||||||
|
// faces but are boundary faces
|
||||||
|
for (label bFacei = 0; bFacei < mesh.nBoundaryFaces(); bFacei++)
|
||||||
|
{
|
||||||
|
const label facei = mesh.nInternalFaces()+bFacei;
|
||||||
|
|
||||||
|
if (!meshMod.faceRemoved(facei))
|
||||||
|
{
|
||||||
|
const label interfacei = faceToInterface[facei];
|
||||||
|
const label ownRegion = cellRegion[mesh.faceOwner()[facei]];
|
||||||
|
const label neiRegion = coupledRegion[bFacei];
|
||||||
|
|
||||||
|
label exposedPatchID = -1;
|
||||||
|
if (ownRegion == regionI)
|
||||||
|
{
|
||||||
|
if (regionI < neiRegion)
|
||||||
|
{
|
||||||
|
exposedPatchID = interfacePatches[interfacei];
|
||||||
|
}
|
||||||
|
else if (regionI > neiRegion)
|
||||||
|
{
|
||||||
|
exposedPatchID = interfacePatches[interfacei]+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (neiRegion == regionI)
|
||||||
|
{
|
||||||
|
if (regionI < ownRegion)
|
||||||
|
{
|
||||||
|
exposedPatchID = interfacePatches[interfacei];
|
||||||
|
}
|
||||||
|
else if (regionI > ownRegion)
|
||||||
|
{
|
||||||
|
exposedPatchID = interfacePatches[interfacei]+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exposedPatchID != -1)
|
||||||
|
{
|
||||||
|
// In-place modify the patch
|
||||||
|
DynamicList<label>& patchID =
|
||||||
|
const_cast<DynamicList<label>&>(meshMod.region());
|
||||||
|
|
||||||
|
//Pout<< "For face:" << facei
|
||||||
|
// << " on interface:" << interfacei
|
||||||
|
// << " modifying from own:" << meshMod.faceOwner()[facei]
|
||||||
|
// << " nei:" << meshMod.faceNeighbour()[facei]
|
||||||
|
// << " verts:" << meshMod.faces()[facei]
|
||||||
|
// << " patch " << patchID[facei]
|
||||||
|
// << " to " << exposedPatchID << endl;
|
||||||
|
patchID[facei] = exposedPatchID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
autoPtr<mapPolyMesh> map = meshMod.makeMesh
|
autoPtr<mapPolyMesh> map = meshMod.makeMesh
|
||||||
(
|
(
|
||||||
newMesh,
|
newMesh,
|
||||||
@ -705,6 +874,8 @@ void createAndWriteRegion
|
|||||||
const labelList& cellRegion,
|
const labelList& cellRegion,
|
||||||
const wordList& regionNames,
|
const wordList& regionNames,
|
||||||
const bool prefixRegion,
|
const bool prefixRegion,
|
||||||
|
const word& AMIMethod,
|
||||||
|
const labelList& matchPatchIDs,
|
||||||
const labelList& faceToInterface,
|
const labelList& faceToInterface,
|
||||||
const labelList& interfacePatches,
|
const labelList& interfacePatches,
|
||||||
const label regionI,
|
const label regionI,
|
||||||
@ -721,6 +892,8 @@ void createAndWriteRegion
|
|||||||
cellRegion,
|
cellRegion,
|
||||||
regionI,
|
regionI,
|
||||||
regionNames[regionI],
|
regionNames[regionI],
|
||||||
|
AMIMethod,
|
||||||
|
matchPatchIDs,
|
||||||
interfacePatches,
|
interfacePatches,
|
||||||
faceToInterface,
|
faceToInterface,
|
||||||
newMesh
|
newMesh
|
||||||
@ -1019,6 +1192,7 @@ labelList addRegionPatches
|
|||||||
const wordList& regionNames,
|
const wordList& regionNames,
|
||||||
const edgeList& interfaces,
|
const edgeList& interfaces,
|
||||||
const List<Pair<word>>& interfaceNames
|
const List<Pair<word>>& interfaceNames
|
||||||
|
//const List<mappedPatchBase::sampleMode>& interfaceModes
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< nl << "Adding patches" << nl << endl;
|
Info<< nl << "Adding patches" << nl << endl;
|
||||||
@ -1042,7 +1216,7 @@ labelList addRegionPatches
|
|||||||
0, // overridden
|
0, // overridden
|
||||||
0, // overridden
|
0, // overridden
|
||||||
regionNames[e[1]], // sampleRegion
|
regionNames[e[1]], // sampleRegion
|
||||||
mappedPatchBase::NEARESTPATCHFACE,
|
mappedPatchBase::NEARESTPATCHFACE, //interfaceModes[interI]
|
||||||
names[1], // samplePatch
|
names[1], // samplePatch
|
||||||
point::zero, // offset
|
point::zero, // offset
|
||||||
mesh.boundaryMesh()
|
mesh.boundaryMesh()
|
||||||
@ -1064,7 +1238,7 @@ labelList addRegionPatches
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
regionNames[e[0]], // sampleRegion
|
regionNames[e[0]], // sampleRegion
|
||||||
mappedPatchBase::NEARESTPATCHFACE,
|
mappedPatchBase::NEARESTPATCHFACE, //interfaceModes[interI]
|
||||||
names[0],
|
names[0],
|
||||||
point::zero, // offset
|
point::zero, // offset
|
||||||
mesh.boundaryMesh()
|
mesh.boundaryMesh()
|
||||||
@ -1455,6 +1629,7 @@ int main(int argc, char *argv[])
|
|||||||
"Split mesh into multiple regions (detected by walking across faces)"
|
"Split mesh into multiple regions (detected by walking across faces)"
|
||||||
);
|
);
|
||||||
#include "addRegionOption.H"
|
#include "addRegionOption.H"
|
||||||
|
|
||||||
#include "addOverwriteOption.H"
|
#include "addOverwriteOption.H"
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
@ -1521,6 +1696,18 @@ int main(int argc, char *argv[])
|
|||||||
"useFaceZones",
|
"useFaceZones",
|
||||||
"Use faceZones to patch inter-region faces instead of single patch"
|
"Use faceZones to patch inter-region faces instead of single patch"
|
||||||
);
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"autoPatch",
|
||||||
|
"lists of patches",
|
||||||
|
"Find overlapping faces to auto-generate interface patches"
|
||||||
|
);
|
||||||
|
argList::addOption
|
||||||
|
(
|
||||||
|
"AMIMethod",
|
||||||
|
"word",
|
||||||
|
"type of AMI matching method"
|
||||||
|
);
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"prefixRegion",
|
"prefixRegion",
|
||||||
@ -1533,6 +1720,12 @@ int main(int argc, char *argv[])
|
|||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createNamedMesh.H"
|
#include "createNamedMesh.H"
|
||||||
|
|
||||||
|
|
||||||
|
// Note: could try to read multiple meshes and merge into one before
|
||||||
|
// operation but this would give problems with unique prefixes:
|
||||||
|
// - patches get renamed. So patchFields would need to be renamed.
|
||||||
|
// - what about e.g. 'samplePatch' in mapped patches?
|
||||||
|
|
||||||
const word oldInstance = mesh.pointsInstance();
|
const word oldInstance = mesh.pointsInstance();
|
||||||
|
|
||||||
word blockedFacesName;
|
word blockedFacesName;
|
||||||
@ -1556,6 +1749,14 @@ int main(int argc, char *argv[])
|
|||||||
const bool useFaceZones = args.found("useFaceZones");
|
const bool useFaceZones = args.found("useFaceZones");
|
||||||
const bool prefixRegion = args.found("prefixRegion");
|
const bool prefixRegion = args.found("prefixRegion");
|
||||||
|
|
||||||
|
labelList matchPatchIDs;
|
||||||
|
word AMIMethod(faceAreaWeightAMI2D::typeName);
|
||||||
|
if (args.found("autoPatch"))
|
||||||
|
{
|
||||||
|
const wordRes patchNames(args.getList<wordRe>("autoPatch"));
|
||||||
|
matchPatchIDs = mesh.boundaryMesh().indices(patchNames);
|
||||||
|
args.readIfPresent("AMIMethod", AMIMethod);
|
||||||
|
}
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -1585,6 +1786,13 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (matchPatchIDs.size())
|
||||||
|
{
|
||||||
|
Info<< "Auto-detecting matching faces out of patches "
|
||||||
|
<< UIndirectList<word>(mesh.boundaryMesh().names(), matchPatchIDs)
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (insidePoint && largestOnly)
|
if (insidePoint && largestOnly)
|
||||||
{
|
{
|
||||||
@ -1652,8 +1860,8 @@ int main(int argc, char *argv[])
|
|||||||
<< " This requires all"
|
<< " This requires all"
|
||||||
<< " cells to be in one and only one cellZone." << nl << endl;
|
<< " cells to be in one and only one cellZone." << nl << endl;
|
||||||
|
|
||||||
// Collect sets of zones into clusters. If no cluster is just an identity
|
// Collect sets of zones into clusters. If no cluster is just an
|
||||||
// list (cluster 0 is cellZone 0 etc.)
|
// identity list (cluster 0 is cellZone 0 etc.)
|
||||||
wordList clusterNames;
|
wordList clusterNames;
|
||||||
labelListList clusterToZones;
|
labelListList clusterToZones;
|
||||||
labelList zoneToCluster;
|
labelList zoneToCluster;
|
||||||
@ -1968,6 +2176,8 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
useFaceZones,
|
useFaceZones,
|
||||||
|
AMIMethod,
|
||||||
|
matchPatchIDs,
|
||||||
cellRegion,
|
cellRegion,
|
||||||
regionNames,
|
regionNames,
|
||||||
|
|
||||||
@ -2147,6 +2357,7 @@ int main(int argc, char *argv[])
|
|||||||
regionNames,
|
regionNames,
|
||||||
interfaces,
|
interfaces,
|
||||||
interfaceNames
|
interfaceNames
|
||||||
|
//interfaceModes
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2199,6 +2410,8 @@ int main(int argc, char *argv[])
|
|||||||
cellRegion,
|
cellRegion,
|
||||||
regionNames,
|
regionNames,
|
||||||
prefixRegion,
|
prefixRegion,
|
||||||
|
AMIMethod,
|
||||||
|
matchPatchIDs,
|
||||||
faceToInterface,
|
faceToInterface,
|
||||||
interfacePatches,
|
interfacePatches,
|
||||||
regionI,
|
regionI,
|
||||||
@ -2220,6 +2433,8 @@ int main(int argc, char *argv[])
|
|||||||
cellRegion,
|
cellRegion,
|
||||||
regionNames,
|
regionNames,
|
||||||
prefixRegion,
|
prefixRegion,
|
||||||
|
AMIMethod,
|
||||||
|
matchPatchIDs,
|
||||||
faceToInterface,
|
faceToInterface,
|
||||||
interfacePatches,
|
interfacePatches,
|
||||||
regionI,
|
regionI,
|
||||||
@ -2241,6 +2456,8 @@ int main(int argc, char *argv[])
|
|||||||
cellRegion,
|
cellRegion,
|
||||||
regionNames,
|
regionNames,
|
||||||
prefixRegion,
|
prefixRegion,
|
||||||
|
AMIMethod,
|
||||||
|
matchPatchIDs,
|
||||||
faceToInterface,
|
faceToInterface,
|
||||||
interfacePatches,
|
interfacePatches,
|
||||||
regionI,
|
regionI,
|
||||||
|
|||||||
@ -1,14 +1,9 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
|
||||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
|
||||||
-I$(LIB_SRC)/sampling/lnInclude \
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
-I$(LIB_SRC)/randomProcesses/lnInclude \
|
-I$(LIB_SRC)/randomProcesses/lnInclude \
|
||||||
-I$(FFTW_INC_DIR)
|
-I$(FFTW_INC_DIR)
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lfileFormats \
|
|
||||||
-lsurfMesh \
|
|
||||||
-lmeshTools \
|
|
||||||
-lsampling \
|
-lsampling \
|
||||||
-lrandomProcesses
|
-lrandomProcesses
|
||||||
|
|||||||
@ -1,13 +1,9 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
|
||||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/randomProcesses/lnInclude
|
-I$(LIB_SRC)/randomProcesses/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lfileFormats \
|
|
||||||
-lsurfMesh \
|
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-lrandomProcesses
|
-lrandomProcesses
|
||||||
|
|||||||
@ -480,8 +480,6 @@ castellatedMeshControls
|
|||||||
// when generating meshes with faceZones as baffles or boundary
|
// when generating meshes with faceZones as baffles or boundary
|
||||||
// faces.
|
// faces.
|
||||||
//minCellFraction 0.001;
|
//minCellFraction 0.001;
|
||||||
// Optional: same but in absolute number of cells. Default is 0.
|
|
||||||
//nMinCells 100;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings for the snapping.
|
// Settings for the snapping.
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
| ========= | |
|
| ========= | |
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
| \\ / O peration | Version: v2206 |
|
| \\ / O peration | Version: v2112 |
|
||||||
| \\ / A nd | Website: www.openfoam.com |
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
| \\/ M anipulation | |
|
| \\/ M anipulation | |
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -26,7 +26,7 @@ Documentation
|
|||||||
(
|
(
|
||||||
"$WM_PROJECT_USER_DIR/html"
|
"$WM_PROJECT_USER_DIR/html"
|
||||||
"$WM_PROJECT_DIR/doc/Doxygen/html"
|
"$WM_PROJECT_DIR/doc/Doxygen/html"
|
||||||
"https://www.openfoam.com/documentation/guides/latest/api/"
|
"https://www.openfoam.com/documentation/guides/latest/doc/"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -365,7 +365,6 @@ $(funcObjs)/logFiles/logFiles.C
|
|||||||
$(funcObjs)/timeControl/timeControl.C
|
$(funcObjs)/timeControl/timeControl.C
|
||||||
$(funcObjs)/timeControl/timeControlFunctionObject.C
|
$(funcObjs)/timeControl/timeControlFunctionObject.C
|
||||||
$(funcObjs)/regionFunctionObject/regionFunctionObject.C
|
$(funcObjs)/regionFunctionObject/regionFunctionObject.C
|
||||||
$(funcObjs)/valueAverageBase/valueAverageBase.C
|
|
||||||
|
|
||||||
Time = db/Time
|
Time = db/Time
|
||||||
$(Time)/TimePaths.C
|
$(Time)/TimePaths.C
|
||||||
@ -595,6 +594,7 @@ meshes/ProcessorTopology/commSchedule.C
|
|||||||
globalMeshData = $(polyMesh)/globalMeshData
|
globalMeshData = $(polyMesh)/globalMeshData
|
||||||
$(globalMeshData)/globalMeshData.C
|
$(globalMeshData)/globalMeshData.C
|
||||||
$(globalMeshData)/globalPoints.C
|
$(globalMeshData)/globalPoints.C
|
||||||
|
$(globalMeshData)/globalIndex.C
|
||||||
|
|
||||||
$(polyMesh)/syncTools/syncTools.C
|
$(polyMesh)/syncTools/syncTools.C
|
||||||
$(polyMesh)/polyMeshTetDecomposition/polyMeshTetDecomposition.C
|
$(polyMesh)/polyMeshTetDecomposition/polyMeshTetDecomposition.C
|
||||||
@ -803,14 +803,22 @@ $(interpolationWeights)/linearInterpolationWeights/linearInterpolationWeights.C
|
|||||||
$(interpolationWeights)/splineInterpolationWeights/splineInterpolationWeights.C
|
$(interpolationWeights)/splineInterpolationWeights/splineInterpolationWeights.C
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
algorithms/indexedOctree/indexedOctreeName.C
|
algorithms/indexedOctree/indexedOctreeName.C
|
||||||
algorithms/indexedOctree/treeDataCell.C
|
algorithms/indexedOctree/treeDataCell.C
|
||||||
algorithms/indexedOctree/volumeType.C
|
algorithms/indexedOctree/volumeType.C
|
||||||
|
|
||||||
|
|
||||||
algorithms/dynamicIndexedOctree/dynamicIndexedOctreeName.C
|
algorithms/dynamicIndexedOctree/dynamicIndexedOctreeName.C
|
||||||
algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C
|
algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C
|
||||||
|
|
||||||
parallel/globalIndex/globalIndex.C
|
graph/curve/curve.C
|
||||||
|
graph/graph.C
|
||||||
|
|
||||||
|
writers = graph/writers
|
||||||
|
$(writers)/rawGraph/rawGraph.C
|
||||||
|
$(writers)/gnuplotGraph/gnuplotGraph.C
|
||||||
|
$(writers)/xmgrGraph/xmgrGraph.C
|
||||||
|
|
||||||
meshes/data/data.C
|
meshes/data/data.C
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -143,14 +143,11 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- True if the number of rows is zero
|
|
||||||
inline bool empty() const noexcept;
|
|
||||||
|
|
||||||
//- The primary size (the number of rows)
|
//- The primary size (the number of rows)
|
||||||
inline label size() const noexcept;
|
inline label size() const noexcept;
|
||||||
|
|
||||||
//- The total addressed size
|
//- True if the number of rows is zero
|
||||||
inline label totalSize() const;
|
inline bool empty() const noexcept;
|
||||||
|
|
||||||
//- Return the offset table (= size()+1)
|
//- Return the offset table (= size()+1)
|
||||||
inline const List<label>& offsets() const;
|
inline const List<label>& offsets() const;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -123,13 +123,6 @@ Foam::CompactListList<T, Container>::null()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, class Container>
|
|
||||||
inline bool Foam::CompactListList<T, Container>::empty() const noexcept
|
|
||||||
{
|
|
||||||
return !size_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class T, class Container>
|
template<class T, class Container>
|
||||||
inline Foam::label Foam::CompactListList<T, Container>::size() const noexcept
|
inline Foam::label Foam::CompactListList<T, Container>::size() const noexcept
|
||||||
{
|
{
|
||||||
@ -138,10 +131,9 @@ inline Foam::label Foam::CompactListList<T, Container>::size() const noexcept
|
|||||||
|
|
||||||
|
|
||||||
template<class T, class Container>
|
template<class T, class Container>
|
||||||
inline Foam::label Foam::CompactListList<T, Container>::totalSize() const
|
inline bool Foam::CompactListList<T, Container>::empty() const noexcept
|
||||||
{
|
{
|
||||||
const label len = (offsets_.size() - 1);
|
return !size_;
|
||||||
return (len < 1) ? static_cast<label>(0) : offsets_[len];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,8 +37,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_SortList_H
|
#ifndef SortList_H
|
||||||
#define Foam_SortList_H
|
#define SortList_H
|
||||||
|
|
||||||
#include "IndirectList.H"
|
#include "IndirectList.H"
|
||||||
|
|
||||||
@ -72,13 +72,13 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return the list of sorted indices (updated every sort).
|
//- Return the list of sorted indices. Updated every sort
|
||||||
// Same as addressing()
|
// Same as addressing()
|
||||||
inline const labelUList& indices() const noexcept;
|
inline const labelUList& indices() const;
|
||||||
|
|
||||||
//- Return the list of indices (updated every sort).
|
//- Return the list of indices. Updated every sort
|
||||||
// Same as addressing()
|
// Same as addressing()
|
||||||
inline labelList& indices() noexcept;
|
inline labelList& indices();
|
||||||
|
|
||||||
//- Reverse the indices
|
//- Reverse the indices
|
||||||
inline void reverse();
|
inline void reverse();
|
||||||
@ -94,13 +94,9 @@ public:
|
|||||||
//- Functionally identical to sort with std::less\<T\>()
|
//- Functionally identical to sort with std::less\<T\>()
|
||||||
inline void sort();
|
inline void sort();
|
||||||
|
|
||||||
//- Reverse (stable) sort the list.
|
//- Reverse (stable) sort the list
|
||||||
//- Functionally identical to sort with std::greater\<T\>()
|
|
||||||
inline void reverseSort();
|
inline void reverseSort();
|
||||||
|
|
||||||
//- Sort the list, only retaining unique entries
|
|
||||||
inline void uniqueSort();
|
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -32,7 +32,7 @@ License
|
|||||||
template<class T>
|
template<class T>
|
||||||
inline Foam::SortList<T>::SortList(const UList<T>& values)
|
inline Foam::SortList<T>::SortList(const UList<T>& values)
|
||||||
:
|
:
|
||||||
IndirectList<T>(values, labelList())
|
IndirectList<T>(values, identity(values.size()))
|
||||||
{
|
{
|
||||||
sort();
|
sort();
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ template<class T>
|
|||||||
template<class Compare>
|
template<class Compare>
|
||||||
inline Foam::SortList<T>::SortList(const UList<T>& values, const Compare& comp)
|
inline Foam::SortList<T>::SortList(const UList<T>& values, const Compare& comp)
|
||||||
:
|
:
|
||||||
IndirectList<T>(values, labelList())
|
IndirectList<T>(values, identity(values.size()))
|
||||||
{
|
{
|
||||||
sort<Compare>(comp);
|
sort<Compare>(comp);
|
||||||
}
|
}
|
||||||
@ -51,14 +51,14 @@ inline Foam::SortList<T>::SortList(const UList<T>& values, const Compare& comp)
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline const Foam::labelUList& Foam::SortList<T>::indices() const noexcept
|
inline const Foam::labelUList& Foam::SortList<T>::indices() const
|
||||||
{
|
{
|
||||||
return this->addressing();
|
return this->addressing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline Foam::labelList& Foam::SortList<T>::indices() noexcept
|
inline Foam::labelList& Foam::SortList<T>::indices()
|
||||||
{
|
{
|
||||||
return this->addressing();
|
return this->addressing();
|
||||||
}
|
}
|
||||||
@ -74,9 +74,10 @@ inline void Foam::SortList<T>::reverse()
|
|||||||
template<class T>
|
template<class T>
|
||||||
inline void Foam::SortList<T>::reset()
|
inline void Foam::SortList<T>::reset()
|
||||||
{
|
{
|
||||||
auto& addr = this->indices();
|
const label len = this->values().size();
|
||||||
|
|
||||||
addr.resize_nocopy(this->values().size());
|
labelList& addr = this->indices();
|
||||||
|
addr.resize(len);
|
||||||
ListOps::identity(addr);
|
ListOps::identity(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,11 +86,14 @@ template<class T>
|
|||||||
template<class Compare>
|
template<class Compare>
|
||||||
inline void Foam::SortList<T>::sort(const Compare& comp)
|
inline void Foam::SortList<T>::sort(const Compare& comp)
|
||||||
{
|
{
|
||||||
auto& vals = this->values();
|
UList<T>& vals = this->values();
|
||||||
auto& addr = this->indices();
|
labelList& addr = this->indices();
|
||||||
|
|
||||||
addr.resize_nocopy(vals.size());
|
if (addr.size() != vals.size())
|
||||||
ListOps::identity(addr);
|
{
|
||||||
|
addr.resize(vals.size());
|
||||||
|
ListOps::identity(addr);
|
||||||
|
}
|
||||||
|
|
||||||
std::stable_sort
|
std::stable_sort
|
||||||
(
|
(
|
||||||
@ -103,26 +107,43 @@ inline void Foam::SortList<T>::sort(const Compare& comp)
|
|||||||
template<class T>
|
template<class T>
|
||||||
inline void Foam::SortList<T>::sort()
|
inline void Foam::SortList<T>::sort()
|
||||||
{
|
{
|
||||||
Foam::sortedOrder(this->values(), this->indices());
|
UList<T>& vals = this->values();
|
||||||
}
|
labelList& addr = this->indices();
|
||||||
|
|
||||||
|
if (addr.size() != vals.size())
|
||||||
|
{
|
||||||
|
addr.resize(vals.size());
|
||||||
|
ListOps::identity(addr);
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
// Forward sort of indices
|
||||||
inline void Foam::SortList<T>::uniqueSort()
|
std::stable_sort
|
||||||
{
|
(
|
||||||
Foam::uniqueOrder(this->values(), this->indices());
|
addr.begin(),
|
||||||
|
addr.end(),
|
||||||
|
[&](label a, label b) -> bool { return vals[a] < vals[b]; }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void Foam::SortList<T>::reverseSort()
|
inline void Foam::SortList<T>::reverseSort()
|
||||||
{
|
{
|
||||||
// Reverse sorted order for indices
|
UList<T>& vals = this->values();
|
||||||
Foam::sortedOrder
|
labelList& addr = this->indices();
|
||||||
|
|
||||||
|
if (addr.size() != vals.size())
|
||||||
|
{
|
||||||
|
addr.resize(vals.size());
|
||||||
|
ListOps::identity(addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reverse sort of indices
|
||||||
|
std::stable_sort
|
||||||
(
|
(
|
||||||
this->values(),
|
addr.begin(),
|
||||||
this->indices(),
|
addr.end(),
|
||||||
typename UList<T>::greater(this->values())
|
[&](label a, label b) -> bool { return vals[b] < vals[a]; }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,8 +37,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_FixedList_H
|
#ifndef FixedList_H
|
||||||
#define Foam_FixedList_H
|
#define FixedList_H
|
||||||
|
|
||||||
#include "bool.H"
|
#include "bool.H"
|
||||||
#include "label.H"
|
#include "label.H"
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,11 +40,6 @@ void Foam::FixedList<T, N>::writeEntry(Ostream& os) const
|
|||||||
if (token::compound::isCompound(tag))
|
if (token::compound::isCompound(tag))
|
||||||
{
|
{
|
||||||
os << tag << token::SPACE;
|
os << tag << token::SPACE;
|
||||||
if (os.format() == IOstream::BINARY && is_contiguous<T>::value)
|
|
||||||
{
|
|
||||||
// Need the size too so that List<Type>::readList parses correctly
|
|
||||||
os << static_cast<label>(N);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
os << *this;
|
os << *this;
|
||||||
}
|
}
|
||||||
@ -160,7 +155,7 @@ Foam::Istream& Foam::FixedList<T, N>::readList
|
|||||||
|
|
||||||
if (is.format() == IOstream::BINARY && is_contiguous<T>::value)
|
if (is.format() == IOstream::BINARY && is_contiguous<T>::value)
|
||||||
{
|
{
|
||||||
// Binary and contiguous. Length is non-zero
|
// Binary and contiguous
|
||||||
|
|
||||||
Detail::readContiguous<T>
|
Detail::readContiguous<T>
|
||||||
(
|
(
|
||||||
@ -174,7 +169,6 @@ Foam::Istream& Foam::FixedList<T, N>::readList
|
|||||||
"FixedList<T, N>::readList(Istream&) : "
|
"FixedList<T, N>::readList(Istream&) : "
|
||||||
"reading the binary block"
|
"reading the binary block"
|
||||||
);
|
);
|
||||||
return is;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -189,22 +183,23 @@ Foam::Istream& Foam::FixedList<T, N>::readList
|
|||||||
if (tok.isCompound())
|
if (tok.isCompound())
|
||||||
{
|
{
|
||||||
// Compound: transfer contents
|
// Compound: transfer contents
|
||||||
// - in practice probably never reach this branch
|
|
||||||
list = dynamicCast<token::Compound<List<T>>>
|
list = dynamicCast<token::Compound<List<T>>>
|
||||||
(
|
(
|
||||||
tok.transferCompoundToken(is)
|
tok.transferCompoundToken(is)
|
||||||
);
|
);
|
||||||
return is;
|
|
||||||
}
|
}
|
||||||
else if (tok.isLabel())
|
else if (tok.isLabel())
|
||||||
{
|
{
|
||||||
|
const label len = tok.labelToken();
|
||||||
|
|
||||||
// List lengths must match
|
// List lengths must match
|
||||||
list.checkSize(tok.labelToken());
|
list.checkSize(len);
|
||||||
}
|
}
|
||||||
else if (!tok.isPunctuation())
|
else if (!tok.isPunctuation())
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction(is)
|
FatalIOErrorInFunction(is)
|
||||||
<< "incorrect first token, expected <label> or '(' , found "
|
<< "incorrect first token, expected <label> "
|
||||||
|
"or '(' or '{', found "
|
||||||
<< tok.info() << nl
|
<< tok.info() << nl
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
@ -233,10 +228,9 @@ Foam::Istream& Foam::FixedList<T, N>::readList
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Uniform content (delimiter == token::BEGIN_BLOCK)
|
// Uniform content (delimiter == token::BEGIN_BLOCK)
|
||||||
// - compatibility for v1812 and earlier (see issue #1160)
|
|
||||||
|
|
||||||
T elem;
|
T val;
|
||||||
is >> elem;
|
is >> val;
|
||||||
|
|
||||||
is.fatalCheck
|
is.fatalCheck
|
||||||
(
|
(
|
||||||
@ -246,7 +240,7 @@ Foam::Istream& Foam::FixedList<T, N>::readList
|
|||||||
|
|
||||||
for (unsigned i=0; i<N; ++i)
|
for (unsigned i=0; i<N; ++i)
|
||||||
{
|
{
|
||||||
list[i] = elem; // Copy the value
|
list[i] = val; // Copy the value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -143,7 +143,7 @@ void Foam::SortableList<T>::reverseSort()
|
|||||||
template<class T>
|
template<class T>
|
||||||
void Foam::SortableList<T>::partialSort(label n, label start)
|
void Foam::SortableList<T>::partialSort(label n, label start)
|
||||||
{
|
{
|
||||||
indices_.resize_nocopy(this->size());
|
indices_.resize(this->size());
|
||||||
ListOps::identity(indices_);
|
ListOps::identity(indices_);
|
||||||
|
|
||||||
// Forward partial sort of indices
|
// Forward partial sort of indices
|
||||||
@ -163,7 +163,7 @@ void Foam::SortableList<T>::partialSort(label n, label start)
|
|||||||
template<class T>
|
template<class T>
|
||||||
void Foam::SortableList<T>::partialReverseSort(label n, label start)
|
void Foam::SortableList<T>::partialReverseSort(label n, label start)
|
||||||
{
|
{
|
||||||
indices_.resize_nocopy(this->size());
|
indices_.resize(this->size());
|
||||||
ListOps::identity(indices_);
|
ListOps::identity(indices_);
|
||||||
|
|
||||||
// Reverse partial sort of indices
|
// Reverse partial sort of indices
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -96,10 +96,13 @@ Foam::label Foam::functionObjects::properties::getTrigger() const
|
|||||||
|
|
||||||
bool Foam::functionObjects::properties::setTrigger
|
bool Foam::functionObjects::properties::setTrigger
|
||||||
(
|
(
|
||||||
const label triggeri
|
const label triggeri,
|
||||||
|
bool increaseOnly
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (triggeri != getTrigger())
|
const label currTriggeri = getTrigger();
|
||||||
|
|
||||||
|
if (increaseOnly ? (triggeri > currTriggeri) : (triggeri != currTriggeri))
|
||||||
{
|
{
|
||||||
set("triggerIndex", triggeri);
|
set("triggerIndex", triggeri);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -123,9 +123,14 @@ public:
|
|||||||
//- Get the current trigger index
|
//- Get the current trigger index
|
||||||
label getTrigger() const;
|
label getTrigger() const;
|
||||||
|
|
||||||
//- Set new trigger index.
|
//- Set the trigger index. Normally only if greater than current
|
||||||
|
//
|
||||||
|
// \param triggeri the new trigger index
|
||||||
|
// \param increaseOnly (default) only change if new index
|
||||||
|
// is greater than the current index.
|
||||||
|
//
|
||||||
// \return True if the index changed
|
// \return True if the index changed
|
||||||
bool setTrigger(const label triggeri);
|
bool setTrigger(const label triggeri, bool increaseOnly = true);
|
||||||
|
|
||||||
//- Set dictionary from named object, return true if set
|
//- Set dictionary from named object, return true if set
|
||||||
bool getObjectDict
|
bool getObjectDict
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -88,10 +88,11 @@ Foam::label Foam::functionObjects::stateFunctionObject::getTrigger() const
|
|||||||
|
|
||||||
bool Foam::functionObjects::stateFunctionObject::setTrigger
|
bool Foam::functionObjects::stateFunctionObject::setTrigger
|
||||||
(
|
(
|
||||||
const label triggeri
|
const label triggeri,
|
||||||
|
bool increaseOnly
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return stateDict().setTrigger(triggeri);
|
return stateDict().setTrigger(triggeri, increaseOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -124,9 +124,14 @@ public:
|
|||||||
//- Get the current trigger index
|
//- Get the current trigger index
|
||||||
label getTrigger() const;
|
label getTrigger() const;
|
||||||
|
|
||||||
//- Set new trigger index.
|
//- Set the trigger index. Normally only if greater than current
|
||||||
|
//
|
||||||
|
// \param triggeri the new trigger index
|
||||||
|
// \param increaseOnly (default) only change if new index
|
||||||
|
// is greater than the current index.
|
||||||
|
//
|
||||||
// \return True if the index changed
|
// \return True if the index changed
|
||||||
bool setTrigger(const label triggeri);
|
bool setTrigger(const label triggeri, bool increaseOnly = true);
|
||||||
|
|
||||||
//- Set dictionary, return true if set
|
//- Set dictionary, return true if set
|
||||||
bool getDict
|
bool getDict
|
||||||
|
|||||||
@ -64,10 +64,11 @@ void Foam::functionObjects::timeControl::readControls()
|
|||||||
timeEnd_ = time_.userTimeToTime(timeEnd_);
|
timeEnd_ = time_.userTimeToTime(timeEnd_);
|
||||||
}
|
}
|
||||||
|
|
||||||
controlMode_ =
|
if (dict_.readIfPresent("triggerStart", triggerStart_))
|
||||||
controlModeNames_.getOrDefault("controlMode", dict_, controlMode::TIME);
|
{
|
||||||
dict_.readIfPresent("triggerStart", triggerStart_);
|
dict_.readIfPresent("triggerEnd", triggerEnd_);
|
||||||
dict_.readIfPresent("triggerEnd", triggerEnd_);
|
controlMode_ = controlModeNames_.get("controlMode", dict_);
|
||||||
|
}
|
||||||
|
|
||||||
deltaTCoeff_ = GREAT;
|
deltaTCoeff_ = GREAT;
|
||||||
if (dict_.readIfPresent("deltaTCoeff", deltaTCoeff_))
|
if (dict_.readIfPresent("deltaTCoeff", deltaTCoeff_))
|
||||||
@ -96,18 +97,6 @@ bool Foam::functionObjects::timeControl::active() const
|
|||||||
|
|
||||||
bool inTrigger = triggeri >= triggerStart_ && triggeri <= triggerEnd_;
|
bool inTrigger = triggeri >= triggerStart_ && triggeri <= triggerEnd_;
|
||||||
|
|
||||||
DebugInFunction
|
|
||||||
<< name() << " mode:" << controlModeNames_[controlMode_] << nl
|
|
||||||
<< " - time:" << time_.value()
|
|
||||||
<< " timeStart:" << timeStart_
|
|
||||||
<< " timeEnd:" << timeEnd_
|
|
||||||
<< " inTime:" << inTime << nl
|
|
||||||
<< " - triggeri:" << triggeri
|
|
||||||
<< " triggerStart:" << triggerStart_
|
|
||||||
<< " triggerEnd:" << triggerEnd_
|
|
||||||
<< " inTrigger:" << inTrigger
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
switch (controlMode_)
|
switch (controlMode_)
|
||||||
{
|
{
|
||||||
case controlMode::TIME:
|
case controlMode::TIME:
|
||||||
@ -465,7 +454,7 @@ Foam::functionObjects::timeControl::timeControl
|
|||||||
controlMode_(controlMode::TIME),
|
controlMode_(controlMode::TIME),
|
||||||
timeStart_(-VGREAT),
|
timeStart_(-VGREAT),
|
||||||
timeEnd_(VGREAT),
|
timeEnd_(VGREAT),
|
||||||
triggerStart_(labelMin),
|
triggerStart_(labelMax),
|
||||||
triggerEnd_(labelMax),
|
triggerEnd_(labelMax),
|
||||||
nStepsToStartTimeChange_(labelMax),
|
nStepsToStartTimeChange_(labelMax),
|
||||||
executeControl_(runTime, dict, "execute"),
|
executeControl_(runTime, dict, "execute"),
|
||||||
|
|||||||
@ -1,238 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | www.openfoam.com
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "valueAverageBase.H"
|
|
||||||
#include "Time.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
const Foam::Enum
|
|
||||||
<
|
|
||||||
Foam::functionObjects::valueAverageBase::windowType
|
|
||||||
>
|
|
||||||
Foam::functionObjects::valueAverageBase::windowTypeNames
|
|
||||||
({
|
|
||||||
{ windowType::NONE, "none" },
|
|
||||||
{ windowType::APPROXIMATE, "approximate" },
|
|
||||||
{ windowType::EXACT, "exact" }
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::functionObjects::valueAverageBase::writeFileHeader(Ostream& os) const
|
|
||||||
{
|
|
||||||
writeHeader(os, "Value averages");
|
|
||||||
writeCommented(os, "Time");
|
|
||||||
forAll(fieldNames_, fieldi)
|
|
||||||
{
|
|
||||||
writeTabbed(os, fieldNames_[fieldi]);
|
|
||||||
}
|
|
||||||
os << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::valueAverageBase::readState(dictionary& dict)
|
|
||||||
{
|
|
||||||
if (resetOnRestart_)
|
|
||||||
{
|
|
||||||
resetState(dict);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(fieldNames_, fieldi)
|
|
||||||
{
|
|
||||||
const word& fieldName = fieldNames_[fieldi];
|
|
||||||
|
|
||||||
if (dict.found(fieldName))
|
|
||||||
{
|
|
||||||
const dictionary& valueDict = dict.subDict(fieldName);
|
|
||||||
valueDict.readEntry("totalTime", totalTime_[fieldi]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dict.set(fieldName, dictionary());
|
|
||||||
totalTime_[fieldi] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::valueAverageBase::writeState(dictionary& dict)
|
|
||||||
{
|
|
||||||
forAll(fieldNames_, fieldi)
|
|
||||||
{
|
|
||||||
const word& fieldName = fieldNames_[fieldi];
|
|
||||||
|
|
||||||
if (dict.found(fieldName))
|
|
||||||
{
|
|
||||||
dictionary& valueDict = dict.subDict(fieldName);
|
|
||||||
valueDict.add("totalTime", totalTime_[fieldi], true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dictionary valueDict;
|
|
||||||
valueDict.add("totalTime", totalTime_[fieldi], true);
|
|
||||||
dict.add(fieldName, valueDict);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::valueAverageBase::resetState(dictionary& dict)
|
|
||||||
{
|
|
||||||
forAll(fieldNames_, fieldi)
|
|
||||||
{
|
|
||||||
dict.set(fieldNames_[fieldi], dictionary());
|
|
||||||
totalTime_[fieldi] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::functionObjects::valueAverageBase::valueAverageBase
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const dictionary& dict,
|
|
||||||
stateFunctionObject& state,
|
|
||||||
const bool writeToFile
|
|
||||||
)
|
|
||||||
:
|
|
||||||
writeFile(obr, name, state.type(), dict, writeToFile),
|
|
||||||
log(true),
|
|
||||||
resetOnRestart_(false),
|
|
||||||
windowType_(windowType::NONE),
|
|
||||||
state_(state),
|
|
||||||
functionObjectName_("unknown-functionObject"),
|
|
||||||
fieldNames_(),
|
|
||||||
tolerance_(dict.getOrDefault<scalar>("tolerance", -1)),
|
|
||||||
window_(-1),
|
|
||||||
totalTime_()
|
|
||||||
{
|
|
||||||
read(dict);
|
|
||||||
|
|
||||||
writeFileHeader(file());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
bool Foam::functionObjects::valueAverageBase::read(const dictionary& dict)
|
|
||||||
{
|
|
||||||
if (writeFile::read(dict))
|
|
||||||
{
|
|
||||||
// Make certain that the values are consistent with the defaults:
|
|
||||||
resetOnRestart_ = false;
|
|
||||||
|
|
||||||
dict.readEntry("functionObject", functionObjectName_);
|
|
||||||
dict.readEntry("fields", fieldNames_);
|
|
||||||
if (dict.readIfPresent("window", window_))
|
|
||||||
{
|
|
||||||
window_ = state_.time().userTimeToTime(window_);
|
|
||||||
|
|
||||||
if (window_ > 0)
|
|
||||||
{
|
|
||||||
windowType_ = windowTypeNames.get("windowType", dict);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
totalTime_.resize(fieldNames_.size(), Zero);
|
|
||||||
|
|
||||||
dict.readIfPresent("resetOnRestart", resetOnRestart_);
|
|
||||||
|
|
||||||
dict.readIfPresent("log", log);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::valueAverageBase::calculate(dictionary& dict)
|
|
||||||
{
|
|
||||||
scalar dt = state_.time().deltaTValue();
|
|
||||||
|
|
||||||
Log << indent << state_.type() << ": " << prefix_.c_str()
|
|
||||||
<< " averages:" << nl;
|
|
||||||
|
|
||||||
file() << state_.time().timeName();
|
|
||||||
|
|
||||||
DynamicList<word> unprocessedFields(fieldNames_.size());
|
|
||||||
|
|
||||||
bool converged = true;
|
|
||||||
|
|
||||||
forAll(fieldNames_, fieldi)
|
|
||||||
{
|
|
||||||
totalTime_[fieldi] += dt;
|
|
||||||
|
|
||||||
const bool processed =
|
|
||||||
(
|
|
||||||
calc<scalar>(fieldi, converged, dict)
|
|
||||||
|| calc<vector>(fieldi, converged, dict)
|
|
||||||
|| calc<sphericalTensor>(fieldi, converged, dict)
|
|
||||||
|| calc<symmTensor>(fieldi, converged, dict)
|
|
||||||
|| calc<tensor>(fieldi, converged, dict)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!processed)
|
|
||||||
{
|
|
||||||
unprocessedFields.append(fieldNames_[fieldi]);
|
|
||||||
|
|
||||||
file() << tab << "n/a";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
file() << endl;
|
|
||||||
|
|
||||||
if (unprocessedFields.size())
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "From function object: " << functionObjectName_ << nl
|
|
||||||
<< "Unprocessed fields:" << nl;
|
|
||||||
|
|
||||||
for (const word& fieldName : unprocessedFields)
|
|
||||||
{
|
|
||||||
Log << indent << " " << fieldName << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unprocessedFields.size() == fieldNames_.size())
|
|
||||||
{
|
|
||||||
converged = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Log << endl;
|
|
||||||
|
|
||||||
return converged;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,189 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | www.openfoam.com
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::functionObjects::valueAverageBase
|
|
||||||
|
|
||||||
Description
|
|
||||||
Base class that computes the ensemble- or time-based singular-value average
|
|
||||||
values, with optional windowing, from the output of function objects
|
|
||||||
that generate non-field type values, e.g. \c Cd of \c forceCoeffs or
|
|
||||||
\c momentum_x in \c momentum function objects.
|
|
||||||
|
|
||||||
See also
|
|
||||||
- Foam::functionObjects::writeFile
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
valueAverageBase.C
|
|
||||||
valueAverageBaseTemplates.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef functionObjects_valueAverageBase_H
|
|
||||||
#define functionObjects_valueAverageBase_H
|
|
||||||
|
|
||||||
#include "writeFile.H"
|
|
||||||
#include "Enum.H"
|
|
||||||
#include "stateFunctionObject.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
namespace functionObjects
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class valueAverageBase Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class valueAverageBase
|
|
||||||
:
|
|
||||||
public functionObjects::writeFile
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Public Enumerations
|
|
||||||
|
|
||||||
//- Averaging window types
|
|
||||||
enum class windowType : uint8_t
|
|
||||||
{
|
|
||||||
NONE, //!< "none"
|
|
||||||
APPROXIMATE, //!< "approximate"
|
|
||||||
EXACT //!< "exact"
|
|
||||||
};
|
|
||||||
|
|
||||||
//- Names for windowType enumeration
|
|
||||||
static const Enum<windowType> windowTypeNames;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private Data
|
|
||||||
|
|
||||||
//- Log flag
|
|
||||||
bool log;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// Protected Data
|
|
||||||
|
|
||||||
//- Reset the averaging process on restart
|
|
||||||
bool resetOnRestart_;
|
|
||||||
|
|
||||||
//- Window type
|
|
||||||
windowType windowType_;
|
|
||||||
|
|
||||||
//- Reference to the state functionObject
|
|
||||||
stateFunctionObject& state_;
|
|
||||||
|
|
||||||
//- Name of function object to retrieve data from
|
|
||||||
word functionObjectName_;
|
|
||||||
|
|
||||||
//- List of fields on which to operate
|
|
||||||
wordList fieldNames_;
|
|
||||||
|
|
||||||
//- Optional tolerance to check for converged results
|
|
||||||
scalar tolerance_;
|
|
||||||
|
|
||||||
//- Averaging window
|
|
||||||
scalar window_;
|
|
||||||
|
|
||||||
//- Average time per field
|
|
||||||
List<scalar> totalTime_;
|
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
|
||||||
|
|
||||||
//- Templated function to calculate the average
|
|
||||||
// Return true if processed
|
|
||||||
template<class Type>
|
|
||||||
bool calc(const label fieldi, bool& converged, dictionary& dict);
|
|
||||||
|
|
||||||
//- Output file header information
|
|
||||||
virtual void writeFileHeader(Ostream& os) const;
|
|
||||||
|
|
||||||
//- Read state from dictionary
|
|
||||||
virtual void readState(dictionary& dict);
|
|
||||||
|
|
||||||
//- Write state to dictionary for restarts
|
|
||||||
virtual void writeState(dictionary& dict);
|
|
||||||
|
|
||||||
//- Reset state
|
|
||||||
virtual void resetState(dictionary& dict);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from Time and dictionary
|
|
||||||
valueAverageBase
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const dictionary& dict,
|
|
||||||
stateFunctionObject& state,
|
|
||||||
const bool writeToFile = true
|
|
||||||
);
|
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
valueAverageBase(const valueAverageBase&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
|
||||||
void operator=(const valueAverageBase&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
virtual ~valueAverageBase() = default;
|
|
||||||
|
|
||||||
|
|
||||||
// Public Member Functions
|
|
||||||
|
|
||||||
//- Read the field value average data
|
|
||||||
virtual bool read(const dictionary& dict);
|
|
||||||
|
|
||||||
//- Calculate the averages
|
|
||||||
virtual bool calculate(dictionary& dict);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace functionObjects
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
#include "valueAverageBaseTemplates.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -27,6 +27,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "emptyPolyPatch.H"
|
#include "emptyPolyPatch.H"
|
||||||
|
#include "commSchedule.H"
|
||||||
#include "globalMeshData.H"
|
#include "globalMeshData.H"
|
||||||
#include "cyclicPolyPatch.H"
|
#include "cyclicPolyPatch.H"
|
||||||
|
|
||||||
|
|||||||
@ -34,8 +34,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_curve_H
|
#ifndef curve_H
|
||||||
#define Foam_curve_H
|
#define curve_H
|
||||||
|
|
||||||
#include "string.H"
|
#include "string.H"
|
||||||
#include "primitiveFields.H"
|
#include "primitiveFields.H"
|
||||||
@ -46,7 +46,8 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward Declarations
|
// Forward declaration of friend functions and operators
|
||||||
|
|
||||||
class curve;
|
class curve;
|
||||||
Ostream& operator<<(Ostream&, const curve&);
|
Ostream& operator<<(Ostream&, const curve&);
|
||||||
|
|
||||||
@ -59,11 +60,13 @@ class curve
|
|||||||
:
|
:
|
||||||
public scalarField
|
public scalarField
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- The style (line, symbol, etc) of a curve
|
//- The style (line, symbol, etc) of a curve
|
||||||
class curveStyle
|
class curveStyle
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Enumeration definitions
|
//- Enumeration definitions
|
||||||
@ -113,10 +116,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private Data
|
// private data
|
||||||
|
|
||||||
string name_;
|
string name_;
|
||||||
|
|
||||||
curveStyle style_;
|
curveStyle style_;
|
||||||
|
|
||||||
|
|
||||||
@ -124,6 +126,9 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct as interpolation of an existing curve
|
||||||
|
//curve(const curve&, const label);
|
||||||
|
|
||||||
//- Construct from name, style and size
|
//- Construct from name, style and size
|
||||||
curve
|
curve
|
||||||
(
|
(
|
||||||
@ -146,7 +151,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
@ -161,6 +166,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Friend functions
|
||||||
|
|
||||||
|
//- Gradient of the curve
|
||||||
|
//friend curve grad(const curve&);
|
||||||
|
|
||||||
|
|
||||||
// Ostream operator
|
// Ostream operator
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream&, const curve&);
|
friend Ostream& operator<<(Ostream&, const curve&);
|
||||||
@ -29,6 +29,7 @@ License
|
|||||||
#include "graph.H"
|
#include "graph.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
|
#include "Pair.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
#include "SubField.H"
|
#include "SubField.H"
|
||||||
|
|
||||||
@ -271,9 +272,9 @@ void Foam::graph::write(Ostream& os, const word& format) const
|
|||||||
|
|
||||||
void Foam::graph::write(const fileName& pName, const word& format) const
|
void Foam::graph::write(const fileName& pName, const word& format) const
|
||||||
{
|
{
|
||||||
autoPtr<writer> writer(writer::New(format));
|
autoPtr<writer> graphWriter(writer::New(format));
|
||||||
|
|
||||||
OFstream graphFile(pName + '.' + writer().ext());
|
OFstream graphFile(pName + '.' + graphWriter().ext());
|
||||||
|
|
||||||
if (graphFile.good())
|
if (graphFile.good())
|
||||||
{
|
{
|
||||||
@ -35,21 +35,23 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_graph_H
|
#ifndef graph_H
|
||||||
#define Foam_graph_H
|
#define graph_H
|
||||||
|
|
||||||
#include "string.H"
|
#include "string.H"
|
||||||
#include "point.H"
|
#include "point.H"
|
||||||
#include "curve.H"
|
|
||||||
#include "HashPtrTable.H"
|
#include "HashPtrTable.H"
|
||||||
|
#include "curve.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward Declaration
|
// Forward declaration of friend functions and operators
|
||||||
|
|
||||||
class graph;
|
class graph;
|
||||||
|
|
||||||
Ostream& operator<<(Ostream&, const graph&);
|
Ostream& operator<<(Ostream&, const graph&);
|
||||||
|
|
||||||
|
|
||||||
@ -61,7 +63,7 @@ class graph
|
|||||||
:
|
:
|
||||||
public HashPtrTable<curve>
|
public HashPtrTable<curve>
|
||||||
{
|
{
|
||||||
// Private Data
|
// private data
|
||||||
|
|
||||||
string title_;
|
string title_;
|
||||||
string xName_;
|
string xName_;
|
||||||
@ -69,10 +71,13 @@ class graph
|
|||||||
|
|
||||||
scalarField x_;
|
scalarField x_;
|
||||||
|
|
||||||
|
|
||||||
struct xy
|
struct xy
|
||||||
{
|
{
|
||||||
scalar x_, y_;
|
scalar x_, y_;
|
||||||
|
|
||||||
|
xy()
|
||||||
|
{}
|
||||||
|
|
||||||
// Friend Operators
|
// Friend Operators
|
||||||
|
|
||||||
@ -138,10 +143,10 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
explicit graph(Istream& is);
|
graph(Istream& is);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member functions
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
@ -185,6 +190,7 @@ public:
|
|||||||
//- Abstract base class for a graph writer
|
//- Abstract base class for a graph writer
|
||||||
class writer
|
class writer
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void writeXY
|
void writeXY
|
||||||
@ -213,13 +219,17 @@ public:
|
|||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
//- Return a reference to the selected writer
|
//- Return a reference to the selected writer
|
||||||
static autoPtr<writer> New(const word& writeFormat);
|
static autoPtr<writer> New
|
||||||
|
(
|
||||||
|
const word& writeFormat
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Default construct
|
//- Construct null
|
||||||
writer() = default;
|
writer()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
@ -228,14 +238,19 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- The fileName extension for this graph format
|
// Access
|
||||||
virtual word ext() const = 0;
|
|
||||||
|
|
||||||
//- Write graph in appropriate format
|
//- Return the appropriate fileName extension
|
||||||
virtual void write(const graph&, Ostream&) const = 0;
|
// for this graph format
|
||||||
|
virtual const word& ext() const = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Write
|
||||||
|
|
||||||
|
//- Write graph in appropriate format
|
||||||
|
virtual void write(const graph&, Ostream&) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//- Write out graph data as a simple table
|
//- Write out graph data as a simple table
|
||||||
void writeTable(Ostream&) const;
|
void writeTable(Ostream&) const;
|
||||||
|
|
||||||
@ -257,7 +272,7 @@ public:
|
|||||||
static word wordify(const string& sname);
|
static word wordify(const string& sname);
|
||||||
|
|
||||||
|
|
||||||
// Friend Operators
|
// Friend operators
|
||||||
|
|
||||||
//- Ostream Operator
|
//- Ostream Operator
|
||||||
friend Ostream& operator<<(Ostream&, const graph&);
|
friend Ostream& operator<<(Ostream&, const graph&);
|
||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,49 +26,50 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "gnuplotGraphWriter.H"
|
#include "gnuplotGraph.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
typedef graph::writer graphWriter;
|
defineTypeNameAndDebug(gnuplotGraph, 0);
|
||||||
|
const word gnuplotGraph::ext_("gplt");
|
||||||
|
|
||||||
namespace graphWriters
|
typedef graph::writer graphWriter;
|
||||||
{
|
addToRunTimeSelectionTable(graphWriter, gnuplotGraph, word);
|
||||||
defineTypeName(gnuplotWriter);
|
|
||||||
addToRunTimeSelectionTable(graphWriter, gnuplotWriter, word);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::graphWriters::gnuplotWriter::write
|
void Foam::gnuplotGraph::write(const graph& g, Ostream& os) const
|
||||||
(
|
|
||||||
const graph& g,
|
|
||||||
Ostream& os
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
os << "set term pngcairo" << nl
|
os << "#set term postscript color" << endl
|
||||||
<< "set output \"" << word(g.title()) << ".png\"" << nl
|
<< "set output \"" << word(g.title()) << ".ps\"" << endl
|
||||||
<< "set title " << g.title() << " 0,0" << nl << "show title" << nl
|
<< "set title " << g.title() << " 0,0" << endl << "show title" << endl
|
||||||
<< "set xlabel " << g.xName() << " 0,0" << nl << "show xlabel" << nl
|
<< "set xlabel " << g.xName() << " 0,0" << endl << "show xlabel" << endl
|
||||||
<< "set ylabel " << g.yName() << " 0,0" << nl << "show ylabel" << nl;
|
<< "set ylabel " << g.yName() << " 0,0" << endl << "show ylabel" << endl
|
||||||
|
<< "plot";
|
||||||
|
|
||||||
|
bool firstField = true;
|
||||||
|
|
||||||
label nplots = 0;
|
|
||||||
forAllConstIters(g, iter)
|
forAllConstIters(g, iter)
|
||||||
{
|
{
|
||||||
os << (nplots++ ? ", \\" : "plot \\") << nl;
|
if (!firstField)
|
||||||
|
{
|
||||||
|
os << ',';
|
||||||
|
}
|
||||||
|
firstField = false;
|
||||||
|
|
||||||
os << "'-' title " << iter()->name() << " with lines";
|
os << "'-' title " << iter()->name() << " with lines";
|
||||||
}
|
}
|
||||||
os << "; pause -1" << nl;
|
os << "; pause -1" << endl;
|
||||||
|
|
||||||
|
|
||||||
forAllConstIters(g, iter)
|
forAllConstIters(g, iter)
|
||||||
{
|
{
|
||||||
os << nl;
|
os << endl;
|
||||||
writeXY(g.x(), *iter(), os);
|
writeXY(g.x(), *iter(), os);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,7 +6,6 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,18 +24,18 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::graphWriters::gnuplotWriter
|
Foam::gnuplotGraph
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Output in gnuplot (http://www.gnuplot.info) format
|
Output in gnuplot (http://www.gnuplot.info) format
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
gnuplotGraphWriter.C
|
gnuplotGraph.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_gnuplotGraphWriter_H
|
#ifndef gnuplotGraph_H
|
||||||
#define Foam_gnuplotGraphWriter_H
|
#define gnuplotGraph_H
|
||||||
|
|
||||||
#include "graph.H"
|
#include "graph.H"
|
||||||
|
|
||||||
@ -44,42 +43,57 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace graphWriters
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class gnuplotWriter Declaration
|
Class gnuplotGraph Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class gnuplotWriter
|
class gnuplotGraph
|
||||||
:
|
:
|
||||||
public graph::writer
|
public graph::writer
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeNameNoDebug("gnuplot");
|
TypeName("gnuplot");
|
||||||
|
|
||||||
|
//- FileName extension for this graph format
|
||||||
|
static const word ext_;
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
gnuplotGraph()
|
||||||
|
{}
|
||||||
|
|
||||||
//- Default construct
|
|
||||||
gnuplotWriter() = default;
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~gnuplotWriter() = default;
|
~gnuplotGraph()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- The fileName extension for this graph format
|
// Access
|
||||||
word ext() const { return "gplt"; }
|
|
||||||
|
|
||||||
//- Write
|
//- Return the appropriate fileName extension
|
||||||
void write(const graph&, Ostream& os) const;
|
// for this graph format
|
||||||
|
const word& ext() const
|
||||||
|
{
|
||||||
|
return ext_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Write
|
||||||
|
|
||||||
|
void write(const graph&, Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace graphWriters
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -6,7 +6,6 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,30 +25,24 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "rawGraphWriter.H"
|
#include "rawGraph.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
typedef graph::writer graphWriter;
|
defineTypeNameAndDebug(rawGraph, 0);
|
||||||
|
const word rawGraph::ext_("xy");
|
||||||
|
|
||||||
namespace graphWriters
|
typedef graph::writer graphWriter;
|
||||||
{
|
addToRunTimeSelectionTable(graphWriter, rawGraph, word);
|
||||||
defineTypeName(rawWriter);
|
|
||||||
addToRunTimeSelectionTable(graphWriter, rawWriter, word);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::graphWriters::rawWriter::write
|
void Foam::rawGraph::write(const graph& g, Ostream& os) const
|
||||||
(
|
|
||||||
const graph& g,
|
|
||||||
Ostream& os
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
g.writeTable(os);
|
g.writeTable(os);
|
||||||
}
|
}
|
||||||
@ -6,7 +6,6 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,18 +24,18 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::graphWriters::rawWriter
|
Foam::rawGraph
|
||||||
|
|
||||||
Description
|
Description
|
||||||
A raw xy graph output
|
A raw xy graph output
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
rawGraphWriter.C
|
rawGraph.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_rawGraphWriter_H
|
#ifndef rawGraph_H
|
||||||
#define Foam_rawGraphWriter_H
|
#define rawGraph_H
|
||||||
|
|
||||||
#include "graph.H"
|
#include "graph.H"
|
||||||
|
|
||||||
@ -44,42 +43,57 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace graphWriters
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class rawWriter Declaration
|
Class rawGraph Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class rawWriter
|
class rawGraph
|
||||||
:
|
:
|
||||||
public graph::writer
|
public graph::writer
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeNameNoDebug("raw");
|
TypeName("raw");
|
||||||
|
|
||||||
|
//- FileName extension for this graph format
|
||||||
|
static const word ext_;
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
rawGraph()
|
||||||
|
{}
|
||||||
|
|
||||||
//- Default construct
|
|
||||||
rawWriter() = default;
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~rawWriter() = default;
|
~rawGraph()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- The fileName extension for this graph format
|
// Access
|
||||||
word ext() const { return "xy"; }
|
|
||||||
|
|
||||||
//- Write
|
//- Return the appropriate fileName extension
|
||||||
void write(const graph&, Ostream& os) const;
|
// for this graph format
|
||||||
|
const word& ext() const
|
||||||
|
{
|
||||||
|
return ext_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Write
|
||||||
|
|
||||||
|
void write(const graph&, Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace graphWriters
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,49 +26,43 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "xmgraceGraphWriter.H"
|
#include "xmgrGraph.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
defineTypeNameAndDebug(xmgrGraph, 0);
|
||||||
|
const word xmgrGraph::ext_("agr");
|
||||||
|
|
||||||
typedef graph::writer graphWriter;
|
typedef graph::writer graphWriter;
|
||||||
|
addToRunTimeSelectionTable(graphWriter, xmgrGraph, word);
|
||||||
namespace graphWriters
|
|
||||||
{
|
|
||||||
defineTypeName(xmgraceWriter);
|
|
||||||
addToRunTimeSelectionTable(graphWriter, xmgraceWriter, word);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::graphWriters::xmgraceWriter::write
|
void Foam::xmgrGraph::write(const graph& g, Ostream& os) const
|
||||||
(
|
|
||||||
const graph& g,
|
|
||||||
Ostream& os
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
os << "@title " << g.title() << nl
|
os << "@title " << g.title() << nl
|
||||||
<< "@xaxis label " << g.xName() << nl
|
<< "@xaxis label " << g.xName() << nl
|
||||||
<< "@yaxis label " << g.yName() << nl;
|
<< "@yaxis label " << g.yName() << endl;
|
||||||
|
|
||||||
label nWritten_ = 0;
|
label fieldi = 0;
|
||||||
|
|
||||||
forAllConstIters(g, iter)
|
forAllConstIters(g, iter)
|
||||||
{
|
{
|
||||||
os << "@s" << nWritten_ << " legend "
|
os << "@s" << fieldi << " legend "
|
||||||
<< iter()->name() << nl
|
<< iter()->name() << nl
|
||||||
<< "@target G0.S" << nWritten_ << nl
|
<< "@target G0.S" << fieldi << nl
|
||||||
<< "@type xy" << nl;
|
<< "@type xy" << endl;
|
||||||
|
|
||||||
writeXY(g.x(), *iter(), os);
|
writeXY(g.x(), *iter(), os);
|
||||||
|
|
||||||
os << endl;
|
os << endl;
|
||||||
|
|
||||||
++nWritten_;
|
fieldi++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6,7 +6,6 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,19 +24,19 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::graphWriters::xmgraceWriter
|
Foam::xmgrGraph
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Output and \b agr file for \em xmgrace
|
Output and \b agr file for \em xmgrace
|
||||||
(http://plasma-gate.weizmann.ac.il/Grace/)
|
(http://plasma-gate.weizmann.ac.il/Grace/)
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
xmgraceGraphWriter.C
|
xmgrGraph.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_xmgraceGraphWriter_H
|
#ifndef xmgrGraph_H
|
||||||
#define Foam_xmgraceGraphWriter_H
|
#define xmgrGraph_H
|
||||||
|
|
||||||
#include "graph.H"
|
#include "graph.H"
|
||||||
|
|
||||||
@ -45,42 +44,57 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
namespace graphWriters
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class xmgraceWriter Declaration
|
Class xmgrGraph Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class xmgraceWriter
|
class xmgrGraph
|
||||||
:
|
:
|
||||||
public graph::writer
|
public graph::writer
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeNameNoDebug("xmgr");
|
TypeName("xmgr");
|
||||||
|
|
||||||
|
//- FileName extension for this graph format
|
||||||
|
static const word ext_;
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
xmgrGraph()
|
||||||
|
{}
|
||||||
|
|
||||||
//- Default construct
|
|
||||||
xmgraceWriter() = default;
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~xmgraceWriter() = default;
|
~xmgrGraph()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- The fileName extension for this graph format
|
// Access
|
||||||
word ext() const { return "agr"; }
|
|
||||||
|
|
||||||
//- Write
|
//- Return the appropriate fileName extension
|
||||||
void write(const graph&, Ostream& os) const;
|
// for this graph format
|
||||||
|
const word& ext() const
|
||||||
|
{
|
||||||
|
return ext_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Write
|
||||||
|
|
||||||
|
void write(const graph&, Ostream& os) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace graphWriters
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -67,10 +67,13 @@ if (args.dryRun() || args.found("dry-run-write"))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Foam::Info << "Create mesh";
|
|
||||||
if (args.readIfPresent("region", regionName))
|
if (args.readIfPresent("region", regionName))
|
||||||
{
|
{
|
||||||
Foam::Info << ' ' << regionName;
|
Foam::Info << "Create mesh " << regionName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Foam::Info << "Create mesh";
|
||||||
}
|
}
|
||||||
Foam::Info << " for time = " << runTime.timeName() << Foam::nl;
|
Foam::Info << " for time = " << runTime.timeName() << Foam::nl;
|
||||||
|
|
||||||
|
|||||||
@ -27,10 +27,13 @@ Provided Variables
|
|||||||
Foam::word regionName(Foam::polyMesh::defaultRegion);
|
Foam::word regionName(Foam::polyMesh::defaultRegion);
|
||||||
|
|
||||||
{
|
{
|
||||||
Foam::Info << "Create mesh";
|
|
||||||
if (args.readIfPresent("region", regionName))
|
if (args.readIfPresent("region", regionName))
|
||||||
{
|
{
|
||||||
Foam::Info << ' ' << regionName;
|
Foam::Info << "Create mesh " << regionName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Foam::Info << "Create mesh";
|
||||||
}
|
}
|
||||||
Foam::Info << " for time = " << runTime.timeName() << Foam::nl;
|
Foam::Info << " for time = " << runTime.timeName() << Foam::nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,10 +26,13 @@ Provided Variables
|
|||||||
Foam::word regionName(Foam::polyMesh::defaultRegion);
|
Foam::word regionName(Foam::polyMesh::defaultRegion);
|
||||||
|
|
||||||
{
|
{
|
||||||
Foam::Info << "Create polyMesh";
|
|
||||||
if (args.readIfPresent("region", regionName))
|
if (args.readIfPresent("region", regionName))
|
||||||
{
|
{
|
||||||
Foam::Info << ' ' << regionName;
|
Foam::Info << "Create polyMesh " << regionName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Foam::Info << "Create polyMesh";
|
||||||
}
|
}
|
||||||
Foam::Info << " for time = " << runTime.timeName() << Foam::nl;
|
Foam::Info << " for time = " << runTime.timeName() << Foam::nl;
|
||||||
}
|
}
|
||||||
@ -48,5 +51,4 @@ Foam::polyMesh mesh
|
|||||||
|
|
||||||
Foam::Info << Foam::endl;
|
Foam::Info << Foam::endl;
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,68 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | www.openfoam.com
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
|
||||||
|
|
||||||
Description
|
|
||||||
Create single or multiple polyMesh regions based on the
|
|
||||||
wordList 'regionNames'
|
|
||||||
|
|
||||||
Required Variables
|
|
||||||
- runTime [Time]
|
|
||||||
- regionNames [wordList]
|
|
||||||
|
|
||||||
Provided Variables
|
|
||||||
- meshes [PtrList<polyMesh>]
|
|
||||||
|
|
||||||
See Also
|
|
||||||
addAllRegionOptions.H
|
|
||||||
getAllRegionOptions.H
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
Foam::PtrList<Foam::polyMesh> meshes(regionNames.size());
|
|
||||||
|
|
||||||
{
|
|
||||||
forAll(regionNames, regioni)
|
|
||||||
{
|
|
||||||
const Foam::word& regionName = regionNames[regioni];
|
|
||||||
|
|
||||||
Foam::Info<< "Create polyMesh";
|
|
||||||
if
|
|
||||||
(
|
|
||||||
regionNames.size() > 1
|
|
||||||
|| regionName != Foam::polyMesh::defaultRegion
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Foam::Info<< ' ' << regionName;
|
|
||||||
}
|
|
||||||
Foam::Info<< " for time = " << runTime.timeName() << Foam::nl;
|
|
||||||
|
|
||||||
meshes.set
|
|
||||||
(
|
|
||||||
regioni,
|
|
||||||
new Foam::polyMesh
|
|
||||||
(
|
|
||||||
Foam::IOobject
|
|
||||||
(
|
|
||||||
regionName,
|
|
||||||
runTime.timeName(),
|
|
||||||
runTime,
|
|
||||||
Foam::IOobject::MUST_READ
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Foam::Info<< Foam::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -101,16 +101,18 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Order in which comms is scheduled
|
//- Order in which comms is scheduled
|
||||||
const labelList& schedule() const noexcept
|
const labelList& schedule() const
|
||||||
{
|
{
|
||||||
return schedule_;
|
return schedule_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Per processor the order in which communication has been scheduled
|
//- Per processor the order in which communication has been scheduled
|
||||||
const labelListList& procSchedule() const noexcept
|
const labelListList& procSchedule() const
|
||||||
{
|
{
|
||||||
return procSchedule_;
|
return procSchedule_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -39,15 +39,8 @@ void Foam::globalIndex::reportOverflowAndExit
|
|||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Overflow : sum of sizes exceeds labelMax ("
|
<< "Overflow : sum of sizes exceeds labelMax ("
|
||||||
<< labelMax << ") after index " << idx;
|
<< labelMax << ") after index " << idx << " of "
|
||||||
|
<< flatOutput(localSizes) << nl
|
||||||
if (!localSizes.empty())
|
|
||||||
{
|
|
||||||
FatalError << " of " << flatOutput(localSizes);
|
|
||||||
}
|
|
||||||
|
|
||||||
FatalError
|
|
||||||
<< nl
|
|
||||||
<< "Please recompile with larger datatype for label." << nl
|
<< "Please recompile with larger datatype for label." << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ class globalIndex
|
|||||||
static void reportOverflowAndExit
|
static void reportOverflowAndExit
|
||||||
(
|
(
|
||||||
const label idx,
|
const label idx,
|
||||||
const labelUList& localSizes = labelUList::null()
|
const labelUList& localSizes
|
||||||
);
|
);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -175,7 +175,7 @@ public:
|
|||||||
//- Global sum of localSizes. Same as totalSize()
|
//- Global sum of localSizes. Same as totalSize()
|
||||||
inline label size() const;
|
inline label size() const;
|
||||||
|
|
||||||
//- Global sum of localSizes.
|
//- Global sum of localSizes. Same as size()
|
||||||
inline label totalSize() const;
|
inline label totalSize() const;
|
||||||
|
|
||||||
//- The local sizes
|
//- The local sizes
|
||||||
@ -285,6 +285,9 @@ public:
|
|||||||
|
|
||||||
// Global (off-processor) queries
|
// Global (off-processor) queries
|
||||||
|
|
||||||
|
//- Start of proci data
|
||||||
|
inline label offset(const label proci) const;
|
||||||
|
|
||||||
//- Start of proci data
|
//- Start of proci data
|
||||||
inline label localStart(const label proci) const;
|
inline label localStart(const label proci) const;
|
||||||
|
|
||||||
@ -325,15 +328,6 @@ public:
|
|||||||
inline label whichProcID(const label i) const;
|
inline label whichProcID(const label i) const;
|
||||||
|
|
||||||
|
|
||||||
// Housekeeping
|
|
||||||
|
|
||||||
//- Same as localStart
|
|
||||||
label offset(const label proci) const
|
|
||||||
{
|
|
||||||
return localStart(proci);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Iteration
|
// Iteration
|
||||||
|
|
||||||
//- Forward input iterator with const access
|
//- Forward input iterator with const access
|
||||||
@ -187,6 +187,12 @@ inline const Foam::labelUList Foam::globalIndex::localStarts() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::globalIndex::offset(const label proci) const
|
||||||
|
{
|
||||||
|
return offsets_[proci];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::globalIndex::localStart(const label proci) const
|
inline Foam::label Foam::globalIndex::localStart(const label proci) const
|
||||||
{
|
{
|
||||||
return offsets_[proci];
|
return offsets_[proci];
|
||||||
@ -331,7 +337,7 @@ inline Foam::label Foam::globalIndex::toLocal(const label i) const
|
|||||||
|
|
||||||
inline Foam::label Foam::globalIndex::whichProcID(const label i) const
|
inline Foam::label Foam::globalIndex::whichProcID(const label i) const
|
||||||
{
|
{
|
||||||
if (i < 0 || i >= totalSize())
|
if (i < 0 || i >= size())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Global " << i << " does not belong on any processor."
|
<< "Global " << i << " does not belong on any processor."
|
||||||
@ -54,7 +54,11 @@ Foam::globalIndex::calcListOffsets
|
|||||||
|
|
||||||
if (checkOverflow && start < values[i])
|
if (checkOverflow && start < values[i])
|
||||||
{
|
{
|
||||||
reportOverflowAndExit(i);
|
FatalErrorInFunction
|
||||||
|
<< "Overflow : sum of sizes exceeds labelMax ("
|
||||||
|
<< labelMax << ") after index " << i << nl
|
||||||
|
<< "Please recompile with larger datatype for label." << nl
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
values[len] = start;
|
values[len] = start;
|
||||||
@ -94,7 +98,7 @@ void Foam::globalIndex::gather
|
|||||||
|
|
||||||
if (Pstream::myProcNo(comm) == procIDs[0])
|
if (Pstream::myProcNo(comm) == procIDs[0])
|
||||||
{
|
{
|
||||||
allFld.resize_nocopy(off.last()); // == totalSize()
|
allFld.resize_nocopy(off.last());
|
||||||
|
|
||||||
// Assign my local data - respect offset information
|
// Assign my local data - respect offset information
|
||||||
// so that we can request 0 entries to be copied.
|
// so that we can request 0 entries to be copied.
|
||||||
@ -108,11 +112,7 @@ void Foam::globalIndex::gather
|
|||||||
{
|
{
|
||||||
SubList<Type> procSlot(allFld, off[i+1]-off[i], off[i]);
|
SubList<Type> procSlot(allFld, off[i+1]-off[i], off[i]);
|
||||||
|
|
||||||
if (procSlot.empty())
|
if (is_contiguous<Type>::value)
|
||||||
{
|
|
||||||
// Nothing to do
|
|
||||||
}
|
|
||||||
else if (is_contiguous<Type>::value)
|
|
||||||
{
|
{
|
||||||
IPstream::read
|
IPstream::read
|
||||||
(
|
(
|
||||||
@ -140,11 +140,7 @@ void Foam::globalIndex::gather
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (fld.empty())
|
if (is_contiguous<Type>::value)
|
||||||
{
|
|
||||||
// Nothing to do
|
|
||||||
}
|
|
||||||
else if (is_contiguous<Type>::value)
|
|
||||||
{
|
{
|
||||||
OPstream::write
|
OPstream::write
|
||||||
(
|
(
|
||||||
@ -202,7 +198,7 @@ void Foam::globalIndex::gather
|
|||||||
|
|
||||||
if (Pstream::myProcNo(comm) == procIDs[0])
|
if (Pstream::myProcNo(comm) == procIDs[0])
|
||||||
{
|
{
|
||||||
allFld.resize_nocopy(off.last()); // == totalSize()
|
allFld.resize_nocopy(off.last());
|
||||||
|
|
||||||
// Assign my local data - respect offset information
|
// Assign my local data - respect offset information
|
||||||
// so that we can request 0 entries to be copied
|
// so that we can request 0 entries to be copied
|
||||||
@ -218,43 +214,29 @@ void Foam::globalIndex::gather
|
|||||||
{
|
{
|
||||||
SubList<Type> procSlot(allFld, off[i+1]-off[i], off[i]);
|
SubList<Type> procSlot(allFld, off[i+1]-off[i], off[i]);
|
||||||
|
|
||||||
if (procSlot.empty())
|
IPstream fromProc
|
||||||
{
|
|
||||||
// Nothing to do
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IPstream fromProc
|
|
||||||
(
|
|
||||||
commsType,
|
|
||||||
procIDs[i],
|
|
||||||
0,
|
|
||||||
tag,
|
|
||||||
comm
|
|
||||||
);
|
|
||||||
fromProc >> procSlot;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (fld.empty())
|
|
||||||
{
|
|
||||||
// Nothing to do
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OPstream toMaster
|
|
||||||
(
|
(
|
||||||
commsType,
|
commsType,
|
||||||
procIDs[0],
|
procIDs[i],
|
||||||
0,
|
0,
|
||||||
tag,
|
tag,
|
||||||
comm
|
comm
|
||||||
);
|
);
|
||||||
toMaster << fld;
|
fromProc >> procSlot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OPstream toMaster
|
||||||
|
(
|
||||||
|
commsType,
|
||||||
|
procIDs[0],
|
||||||
|
0,
|
||||||
|
tag,
|
||||||
|
comm
|
||||||
|
);
|
||||||
|
toMaster << fld;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -459,7 +441,7 @@ void Foam::globalIndex::mpiGather
|
|||||||
nSendBytes = 0;
|
nSendBytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
allData.resize_nocopy(globalAddr.totalSize());
|
allData.resize_nocopy(globalAddr.size());
|
||||||
|
|
||||||
recvSizes.resize(nproc);
|
recvSizes.resize(nproc);
|
||||||
recvOffsets.resize(nproc+1);
|
recvOffsets.resize(nproc+1);
|
||||||
@ -469,7 +451,7 @@ void Foam::globalIndex::mpiGather
|
|||||||
recvSizes[proci] = globalAddr.localSize(proci) * sizeof(Type);
|
recvSizes[proci] = globalAddr.localSize(proci) * sizeof(Type);
|
||||||
recvOffsets[proci] = globalAddr.localStart(proci) * sizeof(Type);
|
recvOffsets[proci] = globalAddr.localStart(proci) * sizeof(Type);
|
||||||
}
|
}
|
||||||
recvOffsets[nproc] = globalAddr.totalSize() * sizeof(Type);
|
recvOffsets[nproc] = globalAddr.size() * sizeof(Type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -707,10 +689,6 @@ void Foam::globalIndex::scatter
|
|||||||
// Could also warn and change to scheduled etc...
|
// Could also warn and change to scheduled etc...
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUTURE:
|
|
||||||
// could decide which procs will receive data and use mpiScatter
|
|
||||||
// to distribute. Could then skip send/receive for those procs...
|
|
||||||
|
|
||||||
const label startOfRequests = UPstream::nRequests();
|
const label startOfRequests = UPstream::nRequests();
|
||||||
|
|
||||||
if (Pstream::myProcNo(comm) == procIDs[0])
|
if (Pstream::myProcNo(comm) == procIDs[0])
|
||||||
@ -157,7 +157,7 @@ void Foam::globalMeshData::calcSharedPoints() const
|
|||||||
// Allocate global numbers
|
// Allocate global numbers
|
||||||
globalIndex masterNumbering(nMaster);
|
globalIndex masterNumbering(nMaster);
|
||||||
|
|
||||||
nGlobalPoints_ = masterNumbering.totalSize();
|
nGlobalPoints_ = masterNumbering.size();
|
||||||
|
|
||||||
|
|
||||||
// Push master number to slaves
|
// Push master number to slaves
|
||||||
|
|||||||
@ -158,14 +158,14 @@ void Foam::PatchTools::gatherAndMerge
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mergedFaces.setSize(globalFacesPtr().totalSize());
|
mergedFaces.setSize(globalFacesPtr().size());
|
||||||
mergedPoints.setSize(globalPointsPtr().totalSize());
|
mergedPoints.setSize(globalPointsPtr().size());
|
||||||
|
|
||||||
// Insert master data first
|
// Insert master data first
|
||||||
label pOffset = globalPointsPtr().localStart(Pstream::masterNo());
|
label pOffset = globalPointsPtr().offset(Pstream::masterNo());
|
||||||
SubList<point>(mergedPoints, myPoints.size(), pOffset) = myPoints;
|
SubList<point>(mergedPoints, myPoints.size(), pOffset) = myPoints;
|
||||||
|
|
||||||
label fOffset = globalFacesPtr().localStart(Pstream::masterNo());
|
label fOffset = globalFacesPtr().offset(Pstream::masterNo());
|
||||||
SubList<FaceType>(mergedFaces, myFaces.size(), fOffset) = myFaces;
|
SubList<FaceType>(mergedFaces, myFaces.size(), fOffset) = myFaces;
|
||||||
|
|
||||||
|
|
||||||
@ -177,11 +177,11 @@ void Foam::PatchTools::gatherAndMerge
|
|||||||
pointField slavePoints(fromSlave);
|
pointField slavePoints(fromSlave);
|
||||||
List<FaceType> slaveFaces(fromSlave);
|
List<FaceType> slaveFaces(fromSlave);
|
||||||
|
|
||||||
label pOffset = globalPointsPtr().localStart(slave);
|
label pOffset = globalPointsPtr().offset(slave);
|
||||||
SubList<point>(mergedPoints, slavePoints.size(), pOffset) =
|
SubList<point>(mergedPoints, slavePoints.size(), pOffset) =
|
||||||
slavePoints;
|
slavePoints;
|
||||||
|
|
||||||
label fOffset = globalFacesPtr().localStart(slave);
|
label fOffset = globalFacesPtr().offset(slave);
|
||||||
SubList<FaceType>(mergedFaces, slaveFaces.size(), fOffset) =
|
SubList<FaceType>(mergedFaces, slaveFaces.size(), fOffset) =
|
||||||
slaveFaces;
|
slaveFaces;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,11 +59,11 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_contiguous_H
|
#ifndef contiguous_H
|
||||||
#define Foam_contiguous_H
|
#define contiguous_H
|
||||||
|
|
||||||
#include "scalarFwd.H"
|
#include "scalar.H"
|
||||||
#include "labelFwd.H"
|
#include "label.H"
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -427,50 +427,21 @@ Foam::fileName Foam::fileName::relative
|
|||||||
const bool caseTag
|
const bool caseTag
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const auto top = parent.length();
|
const auto top = parent.size();
|
||||||
const fileName& f = *this;
|
const fileName& f = *this;
|
||||||
|
|
||||||
// Everything after "parent/xxx/yyy" -> "xxx/yyy"
|
// Everything after "parent/xxx/yyy" -> "xxx/yyy"
|
||||||
//
|
//
|
||||||
// case-relative:
|
// case-relative:
|
||||||
// "parent/xxx/yyy" -> "<case>/xxx/yyy"
|
// "parent/xxx/yyy" -> "<case>/xxx/yyy"
|
||||||
// "parent/constant/xxx/yyy" -> "<constant>/xxx/yyy"
|
|
||||||
// "parent/system/xxx/yyy" -> "<system>/xxx/yyy"
|
|
||||||
//
|
|
||||||
// as per stringOps::inplaceExpand()
|
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
top && (f.length() > (top+1)) && f[top] == '/'
|
top && (f.size() > (top+1)) && f[top] == '/'
|
||||||
&& f.starts_with(parent)
|
&& f.starts_with(parent)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (caseTag)
|
if (caseTag)
|
||||||
{
|
{
|
||||||
const auto trailing = f.find('/', top+1);
|
|
||||||
|
|
||||||
if (npos != trailing)
|
|
||||||
{
|
|
||||||
switch (trailing-top-1)
|
|
||||||
{
|
|
||||||
case 6: // "system"
|
|
||||||
{
|
|
||||||
if (!compare((top+1), 6, "system"))
|
|
||||||
{
|
|
||||||
return "<system>"/f.substr(trailing+1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 8: // "constant"
|
|
||||||
{
|
|
||||||
if (!compare((top+1), 8, "constant"))
|
|
||||||
{
|
|
||||||
return "<constant>"/f.substr(trailing+1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "<case>"/f.substr(top+1);
|
return "<case>"/f.substr(top+1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -478,32 +449,8 @@ Foam::fileName Foam::fileName::relative
|
|||||||
return f.substr(top+1);
|
return f.substr(top+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (caseTag && f.length() && !f.isAbsolute())
|
else if (caseTag && f.size() && !f.isAbsolute())
|
||||||
{
|
{
|
||||||
const auto trailing = f.find('/');
|
|
||||||
|
|
||||||
if (npos != trailing)
|
|
||||||
{
|
|
||||||
switch (trailing)
|
|
||||||
{
|
|
||||||
case 6: // "system"
|
|
||||||
{
|
|
||||||
if (!compare(0, 6, "system"))
|
|
||||||
{
|
|
||||||
return "<system>"/f.substr(trailing+1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 8: // "constant"
|
|
||||||
{
|
|
||||||
if (!compare(0, 8, "constant"))
|
|
||||||
{
|
|
||||||
return "<constant>"/f.substr(trailing+1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "<case>"/f;
|
return "<case>"/f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,8 +41,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_stringListOps_H
|
#ifndef stringListOps_H
|
||||||
#define Foam_stringListOps_H
|
#define stringListOps_H
|
||||||
|
|
||||||
#include "labelList.H"
|
#include "labelList.H"
|
||||||
#include "stringList.H"
|
#include "stringList.H"
|
||||||
@ -358,18 +358,6 @@ struct foundOp
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//- Return ids for items with matching names.
|
|
||||||
// The filter predicate is a combination of allow and deny lists
|
|
||||||
//
|
|
||||||
// \return List indices for matches
|
|
||||||
template<class StringListType, class AccessOp = noOp>
|
|
||||||
labelList findMatching
|
|
||||||
(
|
|
||||||
const StringListType& input,
|
|
||||||
const wordRes::filter& pred,
|
|
||||||
AccessOp aop = noOp()
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Return ids for items with matching names.
|
//- Return ids for items with matching names.
|
||||||
// Uses a combination of allow and deny lists
|
// Uses a combination of allow and deny lists
|
||||||
//
|
//
|
||||||
|
|||||||
@ -135,18 +135,21 @@ template<class StringListType, class AccessOp>
|
|||||||
Foam::labelList Foam::stringListOps::findMatching
|
Foam::labelList Foam::stringListOps::findMatching
|
||||||
(
|
(
|
||||||
const StringListType& input,
|
const StringListType& input,
|
||||||
const wordRes::filter& pred,
|
const wordRes& allow,
|
||||||
|
const wordRes& deny,
|
||||||
AccessOp aop
|
AccessOp aop
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const label len = input.size();
|
const label len = input.size();
|
||||||
|
|
||||||
if (pred.empty())
|
if (allow.empty() && deny.empty())
|
||||||
{
|
{
|
||||||
// Accept all
|
|
||||||
return identity(len);
|
return identity(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use combined accept/reject filter
|
||||||
|
const wordRes::filter pred(allow, deny);
|
||||||
|
|
||||||
labelList indices(len);
|
labelList indices(len);
|
||||||
|
|
||||||
label count = 0;
|
label count = 0;
|
||||||
@ -166,26 +169,4 @@ Foam::labelList Foam::stringListOps::findMatching
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class StringListType, class AccessOp>
|
|
||||||
Foam::labelList Foam::stringListOps::findMatching
|
|
||||||
(
|
|
||||||
const StringListType& input,
|
|
||||||
const wordRes& allow,
|
|
||||||
const wordRes& deny,
|
|
||||||
AccessOp aop
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (allow.empty() && deny.empty())
|
|
||||||
{
|
|
||||||
// Accept all
|
|
||||||
return identity(input.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use combined accept/reject filter
|
|
||||||
const wordRes::filter pred(allow, deny);
|
|
||||||
|
|
||||||
return stringListOps::findMatching(input, pred, aop);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2626,7 +2626,7 @@ void Foam::polyMeshAdder::compactPoints
|
|||||||
|
|
||||||
// Compact out unused points
|
// Compact out unused points
|
||||||
localPoints.setSize(meshes.size());
|
localPoints.setSize(meshes.size());
|
||||||
labelList globalToCompact(globalPoints.totalSize(), -1);
|
labelList globalToCompact(globalPoints.size(), -1);
|
||||||
label nGlobal = 0;
|
label nGlobal = 0;
|
||||||
forAll(meshes, meshi)
|
forAll(meshes, meshi)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -135,7 +135,7 @@ void Foam::vtk::writeListParallel
|
|||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
// Write master data - with value offset
|
// Write master data - with value offset
|
||||||
const label offsetId = procOffset.localStart(0);
|
const label offsetId = procOffset.offset(0);
|
||||||
for (const label val : values)
|
for (const label val : values)
|
||||||
{
|
{
|
||||||
vtk::write(fmt, val + offsetId);
|
vtk::write(fmt, val + offsetId);
|
||||||
@ -156,7 +156,7 @@ void Foam::vtk::writeListParallel
|
|||||||
);
|
);
|
||||||
|
|
||||||
// With value offset
|
// With value offset
|
||||||
const label offsetId = procOffset.localStart(proci);
|
const label offsetId = procOffset.offset(proci);
|
||||||
for (const label val : recvData)
|
for (const label val : recvData)
|
||||||
{
|
{
|
||||||
vtk::write(fmt, val + offsetId);
|
vtk::write(fmt, val + offsetId);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2010-2018 Bernhard Gschaider
|
Copyright (C) 2010-2018 Bernhard Gschaider
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -166,7 +166,7 @@ protected:
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
static inline word defaultBoundaryType
|
static inline word defaultBoundaryType
|
||||||
(
|
(
|
||||||
const VolumeField<Type>&
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return "zeroGradient";
|
return "zeroGradient";
|
||||||
@ -180,7 +180,7 @@ protected:
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
static inline void correctField
|
static inline void correctField
|
||||||
(
|
(
|
||||||
VolumeField<Type>& fld
|
GeometricField<Type, fvPatchField, volMesh>& fld
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fld.correctBoundaryConditions();
|
fld.correctBoundaryConditions();
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2010-2018 Bernhard Gschaider
|
Copyright (C) 2010-2018 Bernhard Gschaider
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -231,14 +231,18 @@ bool Foam::expressions::fvExprDriver::isField
|
|||||||
Info<< "fvExprDriver::isField <" << name << '>' << endl;
|
Info<< "fvExprDriver::isField <" << name << '>' << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> vfieldType;
|
||||||
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfieldType;
|
||||||
|
typedef GeometricField<Type, pointPatchField, pointMesh> pfieldType;
|
||||||
|
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
wantPointData
|
wantPointData
|
||||||
? this->foundField<PointField<Type>>(name)
|
? this->foundField<pfieldType>(name)
|
||||||
:
|
:
|
||||||
(
|
(
|
||||||
this->foundField<VolumeField<Type>>(name)
|
this->foundField<vfieldType>(name)
|
||||||
|| this->foundField<SurfaceField<Type>>(name)
|
|| this->foundField<sfieldType>(name)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -118,11 +118,17 @@ Foam::expressions::patchExpr::parseDriver::getField(const word& name)
|
|||||||
const label patchIndex = patch_.index();
|
const label patchIndex = patch_.index();
|
||||||
|
|
||||||
|
|
||||||
|
// Field types
|
||||||
|
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> vfieldType;
|
||||||
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfieldType;
|
||||||
|
typedef GeometricField<Type, pointPatchField, pointMesh> pfieldType;
|
||||||
|
|
||||||
// Local, temporary storage and/or lookup values
|
// Local, temporary storage and/or lookup values
|
||||||
bool found = false;
|
bool found = false;
|
||||||
tmp<VolumeField<Type>> vfield;
|
tmp<vfieldType> vfield;
|
||||||
tmp<SurfaceField<Type>> sfield;
|
tmp<sfieldType> sfield;
|
||||||
tmp<PointField<Type>> pfield;
|
tmp<pfieldType> pfield;
|
||||||
|
|
||||||
for (int checki = 0; !found && checki < 2; ++checki)
|
for (int checki = 0; !found && checki < 2; ++checki)
|
||||||
{
|
{
|
||||||
@ -138,17 +144,17 @@ Foam::expressions::patchExpr::parseDriver::getField(const word& name)
|
|||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
vfield.cref(dynamic_cast<const VolumeField<Type>*>(ioptr));
|
vfield.cref(dynamic_cast<const vfieldType*>(ioptr));
|
||||||
found = vfield.valid();
|
found = vfield.valid();
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
sfield.cref(dynamic_cast<const SurfaceField<Type>*>(ioptr));
|
sfield.cref(dynamic_cast<const sfieldType*>(ioptr));
|
||||||
found = sfield.valid();
|
found = sfield.valid();
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
pfield.cref(dynamic_cast<const PointField<Type>*>(ioptr));
|
pfield.cref(dynamic_cast<const pfieldType*>(ioptr));
|
||||||
found = pfield.valid();
|
found = pfield.valid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,17 +165,17 @@ Foam::expressions::patchExpr::parseDriver::getField(const word& name)
|
|||||||
{
|
{
|
||||||
const word fldType = this->getTypeOfField(name);
|
const word fldType = this->getTypeOfField(name);
|
||||||
|
|
||||||
if (fldType == VolumeField<Type>::typeName)
|
if (fldType == vfieldType::typeName)
|
||||||
{
|
{
|
||||||
vfield = this->readAndRegister<VolumeField<Type>>(name, mesh());
|
vfield = this->readAndRegister<vfieldType>(name, mesh());
|
||||||
}
|
}
|
||||||
else if (fldType == SurfaceField<Type>::typeName)
|
else if (fldType == sfieldType::typeName)
|
||||||
{
|
{
|
||||||
sfield = this->readAndRegister<SurfaceField<Type>>(name, mesh());
|
sfield = this->readAndRegister<sfieldType>(name, mesh());
|
||||||
}
|
}
|
||||||
else if (fldType == PointField<Type>::typeName)
|
else if (fldType == pfieldType::typeName)
|
||||||
{
|
{
|
||||||
pfield = this->readAndRegister<PointField<Type>>
|
pfield = this->readAndRegister<pfieldType>
|
||||||
(
|
(
|
||||||
name,
|
name,
|
||||||
pointMesh::New(mesh())
|
pointMesh::New(mesh())
|
||||||
@ -203,16 +209,16 @@ Foam::expressions::patchExpr::parseDriver::getField(const word& name)
|
|||||||
<< pTraits<Type>::typeName << nl << nl;
|
<< pTraits<Type>::typeName << nl << nl;
|
||||||
|
|
||||||
FatalError
|
FatalError
|
||||||
<< VolumeField<Type>::typeName << " Fields: "
|
<< vfieldType::typeName << " Fields: "
|
||||||
<< flatOutput(obr.sortedNames<VolumeField<Type>>()) << nl;
|
<< flatOutput(obr.sortedNames<vfieldType>()) << nl;
|
||||||
|
|
||||||
FatalError
|
FatalError
|
||||||
<< SurfaceField<Type>::typeName << " Fields: "
|
<< sfieldType::typeName << " Fields: "
|
||||||
<< flatOutput(obr.sortedNames<SurfaceField<Type>>()) << nl;
|
<< flatOutput(obr.sortedNames<sfieldType>()) << nl;
|
||||||
|
|
||||||
FatalError
|
FatalError
|
||||||
<< PointField<Type>::typeName << " Fields: "
|
<< pfieldType::typeName << " Fields: "
|
||||||
<< flatOutput(obr.sortedNames<PointField<Type>>()) << nl;
|
<< flatOutput(obr.sortedNames<pfieldType>()) << nl;
|
||||||
|
|
||||||
FatalError
|
FatalError
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
@ -239,10 +245,15 @@ Foam::expressions::patchExpr::parseDriver::patchInternalField
|
|||||||
const label patchIndex = patch_.index();
|
const label patchIndex = patch_.index();
|
||||||
|
|
||||||
|
|
||||||
|
// Field types
|
||||||
|
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> vfieldType;
|
||||||
|
typedef GeometricField<Type, pointPatchField, pointMesh> pfieldType;
|
||||||
|
|
||||||
// Local, temporary storage and/or lookup values
|
// Local, temporary storage and/or lookup values
|
||||||
bool found = false;
|
bool found = false;
|
||||||
tmp<VolumeField<Type>> vfield;
|
tmp<vfieldType> vfield;
|
||||||
tmp<PointField<Type>> pfield;
|
tmp<pfieldType> pfield;
|
||||||
|
|
||||||
for (int checki = 0; !found && checki < 2; ++checki)
|
for (int checki = 0; !found && checki < 2; ++checki)
|
||||||
{
|
{
|
||||||
@ -258,12 +269,12 @@ Foam::expressions::patchExpr::parseDriver::patchInternalField
|
|||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
vfield.cref(dynamic_cast<const VolumeField<Type>*>(ioptr));
|
vfield.cref(dynamic_cast<const vfieldType*>(ioptr));
|
||||||
found = vfield.valid();
|
found = vfield.valid();
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
pfield.cref(dynamic_cast<const PointField<Type>*>(ioptr));
|
pfield.cref(dynamic_cast<const pfieldType*>(ioptr));
|
||||||
found = pfield.valid();
|
found = pfield.valid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,13 +285,13 @@ Foam::expressions::patchExpr::parseDriver::patchInternalField
|
|||||||
{
|
{
|
||||||
const word fldType = this->getTypeOfField(name);
|
const word fldType = this->getTypeOfField(name);
|
||||||
|
|
||||||
if (fldType == VolumeField<Type>::typeName)
|
if (fldType == vfieldType::typeName)
|
||||||
{
|
{
|
||||||
vfield = this->readAndRegister<VolumeField<Type>>(name, mesh());
|
vfield = this->readAndRegister<vfieldType>(name, mesh());
|
||||||
}
|
}
|
||||||
else if (fldType == PointField<Type>::typeName)
|
else if (fldType == pfieldType::typeName)
|
||||||
{
|
{
|
||||||
pfield = this->readAndRegister<PointField<Type>>
|
pfield = this->readAndRegister<pfieldType>
|
||||||
(
|
(
|
||||||
name,
|
name,
|
||||||
pointMesh::New(mesh())
|
pointMesh::New(mesh())
|
||||||
@ -304,12 +315,12 @@ Foam::expressions::patchExpr::parseDriver::patchInternalField
|
|||||||
<< pTraits<Type>::typeName << nl << nl;
|
<< pTraits<Type>::typeName << nl << nl;
|
||||||
|
|
||||||
FatalError
|
FatalError
|
||||||
<< VolumeField<Type>::typeName << " Fields: "
|
<< vfieldType::typeName << " Fields: "
|
||||||
<< flatOutput(obr.sortedNames<VolumeField<Type>>()) << nl;
|
<< flatOutput(obr.sortedNames<vfieldType>()) << nl;
|
||||||
|
|
||||||
FatalError
|
FatalError
|
||||||
<< PointField<Type>::typeName << " Fields: "
|
<< pfieldType::typeName << " Fields: "
|
||||||
<< flatOutput(obr.sortedNames<PointField<Type>>()) << nl;
|
<< flatOutput(obr.sortedNames<pfieldType>()) << nl;
|
||||||
|
|
||||||
FatalError
|
FatalError
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
@ -336,9 +347,13 @@ Foam::expressions::patchExpr::parseDriver::patchNeighbourField
|
|||||||
const label patchIndex = patch_.index();
|
const label patchIndex = patch_.index();
|
||||||
|
|
||||||
|
|
||||||
|
// Field types
|
||||||
|
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> vfieldType;
|
||||||
|
|
||||||
// Local, temporary storage and/or lookup values
|
// Local, temporary storage and/or lookup values
|
||||||
bool found = false;
|
bool found = false;
|
||||||
tmp<VolumeField<Type>> vfield;
|
tmp<vfieldType> vfield;
|
||||||
|
|
||||||
for (int checki = 0; !found && checki < 2; ++checki)
|
for (int checki = 0; !found && checki < 2; ++checki)
|
||||||
{
|
{
|
||||||
@ -354,7 +369,7 @@ Foam::expressions::patchExpr::parseDriver::patchNeighbourField
|
|||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
vfield.cref(dynamic_cast<const VolumeField<Type>*>(ioptr));
|
vfield.cref(dynamic_cast<const vfieldType*>(ioptr));
|
||||||
found = vfield.valid();
|
found = vfield.valid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -365,9 +380,9 @@ Foam::expressions::patchExpr::parseDriver::patchNeighbourField
|
|||||||
{
|
{
|
||||||
const word fldType = this->getTypeOfField(name);
|
const word fldType = this->getTypeOfField(name);
|
||||||
|
|
||||||
if (fldType == VolumeField<Type>::typeName)
|
if (fldType == vfieldType::typeName)
|
||||||
{
|
{
|
||||||
vfield = this->readAndRegister<VolumeField<Type>>(name, mesh());
|
vfield = this->readAndRegister<vfieldType>(name, mesh());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,8 +398,8 @@ Foam::expressions::patchExpr::parseDriver::patchNeighbourField
|
|||||||
<< pTraits<Type>::typeName << nl << nl;
|
<< pTraits<Type>::typeName << nl << nl;
|
||||||
|
|
||||||
FatalError
|
FatalError
|
||||||
<< VolumeField<Type>::typeName << " Fields: "
|
<< vfieldType::typeName << " Fields: "
|
||||||
<< flatOutput(obr.sortedNames<VolumeField<Type>>()) << nl;
|
<< flatOutput(obr.sortedNames<vfieldType>()) << nl;
|
||||||
|
|
||||||
FatalError
|
FatalError
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
@ -411,9 +426,13 @@ Foam::expressions::patchExpr::parseDriver::patchNormalField
|
|||||||
const label patchIndex = patch_.index();
|
const label patchIndex = patch_.index();
|
||||||
|
|
||||||
|
|
||||||
|
// Field types
|
||||||
|
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> vfieldType;
|
||||||
|
|
||||||
// Local, temporary storage and/or lookup values
|
// Local, temporary storage and/or lookup values
|
||||||
bool found = false;
|
bool found = false;
|
||||||
tmp<VolumeField<Type>> vfield;
|
tmp<vfieldType> vfield;
|
||||||
|
|
||||||
for (int checki = 0; !found && checki < 2; ++checki)
|
for (int checki = 0; !found && checki < 2; ++checki)
|
||||||
{
|
{
|
||||||
@ -429,7 +448,7 @@ Foam::expressions::patchExpr::parseDriver::patchNormalField
|
|||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
vfield.cref(dynamic_cast<const VolumeField<Type>*>(ioptr));
|
vfield.cref(dynamic_cast<const vfieldType*>(ioptr));
|
||||||
found = vfield.valid();
|
found = vfield.valid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -440,9 +459,9 @@ Foam::expressions::patchExpr::parseDriver::patchNormalField
|
|||||||
{
|
{
|
||||||
const word fldType = this->getTypeOfField(name);
|
const word fldType = this->getTypeOfField(name);
|
||||||
|
|
||||||
if (fldType == VolumeField<Type>::typeName)
|
if (fldType == vfieldType::typeName)
|
||||||
{
|
{
|
||||||
vfield = this->readAndRegister<VolumeField<Type>>(name, mesh());
|
vfield = this->readAndRegister<vfieldType>(name, mesh());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,8 +477,8 @@ Foam::expressions::patchExpr::parseDriver::patchNormalField
|
|||||||
<< pTraits<Type>::typeName << nl << nl;
|
<< pTraits<Type>::typeName << nl << nl;
|
||||||
|
|
||||||
FatalError
|
FatalError
|
||||||
<< VolumeField<Type>::typeName << " Fields: "
|
<< vfieldType::typeName << " Fields: "
|
||||||
<< flatOutput(obr.sortedNames<VolumeField<Type>>()) << nl;
|
<< flatOutput(obr.sortedNames<vfieldType>()) << nl;
|
||||||
|
|
||||||
FatalError
|
FatalError
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -325,48 +325,60 @@ public:
|
|||||||
|
|
||||||
//- Set result (vol field)
|
//- Set result (vol field)
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void setResult(VolumeField<Type>* ptr, bool logical = false);
|
void setResult
|
||||||
|
(
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>* ptr,
|
||||||
|
bool logical = false
|
||||||
|
);
|
||||||
|
|
||||||
//- Set result (surface field)
|
//- Set result (surface field)
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void setResult(SurfaceField<Type>* ptr, bool logical = false);
|
void setResult
|
||||||
|
(
|
||||||
|
GeometricField<Type, fvsPatchField, surfaceMesh>* ptr,
|
||||||
|
bool logical = false
|
||||||
|
);
|
||||||
|
|
||||||
//- Set result (point field)
|
//- Set result (point field)
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void setResult(PointField<Type>* ptr, bool logical = false);
|
void setResult
|
||||||
|
(
|
||||||
|
GeometricField<Type, pointPatchField, pointMesh>* ptr,
|
||||||
|
bool logical = false
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// New Fields
|
// New Fields
|
||||||
|
|
||||||
//- Return a new volume field with the mesh size
|
//- Return a new volume field with the mesh size
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<VolumeField<Type>>
|
tmp<GeometricField<Type, fvPatchField, volMesh>>
|
||||||
newVolField(const Type& val = pTraits<Type>::zero) const;
|
newVolField(const Type& val = pTraits<Type>::zero) const;
|
||||||
|
|
||||||
//- Return a new surface field with the mesh nInternalFaces size
|
//- Return a new surface field with the mesh nInternalFaces size
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<SurfaceField<Type>>
|
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
|
||||||
newSurfaceField(const Type& val = pTraits<Type>::zero) const;
|
newSurfaceField(const Type& val = pTraits<Type>::zero) const;
|
||||||
|
|
||||||
//- Return a new point field with the mesh nPoints size
|
//- Return a new point field with the mesh nPoints size
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<PointField<Type>>
|
tmp<GeometricField<Type, pointPatchField, pointMesh>>
|
||||||
newPointField(const Type& val = pTraits<Type>::zero) const;
|
newPointField(const Type& val = pTraits<Type>::zero) const;
|
||||||
|
|
||||||
|
|
||||||
//- Retrieve field (vol field)
|
//- Retrieve field (vol field)
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<VolumeField<Type>>
|
tmp<GeometricField<Type, fvPatchField, volMesh>>
|
||||||
getVolField(const word& fldName, bool getOldTime=false);
|
getVolField(const word& fldName, bool getOldTime=false);
|
||||||
|
|
||||||
//- Retrieve field (surface field)
|
//- Retrieve field (surface field)
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<SurfaceField<Type>>
|
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
|
||||||
getSurfaceField(const word& fldName, bool getOldTime=false);
|
getSurfaceField(const word& fldName, bool getOldTime=false);
|
||||||
|
|
||||||
//- Retrieve field (surface field)
|
//- Retrieve field (surface field)
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<PointField<Type>>
|
tmp<GeometricField<Type, pointPatchField, pointMesh>>
|
||||||
getPointField(const word& fldName, bool getOldTime=false);
|
getPointField(const word& fldName, bool getOldTime=false);
|
||||||
|
|
||||||
|
|
||||||
@ -374,39 +386,57 @@ public:
|
|||||||
|
|
||||||
//- Interpolate cell to face values
|
//- Interpolate cell to face values
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<SurfaceField<Type>>
|
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>>
|
||||||
cellToFace(const VolumeField<Type>& field) const;
|
cellToFace
|
||||||
|
(
|
||||||
|
const GeometricField<Type,fvPatchField,volMesh>& field
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Interpolate cell to point values
|
//- Interpolate cell to point values
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<PointField<Type>>
|
tmp<GeometricField<Type, pointPatchField, pointMesh>>
|
||||||
cellToPoint(const VolumeField<Type>& field) const;
|
cellToPoint
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& field
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Interpolate point to cell values
|
//- Interpolate point to cell values
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<VolumeField<Type>>
|
tmp<GeometricField<Type, fvPatchField, volMesh>>
|
||||||
pointToCell(const PointField<Type>& field) const;
|
pointToCell
|
||||||
|
(
|
||||||
|
const GeometricField<Type, pointPatchField, pointMesh>& field
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Custom Field Functions
|
// Custom Field Functions
|
||||||
|
|
||||||
//- The volume-weighted average of a field
|
//- The volume-weighted average of a field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Type volAverage(VolumeField<Type>& fld) const
|
Type volAverage
|
||||||
|
(
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>& fld
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
return weightedAverage(fld.mesh().V(), fld.primitiveField());
|
return weightedAverage(fld.mesh().V(), fld.primitiveField());
|
||||||
}
|
}
|
||||||
|
|
||||||
//- The volume-weighted sum of a field
|
//- The volume-weighted sum of a field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Type volSum(VolumeField<Type>& fld) const
|
Type volSum
|
||||||
|
(
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>& fld
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
return weightedSum(fld.mesh().V(), fld.primitiveField());
|
return weightedSum(fld.mesh().V(), fld.primitiveField());
|
||||||
}
|
}
|
||||||
|
|
||||||
//- The area-weighted average of a field
|
//- The area-weighted average of a field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Type areaAverage(SurfaceField<Type>& fld) const
|
Type areaAverage
|
||||||
|
(
|
||||||
|
GeometricField<Type, fvsPatchField, surfaceMesh>& fld
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
return weightedAverage
|
return weightedAverage
|
||||||
(
|
(
|
||||||
@ -417,7 +447,10 @@ public:
|
|||||||
|
|
||||||
//- The area-weighted sum of a field
|
//- The area-weighted sum of a field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Type areaSum(SurfaceField<Type>& fld) const
|
Type areaSum
|
||||||
|
(
|
||||||
|
GeometricField<Type, fvsPatchField, surfaceMesh>& fld
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
return weightedSum
|
return weightedSum
|
||||||
(
|
(
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -62,14 +62,16 @@ void Foam::expressions::volumeExpr::parseDriver::setInternalFieldResult
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::expressions::volumeExpr::parseDriver::setResult
|
void Foam::expressions::volumeExpr::parseDriver::setResult
|
||||||
(
|
(
|
||||||
VolumeField<Type>* ptr,
|
GeometricField<Type, fvPatchField, volMesh>* ptr,
|
||||||
bool logical
|
bool logical
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
resultField_.reset(nullptr);
|
resultField_.reset(nullptr);
|
||||||
|
|
||||||
// Characteristics
|
// Characteristics
|
||||||
resultType_ = VolumeField<Type>::typeName;
|
resultType_ = pTraits<fieldType>::typeName;
|
||||||
isLogical_ = logical;
|
isLogical_ = logical;
|
||||||
fieldGeoType_ = VOLUME_DATA;
|
fieldGeoType_ = VOLUME_DATA;
|
||||||
|
|
||||||
@ -89,14 +91,16 @@ void Foam::expressions::volumeExpr::parseDriver::setResult
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::expressions::volumeExpr::parseDriver::setResult
|
void Foam::expressions::volumeExpr::parseDriver::setResult
|
||||||
(
|
(
|
||||||
SurfaceField<Type>* ptr,
|
GeometricField<Type, fvsPatchField, surfaceMesh>* ptr,
|
||||||
bool logical
|
bool logical
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> fieldType;
|
||||||
|
|
||||||
resultField_.reset(nullptr);
|
resultField_.reset(nullptr);
|
||||||
|
|
||||||
// Characteristics
|
// Characteristics
|
||||||
resultType_ = SurfaceField<Type>::typeName;
|
resultType_ = pTraits<fieldType>::typeName;
|
||||||
isLogical_ = logical;
|
isLogical_ = logical;
|
||||||
fieldGeoType_ = FACE_DATA;
|
fieldGeoType_ = FACE_DATA;
|
||||||
|
|
||||||
@ -116,14 +120,16 @@ void Foam::expressions::volumeExpr::parseDriver::setResult
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::expressions::volumeExpr::parseDriver::setResult
|
void Foam::expressions::volumeExpr::parseDriver::setResult
|
||||||
(
|
(
|
||||||
PointField<Type>* ptr,
|
GeometricField<Type, pointPatchField, pointMesh>* ptr,
|
||||||
bool logical
|
bool logical
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
typedef GeometricField<Type, pointPatchField, pointMesh> fieldType;
|
||||||
|
|
||||||
resultField_.reset(nullptr);
|
resultField_.reset(nullptr);
|
||||||
|
|
||||||
// Characteristics
|
// Characteristics
|
||||||
resultType_ = PointField<Type>::typeName;
|
resultType_ = pTraits<fieldType>::typeName;
|
||||||
isLogical_ = logical;
|
isLogical_ = logical;
|
||||||
fieldGeoType_ = POINT_DATA;
|
fieldGeoType_ = POINT_DATA;
|
||||||
|
|
||||||
@ -176,14 +182,16 @@ Foam::expressions::volumeExpr::parseDriver::isResultType
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::VolumeField<Type>>
|
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
|
||||||
Foam::expressions::volumeExpr::parseDriver::getVolField
|
Foam::expressions::volumeExpr::parseDriver::getVolField
|
||||||
(
|
(
|
||||||
const word& fldName,
|
const word& fldName,
|
||||||
bool getOldTime
|
bool getOldTime
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return this->getOrReadField<VolumeField<Type>>
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
|
return this->getOrReadField<fieldType>
|
||||||
(
|
(
|
||||||
fldName,
|
fldName,
|
||||||
true, // mandatory
|
true, // mandatory
|
||||||
@ -193,14 +201,16 @@ Foam::expressions::volumeExpr::parseDriver::getVolField
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::SurfaceField<Type>>
|
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>>
|
||||||
Foam::expressions::volumeExpr::parseDriver::getSurfaceField
|
Foam::expressions::volumeExpr::parseDriver::getSurfaceField
|
||||||
(
|
(
|
||||||
const word& fldName,
|
const word& fldName,
|
||||||
bool getOldTime
|
bool getOldTime
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return this->getOrReadField<SurfaceField<Type>>
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> fieldType;
|
||||||
|
|
||||||
|
return this->getOrReadField<fieldType>
|
||||||
(
|
(
|
||||||
fldName,
|
fldName,
|
||||||
true, // mandatory
|
true, // mandatory
|
||||||
@ -210,14 +220,16 @@ Foam::expressions::volumeExpr::parseDriver::getSurfaceField
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::PointField<Type>>
|
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>>
|
||||||
Foam::expressions::volumeExpr::parseDriver::getPointField
|
Foam::expressions::volumeExpr::parseDriver::getPointField
|
||||||
(
|
(
|
||||||
const word& fldName,
|
const word& fldName,
|
||||||
bool getOldTime
|
bool getOldTime
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return this->getOrReadPointField<PointField<Type>>
|
typedef GeometricField<Type, pointPatchField, pointMesh> fieldType;
|
||||||
|
|
||||||
|
return this->getOrReadPointField<fieldType>
|
||||||
(
|
(
|
||||||
fldName,
|
fldName,
|
||||||
true, // mandatory
|
true, // mandatory
|
||||||
@ -227,13 +239,15 @@ Foam::expressions::volumeExpr::parseDriver::getPointField
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::VolumeField<Type>>
|
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
|
||||||
Foam::expressions::volumeExpr::parseDriver::newVolField
|
Foam::expressions::volumeExpr::parseDriver::newVolField
|
||||||
(
|
(
|
||||||
const Type& val
|
const Type& val
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return VolumeField<Type>::New
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
|
return fieldType::New
|
||||||
(
|
(
|
||||||
word("constant.") + word(pTraits<Type>::typeName),
|
word("constant.") + word(pTraits<Type>::typeName),
|
||||||
mesh(),
|
mesh(),
|
||||||
@ -243,13 +257,15 @@ Foam::expressions::volumeExpr::parseDriver::newVolField
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::SurfaceField<Type>>
|
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>>
|
||||||
Foam::expressions::volumeExpr::parseDriver::newSurfaceField
|
Foam::expressions::volumeExpr::parseDriver::newSurfaceField
|
||||||
(
|
(
|
||||||
const Type& val
|
const Type& val
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return SurfaceField<Type>::New
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> fieldType;
|
||||||
|
|
||||||
|
return fieldType::New
|
||||||
(
|
(
|
||||||
word("constant.") + word(pTraits<Type>::typeName),
|
word("constant.") + word(pTraits<Type>::typeName),
|
||||||
mesh(),
|
mesh(),
|
||||||
@ -259,13 +275,15 @@ Foam::expressions::volumeExpr::parseDriver::newSurfaceField
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::PointField<Type>>
|
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>>
|
||||||
Foam::expressions::volumeExpr::parseDriver::newPointField
|
Foam::expressions::volumeExpr::parseDriver::newPointField
|
||||||
(
|
(
|
||||||
const Type& val
|
const Type& val
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return PointField<Type>::New
|
typedef GeometricField<Type, pointPatchField, pointMesh> fieldType;
|
||||||
|
|
||||||
|
return fieldType::New
|
||||||
(
|
(
|
||||||
word("constant.") + word(pTraits<Type>::typeName),
|
word("constant.") + word(pTraits<Type>::typeName),
|
||||||
pointMesh::New(mesh()),
|
pointMesh::New(mesh()),
|
||||||
@ -275,10 +293,10 @@ Foam::expressions::volumeExpr::parseDriver::newPointField
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::SurfaceField<Type>>
|
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>>
|
||||||
Foam::expressions::volumeExpr::parseDriver::cellToFace
|
Foam::expressions::volumeExpr::parseDriver::cellToFace
|
||||||
(
|
(
|
||||||
const VolumeField<Type>& field
|
const GeometricField<Type, fvPatchField, volMesh>& field
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return fvc::interpolate(field);
|
return fvc::interpolate(field);
|
||||||
@ -286,10 +304,10 @@ Foam::expressions::volumeExpr::parseDriver::cellToFace
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::PointField<Type>>
|
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>>
|
||||||
Foam::expressions::volumeExpr::parseDriver::cellToPoint
|
Foam::expressions::volumeExpr::parseDriver::cellToPoint
|
||||||
(
|
(
|
||||||
const VolumeField<Type>& field
|
const GeometricField<Type, fvPatchField, volMesh>& field
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
volPointInterpolation interp(this->mesh());
|
volPointInterpolation interp(this->mesh());
|
||||||
@ -298,10 +316,10 @@ Foam::expressions::volumeExpr::parseDriver::cellToPoint
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::VolumeField<Type>>
|
Foam::tmp<Foam::GeometricField<Type,Foam::fvPatchField,Foam::volMesh>>
|
||||||
Foam::expressions::volumeExpr::parseDriver::pointToCell
|
Foam::expressions::volumeExpr::parseDriver::pointToCell
|
||||||
(
|
(
|
||||||
const PointField<Type>& field
|
const GeometricField<Type, pointPatchField, pointMesh>& field
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
auto tresult = newVolField<Type>();
|
auto tresult = newVolField<Type>();
|
||||||
|
|||||||
@ -76,8 +76,8 @@ bool Foam::functionObjects::columnAverage::columnAverageField
|
|||||||
const labelList& cellToPatchFace = ms.cellToPatchFaceAddressing();
|
const labelList& cellToPatchFace = ms.cellToPatchFaceAddressing();
|
||||||
|
|
||||||
// Brute force: collect per-global-patchface on all processors
|
// Brute force: collect per-global-patchface on all processors
|
||||||
Field<Type> regionField(globalFaces_().totalSize(), Zero);
|
Field<Type> regionField(globalFaces_().size(), Zero);
|
||||||
labelList regionCount(globalFaces_().totalSize(), Zero);
|
labelList regionCount(globalFaces_().size(), 0);
|
||||||
|
|
||||||
forAll(cellToPatchFace, celli)
|
forAll(cellToPatchFace, celli)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -80,7 +80,7 @@ template<class Type>
|
|||||||
static void doCorrectBoundaryConditions
|
static void doCorrectBoundaryConditions
|
||||||
(
|
(
|
||||||
bool correctBCs,
|
bool correctBCs,
|
||||||
VolumeField<Type>& field
|
GeometricField<Type, fvPatchField, volMesh>& field
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (correctBCs)
|
if (correctBCs)
|
||||||
@ -104,7 +104,7 @@ template<class Type>
|
|||||||
void doCorrectBoundaryConditions
|
void doCorrectBoundaryConditions
|
||||||
(
|
(
|
||||||
bool correctBCs,
|
bool correctBCs,
|
||||||
PointField<Type>& field
|
GeometricField<Type, pointPatchField, pointMesh>& field
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (correctBCs)
|
if (correctBCs)
|
||||||
@ -119,7 +119,7 @@ template<class Type>
|
|||||||
void doCorrectBoundaryConditions
|
void doCorrectBoundaryConditions
|
||||||
(
|
(
|
||||||
bool correctBCs,
|
bool correctBCs,
|
||||||
SurfaceField<Type>& field
|
GeometricField<Type, fvsPatchField, surfaceMesh>& field
|
||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -148,11 +148,15 @@ bool Foam::functionObjects::fvExpressionField::loadAndStore(const IOobject& io)
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
bool Foam::functionObjects::fvExpressionField::loadField(const IOobject& io)
|
bool Foam::functionObjects::fvExpressionField::loadField(const IOobject& io)
|
||||||
{
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||||
|
// typedef typename VolFieldType::Internal IntVolFieldType;
|
||||||
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
|
||||||
|
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
loadAndStore<VolumeField<Type>>(io)
|
loadAndStore<VolFieldType>(io)
|
||||||
/// || loadAndStore<VolumeInternalField<Type>>(io)
|
/// || loadAndStore<IntVolFieldType>(io)
|
||||||
|| loadAndStore<SurfaceField<Type>>(io)
|
|| loadAndStore<SurfaceFieldType>(io)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -141,7 +141,7 @@ void Foam::functionObjects::externalCoupled::readColumns
|
|||||||
<< "Trying to read data for processor " << proci
|
<< "Trying to read data for processor " << proci
|
||||||
<< " row " << rowi
|
<< " row " << rowi
|
||||||
<< ". Does your file have as many rows as there are"
|
<< ". Does your file have as many rows as there are"
|
||||||
<< " patch faces (" << globalFaces.totalSize()
|
<< " patch faces (" << globalFaces.size()
|
||||||
<< ") ?" << exit(FatalIOError);
|
<< ") ?" << exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ void Foam::functionObjects::externalCoupled::readLines
|
|||||||
<< "Trying to read data for processor " << proci
|
<< "Trying to read data for processor " << proci
|
||||||
<< " row " << rowi
|
<< " row " << rowi
|
||||||
<< ". Does your file have as many rows as there are"
|
<< ". Does your file have as many rows as there are"
|
||||||
<< " patch faces (" << globalFaces.totalSize()
|
<< " patch faces (" << globalFaces.size()
|
||||||
<< ") ?" << exit(FatalIOError);
|
<< ") ?" << exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
// Global indexing
|
// Global indexing
|
||||||
globalIndex globalWalls(nPatchFaces);
|
globalIndex globalWalls(nPatchFaces);
|
||||||
|
|
||||||
DebugInFunction << "nPatchFaces: " << globalWalls.totalSize() << endl;
|
DebugInFunction << "nPatchFaces: " << globalWalls.size() << endl;
|
||||||
|
|
||||||
// Construct cloud
|
// Construct cloud
|
||||||
Cloud<findCellParticle> cloud
|
Cloud<findCellParticle> cloud
|
||||||
|
|||||||
@ -563,7 +563,7 @@ bool Foam::functionObjects::streamLineBase::writeToFile()
|
|||||||
|
|
||||||
const mapDistribute distMap
|
const mapDistribute distMap
|
||||||
(
|
(
|
||||||
globalTrackIDs.totalSize(),
|
globalTrackIDs.size(),
|
||||||
std::move(sendMap),
|
std::move(sendMap),
|
||||||
std::move(recvMap)
|
std::move(recvMap)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -5,7 +5,8 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,6 +28,7 @@ License
|
|||||||
|
|
||||||
#include "valueAverage.H"
|
#include "valueAverage.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -39,6 +41,21 @@ namespace functionObjects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::functionObjects::valueAverage::writeFileHeader(Ostream& os) const
|
||||||
|
{
|
||||||
|
writeHeader(os, "Value averages");
|
||||||
|
writeCommented(os, "Time");
|
||||||
|
forAll(fieldNames_, fieldi)
|
||||||
|
{
|
||||||
|
writeTabbed(os, fieldNames_[fieldi]);
|
||||||
|
}
|
||||||
|
os << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjects::valueAverage::valueAverage
|
Foam::functionObjects::valueAverage::valueAverage
|
||||||
@ -49,9 +66,30 @@ Foam::functionObjects::valueAverage::valueAverage
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
regionFunctionObject(name, runTime, dict),
|
regionFunctionObject(name, runTime, dict),
|
||||||
valueAverageBase(name, obr_, dict, *this)
|
writeFile(obr_, name, typeName, dict),
|
||||||
|
functionObjectName_("unknown-functionObject"),
|
||||||
|
fieldNames_(),
|
||||||
|
window_(-1),
|
||||||
|
totalTime_(),
|
||||||
|
resetOnRestart_(false)
|
||||||
{
|
{
|
||||||
readState(this->propertyDict());
|
read(dict);
|
||||||
|
|
||||||
|
if (resetOnRestart_)
|
||||||
|
{
|
||||||
|
forAll(fieldNames_, fieldi)
|
||||||
|
{
|
||||||
|
const word& fieldName = fieldNames_[fieldi];
|
||||||
|
|
||||||
|
if (dict.found(fieldName))
|
||||||
|
{
|
||||||
|
const dictionary& valueDict = dict.subDict(fieldName);
|
||||||
|
valueDict.readEntry("totalTime", totalTime_[fieldi]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writeFileHeader(file());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -59,25 +97,103 @@ Foam::functionObjects::valueAverage::valueAverage
|
|||||||
|
|
||||||
bool Foam::functionObjects::valueAverage::read(const dictionary& dict)
|
bool Foam::functionObjects::valueAverage::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
if (regionFunctionObject::read(dict) && valueAverageBase::read(dict))
|
regionFunctionObject::read(dict);
|
||||||
|
writeFile::read(dict);
|
||||||
|
|
||||||
|
// Make certain that the values are consistent with the defaults:
|
||||||
|
resetOnRestart_ = false;
|
||||||
|
|
||||||
|
dict.readEntry("functionObject", functionObjectName_);
|
||||||
|
dict.readEntry("fields", fieldNames_);
|
||||||
|
if (dict.readIfPresent("window", window_))
|
||||||
{
|
{
|
||||||
return true;
|
window_ = obr().time().userTimeToTime(window_);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
totalTime_.setSize(fieldNames_.size());
|
||||||
|
forAll(totalTime_, i)
|
||||||
|
{
|
||||||
|
totalTime_[i] = time_.deltaTValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
dict.readIfPresent("resetOnRestart", resetOnRestart_);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::valueAverage::execute()
|
bool Foam::functionObjects::valueAverage::execute()
|
||||||
{
|
{
|
||||||
(void)valueAverageBase::calculate(this->propertyDict());
|
scalar dt = obr_.time().deltaTValue();
|
||||||
|
|
||||||
|
Log << type() << ": " << name() << " averages:" << nl;
|
||||||
|
|
||||||
|
file() << time_.timeName();
|
||||||
|
|
||||||
|
DynamicList<label> unprocessedFields(fieldNames_.size());
|
||||||
|
|
||||||
|
forAll(fieldNames_, fieldi)
|
||||||
|
{
|
||||||
|
const word& fieldName(fieldNames_[fieldi]);
|
||||||
|
const word meanName(fieldName + "Mean");
|
||||||
|
|
||||||
|
scalar Dt = totalTime_[fieldi];
|
||||||
|
scalar alpha = (Dt - dt)/Dt;
|
||||||
|
scalar beta = dt/Dt;
|
||||||
|
|
||||||
|
if (window_ > 0)
|
||||||
|
{
|
||||||
|
if (Dt - dt >= window_)
|
||||||
|
{
|
||||||
|
alpha = (window_ - dt)/window_;
|
||||||
|
beta = dt/window_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool processed = false;
|
||||||
|
calc<scalar>(fieldName, meanName, alpha, beta, processed);
|
||||||
|
calc<vector>(fieldName, meanName, alpha, beta, processed);
|
||||||
|
calc<sphericalTensor>(fieldName, meanName, alpha, beta, processed);
|
||||||
|
calc<symmTensor>(fieldName, meanName, alpha, beta, processed);
|
||||||
|
calc<tensor>(fieldName, meanName, alpha, beta, processed);
|
||||||
|
|
||||||
|
if (!processed)
|
||||||
|
{
|
||||||
|
unprocessedFields.append(fieldi);
|
||||||
|
|
||||||
|
if (writeToFile())
|
||||||
|
{
|
||||||
|
file() << tab << "n/a";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
totalTime_[fieldi] += dt;
|
||||||
|
}
|
||||||
|
|
||||||
|
file()<< endl;
|
||||||
|
|
||||||
|
if (unprocessedFields.size())
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "From function object: " << functionObjectName_ << nl
|
||||||
|
<< "Unprocessed fields:" << nl;
|
||||||
|
|
||||||
|
forAll(unprocessedFields, i)
|
||||||
|
{
|
||||||
|
label fieldi = unprocessedFields[i];
|
||||||
|
Log << " " << fieldNames_[fieldi] << nl;
|
||||||
|
}
|
||||||
|
Log << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log << endl;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::valueAverage::write()
|
bool Foam::functionObjects::valueAverage::write()
|
||||||
{
|
{
|
||||||
valueAverageBase::writeState(this->propertyDict());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,8 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -78,13 +79,14 @@ Usage
|
|||||||
|
|
||||||
The inherited entries are elaborated in:
|
The inherited entries are elaborated in:
|
||||||
- \link regionFunctionObject.H \endlink
|
- \link regionFunctionObject.H \endlink
|
||||||
- \link valueAverageBase.H \endlink
|
- \link writeFile.H \endlink
|
||||||
|
|
||||||
Usage by the \c postProcess utility is not available.
|
Usage by the \c postProcess utility is not available.
|
||||||
|
|
||||||
See also
|
See also
|
||||||
- Foam::functionObject
|
- Foam::functionObject
|
||||||
- Foam::functionObjects::valueAverageBase
|
- Foam::functionObjects::stateFunctionObject
|
||||||
|
- Foam::functionObjects::writeFile
|
||||||
- ExtendedCodeGuide::functionObjects::field::valueAverage
|
- ExtendedCodeGuide::functionObjects::field::valueAverage
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -97,7 +99,6 @@ SourceFiles
|
|||||||
#define functionObjects_valueAverage_H
|
#define functionObjects_valueAverage_H
|
||||||
|
|
||||||
#include "regionFunctionObject.H"
|
#include "regionFunctionObject.H"
|
||||||
#include "valueAverageBase.H"
|
|
||||||
#include "writeFile.H"
|
#include "writeFile.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -114,8 +115,45 @@ namespace functionObjects
|
|||||||
class valueAverage
|
class valueAverage
|
||||||
:
|
:
|
||||||
public regionFunctionObject,
|
public regionFunctionObject,
|
||||||
public valueAverageBase
|
public writeFile
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Data
|
||||||
|
|
||||||
|
//- Name of function object to retrieve data from
|
||||||
|
word functionObjectName_;
|
||||||
|
|
||||||
|
//- List of fields on which to operate
|
||||||
|
wordList fieldNames_;
|
||||||
|
|
||||||
|
//- Averaging window
|
||||||
|
scalar window_;
|
||||||
|
|
||||||
|
//- Average time per field
|
||||||
|
List<scalar> totalTime_;
|
||||||
|
|
||||||
|
//- Reset the averaging process on restart
|
||||||
|
Switch resetOnRestart_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Templated function to calculate the average
|
||||||
|
template<class Type>
|
||||||
|
void calc
|
||||||
|
(
|
||||||
|
const word& fieldName,
|
||||||
|
const word& meanName,
|
||||||
|
const scalar alpha,
|
||||||
|
const scalar beta,
|
||||||
|
bool& processed
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Output file header information
|
||||||
|
virtual void writeFileHeader(Ostream& os) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -163,6 +201,12 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "valueAverageTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -5,7 +5,8 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,56 +26,37 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "noneCondition.H"
|
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
template<class Type>
|
||||||
|
void Foam::functionObjects::valueAverage::calc
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
namespace functionObjects
|
|
||||||
{
|
|
||||||
namespace runTimeControls
|
|
||||||
{
|
|
||||||
defineTypeName(noneCondition);
|
|
||||||
addToRunTimeSelectionTable(runTimeCondition, noneCondition, dictionary);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::functionObjects::runTimeControls::noneCondition::noneCondition
|
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& fieldName,
|
||||||
const objectRegistry& obr,
|
const word& meanName,
|
||||||
const dictionary& dict,
|
const scalar alpha,
|
||||||
stateFunctionObject& state
|
const scalar beta,
|
||||||
|
bool& processed
|
||||||
)
|
)
|
||||||
:
|
|
||||||
runTimeCondition(name, obr, dict, state)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
bool Foam::functionObjects::runTimeControls::noneCondition::apply()
|
|
||||||
{
|
{
|
||||||
return true;
|
const word valueType = objectResultType(functionObjectName_, fieldName);
|
||||||
}
|
|
||||||
|
|
||||||
|
if (pTraits<Type>::typeName != valueType)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void Foam::functionObjects::runTimeControls::noneCondition::write()
|
Type currentValue = getObjectResult<Type>(functionObjectName_, fieldName);
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Type meanValue = getResult<Type>(meanName);
|
||||||
|
meanValue = alpha*meanValue + beta*currentValue;
|
||||||
|
|
||||||
void Foam::functionObjects::runTimeControls::noneCondition::reset()
|
setResult(meanName, meanValue);
|
||||||
{
|
|
||||||
// do nothing
|
file() << tab << meanValue;
|
||||||
|
|
||||||
|
Log<< " " << meanName << ": " << meanValue << nl;
|
||||||
|
|
||||||
|
processed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,10 +27,8 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "cloudInfo.H"
|
#include "cloudInfo.H"
|
||||||
#include "cloud.H"
|
|
||||||
#include "kinematicCloud.H"
|
#include "kinematicCloud.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "mathematicalConstants.H"
|
|
||||||
#include "PstreamReduceOps.H"
|
#include "PstreamReduceOps.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
@ -76,10 +74,8 @@ Foam::functionObjects::cloudInfo::cloudInfo
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjects::regionFunctionObject(name, runTime, dict),
|
regionFunctionObject(name, runTime, dict),
|
||||||
functionObjects::logFiles(obr_, name, dict),
|
logFiles(obr_, name, dict)
|
||||||
verbose_(false),
|
|
||||||
onExecute_(false)
|
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
@ -89,175 +85,55 @@ Foam::functionObjects::cloudInfo::cloudInfo
|
|||||||
|
|
||||||
bool Foam::functionObjects::cloudInfo::read(const dictionary& dict)
|
bool Foam::functionObjects::cloudInfo::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
parcelSelect_.clear();
|
|
||||||
verbose_ = false;
|
|
||||||
onExecute_ = false;
|
|
||||||
|
|
||||||
if (regionFunctionObject::read(dict) && logFiles::read(dict))
|
if (regionFunctionObject::read(dict) && logFiles::read(dict))
|
||||||
{
|
{
|
||||||
logFiles::resetNames(dict.get<wordList>("clouds"));
|
logFiles::resetNames(dict.get<wordList>("clouds"));
|
||||||
|
|
||||||
Info<< type() << " " << name() << ": ";
|
Info<< type() << " " << name() << ": ";
|
||||||
if (names().size())
|
if (writeToFile() && names().size())
|
||||||
{
|
{
|
||||||
Info<< "applying to clouds:" << nl;
|
Info<< "applying to clouds:" << nl;
|
||||||
for (const word& cldName : names())
|
forAll(names(), cloudi)
|
||||||
{
|
{
|
||||||
Info<< " " << cldName << nl;
|
Info<< " " << names()[cloudi] << nl;
|
||||||
|
writeFileHeader(files(cloudi));
|
||||||
}
|
}
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
// Actions to define selection
|
|
||||||
parcelSelect_ = dict.subOrEmptyDict("selection");
|
|
||||||
|
|
||||||
verbose_ = dict.getOrDefault("verbose", false);
|
|
||||||
onExecute_ = dict.getOrDefault("sampleOnExecute", false);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "no clouds to be processed" << nl << endl;
|
Info<< "no clouds to be processed" << nl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (writeToFile())
|
|
||||||
{
|
|
||||||
forAll(names(), cloudi)
|
|
||||||
{
|
|
||||||
writeFileHeader(files(cloudi));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::cloudInfo::performAction(unsigned request)
|
bool Foam::functionObjects::cloudInfo::execute()
|
||||||
{
|
{
|
||||||
if (!request || names().empty())
|
return true;
|
||||||
{
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::cloudInfo::write()
|
||||||
|
{
|
||||||
forAll(names(), cloudi)
|
forAll(names(), cloudi)
|
||||||
{
|
{
|
||||||
// The reported quantities
|
|
||||||
label nTotParcels = 0;
|
|
||||||
scalar totMass = 0, Dmax = 0, D10 = 0, D32 = 0;
|
|
||||||
bool applyFilter = false;
|
|
||||||
|
|
||||||
const word& cloudName = names()[cloudi];
|
const word& cloudName = names()[cloudi];
|
||||||
|
|
||||||
const auto* kinCloudPtr = obr_.cfindObject<kinematicCloud>(cloudName);
|
const kinematicCloud& cloud =
|
||||||
|
obr_.lookupObject<kinematicCloud>(cloudName);
|
||||||
|
|
||||||
if (!kinCloudPtr)
|
const label nTotParcels =
|
||||||
{
|
returnReduce(cloud.nParcels(), sumOp<label>());
|
||||||
// Safety
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& kinCloud = *kinCloudPtr;
|
const scalar totMass =
|
||||||
const auto* plainCloudPtr = isA<cloud>(kinCloud);
|
returnReduce(cloud.massInSystem(), sumOp<scalar>());
|
||||||
|
|
||||||
if (!parcelSelect_.empty() && plainCloudPtr)
|
const scalar Dmax = cloud.Dmax();
|
||||||
{
|
const scalar D10 = cloud.Dij(1, 0);
|
||||||
const auto& plainCloud = *plainCloudPtr;
|
const scalar D32 = cloud.Dij(3, 2);
|
||||||
|
|
||||||
// Filtering - simply use cloud methods
|
|
||||||
|
|
||||||
objectRegistry obrTmp
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"tmp::cloudInfo::" + cloudName,
|
|
||||||
obr_.time().constant(),
|
|
||||||
obr_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
plainCloud.writeObjects(obrTmp);
|
|
||||||
|
|
||||||
// Apply output filter (for the current cloud)
|
|
||||||
applyFilter = calculateFilter(obrTmp, log);
|
|
||||||
|
|
||||||
// Expected/required fields
|
|
||||||
const auto* diamFldPtr = obrTmp.cfindObject<IOField<scalar>>("d");
|
|
||||||
const auto* rhoFldPtr = obrTmp.cfindObject<IOField<scalar>>("rho");
|
|
||||||
const auto* nParticleFldPtr =
|
|
||||||
obrTmp.cfindObject<IOField<scalar>>("nParticle");
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
#undef doLocalCode
|
|
||||||
#define doLocalCode(FldPtr, FldName) \
|
|
||||||
if (applyFilter && !FldPtr) \
|
|
||||||
{ \
|
|
||||||
WarningInFunction \
|
|
||||||
<< "Missing \"" << #FldName \
|
|
||||||
<< "\" field - disabling filter" << nl; \
|
|
||||||
applyFilter = false; \
|
|
||||||
break; \
|
|
||||||
}
|
|
||||||
|
|
||||||
doLocalCode(diamFldPtr, d);
|
|
||||||
doLocalCode(rhoFldPtr, rho);
|
|
||||||
doLocalCode(nParticleFldPtr, nParticle);
|
|
||||||
#undef doLocalCode
|
|
||||||
}
|
|
||||||
while (false);
|
|
||||||
|
|
||||||
if (applyFilter)
|
|
||||||
{
|
|
||||||
// Filtered. Need to do everything by hand!
|
|
||||||
|
|
||||||
const auto& diams = *diamFldPtr;
|
|
||||||
const auto& rhos = *rhoFldPtr;
|
|
||||||
const auto& nParts = *nParticleFldPtr;
|
|
||||||
|
|
||||||
FixedList<scalar, 4> Dsums(Zero);
|
|
||||||
|
|
||||||
for (const label particlei : parcelAddr_)
|
|
||||||
{
|
|
||||||
++nTotParcels;
|
|
||||||
|
|
||||||
const scalar d = diams[particlei];
|
|
||||||
const scalar rho = rhos[particlei];
|
|
||||||
const scalar np = nParts[particlei];
|
|
||||||
|
|
||||||
totMass += np*rho*pow3(d);
|
|
||||||
Dmax = max(Dmax, d);
|
|
||||||
|
|
||||||
Dsums[0] += np;
|
|
||||||
Dsums[1] += np*(d);
|
|
||||||
Dsums[2] += np*(sqr(d));
|
|
||||||
Dsums[3] += np*(pow3(d));
|
|
||||||
}
|
|
||||||
|
|
||||||
reduce(nTotParcels, sumOp<label>());
|
|
||||||
reduce(totMass, sumOp<scalar>());
|
|
||||||
reduce(Dmax, maxOp<scalar>());
|
|
||||||
reduce(Dsums, sumOp<scalar>());
|
|
||||||
|
|
||||||
totMass *= (constant::mathematical::pi/6.0);
|
|
||||||
|
|
||||||
Dmax = max(0, Dmax);
|
|
||||||
D10 = Dsums[1]/(max(Dsums[0], VSMALL));
|
|
||||||
D32 = Dsums[3]/(max(Dsums[2], VSMALL));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!applyFilter)
|
|
||||||
{
|
|
||||||
// No filter - use regular cloud methods
|
|
||||||
nTotParcels = returnReduce(kinCloud.nParcels(), sumOp<label>());
|
|
||||||
totMass = returnReduce(kinCloud.massInSystem(), sumOp<scalar>());
|
|
||||||
|
|
||||||
Dmax = kinCloud.Dmax();
|
|
||||||
D10 = kinCloud.Dij(1, 0);
|
|
||||||
D32 = kinCloud.Dij(3, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
Log << type() << " " << name() << " write:" << nl
|
Log << type() << " " << name() << " write:" << nl
|
||||||
<< " number of parcels : " << nTotParcels << nl
|
<< " number of parcels : " << nTotParcels << nl
|
||||||
@ -267,7 +143,7 @@ bool Foam::functionObjects::cloudInfo::performAction(unsigned request)
|
|||||||
<< " D32 diameter : " << D32 << nl
|
<< " D32 diameter : " << D32 << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
if ((request & ACTION_WRITE) && writeToFile())
|
if (writeToFile())
|
||||||
{
|
{
|
||||||
auto& os = files(cloudi);
|
auto& os = files(cloudi);
|
||||||
|
|
||||||
@ -286,21 +162,4 @@ bool Foam::functionObjects::cloudInfo::performAction(unsigned request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::cloudInfo::execute()
|
|
||||||
{
|
|
||||||
if (onExecute_)
|
|
||||||
{
|
|
||||||
return performAction(ACTION_ALL & ~ACTION_WRITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::cloudInfo::write()
|
|
||||||
{
|
|
||||||
return performAction(ACTION_ALL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -58,8 +58,6 @@ Usage
|
|||||||
Property | Description | Required | Default
|
Property | Description | Required | Default
|
||||||
type | type name: cloudInfo | yes |
|
type | type name: cloudInfo | yes |
|
||||||
clouds | list of clouds names to process | yes |
|
clouds | list of clouds names to process | yes |
|
||||||
selection | Parcel selection control | no | empty-dict
|
|
||||||
sampleOnExecute| Sample/report (on execute) without writing | no | false
|
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
The output data of each cloud is written to a file named \<cloudName\>.dat
|
The output data of each cloud is written to a file named \<cloudName\>.dat
|
||||||
@ -74,12 +72,11 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_functionObjects_cloudInfo_H
|
#ifndef functionObjects_cloudInfo_H
|
||||||
#define Foam_functionObjects_cloudInfo_H
|
#define functionObjects_cloudInfo_H
|
||||||
|
|
||||||
#include "regionFunctionObject.H"
|
#include "regionFunctionObject.H"
|
||||||
#include "logFiles.H"
|
#include "logFiles.H"
|
||||||
#include "parcelSelectionDetail.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -94,31 +91,13 @@ namespace functionObjects
|
|||||||
|
|
||||||
class cloudInfo
|
class cloudInfo
|
||||||
:
|
:
|
||||||
public functionObjects::regionFunctionObject,
|
public regionFunctionObject,
|
||||||
public functionObjects::logFiles,
|
public logFiles
|
||||||
public Foam::Detail::parcelSelection
|
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Data Types
|
//- Switch to send output to Info as well
|
||||||
|
Switch log_;
|
||||||
//- Local control for sampling actions
|
|
||||||
enum sampleActionType : unsigned
|
|
||||||
{
|
|
||||||
ACTION_NONE = 0,
|
|
||||||
ACTION_WRITE = 0x1,
|
|
||||||
ACTION_STORE = 0x2,
|
|
||||||
ACTION_ALL = 0xF
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Protected Data
|
|
||||||
|
|
||||||
//- Additional verbosity
|
|
||||||
bool verbose_;
|
|
||||||
|
|
||||||
//- Perform sample actions on execute as well
|
|
||||||
bool onExecute_;
|
|
||||||
|
|
||||||
//- List of cloud names
|
//- List of cloud names
|
||||||
wordList cloudNames_;
|
wordList cloudNames_;
|
||||||
@ -126,14 +105,11 @@ protected:
|
|||||||
//- Output file per cloud
|
//- Output file per cloud
|
||||||
PtrList<OFstream> filePtrs_;
|
PtrList<OFstream> filePtrs_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- File header information
|
//- File header information
|
||||||
virtual void writeFileHeader(Ostream& os) const;
|
virtual void writeFileHeader(Ostream& os) const;
|
||||||
|
|
||||||
//- Perform operation report/write
|
|
||||||
bool performAction(unsigned request);
|
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
cloudInfo(const cloudInfo&) = delete;
|
cloudInfo(const cloudInfo&) = delete;
|
||||||
|
|||||||
@ -22,13 +22,12 @@ timeInfo/timeInfo.C
|
|||||||
runTimeControl/runTimeControl.C
|
runTimeControl/runTimeControl.C
|
||||||
runTimeControl/runTimeCondition/runTimeCondition/runTimeCondition.C
|
runTimeControl/runTimeCondition/runTimeCondition/runTimeCondition.C
|
||||||
runTimeControl/runTimeCondition/runTimeCondition/runTimeConditionNew.C
|
runTimeControl/runTimeCondition/runTimeCondition/runTimeConditionNew.C
|
||||||
runTimeControl/runTimeCondition/averageCondition/averageCondition.C
|
|
||||||
runTimeControl/runTimeCondition/equationMaxIterCondition/equationMaxIterCondition.C
|
runTimeControl/runTimeCondition/equationMaxIterCondition/equationMaxIterCondition.C
|
||||||
runTimeControl/runTimeCondition/equationInitialResidualCondition/equationInitialResidualCondition.C
|
runTimeControl/runTimeCondition/equationInitialResidualCondition/equationInitialResidualCondition.C
|
||||||
runTimeControl/runTimeCondition/maxDurationCondition/maxDurationCondition.C
|
runTimeControl/runTimeCondition/maxDurationCondition/maxDurationCondition.C
|
||||||
runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.C
|
runTimeControl/runTimeCondition/minMaxCondition/minMaxCondition.C
|
||||||
|
runTimeControl/runTimeCondition/averageCondition/averageCondition.C
|
||||||
runTimeControl/runTimeCondition/minTimeStepCondition/minTimeStepCondition.C
|
runTimeControl/runTimeCondition/minTimeStepCondition/minTimeStepCondition.C
|
||||||
runTimeControl/runTimeCondition/noneCondition/noneCondition.C
|
|
||||||
|
|
||||||
setTimeStep/setTimeStepFunctionObject.C
|
setTimeStep/setTimeStepFunctionObject.C
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,8 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,6 +28,7 @@ License
|
|||||||
|
|
||||||
#include "averageCondition.H"
|
#include "averageCondition.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -42,6 +44,18 @@ namespace runTimeControls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Foam::Enum
|
||||||
|
<
|
||||||
|
Foam::functionObjects::runTimeControls::averageCondition::windowType
|
||||||
|
>
|
||||||
|
Foam::functionObjects::runTimeControls::averageCondition::windowTypeNames
|
||||||
|
({
|
||||||
|
{ windowType::NONE, "none" },
|
||||||
|
{ windowType::APPROXIMATE, "approximate" },
|
||||||
|
{ windowType::EXACT, "exact" }
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjects::runTimeControls::averageCondition::averageCondition
|
Foam::functionObjects::runTimeControls::averageCondition::averageCondition
|
||||||
@ -53,13 +67,44 @@ Foam::functionObjects::runTimeControls::averageCondition::averageCondition
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
runTimeCondition(name, obr, dict, state),
|
runTimeCondition(name, obr, dict, state),
|
||||||
valueAverageBase(name, obr_, dict, state, false),
|
functionObjectName_(dict.get<word>("functionObject")),
|
||||||
|
fieldNames_(dict.get<wordList>("fields")),
|
||||||
|
tolerance_(dict.get<scalar>("tolerance")),
|
||||||
|
window_(dict.getOrDefault<scalar>("window", -1)),
|
||||||
|
windowType_
|
||||||
|
(
|
||||||
|
window_ > 0
|
||||||
|
? windowTypeNames.get("windowType", dict)
|
||||||
|
: windowType::NONE
|
||||||
|
),
|
||||||
|
totalTime_(fieldNames_.size(), scalar(0)),
|
||||||
|
resetOnRestart_(dict.getOrDefault("resetOnRestart", false)),
|
||||||
nIterStartUp_(dict.getOrDefault<label>("nIterStartUp", 10)),
|
nIterStartUp_(dict.getOrDefault<label>("nIterStartUp", 10)),
|
||||||
iter_(-1)
|
iter_(-1)
|
||||||
{
|
{
|
||||||
dictionary& conditionDict = this->conditionDict();
|
dictionary& conditionDict = this->conditionDict();
|
||||||
|
|
||||||
readState(conditionDict);
|
forAll(fieldNames_, fieldi)
|
||||||
|
{
|
||||||
|
const word& fieldName = fieldNames_[fieldi];
|
||||||
|
|
||||||
|
if (resetOnRestart_)
|
||||||
|
{
|
||||||
|
conditionDict.set(fieldName, dictionary());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (conditionDict.found(fieldName))
|
||||||
|
{
|
||||||
|
const dictionary& valueDict = conditionDict.subDict(fieldName);
|
||||||
|
valueDict.readIfPresent("totalTime", totalTime_[fieldi]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
conditionDict.set(fieldName, dictionary());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
conditionDict.readIfPresent("iter", iter_);
|
conditionDict.readIfPresent("iter", iter_);
|
||||||
}
|
}
|
||||||
@ -74,18 +119,53 @@ bool Foam::functionObjects::runTimeControls::averageCondition::apply()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool running = iter_ > nIterStartUp_;
|
bool satisfied = iter_ > nIterStartUp_;
|
||||||
|
|
||||||
++iter_;
|
++iter_;
|
||||||
|
|
||||||
dictionary& conditionDict = this->conditionDict();
|
const scalar dt = obr_.time().deltaTValue();
|
||||||
|
|
||||||
|
Log << " " << type() << ": " << name_ << " averages:" << nl;
|
||||||
|
|
||||||
Info<< incrIndent;
|
DynamicList<label> unprocessedFields(fieldNames_.size());
|
||||||
running = valueAverageBase::calculate(conditionDict) && running;
|
|
||||||
Info<< decrIndent;
|
|
||||||
|
|
||||||
return running;
|
forAll(fieldNames_, fieldi)
|
||||||
|
{
|
||||||
|
totalTime_[fieldi] += dt;
|
||||||
|
|
||||||
|
bool processed = false;
|
||||||
|
calc<scalar>(fieldi, satisfied, processed);
|
||||||
|
calc<vector>(fieldi, satisfied, processed);
|
||||||
|
calc<sphericalTensor>(fieldi, satisfied, processed);
|
||||||
|
calc<symmTensor>(fieldi, satisfied, processed);
|
||||||
|
calc<tensor>(fieldi, satisfied, processed);
|
||||||
|
|
||||||
|
if (!processed)
|
||||||
|
{
|
||||||
|
unprocessedFields.append(fieldi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unprocessedFields.size())
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "From function object: " << functionObjectName_ << nl
|
||||||
|
<< "Unprocessed fields:" << nl;
|
||||||
|
|
||||||
|
for (const label fieldi : unprocessedFields)
|
||||||
|
{
|
||||||
|
Info<< " " << fieldNames_[fieldi] << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unprocessedFields.size() == fieldNames_.size())
|
||||||
|
{
|
||||||
|
satisfied = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Log << endl;
|
||||||
|
|
||||||
|
return satisfied;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -93,18 +173,25 @@ void Foam::functionObjects::runTimeControls::averageCondition::write()
|
|||||||
{
|
{
|
||||||
dictionary& conditionDict = this->conditionDict();
|
dictionary& conditionDict = this->conditionDict();
|
||||||
|
|
||||||
valueAverageBase::writeState(conditionDict);
|
forAll(fieldNames_, fieldi)
|
||||||
|
{
|
||||||
|
const word& fieldName = fieldNames_[fieldi];
|
||||||
|
|
||||||
|
if (conditionDict.found(fieldName))
|
||||||
|
{
|
||||||
|
dictionary& valueDict = conditionDict.subDict(fieldName);
|
||||||
|
valueDict.add("totalTime", totalTime_[fieldi], true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dictionary valueDict;
|
||||||
|
valueDict.add("totalTime", totalTime_[fieldi], true);
|
||||||
|
conditionDict.add(fieldName, valueDict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
conditionDict.set("iter", iter_);
|
conditionDict.set("iter", iter_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::runTimeControls::averageCondition::reset()
|
|
||||||
{
|
|
||||||
valueAverageBase::resetState(this->conditionDict());
|
|
||||||
|
|
||||||
iter_ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -5,7 +5,8 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,20 +31,18 @@ Description
|
|||||||
Average run time condition - satisfied when average does not change by
|
Average run time condition - satisfied when average does not change by
|
||||||
more than a given value.
|
more than a given value.
|
||||||
|
|
||||||
See also
|
|
||||||
- Foam::functionObjects::valueAverageBase
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
averageCondition.H
|
averageCondition.H
|
||||||
averageCondition.C
|
averageCondition.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef functionObjects_runTimeControls_averageCondition_H
|
#ifndef averageCondition_H
|
||||||
#define functionObjects_runTimeControls_averageCondition_H
|
#define averageCondition_H
|
||||||
|
|
||||||
#include "runTimeCondition.H"
|
#include "runTimeCondition.H"
|
||||||
#include "valueAverageBase.H"
|
#include "Switch.H"
|
||||||
|
#include "Enum.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -60,12 +59,46 @@ namespace runTimeControls
|
|||||||
|
|
||||||
class averageCondition
|
class averageCondition
|
||||||
:
|
:
|
||||||
public runTimeCondition,
|
public runTimeCondition
|
||||||
public valueAverageBase
|
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Public enumerations
|
||||||
|
|
||||||
|
enum class windowType
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
APPROXIMATE,
|
||||||
|
EXACT
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Enum<windowType> windowTypeNames;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected Data
|
// Protected data
|
||||||
|
|
||||||
|
//- Name of function object to retrieve data from
|
||||||
|
word functionObjectName_;
|
||||||
|
|
||||||
|
//- List of fields on which to operate
|
||||||
|
wordList fieldNames_;
|
||||||
|
|
||||||
|
//- Satisfied when difference in mean values is less than this value
|
||||||
|
const scalar tolerance_;
|
||||||
|
|
||||||
|
//- Averaging window
|
||||||
|
const scalar window_;
|
||||||
|
|
||||||
|
//- Averaging window type
|
||||||
|
windowType windowType_;
|
||||||
|
|
||||||
|
//- Average time per field
|
||||||
|
List<scalar> totalTime_;
|
||||||
|
|
||||||
|
//- Reset the averaging process on restart flag
|
||||||
|
Switch resetOnRestart_;
|
||||||
|
|
||||||
//- Number of start-up iterations before allowing satisfied checks
|
//- Number of start-up iterations before allowing satisfied checks
|
||||||
label nIterStartUp_;
|
label nIterStartUp_;
|
||||||
@ -73,6 +106,17 @@ protected:
|
|||||||
//- Current iteration count
|
//- Current iteration count
|
||||||
label iter_;
|
label iter_;
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Templated function to calculate the average
|
||||||
|
template<class Type>
|
||||||
|
void calc
|
||||||
|
(
|
||||||
|
const label fieldi,
|
||||||
|
bool& satisfied,
|
||||||
|
bool& processed
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -99,9 +143,6 @@ public:
|
|||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
//- Reset
|
|
||||||
virtual void reset();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -113,6 +154,12 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "averageConditionTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,14 +26,17 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "Time.H"
|
||||||
|
#include "FIFOStack.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool Foam::functionObjects::valueAverageBase::calc
|
void Foam::functionObjects::runTimeControls::averageCondition::calc
|
||||||
(
|
(
|
||||||
const label fieldi,
|
const label fieldi,
|
||||||
bool& converged,
|
bool& satisfied,
|
||||||
dictionary& dict
|
bool& processed
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word& fieldName = fieldNames_[fieldi];
|
const word& fieldName = fieldNames_[fieldi];
|
||||||
@ -43,16 +46,16 @@ bool Foam::functionObjects::valueAverageBase::calc
|
|||||||
|
|
||||||
if (pTraits<Type>::typeName != valueType)
|
if (pTraits<Type>::typeName != valueType)
|
||||||
{
|
{
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalar dt = state_.time().deltaTValue();
|
const scalar dt = obr_.time().deltaTValue();
|
||||||
|
|
||||||
const Type currentValue =
|
const Type currentValue =
|
||||||
state_.getObjectResult<Type>(functionObjectName_, fieldName);
|
state_.getObjectResult<Type>(functionObjectName_, fieldName);
|
||||||
|
const word meanName(fieldName + "Mean");
|
||||||
|
|
||||||
// Current mean value
|
// Current mean value
|
||||||
const word meanName(fieldName + "Mean");
|
|
||||||
Type meanValue = state_.getResult<Type>(meanName);
|
Type meanValue = state_.getResult<Type>(meanName);
|
||||||
|
|
||||||
switch (windowType_)
|
switch (windowType_)
|
||||||
@ -60,35 +63,40 @@ bool Foam::functionObjects::valueAverageBase::calc
|
|||||||
case windowType::NONE:
|
case windowType::NONE:
|
||||||
{
|
{
|
||||||
const scalar Dt = totalTime_[fieldi];
|
const scalar Dt = totalTime_[fieldi];
|
||||||
|
const scalar alpha = (Dt - dt)/Dt;
|
||||||
const scalar beta = dt/Dt;
|
const scalar beta = dt/Dt;
|
||||||
meanValue = (1 - beta)*meanValue + beta*currentValue;
|
meanValue = alpha*meanValue + beta*currentValue;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case windowType::APPROXIMATE:
|
case windowType::APPROXIMATE:
|
||||||
{
|
{
|
||||||
const scalar Dt = totalTime_[fieldi];
|
const scalar Dt = totalTime_[fieldi];
|
||||||
|
scalar alpha = (Dt - dt)/Dt;
|
||||||
scalar beta = dt/Dt;
|
scalar beta = dt/Dt;
|
||||||
if (Dt - dt >= window_)
|
if (Dt - dt >= window_)
|
||||||
{
|
{
|
||||||
|
alpha = (window_ - dt)/window_;
|
||||||
beta = dt/window_;
|
beta = dt/window_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
converged = false;
|
// Ensure that averaging is performed over window time
|
||||||
|
// before condition can be satisfied
|
||||||
|
satisfied = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
meanValue = (1 - beta)*meanValue + beta*currentValue;
|
meanValue = alpha*meanValue + beta*currentValue;
|
||||||
|
totalTime_[fieldi] += dt;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case windowType::EXACT:
|
case windowType::EXACT:
|
||||||
{
|
{
|
||||||
FIFOStack<scalar> windowTimes;
|
FIFOStack<scalar> windowTimes;
|
||||||
FIFOStack<Type> windowValues;
|
FIFOStack<Type> windowValues;
|
||||||
dictionary& fieldDict = dict.subDict(fieldName);
|
dictionary& dict = this->conditionDict().subDict(fieldName);
|
||||||
fieldDict.readIfPresent("windowTimes", windowTimes);
|
dict.readIfPresent("windowTimes", windowTimes);
|
||||||
fieldDict.readIfPresent("windowValues", windowValues);
|
dict.readIfPresent("windowValues", windowValues);
|
||||||
|
|
||||||
// Increment time for all existing values
|
// Increment time for all existing values
|
||||||
for (scalar& dti : windowTimes)
|
for (scalar& dti : windowTimes)
|
||||||
@ -143,8 +151,8 @@ bool Foam::functionObjects::valueAverageBase::calc
|
|||||||
meanValue /= windowTimes.first();
|
meanValue /= windowTimes.first();
|
||||||
|
|
||||||
// Store the state information for the next step
|
// Store the state information for the next step
|
||||||
fieldDict.set("windowTimes", windowTimes);
|
dict.set("windowTimes", windowTimes);
|
||||||
fieldDict.set("windowValues", windowValues);
|
dict.set("windowValues", windowValues);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -152,19 +160,19 @@ bool Foam::functionObjects::valueAverageBase::calc
|
|||||||
|
|
||||||
scalar delta = mag(meanValue - currentValue);
|
scalar delta = mag(meanValue - currentValue);
|
||||||
|
|
||||||
Log << indent << " " << meanName << ": " << meanValue
|
Log << " " << meanName << ": " << meanValue
|
||||||
<< ", delta: " << delta << nl;
|
<< ", delta: " << delta << nl;
|
||||||
|
|
||||||
file() << tab << meanValue;
|
// Note: Writing result to owner function object and not the local run-time
|
||||||
|
// condition
|
||||||
state_.setResult(meanName, meanValue);
|
state_.setResult(meanName, meanValue);
|
||||||
|
|
||||||
if ((tolerance_ > 0) && (delta > tolerance_))
|
if (delta > tolerance_)
|
||||||
{
|
{
|
||||||
converged = false;
|
satisfied = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
processed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -230,11 +230,4 @@ equationInitialResidualCondition::write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::runTimeControls::
|
|
||||||
equationInitialResidualCondition::reset()
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -130,9 +130,6 @@ public:
|
|||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
//- Reset
|
|
||||||
virtual void reset();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -168,11 +168,4 @@ void Foam::functionObjects::runTimeControls::equationMaxIterCondition::write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::runTimeControls::equationMaxIterCondition::reset()
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -97,9 +97,6 @@ public:
|
|||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
//- Reset
|
|
||||||
virtual void reset();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -110,10 +110,4 @@ void Foam::functionObjects::runTimeControls::maxDurationCondition::write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::runTimeControls::maxDurationCondition::reset()
|
|
||||||
{
|
|
||||||
initialised_ = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -99,9 +99,6 @@ public:
|
|||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
//- Reset
|
|
||||||
virtual void reset();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -166,10 +166,4 @@ void Foam::functionObjects::runTimeControls::minMaxCondition::write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::runTimeControls::minMaxCondition::reset()
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -125,9 +124,6 @@ public:
|
|||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
//- Reset
|
|
||||||
virtual void reset();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -94,10 +94,4 @@ void Foam::functionObjects::runTimeControls::minTimeStepCondition::write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::runTimeControls::minTimeStepCondition::reset()
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -91,9 +91,6 @@ public:
|
|||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
//- Reset
|
|
||||||
virtual void reset();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,100 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | www.openfoam.com
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::noneCondition
|
|
||||||
|
|
||||||
Description
|
|
||||||
A no-op condition that simply returns true/nothing to do.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
noneCondition.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef functionObjects_runTimeControls_noneCondition_H
|
|
||||||
#define functionObjects_runTimeControls_noneCondition_H
|
|
||||||
|
|
||||||
#include "runTimeCondition.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
namespace functionObjects
|
|
||||||
{
|
|
||||||
namespace runTimeControls
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class noneCondition Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class noneCondition
|
|
||||||
:
|
|
||||||
public runTimeCondition
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeNameNoDebug("none");
|
|
||||||
|
|
||||||
//- Constructor
|
|
||||||
noneCondition
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const dictionary& dict,
|
|
||||||
stateFunctionObject& state
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
virtual ~noneCondition() = default;
|
|
||||||
|
|
||||||
|
|
||||||
// Public Member Functions
|
|
||||||
|
|
||||||
//- Apply the condition
|
|
||||||
virtual bool apply();
|
|
||||||
|
|
||||||
//- Write
|
|
||||||
virtual void write();
|
|
||||||
|
|
||||||
//- Reset
|
|
||||||
virtual void reset();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace runTimeControls
|
|
||||||
} // End namespace functionObjects
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -162,9 +162,6 @@ public:
|
|||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write() = 0;
|
virtual void write() = 0;
|
||||||
|
|
||||||
//- Reset
|
|
||||||
virtual void reset() = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -58,7 +58,6 @@ Foam::functionObjects::runTimeControls::runTimeControl::satisfiedActionNames
|
|||||||
{ satisfiedAction::SET_TRIGGER, "setTrigger"},
|
{ satisfiedAction::SET_TRIGGER, "setTrigger"},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjects::runTimeControls::runTimeControl::runTimeControl
|
Foam::functionObjects::runTimeControls::runTimeControl::runTimeControl
|
||||||
@ -75,8 +74,7 @@ Foam::functionObjects::runTimeControls::runTimeControl::runTimeControl
|
|||||||
writeStepI_(0),
|
writeStepI_(0),
|
||||||
satisfiedAction_(satisfiedAction::END),
|
satisfiedAction_(satisfiedAction::END),
|
||||||
triggerIndex_(labelMin),
|
triggerIndex_(labelMin),
|
||||||
active_(getProperty("active", true)),
|
active_(getObjectProperty(name, "active", true))
|
||||||
canRestart_(getProperty("canRestart", false))
|
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
@ -101,8 +99,6 @@ bool Foam::functionObjects::runTimeControls::runTimeControl::read
|
|||||||
|
|
||||||
if (fvMeshFunctionObject::read(dict))
|
if (fvMeshFunctionObject::read(dict))
|
||||||
{
|
{
|
||||||
Info<< type() << " " << name() << ":" << nl;
|
|
||||||
|
|
||||||
const dictionary& conditionsDict = dict.subDict("conditions");
|
const dictionary& conditionsDict = dict.subDict("conditions");
|
||||||
const wordList conditionNames(conditionsDict.toc());
|
const wordList conditionNames(conditionsDict.toc());
|
||||||
conditions_.setSize(conditionNames.size());
|
conditions_.setSize(conditionNames.size());
|
||||||
@ -132,7 +128,9 @@ bool Foam::functionObjects::runTimeControls::runTimeControl::read
|
|||||||
// Check that some conditions are set
|
// Check that some conditions are set
|
||||||
if (conditions_.empty())
|
if (conditions_.empty())
|
||||||
{
|
{
|
||||||
Info<< " No conditions present" << endl;
|
Info<< type() << " " << name() << " output:" << nl
|
||||||
|
<< " No conditions present" << nl
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -149,12 +147,12 @@ bool Foam::functionObjects::runTimeControls::runTimeControl::read
|
|||||||
|
|
||||||
if (!check)
|
if (!check)
|
||||||
{
|
{
|
||||||
Info<< " All conditions are inactive" << endl;
|
Info<< type() << " " << name() << " output:" << nl
|
||||||
|
<< " All conditions are inactive" << nl
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< endl;
|
|
||||||
|
|
||||||
// Set the action to perform when all conditions are satisfied
|
// Set the action to perform when all conditions are satisfied
|
||||||
// - set to end for backwards compatibility with v1806
|
// - set to end for backwards compatibility with v1806
|
||||||
satisfiedAction_ =
|
satisfiedAction_ =
|
||||||
@ -179,12 +177,6 @@ bool Foam::functionObjects::runTimeControls::runTimeControl::read
|
|||||||
|
|
||||||
bool Foam::functionObjects::runTimeControls::runTimeControl::execute()
|
bool Foam::functionObjects::runTimeControls::runTimeControl::execute()
|
||||||
{
|
{
|
||||||
if (canRestart_)
|
|
||||||
{
|
|
||||||
active_ = true;
|
|
||||||
canRestart_ = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!active_)
|
if (!active_)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -207,7 +199,7 @@ bool Foam::functionObjects::runTimeControls::runTimeControl::execute()
|
|||||||
{
|
{
|
||||||
bool conditionSatisfied = condition.apply();
|
bool conditionSatisfied = condition.apply();
|
||||||
|
|
||||||
const label groupi = condition.groupID();
|
label groupi = condition.groupID();
|
||||||
|
|
||||||
auto conditionIter = groupMap_.cfind(groupi);
|
auto conditionIter = groupMap_.cfind(groupi);
|
||||||
|
|
||||||
@ -279,10 +271,14 @@ bool Foam::functionObjects::runTimeControls::runTimeControl::execute()
|
|||||||
|
|
||||||
if (nWriteStep_ != 0)
|
if (nWriteStep_ != 0)
|
||||||
{
|
{
|
||||||
Info<< " - final step";
|
Info<< " - final step" << nl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< nl << endl;
|
Info<< endl;
|
||||||
active_ = false;
|
active_ = false;
|
||||||
|
|
||||||
// Write any registered objects and set the end-time
|
// Write any registered objects and set the end-time
|
||||||
@ -303,25 +299,11 @@ bool Foam::functionObjects::runTimeControls::runTimeControl::execute()
|
|||||||
case satisfiedAction::SET_TRIGGER:
|
case satisfiedAction::SET_TRIGGER:
|
||||||
{
|
{
|
||||||
Info<< " Setting trigger " << triggerIndex_ << nl;
|
Info<< " Setting trigger " << triggerIndex_ << nl;
|
||||||
|
|
||||||
setTrigger(triggerIndex_);
|
setTrigger(triggerIndex_);
|
||||||
|
|
||||||
// Deactivate the model
|
// Deactivate the model
|
||||||
active_ = false;
|
active_ = false;
|
||||||
setProperty("active", active_);
|
setProperty("active", active_);
|
||||||
|
|
||||||
// Can be restarted
|
|
||||||
canRestart_ = true;
|
|
||||||
setProperty("canRestart", canRestart_);
|
|
||||||
|
|
||||||
// Reset all conditions in case the control is recycled/trigger
|
|
||||||
// index is set to a smaller value
|
|
||||||
forAll(conditions_, conditioni)
|
|
||||||
{
|
|
||||||
runTimeCondition& condition = conditions_[conditioni];
|
|
||||||
condition.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2016 OpenFOAM Foundation
|
Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -111,11 +111,6 @@ private:
|
|||||||
// trigger has been set
|
// trigger has been set
|
||||||
bool active_;
|
bool active_;
|
||||||
|
|
||||||
//- Can be restarted flag
|
|
||||||
// Used in the trigger case after the trigger has been set to allow
|
|
||||||
// this object to be restarted/reset the active flag
|
|
||||||
bool canRestart_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
|||||||
@ -68,7 +68,8 @@ Foam::functionObjects::thermoCoupleProbes::thermoCoupleProbes
|
|||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the property exists (resume old calculation) or is new
|
// Check if the property exist (resume old calculation)
|
||||||
|
// or of it is new.
|
||||||
dictionary probeDict;
|
dictionary probeDict;
|
||||||
if (getDict(typeName, probeDict))
|
if (getDict(typeName, probeDict))
|
||||||
{
|
{
|
||||||
@ -76,7 +77,7 @@ Foam::functionObjects::thermoCoupleProbes::thermoCoupleProbes
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Ttc_ = probes::sample(thermo_.T());
|
Ttc_ = probes::sample(thermo_.T());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: can only create the solver once all samples have been found
|
// Note: can only create the solver once all samples have been found
|
||||||
@ -87,6 +88,10 @@ Foam::functionObjects::thermoCoupleProbes::thermoCoupleProbes
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::thermoCoupleProbes::~thermoCoupleProbes()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::label Foam::functionObjects::thermoCoupleProbes::nEqns() const
|
Foam::label Foam::functionObjects::thermoCoupleProbes::nEqns() const
|
||||||
{
|
{
|
||||||
return this->size();
|
return this->size();
|
||||||
@ -163,12 +168,9 @@ void Foam::functionObjects::thermoCoupleProbes::jacobian
|
|||||||
|
|
||||||
bool Foam::functionObjects::thermoCoupleProbes::write()
|
bool Foam::functionObjects::thermoCoupleProbes::write()
|
||||||
{
|
{
|
||||||
if (!pointField::empty())
|
if (this->size())
|
||||||
{
|
{
|
||||||
(void) prepare(ACTION_WRITE);
|
sampleAndWrite<scalar>(thermo_.T());
|
||||||
|
|
||||||
const auto& Tfield = thermo_.T();
|
|
||||||
writeValues(Tfield.name(), Ttc_, Tfield.time().timeOutputValue());
|
|
||||||
|
|
||||||
dictionary probeDict;
|
dictionary probeDict;
|
||||||
probeDict.add("Tc", Ttc_);
|
probeDict.add("Tc", Ttc_);
|
||||||
@ -182,7 +184,7 @@ bool Foam::functionObjects::thermoCoupleProbes::write()
|
|||||||
|
|
||||||
bool Foam::functionObjects::thermoCoupleProbes::execute()
|
bool Foam::functionObjects::thermoCoupleProbes::execute()
|
||||||
{
|
{
|
||||||
if (!pointField::empty())
|
if (this->size())
|
||||||
{
|
{
|
||||||
scalar dt = mesh_.time().deltaTValue();
|
scalar dt = mesh_.time().deltaTValue();
|
||||||
scalar t = mesh_.time().value();
|
scalar t = mesh_.time().value();
|
||||||
|
|||||||
@ -79,8 +79,8 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_functionObjects_thermoCoupleProbes_H
|
#ifndef functionObjects_thermoCoupleProbes_H
|
||||||
#define Foam_functionObjects_thermoCoupleProbes_H
|
#define functionObjects_thermoCoupleProbes_H
|
||||||
|
|
||||||
#include "probes.H"
|
#include "probes.H"
|
||||||
#include "ODESystem.H"
|
#include "ODESystem.H"
|
||||||
@ -106,7 +106,7 @@ class thermoCoupleProbes
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected Data
|
// Protected data
|
||||||
|
|
||||||
//- Thermocouple density
|
//- Thermocouple density
|
||||||
scalar rho_;
|
scalar rho_;
|
||||||
@ -126,7 +126,7 @@ protected:
|
|||||||
//- Name of the incident radiation field
|
//- Name of the incident radiation field
|
||||||
word radiationFieldName_;
|
word radiationFieldName_;
|
||||||
|
|
||||||
//- Fluid thermo reference
|
//- Fluid thermo reference
|
||||||
const fluidThermo& thermo_;
|
const fluidThermo& thermo_;
|
||||||
|
|
||||||
//- ODESolver
|
//- ODESolver
|
||||||
@ -136,19 +136,18 @@ protected:
|
|||||||
scalarField Ttc_;
|
scalarField Ttc_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
// Protected Member Functions
|
||||||
|
|
||||||
// Private Member Functions
|
//- Sample and write a particular volume field
|
||||||
|
|
||||||
//- Sample/write
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void writeValues
|
void sampleAndWrite
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
const Field<Type>& values,
|
|
||||||
const scalar timeValue
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
thermoCoupleProbes(const thermoCoupleProbes&) = delete;
|
thermoCoupleProbes(const thermoCoupleProbes&) = delete;
|
||||||
|
|
||||||
@ -177,40 +176,40 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~thermoCoupleProbes() = default;
|
virtual ~thermoCoupleProbes();
|
||||||
|
|
||||||
|
|
||||||
// ODE functions (overriding abstract functions in ODE.H)
|
// ODE functions (overriding abstract functions in ODE.H)
|
||||||
|
|
||||||
//- Number of ODE's to solve
|
//- Number of ODE's to solve
|
||||||
virtual label nEqns() const;
|
virtual label nEqns() const;
|
||||||
|
|
||||||
virtual void derivatives
|
virtual void derivatives
|
||||||
(
|
(
|
||||||
const scalar x,
|
const scalar x,
|
||||||
const scalarField& y,
|
const scalarField& y,
|
||||||
scalarField& dydx
|
scalarField& dydx
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
virtual void jacobian
|
virtual void jacobian
|
||||||
(
|
(
|
||||||
const scalar t,
|
const scalar t,
|
||||||
const scalarField& y,
|
const scalarField& y,
|
||||||
scalarField& dfdt,
|
scalarField& dfdt,
|
||||||
scalarSquareMatrix& dfdy
|
scalarSquareMatrix& dfdy
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
//- Read
|
|
||||||
virtual bool read(const dictionary&);
|
|
||||||
|
|
||||||
//- Execute. Evaluates the ODESolver
|
|
||||||
virtual bool execute();
|
|
||||||
|
|
||||||
//- Sample and write
|
//- Sample and write
|
||||||
virtual bool write();
|
virtual bool write();
|
||||||
|
|
||||||
|
//- Execute, currently does nothing
|
||||||
|
virtual bool execute();
|
||||||
|
|
||||||
|
//- Read
|
||||||
|
virtual bool read(const dictionary&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,28 +28,25 @@ License
|
|||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::functionObjects::thermoCoupleProbes::writeValues
|
void Foam::functionObjects::thermoCoupleProbes::sampleAndWrite
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const GeometricField<Type, fvPatchField, volMesh>& vField
|
||||||
const Field<Type>& values,
|
|
||||||
const scalar timeValue
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
const unsigned int w = IOstream::defaultPrecision() + 7;
|
unsigned int w = IOstream::defaultPrecision() + 7;
|
||||||
OFstream& os = *probeFilePtrs_[fieldName];
|
OFstream& probeStream = *probeFilePtrs_[vField.name()];
|
||||||
|
|
||||||
os << setw(w) << timeValue;
|
probeStream
|
||||||
|
<< setw(w)
|
||||||
|
<< vField.time().timeOutputValue();
|
||||||
|
|
||||||
forAll(*this, probei)
|
forAll(*this, probeI)
|
||||||
{
|
{
|
||||||
// if (includeOutOfBounds_ || processor_[probei] != -1)
|
probeStream << ' ' << setw(w) << Ttc_[probeI];
|
||||||
{
|
|
||||||
os << ' ' << setw(w) << values[probei];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
os << endl;
|
probeStream << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -107,17 +107,17 @@ void Foam::CellZoneInjection<CloudType>::setPositions
|
|||||||
|
|
||||||
// Parallel operation manipulations
|
// Parallel operation manipulations
|
||||||
globalIndex globalPositions(positions.size());
|
globalIndex globalPositions(positions.size());
|
||||||
List<vector> allPositions(globalPositions.totalSize(), point::max);
|
List<vector> allPositions(globalPositions.size(), point::max);
|
||||||
List<label> allInjectorCells(globalPositions.totalSize(), -1);
|
List<label> allInjectorCells(globalPositions.size(), -1);
|
||||||
List<label> allInjectorTetFaces(globalPositions.totalSize(), -1);
|
List<label> allInjectorTetFaces(globalPositions.size(), -1);
|
||||||
List<label> allInjectorTetPts(globalPositions.totalSize(), -1);
|
List<label> allInjectorTetPts(globalPositions.size(), -1);
|
||||||
|
|
||||||
// Gather all positions on to all processors
|
// Gather all positions on to all processors
|
||||||
SubList<vector>
|
SubList<vector>
|
||||||
(
|
(
|
||||||
allPositions,
|
allPositions,
|
||||||
globalPositions.localSize(Pstream::myProcNo()),
|
globalPositions.localSize(Pstream::myProcNo()),
|
||||||
globalPositions.localStart(Pstream::myProcNo())
|
globalPositions.offset(Pstream::myProcNo())
|
||||||
) = positions;
|
) = positions;
|
||||||
|
|
||||||
Pstream::listCombineGather(allPositions, minEqOp<point>());
|
Pstream::listCombineGather(allPositions, minEqOp<point>());
|
||||||
@ -128,19 +128,19 @@ void Foam::CellZoneInjection<CloudType>::setPositions
|
|||||||
(
|
(
|
||||||
allInjectorCells,
|
allInjectorCells,
|
||||||
globalPositions.localSize(Pstream::myProcNo()),
|
globalPositions.localSize(Pstream::myProcNo()),
|
||||||
globalPositions.localStart(Pstream::myProcNo())
|
globalPositions.offset(Pstream::myProcNo())
|
||||||
) = injectorCells;
|
) = injectorCells;
|
||||||
SubList<label>
|
SubList<label>
|
||||||
(
|
(
|
||||||
allInjectorTetFaces,
|
allInjectorTetFaces,
|
||||||
globalPositions.localSize(Pstream::myProcNo()),
|
globalPositions.localSize(Pstream::myProcNo()),
|
||||||
globalPositions.localStart(Pstream::myProcNo())
|
globalPositions.offset(Pstream::myProcNo())
|
||||||
) = injectorTetFaces;
|
) = injectorTetFaces;
|
||||||
SubList<label>
|
SubList<label>
|
||||||
(
|
(
|
||||||
allInjectorTetPts,
|
allInjectorTetPts,
|
||||||
globalPositions.localSize(Pstream::myProcNo()),
|
globalPositions.localSize(Pstream::myProcNo()),
|
||||||
globalPositions.localStart(Pstream::myProcNo())
|
globalPositions.offset(Pstream::myProcNo())
|
||||||
) = injectorTetPts;
|
) = injectorTetPts;
|
||||||
|
|
||||||
// Transfer data
|
// Transfer data
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -92,7 +92,7 @@ inline Foam::scalar Foam::SprayCloud<CloudType>::penetration
|
|||||||
|
|
||||||
const label nParcel = this->size();
|
const label nParcel = this->size();
|
||||||
globalIndex globalParcels(nParcel);
|
globalIndex globalParcels(nParcel);
|
||||||
const label nParcelSum = globalParcels.totalSize();
|
const label nParcelSum = globalParcels.size();
|
||||||
|
|
||||||
if (nParcelSum == 0)
|
if (nParcelSum == 0)
|
||||||
{
|
{
|
||||||
@ -139,7 +139,7 @@ inline Foam::scalar Foam::SprayCloud<CloudType>::penetration
|
|||||||
(
|
(
|
||||||
allMass,
|
allMass,
|
||||||
globalParcels.localSize(proci),
|
globalParcels.localSize(proci),
|
||||||
globalParcels.localStart(proci)
|
globalParcels.offset(proci)
|
||||||
) = procMass[proci];
|
) = procMass[proci];
|
||||||
|
|
||||||
// flatten the distance list
|
// flatten the distance list
|
||||||
@ -147,7 +147,7 @@ inline Foam::scalar Foam::SprayCloud<CloudType>::penetration
|
|||||||
(
|
(
|
||||||
allDist,
|
allDist,
|
||||||
globalParcels.localSize(proci),
|
globalParcels.localSize(proci),
|
||||||
globalParcels.localStart(proci)
|
globalParcels.offset(proci)
|
||||||
) = procDist[proci];
|
) = procDist[proci];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,6 @@ Foam::refinementParameters::refinementParameters
|
|||||||
nErodeCellZone_(dict.getOrDefault<label>("nCellZoneErodeIter", 0)),
|
nErodeCellZone_(dict.getOrDefault<label>("nCellZoneErodeIter", 0)),
|
||||||
nFilterIter_(dict.getOrDefault<label>("nFilterIter", 2)),
|
nFilterIter_(dict.getOrDefault<label>("nFilterIter", 2)),
|
||||||
minCellFraction_(dict.getOrDefault<scalar>("minCellFraction", 0)),
|
minCellFraction_(dict.getOrDefault<scalar>("minCellFraction", 0)),
|
||||||
nMinCells_(dict.getOrDefault<label>("nMinCells", 0)),
|
|
||||||
dryRun_(dryRun)
|
dryRun_(dryRun)
|
||||||
{
|
{
|
||||||
point locationInMesh;
|
point locationInMesh;
|
||||||
|
|||||||
@ -115,8 +115,6 @@ class refinementParameters
|
|||||||
|
|
||||||
const scalar minCellFraction_;
|
const scalar minCellFraction_;
|
||||||
|
|
||||||
const label nMinCells_;
|
|
||||||
|
|
||||||
const bool dryRun_;
|
const bool dryRun_;
|
||||||
|
|
||||||
|
|
||||||
@ -246,13 +244,6 @@ public:
|
|||||||
return minCellFraction_;
|
return minCellFraction_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- When are disconnected regions small. Absolute number of cells
|
|
||||||
// in a zone or background. Default 0.
|
|
||||||
label nMinCells() const
|
|
||||||
{
|
|
||||||
return nMinCells_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -3209,22 +3209,21 @@ void Foam::snappyRefineDriver::deleteSmallRegions
|
|||||||
forAll(nCellsPerRegion, regioni)
|
forAll(nCellsPerRegion, regioni)
|
||||||
{
|
{
|
||||||
const label zonei = regionToZone[regioni];
|
const label zonei = regionToZone[regioni];
|
||||||
label& nRegionCells = nCellsPerRegion[regioni];
|
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
nRegionCells < refineParams.minCellFraction()*nCellsPerZone[zonei]
|
nCellsPerRegion[regioni]
|
||||||
|| nRegionCells < refineParams.nMinCells()
|
< refineParams.minCellFraction()*nCellsPerZone[zonei]
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< "Deleting region " << regioni
|
Info<< "Deleting region " << regioni
|
||||||
<< " (size " << nRegionCells
|
<< " (size " << nCellsPerRegion[regioni]
|
||||||
<< ") of zone size " << nCellsPerZone[zonei]
|
<< ") of zone size " << nCellsPerZone[zonei]
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
// Mark region to be deleted. 0 size (= global) should never
|
// Mark region to be deleted. 0 size (= global) should never
|
||||||
// occur.
|
// occur.
|
||||||
nRegionCells = 0;
|
nCellsPerRegion[regioni] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -81,57 +81,6 @@ void Foam::advancingFrontAMI::checkPatches() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::advancingFrontAMI::isCandidate
|
|
||||||
(
|
|
||||||
const label srcFacei,
|
|
||||||
const label tgtFacei
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
const auto& srcPatch = this->srcPatch();
|
|
||||||
const auto& tgtPatch = this->tgtPatch();
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
(srcMagSf_[srcFacei] < ROOTVSMALL)
|
|
||||||
|| (tgtMagSf_[tgtFacei] < ROOTVSMALL)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxDistance2_ > 0)
|
|
||||||
{
|
|
||||||
const point& srcFc = srcPatch.faceCentres()[srcFacei];
|
|
||||||
const point& tgtFc = tgtPatch.faceCentres()[tgtFacei];
|
|
||||||
const vector& srcN = srcPatch.faceNormals()[srcFacei];
|
|
||||||
|
|
||||||
const scalar normalDist((tgtFc-srcFc)&srcN);
|
|
||||||
//if (magSqr(srcFc-tgtFc) >= maxDistance2_)
|
|
||||||
if (sqr(normalDist) >= maxDistance2_)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (minCosAngle_ > -1)
|
|
||||||
{
|
|
||||||
const vector& srcN = srcPatch.faceNormals()[srcFacei];
|
|
||||||
vector tgtN = tgtPatch.faceNormals()[tgtFacei];
|
|
||||||
if (!reverseTarget_)
|
|
||||||
{
|
|
||||||
tgtN = -tgtN;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((srcN & tgtN) <= minCosAngle_)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::advancingFrontAMI::createExtendedTgtPatch()
|
void Foam::advancingFrontAMI::createExtendedTgtPatch()
|
||||||
{
|
{
|
||||||
// Create processor map of extended cells. This map gets (possibly
|
// Create processor map of extended cells. This map gets (possibly
|
||||||
@ -302,7 +251,7 @@ Foam::label Foam::advancingFrontAMI::findTargetFace
|
|||||||
const pointIndexHit sample =
|
const pointIndexHit sample =
|
||||||
treePtr_->findNearest(srcPt, magSqr(bb.max() - bb.centre()), fnOp);
|
treePtr_->findNearest(srcPt, magSqr(bb.max() - bb.centre()), fnOp);
|
||||||
|
|
||||||
if (sample.hit() && isCandidate(srcFacei, sample.index()))
|
if (sample.hit())
|
||||||
{
|
{
|
||||||
targetFacei = sample.index();
|
targetFacei = sample.index();
|
||||||
|
|
||||||
@ -426,8 +375,6 @@ Foam::advancingFrontAMI::advancingFrontAMI
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
AMIInterpolation(dict, reverseTarget),
|
AMIInterpolation(dict, reverseTarget),
|
||||||
maxDistance2_(dict.getOrDefault<scalar>("maxDistance2", -1)),
|
|
||||||
minCosAngle_(dict.getOrDefault<scalar>("minCosAngle", -1)),
|
|
||||||
srcTris_(),
|
srcTris_(),
|
||||||
tgtTris_(),
|
tgtTris_(),
|
||||||
extendedTgtPatchPtr_(nullptr),
|
extendedTgtPatchPtr_(nullptr),
|
||||||
@ -457,8 +404,6 @@ Foam::advancingFrontAMI::advancingFrontAMI
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
AMIInterpolation(requireMatch, reverseTarget, lowWeightCorrection),
|
AMIInterpolation(requireMatch, reverseTarget, lowWeightCorrection),
|
||||||
maxDistance2_(-1),
|
|
||||||
minCosAngle_(-1),
|
|
||||||
srcTris_(),
|
srcTris_(),
|
||||||
tgtTris_(),
|
tgtTris_(),
|
||||||
extendedTgtPatchPtr_(nullptr),
|
extendedTgtPatchPtr_(nullptr),
|
||||||
@ -474,8 +419,6 @@ Foam::advancingFrontAMI::advancingFrontAMI
|
|||||||
Foam::advancingFrontAMI::advancingFrontAMI(const advancingFrontAMI& ami)
|
Foam::advancingFrontAMI::advancingFrontAMI(const advancingFrontAMI& ami)
|
||||||
:
|
:
|
||||||
AMIInterpolation(ami),
|
AMIInterpolation(ami),
|
||||||
maxDistance2_(ami.maxDistance2_),
|
|
||||||
minCosAngle_(ami.minCosAngle_),
|
|
||||||
srcTris_(),
|
srcTris_(),
|
||||||
tgtTris_(),
|
tgtTris_(),
|
||||||
extendedTgtPatchPtr_(nullptr),
|
extendedTgtPatchPtr_(nullptr),
|
||||||
@ -509,24 +452,6 @@ bool Foam::advancingFrontAMI::calculate
|
|||||||
const auto& src = this->srcPatch();
|
const auto& src = this->srcPatch();
|
||||||
const auto& tgt = this->tgtPatch();
|
const auto& tgt = this->tgtPatch();
|
||||||
|
|
||||||
|
|
||||||
if (maxDistance2_ > 0)
|
|
||||||
{
|
|
||||||
// Early trigger face centre calculation
|
|
||||||
(void)src.faceCentres();
|
|
||||||
(void)tgt.faceCentres();
|
|
||||||
// Early trigger face normals calculation
|
|
||||||
(void)src.faceNormals();
|
|
||||||
(void)tgt.faceNormals();
|
|
||||||
}
|
|
||||||
if (minCosAngle_ > -1)
|
|
||||||
{
|
|
||||||
// Early trigger face normals calculation
|
|
||||||
(void)src.faceNormals();
|
|
||||||
(void)tgt.faceNormals();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Initialise area magnitudes
|
// Initialise area magnitudes
|
||||||
srcMagSf_.setSize(src.size(), 1.0);
|
srcMagSf_.setSize(src.size(), 1.0);
|
||||||
tgtMagSf_.setSize(tgt.size(), 1.0);
|
tgtMagSf_.setSize(tgt.size(), 1.0);
|
||||||
@ -554,8 +479,6 @@ bool Foam::advancingFrontAMI::calculate
|
|||||||
void Foam::advancingFrontAMI::write(Ostream& os) const
|
void Foam::advancingFrontAMI::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
AMIInterpolation::write(os);
|
AMIInterpolation::write(os);
|
||||||
os.writeEntryIfDifferent<scalar>("maxDistance2", -1, maxDistance2_);
|
|
||||||
os.writeEntryIfDifferent<scalar>("minCosAngle", -1, minCosAngle_);
|
|
||||||
os.writeEntryIfDifferent<word>
|
os.writeEntryIfDifferent<word>
|
||||||
(
|
(
|
||||||
"triMode",
|
"triMode",
|
||||||
|
|||||||
@ -106,12 +106,6 @@ protected:
|
|||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Maximum squared distance
|
|
||||||
const scalar maxDistance2_;
|
|
||||||
|
|
||||||
//- Minimum (cos of) angle. 1 for perfectly matching.
|
|
||||||
const scalar minCosAngle_;
|
|
||||||
|
|
||||||
//- Storage for src-side triangle decomposition
|
//- Storage for src-side triangle decomposition
|
||||||
List<DynamicList<face>> srcTris_;
|
List<DynamicList<face>> srcTris_;
|
||||||
|
|
||||||
@ -154,10 +148,6 @@ protected:
|
|||||||
//- Check AMI patch coupling
|
//- Check AMI patch coupling
|
||||||
void checkPatches() const;
|
void checkPatches() const;
|
||||||
|
|
||||||
//- Is source/target a valid pair (i.e. not too far/different
|
|
||||||
// orientation). Used for prefiltering before e.g. area overlap
|
|
||||||
bool isCandidate(const label srcFacei, const label tgtFacei) const;
|
|
||||||
|
|
||||||
virtual bool calculate
|
virtual bool calculate
|
||||||
(
|
(
|
||||||
const primitivePatch& srcPatch,
|
const primitivePatch& srcPatch,
|
||||||
|
|||||||
@ -379,8 +379,12 @@ void Foam::faceAreaWeightAMI::calcInterArea
|
|||||||
{
|
{
|
||||||
addProfiling(ami, "faceAreaWeightAMI::interArea");
|
addProfiling(ami, "faceAreaWeightAMI::interArea");
|
||||||
|
|
||||||
// Quick reject if either face has zero area/too far away/wrong orientation
|
// Quick reject if either face has zero area
|
||||||
if (!isCandidate(srcFacei, tgtFacei))
|
if
|
||||||
|
(
|
||||||
|
(srcMagSf_[srcFacei] < ROOTVSMALL)
|
||||||
|
|| (tgtMagSf_[tgtFacei] < ROOTVSMALL)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -455,8 +459,12 @@ bool Foam::faceAreaWeightAMI::overlaps
|
|||||||
const scalar threshold
|
const scalar threshold
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Quick reject if either face has zero area/too far away/wrong orientation
|
// Quick reject if either face has zero area
|
||||||
if (!isCandidate(srcFacei, tgtFacei))
|
if
|
||||||
|
(
|
||||||
|
(srcMagSf_[srcFacei] < ROOTVSMALL)
|
||||||
|
|| (tgtMagSf_[tgtFacei] < ROOTVSMALL)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -133,8 +133,12 @@ void Foam::faceAreaWeightAMI2D::storeInterArea
|
|||||||
{
|
{
|
||||||
addProfiling(ami, "faceAreaWeightAMI2D::calcInterArea");
|
addProfiling(ami, "faceAreaWeightAMI2D::calcInterArea");
|
||||||
|
|
||||||
// Quick reject if either face has zero area/too far away/wrong orientation
|
// Quick reject if either face has zero area
|
||||||
if (!isCandidate(srcFacei, tgtFacei))
|
if
|
||||||
|
(
|
||||||
|
(srcMagSf_[srcFacei] < ROOTVSMALL)
|
||||||
|
|| (tgtMagSf_[tgtFacei] < ROOTVSMALL)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,14 +147,6 @@ $(setWriters)/vtk/foamVtkCoordSetWriter.C
|
|||||||
$(setWriters)/vtk/vtkSetWriterRunTime.C
|
$(setWriters)/vtk/vtkSetWriterRunTime.C
|
||||||
$(setWriters)/xmgrace/xmgraceSetWriterRunTime.C
|
$(setWriters)/xmgrace/xmgraceSetWriterRunTime.C
|
||||||
|
|
||||||
graph/curve.C
|
|
||||||
graph/graph.C
|
|
||||||
|
|
||||||
graphWriters = graph/writers
|
|
||||||
$(graphWriters)/raw/rawGraphWriter.C
|
|
||||||
$(graphWriters)/gnuplot/gnuplotGraphWriter.C
|
|
||||||
$(graphWriters)/xmgrace/xmgraceGraphWriter.C
|
|
||||||
|
|
||||||
|
|
||||||
topoSets = topoSet/topoSets
|
topoSets = topoSet/topoSets
|
||||||
$(topoSets)/cellBitSet.C
|
$(topoSets)/cellBitSet.C
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user