57 const DynamicList<List<point>>& faces,
62 OBJstream
os(fileName +
".obj");
64 if (Pstream::parRun())
67 List<DynamicList<List<point>>> allProcFaces(Pstream::nProcs());
68 allProcFaces[Pstream::myProcNo()] = faces;
69 Pstream::gatherList(allProcFaces);
71 if (Pstream::master())
73 Info<<
"Writing file: " << fileName <<
endl;
75 for (
const DynamicList<List<point>>& procFaces : allProcFaces)
77 for (
const List<point>& facePts : procFaces)
79 os.writeFace(facePts);
86 Info<<
"Writing file: " << fileName <<
endl;
88 for (
const List<point>& facePts : faces)
90 os.writeFace(facePts);
98 DynamicList<List<point>>& facePts,
104 cutCellIso cutCell(
mesh,
f);
105 cutFaceIso cutFace(
mesh,
f);
109 cutCell.calcSubCell(cellI, 0.0);
111 alpha1[cellI] =
clamp(cutCell.VolumeOfFluid(), zero_one{});
115 facePts.append(cutCell.facePoints());
122 if (
mesh.boundary()[patchi].size() > 0)
124 const label start =
mesh.boundary()[patchi].patch().start();
128 forAll(alphap, patchFacei)
130 const label facei = patchFacei + start;
131 cutFace.calcSubFace(facei, 0.0);
133 mag(cutFace.subFaceArea())/magSfp[patchFacei];
140 int main(
int argc,
char *argv[])
144 "Uses cutCellIso to create a volume fraction field from an " 152 "Alternative setAlphaFieldDict dictionary" 159 const word
dictName(
"setAlphaFieldDict");
162 IOdictionary setAlphaFieldDict(
dictIO);
164 Info<<
"Reading " << setAlphaFieldDict.name() <<
endl;
166 const word fieldName = setAlphaFieldDict.get<word>(
"field");
167 const bool invert = setAlphaFieldDict.getOrDefault(
"invert",
false);
168 const bool writeOBJ = setAlphaFieldDict.getOrDefault(
"writeOBJ",
false);
170 Info<<
"Reading field " << fieldName <<
nl <<
endl;
186 setAlphaFieldDict.get<word>(
"type"),
197 DynamicList<List<point>> facePts;
203 isoFacesToFile(facePts, fieldName +
"0");
206 ISstream::defaultPrecision(18);
219 <<
", 1-max(alpha1): " << 1 -
gMax(
alpha)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Type gMin(const FieldField< Field, Type > &f)
constexpr char nl
The newline '\n' character (0x0a)
const word dictName("faMeshDefinition")
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionedScalar e
Elementary charge.
Type gSum(const FieldField< Field, Type > &f)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
constexpr scalar pi(M_PI)
Type gMax(const FieldField< Field, Type > &f)
OBJstream os(runTime.globalPath()/outputName)
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
dimensionSet clamp(const dimensionSet &a, const dimensionSet &range)
static constexpr const zero Zero
Global zero (0)
const volScalarField & alpha1