Commit b4b75fc0 authored by Andrew Heather's avatar Andrew Heather
Browse files

removing old averaging - replaced by averaging function object

parent 35e0527b
nAveragingSteps++;
scalar nm1Coeff = scalar(nAveragingSteps - 1)/nAveragingSteps;
scalar nCoeff = 1.0/nAveragingSteps;
UaMean = nm1Coeff*UaMean + nCoeff*Ua;
UbMean = nm1Coeff*UbMean + nCoeff*Ub;
alphaMean = nm1Coeff*alphaMean + nCoeff*alpha;
pMean = nm1Coeff*pMean + nCoeff*p;
label nAveragingSteps = 1;
IFstream nAveragingStepsFile
(
runTime.path()/runTime.timeName()/"nAveragingSteps.raw"
);
volVectorField* UaMeanPtr;
volVectorField* UbMeanPtr;
volScalarField* alphaMeanPtr;
volScalarField* pMeanPtr;
if (nAveragingStepsFile.good())
{
nAveragingStepsFile >> nAveragingSteps;
Info<< "Reading field UaMean\n" << endl;
UaMeanPtr = new volVectorField
(
IOobject
(
"UaMean",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field UbMean\n" << endl;
UbMeanPtr = new volVectorField
(
IOobject
(
"UbMean",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field alphaMean\n" << endl;
alphaMeanPtr = new volScalarField
(
IOobject
(
"alphaMean",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field pMean\n" << endl;
pMeanPtr = new volScalarField
(
IOobject
(
"pMean",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
}
else
{
Info<< "Creating field UaMean\n" << endl;
UaMeanPtr = new volVectorField
(
IOobject
(
"UaMean",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
Ua
);
Info<< "Creating field UbMean\n" << endl;
UbMeanPtr = new volVectorField
(
IOobject
(
"UbMean",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
Ub
);
Info<< "Creating field alphaMean\n" << endl;
alphaMeanPtr = new volScalarField
(
IOobject
(
"alphaMean",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
alpha
);
Info<< "Creating field pMean\n" << endl;
pMeanPtr = new volScalarField
(
IOobject
(
"pMean",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
p
);
}
volVectorField& UaMean = *UaMeanPtr;
volVectorField& UbMean = *UbMeanPtr;
volScalarField& alphaMean = *alphaMeanPtr;
volScalarField& pMean = *pMeanPtr;
if (runTime.outputTime())
{
OFstream nAveragingStepsFile
(
runTime.path()/runTime.timeName()/"nAveragingSteps.raw"
);
if (nAveragingStepsFile.good())
{
nAveragingStepsFile << nAveragingSteps << endl;
}
else
{
FatalErrorIn(args.executable())
<< "Cannot open file "
<< runTime.path()/runTime.timeName()/"nAveragingSteps.raw"
<< abort(FatalError);
}
mkDir(runTime.path()/runTime.timeName()/"data");
}
......@@ -54,7 +54,6 @@ int main(int argc, char *argv[])
# include "createMesh.H"
# include "readEnvironmentalProperties.H"
# include "createFields.H"
# include "createAverages.H"
# include "readPPProperties.H"
# include "initContinuityErrs.H"
# include "readTimeControls.H"
......@@ -100,9 +99,7 @@ int main(int argc, char *argv[])
kineticTheory.solve();
nuEffa += kineticTheory.mua()/rhoa;
}
# include "calculateAverages.H"
# include "write.H"
# include "writeNaveragingSteps.H"
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
......
......@@ -50,4 +50,45 @@ maxCo 0.5;
maxDeltaT 1;
functions
(
fieldAverage1
{
// Type of functionObject
type fieldAverage;
// Where to load it from (if not already in solver)
functionObjectLibs ("libfieldAverage.so");
// Fields to be averaged - runTime modifiable
fields
(
Ua
{
mean on;
prime2Mean off;
base time;
}
Ub
{
mean on;
prime2Mean off;
base time;
}
alpha
{
mean on;
prime2Mean off;
base time;
}
p
{
mean on;
prime2Mean off;
base time;
}
);
}
);
// ************************************************************************* //
......@@ -50,4 +50,45 @@ maxCo 0.9;
maxDeltaT 1e-5;
functions
(
fieldAverage1
{
// Type of functionObject
type fieldAverage;
// Where to load it from (if not already in solver)
functionObjectLibs ("libfieldAverage.so");
// Fields to be averaged - runTime modifiable
fields
(
Ua
{
mean on;
prime2Mean off;
base time;
}
Ub
{
mean on;
prime2Mean off;
base time;
}
alpha
{
mean on;
prime2Mean off;
base time;
}
p
{
mean on;
prime2Mean off;
base time;
}
);
}
);
// ************************************************************************* //
......@@ -50,4 +50,45 @@ maxCo 0.5;
maxDeltaT 1;
functions
(
fieldAverage1
{
// Type of functionObject
type fieldAverage;
// Where to load it from (if not already in solver)
functionObjectLibs ("libfieldAverage.so");
// Fields to be averaged - runTime modifiable
fields
(
Ua
{
mean on;
prime2Mean off;
base time;
}
Ub
{
mean on;
prime2Mean off;
base time;
}
alpha
{
mean on;
prime2Mean off;
base time;
}
p
{
mean on;
prime2Mean off;
base time;
}
);
}
);
// ************************************************************************* //
Supports Markdown
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