43 int main(
int argc,
char *argv[])
47 "Translate a STARCD SMAP data file into OpenFOAM field format" 50 argList::noParallel();
51 argList::addArgument(
"SMAP fileName");
53 argList
args(argc, argv);
66 fieldNameDict.add(fieldNames[i], word(fieldNames[i]));
70 if (fieldNameDict.found(
"U")) nameMap.add(
"SU", word(
"U"));
71 if (fieldNameDict.found(
"p")) nameMap.add(
"P", word(
"p"));
72 if (fieldNameDict.found(
"T")) nameMap.add(
"T", word(
"T"));
73 if (fieldNameDict.found(
"rho")) nameMap.add(
"DENS", word(
"rho"));
74 if (fieldNameDict.found(
"k")) nameMap.add(
"TE", word(
"k"));
75 if (fieldNameDict.found(
"epsilon")) nameMap.add(
"ED", word(
"epsilon"));
76 if (fieldNameDict.found(
"nuEff")) nameMap.add(
"VIS", word(
"nuEff"));
80 IFstream smapFile(
args.
get<fileName>(1));
85 <<
"Cannot open SMAP file " << smapFile.name()
89 while (!smapFile.eof())
93 token fieldName(smapFile);
100 if (!fieldName.isWord(
"CELL"))
103 <<
"Expected first CELL, found " 109 smapFile >> fieldName;
110 while (fieldName.isWord())
112 starFieldNames[nCols++] = fieldName.wordToken();
113 smapFile >> fieldName;
116 List<volScalarField*> sFields
119 reinterpret_cast<volScalarField*>(0)
122 List<volVectorField*> vFields
125 reinterpret_cast<volVectorField*>(0)
131 if (nameMap.found(starFieldNames[i]))
135 nameMap.get<word>(starFieldNames[i]),
142 if (starFieldNames[i] ==
"SU")
174 smapFile >> (*sFields[i])[celli];
179 smapFile >> (*vFields[i])[celli].
x();
180 smapFile >> (*vFields[i])[celli].
y();
181 smapFile >> (*vFields[i])[celli].z();
192 for (label i=0; i<nCols; i++)
196 sFields[i]->correctBoundaryConditions();
199 sFields[i] =
nullptr;
203 vFields[i]->correctBoundaryConditions();
206 vFields[i] =
nullptr;
216 <<
"Expected first SMAP dummy entry to be cell 0, found " 221 for (label i=0; i<nCols; i++)
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
GeometricField< vector, fvPatchField, volMesh > volVectorField
void exit(const int errNo=1)
Exit : can be called for any error to exit program.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
List< word > wordList
List of word.
T get(const label index) const
Get a value from the argument at index.
messageStream Info
Information stream (stdout output on master, null elsewhere)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
List< fileName > fileNameList
List of fileName.
fileNameList readDir(const fileName &directory, const fileName::Type type=fileName::Type::FILE, const bool filtergz=true, const bool followLink=true)
Read a directory and return the entries as a fileName List.
Foam::argList args(argc, argv)
bool check(bool checkArgs=argList::argsMandatory(), bool checkOpts=true) const
Check the parsed command-line for mandatory arguments and that all the options are correct...