createFields.H
Go to the documentation of this file.
1  IOdictionary pdfDictionary
2  (
3  IOobject
4  (
5  "pdfDict",
6  runTime.constant(),
7  runTime,
8  IOobject::MUST_READ_IF_MODIFIED,
9  IOobject::NO_WRITE
10  )
11  );
12 
13  const label nIntervals(pdfDictionary.lookup<label>("nIntervals"));
14 
15  const label nSamples(pdfDictionary.lookup<label>("nSamples"));
16 
17  const bool writeData(readBool(pdfDictionary.lookup("writeData")));
18 
19  const fileName pdfPath =
20  runTime.globalPath()
21  /functionObjects::writeFile::outputPrefix
22  /args.executable()
23  /runTime.name();
24 
26 
27  Random rndGen(label(0));
28 
29  autoPtr<distribution> p
30  (
32  (
34  rndGen,
35  0
36  )
37  );
38 
39  const scalar xMin = p->min();
40  const scalar xMax = p->max();
41 
42  autoPtr<OFstream> filePtr(nullptr);
43 
44  if (writeData)
45  {
46  fileName fName = pdfPath/(p->type() + ".data");
47  Info<< "Writing " << p->type() << " data samples to file:" << nl
48  << fName << nl << endl;
49 
50  filePtr.reset(new OFstream(fName));
51  }
52 
const word & executable() const
Name of executable without the path.
Definition: argListI.H:36
volScalarField scalarField(fieldObject, mesh)
volScalarField & p
Definition: createFields.H:25
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
bool readBool(Istream &)
Definition: boolIO.C:60
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
messageStream Info
static const char nl
Definition: Ostream.H:260
Foam::argList args(argc, argv)
const bool writeData(readBool(pdfDictionary.lookup("writeData")))
scalarField samples(nIntervals, 0)
const label nSamples(pdfDictionary.lookup< label >("nSamples"))
const scalar xMin
Definition: createFields.H:39
const fileName pdfPath
Definition: createFields.H:19
autoPtr< OFstream > filePtr(nullptr)
mkDir(pdfPath)
IOdictionary pdfDictionary(IOobject("pdfDict", runTime.constant(), runTime, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE))
const label nIntervals(pdfDictionary.lookup< label >("nIntervals"))
Random rndGen(label(0))
const scalar xMax
Definition: createFields.H:40