From d36bb781b7553d68dddba584ac72b5e3776a1589 Mon Sep 17 00:00:00 2001 From: henry <Henry Weller h.weller@opencfd.co.uk> Date: Thu, 28 Jan 2010 16:07:18 +0000 Subject: [PATCH] timeVaryingMappedFixedValueFvPatchField: Added the option to specify the name of the field data table. Defaults to the name of the field the BC is being applied to but may be set using the keyword fieldTableName, e.g. fieldTableName totalPressure; --- .../timeVaryingMappedFixedValueFvPatchField.C | 31 ++++++++++++++----- .../timeVaryingMappedFixedValueFvPatchField.H | 3 ++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index b1afef7b883..9ce0597ff27 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -49,6 +49,7 @@ timeVaryingMappedFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(p, iF), + fieldTableName_(iF.name()), setAverage_(false), referenceCS_(NULL), nearestVertex_(0), @@ -80,6 +81,7 @@ timeVaryingMappedFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(ptf, p, iF, mapper), + fieldTableName_(ptf.fieldTableName_), setAverage_(ptf.setAverage_), referenceCS_(NULL), nearestVertex_(0), @@ -110,6 +112,7 @@ timeVaryingMappedFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(p, iF), + fieldTableName_(iF.name()), setAverage_(readBool(dict.lookup("setAverage"))), referenceCS_(NULL), nearestVertex_(0), @@ -128,6 +131,11 @@ timeVaryingMappedFixedValueFvPatchField << endl; } + if (dict.found("fieldTableName")) + { + dict.lookup("fieldTableName") >> fieldTableName_; + } + if (dict.found("value")) { fvPatchField<Type>::operator==(Field<Type>("value", dict, p.size())); @@ -147,6 +155,7 @@ timeVaryingMappedFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(ptf), + fieldTableName_(ptf.fieldTableName_), setAverage_(ptf.setAverage_), referenceCS_(ptf.referenceCS_), nearestVertex_(ptf.nearestVertex_), @@ -177,6 +186,7 @@ timeVaryingMappedFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(ptf, iF), + fieldTableName_(ptf.fieldTableName_), setAverage_(ptf.setAverage_), referenceCS_(ptf.referenceCS_), nearestVertex_(ptf.nearestVertex_), @@ -271,8 +281,8 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::readSamplePoints() << "Need at least three non-colinear samplePoints" << " to be able to interpolate." << "\n on patch " << this->patch().name() - << " of field " << this->dimensionedInternalField().name() - << " in file " << this->dimensionedInternalField().objectPath() + << " of points " << samplePoints.name() + << " in file " << samplePoints.objectPath() << exit(FatalError); } @@ -332,8 +342,8 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::readSamplePoints() ) << "Cannot find points that make valid normal." << nl << "Need at least three sample points which are not in a line." << "\n on patch " << this->patch().name() - << " of field " << this->dimensionedInternalField().name() - << " in file " << this->dimensionedInternalField().objectPath() + << " of points " << samplePoints.name() + << " in file " << samplePoints.objectPath() << exit(FatalError); } @@ -474,8 +484,7 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::findTime << "In directory " << this->db().time().constant()/"boundaryData"/this->patch().name() << "\n on patch " << this->patch().name() - << " of field " << this->dimensionedInternalField().name() - << " in file " << this->dimensionedInternalField().objectPath() + << " of field " << fieldTableName_ << exit(FatalError); } @@ -563,7 +572,7 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::checkTable() ( IOobject ( - this->dimensionedInternalField().name(), + fieldTableName_, this->db().time().constant(), "boundaryData" /this->patch().name() @@ -608,7 +617,7 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::checkTable() ( IOobject ( - this->dimensionedInternalField().name(), + fieldTableName_, this->db().time().constant(), "boundaryData" /this->patch().name() @@ -771,6 +780,12 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::write(Ostream& os) const { fvPatchField<Type>::write(os); os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl; + + if (fieldTableName_ != this->dimensionedInternalField().name()) + { + os.writeKeyword("fieldTableName") << fieldTableName_ << token::END_STATEMENT << nl; + } + this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H index 31b88ae03aa..a310c8f4dc7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H @@ -57,6 +57,9 @@ class timeVaryingMappedFixedValueFvPatchField { // Private data + //- Name of the field data table, defaults to the name of the field + word fieldTableName_; + //- If true adjust the mapped field to maintain average value bool setAverage_; -- GitLab