Skip to content
Snippets Groups Projects
Commit 9fdb5506 authored by Henry Weller's avatar Henry Weller
Browse files

timeVaryingMappedFixedValueFvPatchField: Simplifed for consistency with the output of sampledPlane

Now a case can be sampled and written in 'foam' format and used for the
timeVaryingMappedFixedValue BC of another case.
parent 507b8988
Branches
Tags
No related merge requests found
......@@ -25,7 +25,7 @@ License
#include "timeVaryingMappedFixedValueFvPatchField.H"
#include "Time.H"
#include "AverageIOField.H"
#include "IFstream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
......@@ -240,21 +240,30 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
// Initialise
if (mapperPtr_.empty())
{
pointIOField samplePoints
// Reread values and interpolate
fileName samplePointsFile
(
IOobject
(
"points",
this->db().time().constant(),
"boundaryData"/this->patch().name(),
this->db(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE,
false
)
this->db().time().constant()
/"boundaryData"
/this->patch().name()
/"points"
);
const fileName samplePointsFile = samplePoints.filePath();
pointField samplePoints((IFstream(samplePointsFile)()));
// pointIOField samplePoints
// (
// IOobject
// (
// "points",
// this->db().time().constant(),
// "boundaryData"/this->patch().name(),
// this->db(),
// IOobject::MUST_READ,
// IOobject::AUTO_WRITE,
// false
// )
// );
if (debug)
{
......@@ -358,32 +367,42 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
// Reread values and interpolate
AverageIOField<Type> vals
fileName valsFile
(
IOobject
(
fieldTableName_,
this->db().time().constant(),
"boundaryData"
/this->patch().name()
/sampleTimes_[startSampleTime_].name(),
this->db(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE,
false
)
this->db().time().constant()
/"boundaryData"
/this->patch().name()
/sampleTimes_[startSampleTime_].name()
/fieldTableName_
);
Field<Type> vals((IFstream(valsFile)()));
// IOField<Type> vals
// (
// IOobject
// (
// fieldTableName_,
// this->db().time().constant(),
// "boundaryData"
// /this->patch().name()
// /sampleTimes_[startSampleTime_].name(),
// this->db(),
// IOobject::MUST_READ,
// IOobject::AUTO_WRITE,
// false
// )
// );
if (vals.size() != mapperPtr_().sourceSize())
{
FatalErrorInFunction
<< "Number of values (" << vals.size()
<< ") differs from the number of points ("
<< mapperPtr_().sourceSize()
<< ") in file " << vals.objectPath() << exit(FatalError);
<< ") in file " << valsFile << exit(FatalError);
}
startAverage_ = vals.average();
//startAverage_ = vals.average();
startSampledValues_ = mapperPtr_().interpolate(vals);
}
}
......@@ -413,7 +432,7 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
}
// Reread values and interpolate
AverageIOField<Type> vals
IOField<Type> vals
(
IOobject
(
......@@ -438,7 +457,7 @@ void Foam::timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()
<< ") in file " << vals.objectPath() << exit(FatalError);
}
endAverage_ = vals.average();
//endAverage_ = vals.average();
endSampledValues_ = mapperPtr_().interpolate(vals);
}
}
......
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class vectorAverageField;
object values;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Average
(0 0 0)
// Data on points
70
(
......
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class scalarAverageField;
object values;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Average
0
// Data on points
70
(
......
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class scalarAverageField;
object values;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Average
0.0
// Data on points
70
(
......
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class vectorField;
object points;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Points
70
(
// min z
(-0.0206 0.000125 0)
(-0.0206 0.000375 0)
(-0.0206 0.000625 0)
(-0.0206 0.000875 0)
(-0.0206 0.001125 0)
(-0.0206 0.001375 0)
(-0.0206 0.001625 0)
(-0.0206 0.001875 0)
(-0.0206 0.00220314 0)
(-0.0206 0.00263672 0)
(-0.0206 0.00312852 0)
(-0.0206 0.00368638 0)
(-0.0206 0.00431918 0)
(-0.0206 0.00503697 0)
(-0.0206 0.00585116 0)
(-0.0206 0.0067747 0)
(-0.0206 0.00782229 0)
(-0.0206 0.00901059 0)
(-0.0206 0.0103585 0)
(-0.0206 0.0118874 0)
(-0.0206 0.0134739 0)
(-0.0206 0.0149487 0)
(-0.0206 0.0162845 0)
(-0.0206 0.0174943 0)
(-0.0206 0.0185901 0)
(-0.0206 0.0195826 0)
(-0.0206 0.0204815 0)
(-0.0206 0.0212956 0)
(-0.0206 0.022033 0)
(-0.0206 0.0227009 0)
(-0.0206 0.0233059 0)
(-0.0206 0.0238537 0)
(-0.0206 0.0243499 0)
(-0.0206 0.0247994 0)
(-0.0206 0.0252065 0)
// max z
(-0.0206 0.000125 0.173)
(-0.0206 0.000375 0.173)
(-0.0206 0.000625 0.173)
(-0.0206 0.000875 0.173)
(-0.0206 0.001125 0.173)
(-0.0206 0.001375 0.173)
(-0.0206 0.001625 0.173)
(-0.0206 0.001875 0.173)
(-0.0206 0.00220314 0.173)
(-0.0206 0.00263672 0.173)
(-0.0206 0.00312852 0.173)
(-0.0206 0.00368638 0.173)
(-0.0206 0.00431918 0.173)
(-0.0206 0.00503697 0.173)
(-0.0206 0.00585116 0.173)
(-0.0206 0.0067747 0.173)
(-0.0206 0.00782229 0.173)
(-0.0206 0.00901059 0.173)
(-0.0206 0.0103585 0.173)
(-0.0206 0.0118874 0.173)
(-0.0206 0.0134739 0.173)
(-0.0206 0.0149487 0.173)
(-0.0206 0.0162845 0.173)
(-0.0206 0.0174943 0.173)
(-0.0206 0.0185901 0.173)
(-0.0206 0.0195826 0.173)
(-0.0206 0.0204815 0.173)
(-0.0206 0.0212956 0.173)
(-0.0206 0.022033 0.173)
(-0.0206 0.0227009 0.173)
(-0.0206 0.0233059 0.173)
(-0.0206 0.0238537 0.173)
(-0.0206 0.0243499 0.173)
(-0.0206 0.0247994 0.173)
(-0.0206 0.0252065 0.173)
// min z
(-0.0206 0.000125 0)
(-0.0206 0.000375 0)
(-0.0206 0.000625 0)
(-0.0206 0.000875 0)
(-0.0206 0.001125 0)
(-0.0206 0.001375 0)
(-0.0206 0.001625 0)
(-0.0206 0.001875 0)
(-0.0206 0.00220314 0)
(-0.0206 0.00263672 0)
(-0.0206 0.00312852 0)
(-0.0206 0.00368638 0)
(-0.0206 0.00431918 0)
(-0.0206 0.00503697 0)
(-0.0206 0.00585116 0)
(-0.0206 0.0067747 0)
(-0.0206 0.00782229 0)
(-0.0206 0.00901059 0)
(-0.0206 0.0103585 0)
(-0.0206 0.0118874 0)
(-0.0206 0.0134739 0)
(-0.0206 0.0149487 0)
(-0.0206 0.0162845 0)
(-0.0206 0.0174943 0)
(-0.0206 0.0185901 0)
(-0.0206 0.0195826 0)
(-0.0206 0.0204815 0)
(-0.0206 0.0212956 0)
(-0.0206 0.022033 0)
(-0.0206 0.0227009 0)
(-0.0206 0.0233059 0)
(-0.0206 0.0238537 0)
(-0.0206 0.0243499 0)
(-0.0206 0.0247994 0)
(-0.0206 0.0252065 0)
// max z
(-0.0206 0.000125 0.173)
(-0.0206 0.000375 0.173)
(-0.0206 0.000625 0.173)
(-0.0206 0.000875 0.173)
(-0.0206 0.001125 0.173)
(-0.0206 0.001375 0.173)
(-0.0206 0.001625 0.173)
(-0.0206 0.001875 0.173)
(-0.0206 0.00220314 0.173)
(-0.0206 0.00263672 0.173)
(-0.0206 0.00312852 0.173)
(-0.0206 0.00368638 0.173)
(-0.0206 0.00431918 0.173)
(-0.0206 0.00503697 0.173)
(-0.0206 0.00585116 0.173)
(-0.0206 0.0067747 0.173)
(-0.0206 0.00782229 0.173)
(-0.0206 0.00901059 0.173)
(-0.0206 0.0103585 0.173)
(-0.0206 0.0118874 0.173)
(-0.0206 0.0134739 0.173)
(-0.0206 0.0149487 0.173)
(-0.0206 0.0162845 0.173)
(-0.0206 0.0174943 0.173)
(-0.0206 0.0185901 0.173)
(-0.0206 0.0195826 0.173)
(-0.0206 0.0204815 0.173)
(-0.0206 0.0212956 0.173)
(-0.0206 0.022033 0.173)
(-0.0206 0.0227009 0.173)
(-0.0206 0.0233059 0.173)
(-0.0206 0.0238537 0.173)
(-0.0206 0.0243499 0.173)
(-0.0206 0.0247994 0.173)
(-0.0206 0.0252065 0.173)
)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment