Go to the documentation of this file.
55 const DynamicList<List<point>>& faces,
60 OBJstream os(fileName +
".obj");
62 if (Pstream::parRun())
65 List<DynamicList<List<point>>> allProcFaces(Pstream::nProcs());
66 allProcFaces[Pstream::myProcNo()] = faces;
67 Pstream::gatherList(allProcFaces);
69 if (Pstream::master())
71 Info<<
"Writing file: " << fileName <<
endl;
73 for (
const DynamicList<List<point>>& procFaces : allProcFaces)
75 for (
const List<point>& facePts : procFaces)
84 Info<<
"Writing file: " << fileName <<
endl;
86 for (
const List<point>& facePts : faces)
94 int main(
int argc,
char *argv[])
98 "Uses cutCellIso to create a volume fraction field from an "
108 const word
dictName(
"setAlphaFieldDict");
111 IOdictionary setAlphaFieldDict(
dictIO);
113 Info<<
"Reading " << setAlphaFieldDict.name() <<
endl;
115 const word fieldName = setAlphaFieldDict.get<word>(
"field");
116 const bool invert = setAlphaFieldDict.getOrDefault(
"invert",
false);
117 const bool writeOBJ = setAlphaFieldDict.getOrDefault(
"writeOBJ",
false);
119 Info<<
"Reading field " << fieldName <<
nl <<
endl;
135 setAlphaFieldDict.get<word>(
"type"),
146 cutCellIso cutCell(
mesh,
f);
148 DynamicList<List<point>> facePts;
150 DynamicList<triSurface> surface;
156 label cellStatus = cutCell.calcSubCell(cellI, 0.0);
158 if (cellStatus == -1)
162 else if (cellStatus == 1)
166 else if (cellStatus == 0)
168 if (
mag(cutCell.faceArea()) != 0)
170 alpha1[cellI] =
max(
min(cutCell.VolumeOfFluid(), 1), 0);
173 facePts.append(cutCell.facePoints());
181 isoFacesToFile(facePts, fieldName +
"0");
184 ISstream::defaultPrecision(18);
191 alpha1.correctBoundaryConditions();
199 <<
", 1-max(alpha1): " << 1 -
gMax(
alpha)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static constexpr const zero Zero
Global zero (0)
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
const word dictName("blockMeshDict")
Ostream & endl(Ostream &os)
Add newline and flush stream.
Type gSum(const FieldField< Field, Type > &f)
const volScalarField & alpha1
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
#define forAll(list, i)
Loop across all elements in list.
messageStream Info
Information stream (uses stdout - output is on the master only)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
void func(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
constexpr scalar pi(M_PI)
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const dimensionedScalar e
Elementary charge.
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
Type gMin(const FieldField< Field, Type > &f)
Type gMax(const FieldField< Field, Type > &f)