bool Foam::fieldValues::faceSource::writeValues(const word& fieldName) { const bool ok = validField<Type>(fieldName); if (ok) { // Get (correctly oriented) field Field<Type> values = combineFields(setFieldValues<Type>(fieldName)()); // Get unoriented magSf scalarField magSf; if (surfacePtr_.valid()) { magSf = combineFields(surfacePtr_().magSf()); } else { magSf = combineFields(filterField(mesh().magSf(), false)()); } // Get (correctly oriented) weighting field scalarField weightField = combineFields(setFieldValues<scalar>(weightFieldName_)()); if (Pstream::master()) { Type result = processValues(values, magSf, weightField); if (valueOutput_) { IOList<Type> ( IOobject ( fieldName + "_" + sourceTypeNames_[source_] + "-" + sourceName_, obr_.time().timeName(), obr_, IOobject::NO_READ, IOobject::NO_WRITE ), values ).write(); } outputFilePtr_()<< tab << result; if (log_) { Info<< " " << operationTypeNames_[operation_] << "(" << sourceName_ << ") for " << fieldName << " = " << result << endl; } } } return ok; }
void Foam::ParticleCollector<CloudType>::makeLogFile ( const faceList& faces, const Field<point>& points, const Field<scalar>& area ) { // Create the output file if not already created if (log_) { if (debug) { Info<< "Creating output file" << endl; } if (Pstream::master()) { const fileName logDir = outputDir_/this->owner().time().timeName(); // Create directory if does not exist mkDir(logDir); // Open new file at start up outputFilePtr_.reset ( new OFstream(logDir/(type() + ".dat")) ); outputFilePtr_() << "# Source : " << type() << nl << "# Total area : " << sum(area) << nl << "# Time"; forAll(faces, i) { word id = Foam::name(i); outputFilePtr_() << tab << "area[" << id << "]" << tab << "mass[" << id << "]" << tab << "massFlowRate[" << id << "]" << endl; } } }
void Foam::overtopping::writeFileHeader() { if (outputFilePtr_.valid()) { outputFilePtr_() << "Time:"; const faceZoneMesh& faceZones( mesh_.faceZones() ); forAll (faceZones, fzi) { if (operateOnZone( faceZones[fzi] )) { outputFilePtr_() << "\t" << faceZones[fzi].name(); } } outputFilePtr_() << endl; }
bool Foam::fieldValues::cellSource::writeValues(const word& fieldName) { const bool ok = validField<Type>(fieldName); if (ok) { Field<Type> values = combineFields(setFieldValues<Type>(fieldName)); scalarField V = combineFields(filterField(mesh().V())); scalarField weightField = combineFields(setFieldValues<scalar>(weightFieldName_)); if (Pstream::master()) { Type result = processValues(values, V, weightField); if (valueOutput_) { IOList<Type> ( IOobject ( fieldName + "_" + sourceTypeNames_[source_] + "-" + sourceName_, obr_.time().timeName(), obr_, IOobject::NO_READ, IOobject::NO_WRITE ), values ).write(); } outputFilePtr_()<< tab << result; if (log_) { Info<< " " << operationTypeNames_[operation_] << "(" << sourceName_ << ") for " << fieldName << " = " << result << endl; } } } return ok; }
void Foam::ParticleCollector<CloudType>::makeLogFile ( const faceList& faces, const Field<point>& points, const Field<scalar>& area ) { // Create the output file if not already created if (log_) { if (debug) { Info<< "Creating output file" << endl; } if (Pstream::master()) { // Create directory if does not exist mkDir(this->writeTimeDir()); // Open new file at start up outputFilePtr_.reset ( new OFstream(this->writeTimeDir()/(type() + ".dat")) ); outputFilePtr_() << "# Source : " << type() << nl << "# Bins : " << faces.size() << nl << "# Total area : " << sum(area) << nl; outputFilePtr_() << "# Geometry :" << nl << '#' << tab << "Bin" << tab << "(Centre_x Centre_y Centre_z)" << tab << "Area" << nl; forAll(faces, i) { outputFilePtr_() << '#' << tab << i << tab << faces[i].centre(points) << tab << area[i] << nl; } outputFilePtr_() << '#' << nl << "# Output format:" << nl; forAll(faces, i) { word id = Foam::name(i); word binId = "bin_" + id; outputFilePtr_() << '#' << tab << "Time" << tab << binId << tab << "mass[" << id << "]" << tab << "massFlowRate[" << id << "]" << endl; } }