41 namespace coordSetWriters
50 Foam::coordSetWriters::abaqusWriter::timeBaseNames_
52 { timeBase::time,
"time" },
53 { timeBase::iter,
"iteration" },
64 if (width)
os <<
setw(width);
72 Foam::string Foam::coordSetWriters::abaqusWriter::replaceUserEntries
75 const dictionary& vars
80 const bool allowEnv =
true;
81 const bool allowEmpty =
false;
89 void Foam::coordSetWriters::abaqusWriter::appendTimeName
91 const word& fieldName,
109 fName.ext(
Foam::name(writeIndex_[fieldName]));
115 <<
"Unhandled enumeration " << timeBaseNames_[timeBase_]
116 <<
". Available options: " << timeBaseNames_.sortedToc()
129 writeGeometry_(false),
141 writeGeometry_(false),
144 timeBase_(timeBase::time),
151 if (!useLocalTimeDir_)
153 timeBaseNames_.
readIfPresent(
"timeBase", options, timeBase_);
172 open(coords, outputPath);
185 open(tracks, outputPath);
204 return getExpectedPath(
"inp");
208 void Foam::coordSetWriters::abaqusWriter::writeGeometry
214 if (!writeGeometry_ || coords_.empty())
219 os <<
"** Geometry" <<
nl 225 label globalPointi = 1;
226 for (
const coordSet& coords : coords_)
228 for (
const point&
p : coords)
230 const point tp =
p*geometryScale_;
232 os << globalPointi <<
", " 233 << tp[0] <<
", " << tp[1] <<
", " << tp[2] <<
nl;
242 <<
"Tracks not implemented for " << typeName <<
endl;
252 const word& fieldName,
257 useTimeDir(useLocalTimeDir_);
271 if (!writeIndex_.insert(fieldName, 0))
273 ++writeIndex_[fieldName];
283 const word geomName(
"geometry");
284 if (!writeIndex_.insert(geomName, 0))
286 ++writeIndex_[geomName];
289 fileName geomFileName(outputFile.
lessExt() +
".inp");
291 appendTimeName(
"geometry", geomFileName);
295 Info<<
"Writing abaqus geometry to " << geomFileName <<
endl;
298 OFstream osGeom(geomFileName);
303 fileName fieldFileName(outputFile.
lessExt() +
".inp_" + fieldName);
304 appendTimeName(fieldName, fieldFileName);
308 Info<<
"Writing field data to " << fieldFileName <<
endl;
311 OFstream
os(fieldFileName);
313 if (!outputHeader_.empty())
317 vars.add(
"FIELD_NAME", fieldName);
318 vars.add(
"FILE_NAME", fieldFileName);
320 for (
const auto&
s : outputHeader_)
322 os << replaceUserEntries(
s, vars).c_str() <<
nl;
327 os <<
"** OpenFOAM " << fieldFileName.nameLessExt() <<
nl 328 <<
"** Project " << outputFile <<
nl 329 <<
"** Field=" << fieldName <<
" Time=" <<
timeName() <<
nl;
332 tmp<Field<Type>> tfield(
values);
333 tfield = adjustFieldTemplate(fieldName, tfield);
334 const auto&
field = tfield();
362 const word& fieldName,
380 Info<<
"Writing abaqus geometry to " << outputFile <<
endl;
388 OFstream osGeom(outputFile.
lessExt() +
"." + fieldName +
".inp");
391 <<
"** Geometry" <<
nl abaqusWriter()
Default construct.
addToRunTimeSelectionTable(coordSetWriter, abaqusWriter, word)
A class for handling file names.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual fileName path() const
Characteristic output file name - information only.
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val, const bool warnOnly=false) const
Find an entry if present, and assign to T val.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
static const fileName null
An empty fileName.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A traits class, which is primarily used for primitives and vector-space.
defineTypeName(abaqusWriter)
Write coordSet(s) as Abaqus point fields.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
static std::string path(const std::string &str)
Return directory path name (part before last /)
Macros for easy insertion into run-time selection tables.
static void putValue(Ostream &os, const Type &value, const int width)
#define forAll(list, i)
Loop across all elements in list.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
timeBase
Enumeration for time base.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Convenience macros for instantiating coordSetWriter methods.
Holds list of sampling positions.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Generic templated field type.
A class for handling words, derived from Foam::string.
Base class for writing coordSet(s) and tracks with fields.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void inplaceExpand(std::string &s, const HashTable< string > &mapping, const char sigil='$')
Inplace expand occurrences of variables according to the mapping. Does not use environment values...
Istream and Ostream manipulators taking arguments.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
OBJstream os(runTime.globalPath()/outputName)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
defineCoordSetWriterWriteFields(Foam::coordSetWriters::abaqusWriter)
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
fileName lessExt() const
Return file name without extension (part before last .)
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual ~abaqusWriter()
Destructor. Calls close()
Omanip< int > setw(const int i)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A class for handling character strings derived from std::string.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)