mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Created new functionObject for dsmcFields, renamed post processing utility dsmcFields to dsmcFieldsCalc and calling function object from there.
This commit is contained in:
@ -1,3 +0,0 @@
|
|||||||
dsmcFields.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/dsmcFields
|
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
dsmcFieldsCalc.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/dsmcFieldsCalc
|
||||||
@ -2,6 +2,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/postProcessing/postCalc \
|
-I$(LIB_SRC)/postProcessing/postCalc \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/postProcessing/functionObjects/utilities/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/dsmc/lnInclude \
|
-I$(LIB_SRC)/lagrangian/dsmc/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
@ -9,6 +10,7 @@ EXE_LIBS = \
|
|||||||
$(FOAM_LIBBIN)/postCalc.o \
|
$(FOAM_LIBBIN)/postCalc.o \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
|
-lutilityFunctionObjects \
|
||||||
-llagrangian \
|
-llagrangian \
|
||||||
-ldsmc
|
-ldsmc
|
||||||
|
|
||||||
@ -34,6 +34,7 @@ Description
|
|||||||
#include "calc.H"
|
#include "calc.H"
|
||||||
#include "fvc.H"
|
#include "fvc.H"
|
||||||
#include "dsmcCloud.H"
|
#include "dsmcCloud.H"
|
||||||
|
#include "dsmcFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -133,97 +134,17 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
|||||||
Info<< "Reading field iDofMean" << endl;
|
Info<< "Reading field iDofMean" << endl;
|
||||||
volScalarField iDofMean(iDofMeanheader, mesh);
|
volScalarField iDofMean(iDofMeanheader, mesh);
|
||||||
|
|
||||||
// Check if there are any zero values in the density fields
|
dsmcFields dF
|
||||||
|
(
|
||||||
|
"dsmcFieldsUtility",
|
||||||
|
mesh,
|
||||||
|
dictionary(),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
if (min(rhoNMean).value() > VSMALL)
|
if (writeResults)
|
||||||
{
|
{
|
||||||
// TODO Sort out boundary field values if required
|
dF.write();
|
||||||
|
|
||||||
Info<< nl << "Calculating UMean field." << endl;
|
|
||||||
volVectorField UMean
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"UMean",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ
|
|
||||||
),
|
|
||||||
momentumMean/rhoMMean
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Calculating translationalTMean field." << endl;
|
|
||||||
volScalarField translationalTMean
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"translationalTMean",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ
|
|
||||||
),
|
|
||||||
2.0/(3.0*dsmcCloud::kb*rhoNMean)
|
|
||||||
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean))
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Calculating internalTMean field." << endl;
|
|
||||||
volScalarField internalTMean
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"internalTMean",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ
|
|
||||||
),
|
|
||||||
2.0/(dsmcCloud::kb*iDofMean)*internalEMean
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Calculating overallTMean field." << endl;
|
|
||||||
volScalarField overallTMean
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"overallTMean",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ
|
|
||||||
),
|
|
||||||
2.0/(dsmcCloud::kb*(3.0*rhoNMean + iDofMean))
|
|
||||||
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean) + internalEMean)
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "mag(UMean) max/min : "
|
|
||||||
<< max(mag(UMean)).value() << " "
|
|
||||||
<< min(mag(UMean)).value() << endl;
|
|
||||||
|
|
||||||
Info<< nl << "translationalTMean max/min : "
|
|
||||||
<< max(translationalTMean).value() << " "
|
|
||||||
<< min(translationalTMean).value() << endl;
|
|
||||||
|
|
||||||
Info<< nl << "internalTMean max/min : "
|
|
||||||
<< max(internalTMean).value() << " "
|
|
||||||
<< min(internalTMean).value() << endl;
|
|
||||||
|
|
||||||
Info<< nl << "overallTMean max/min : "
|
|
||||||
<< max(overallTMean).value() << " "
|
|
||||||
<< min(overallTMean).value() << endl;
|
|
||||||
|
|
||||||
if (writeResults)
|
|
||||||
{
|
|
||||||
UMean.write();
|
|
||||||
translationalTMean.write();
|
|
||||||
internalTMean.write();
|
|
||||||
overallTMean.write();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< "Small or negative value (" << min(rhoNMean)
|
|
||||||
<< ") found in rhoNMean field. "
|
|
||||||
<< "Not calculating fields to avoid division by zero "
|
|
||||||
<< "or invalid results."
|
|
||||||
<< endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,6 +6,7 @@ wmake libso basic
|
|||||||
wmake libso solidParticle
|
wmake libso solidParticle
|
||||||
wmake libso intermediate
|
wmake libso intermediate
|
||||||
wmake libso dieselSpray
|
wmake libso dieselSpray
|
||||||
|
wmake libso dsmc
|
||||||
|
|
||||||
molecularDynamics/Allwmake
|
molecularDynamics/Allwmake
|
||||||
|
|
||||||
|
|||||||
@ -85,6 +85,8 @@ void Foam::DsmcCloud<ParcelType>::initialise
|
|||||||
const IOdictionary& dsmcInitialiseDict
|
const IOdictionary& dsmcInitialiseDict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
Info<< nl << "Initialising particles" << endl;
|
||||||
|
|
||||||
const scalar temperature
|
const scalar temperature
|
||||||
(
|
(
|
||||||
readScalar(dsmcInitialiseDict.lookup("temperature"))
|
readScalar(dsmcInitialiseDict.lookup("temperature"))
|
||||||
@ -619,6 +621,9 @@ void Foam::DsmcCloud<ParcelType>::evolve()
|
|||||||
{
|
{
|
||||||
typename ParcelType::trackData td(*this);
|
typename ParcelType::trackData td(*this);
|
||||||
|
|
||||||
|
// Reset the surface data collection fields
|
||||||
|
resetSurfaceDataFields();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
this->dumpParticlePositions();
|
this->dumpParticlePositions();
|
||||||
@ -627,9 +632,6 @@ void Foam::DsmcCloud<ParcelType>::evolve()
|
|||||||
// Insert new particles from the inflow boundary
|
// Insert new particles from the inflow boundary
|
||||||
this->inflowBoundary().inflow();
|
this->inflowBoundary().inflow();
|
||||||
|
|
||||||
// Reset the surface data collection fields
|
|
||||||
resetSurfaceDataFields();
|
|
||||||
|
|
||||||
// Move the particles ballistically with their current velocities
|
// Move the particles ballistically with their current velocities
|
||||||
Cloud<ParcelType>::move(td);
|
Cloud<ParcelType>::move(td);
|
||||||
|
|
||||||
|
|||||||
@ -358,6 +358,10 @@ Foam::DsmcCloud<ParcelType>::rhoN() const
|
|||||||
|
|
||||||
rhoN *= nParticle_/mesh().cellVolumes();
|
rhoN *= nParticle_/mesh().cellVolumes();
|
||||||
|
|
||||||
|
trhoN().boundaryField() = trhoN().boundaryField().boundaryInternalField();
|
||||||
|
|
||||||
|
trhoN().correctBoundaryConditions();
|
||||||
|
|
||||||
return trhoN;
|
return trhoN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,6 +399,10 @@ Foam::DsmcCloud<ParcelType>::rhoM() const
|
|||||||
|
|
||||||
rhoM *= nParticle_/mesh().cellVolumes();
|
rhoM *= nParticle_/mesh().cellVolumes();
|
||||||
|
|
||||||
|
trhoM().boundaryField() = trhoM().boundaryField().boundaryInternalField();
|
||||||
|
|
||||||
|
trhoM().correctBoundaryConditions();
|
||||||
|
|
||||||
return trhoM;
|
return trhoM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,6 +438,11 @@ Foam::DsmcCloud<ParcelType>::dsmcRhoN() const
|
|||||||
dsmcRhoN[cellI]++;
|
dsmcRhoN[cellI]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tdsmcRhoN().boundaryField() =
|
||||||
|
tdsmcRhoN().boundaryField().boundaryInternalField();
|
||||||
|
|
||||||
|
tdsmcRhoN().correctBoundaryConditions();
|
||||||
|
|
||||||
return tdsmcRhoN;
|
return tdsmcRhoN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,6 +485,11 @@ Foam::DsmcCloud<ParcelType>::momentum() const
|
|||||||
|
|
||||||
momentum *= nParticle_/mesh().cellVolumes();
|
momentum *= nParticle_/mesh().cellVolumes();
|
||||||
|
|
||||||
|
tmomentum().boundaryField() =
|
||||||
|
tmomentum().boundaryField().boundaryInternalField();
|
||||||
|
|
||||||
|
tmomentum().correctBoundaryConditions();
|
||||||
|
|
||||||
return tmomentum;
|
return tmomentum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,6 +527,11 @@ Foam::DsmcCloud<ParcelType>::linearKE() const
|
|||||||
|
|
||||||
linearKE *= nParticle_/mesh().cellVolumes();
|
linearKE *= nParticle_/mesh().cellVolumes();
|
||||||
|
|
||||||
|
tlinearKE().boundaryField() =
|
||||||
|
tlinearKE().boundaryField().boundaryInternalField();
|
||||||
|
|
||||||
|
tlinearKE().correctBoundaryConditions();
|
||||||
|
|
||||||
return tlinearKE;
|
return tlinearKE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -546,6 +569,11 @@ Foam::DsmcCloud<ParcelType>::internalE() const
|
|||||||
|
|
||||||
internalE *= nParticle_/mesh().cellVolumes();
|
internalE *= nParticle_/mesh().cellVolumes();
|
||||||
|
|
||||||
|
tinternalE().boundaryField() =
|
||||||
|
tinternalE().boundaryField().boundaryInternalField();
|
||||||
|
|
||||||
|
tinternalE().correctBoundaryConditions();
|
||||||
|
|
||||||
return tinternalE;
|
return tinternalE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,6 +612,11 @@ Foam::DsmcCloud<ParcelType>::iDof() const
|
|||||||
|
|
||||||
iDof *= nParticle_/mesh().cellVolumes();
|
iDof *= nParticle_/mesh().cellVolumes();
|
||||||
|
|
||||||
|
tiDof().boundaryField() =
|
||||||
|
tiDof().boundaryField().boundaryInternalField();
|
||||||
|
|
||||||
|
tiDof().correctBoundaryConditions();
|
||||||
|
|
||||||
return tiDof;
|
return tiDof;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
dynamicPressure/dynamicPressure.C
|
dynamicPressure/dynamicPressure.C
|
||||||
dynamicPressure/dynamicPressureFunctionObject.C
|
dynamicPressure/dynamicPressureFunctionObject.C
|
||||||
|
|
||||||
|
dsmcFields/dsmcFields.C
|
||||||
|
dsmcFields/dsmcFieldsFunctionObject.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects
|
LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/lagrangian/dsmc/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude
|
-I$(LIB_SRC)/sampling/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-lsampling
|
-lsampling \
|
||||||
|
-llagrangian \
|
||||||
|
-ldsmc
|
||||||
|
|||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::IOdsmcFields
|
||||||
|
|
||||||
|
Description
|
||||||
|
Instance of the generic IOOutputFilter for dsmcFields.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef IOdsmcFields_H
|
||||||
|
#define IOdsmcFields_H
|
||||||
|
|
||||||
|
#include "dsmcFields.H"
|
||||||
|
#include "IOOutputFilter.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef IOOutputFilter<dsmcFields> IOdsmcFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,236 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "dsmcFields.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
#include "dsmcCloud.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(dsmcFields, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::dsmcFields::dsmcFields
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const dictionary& dict,
|
||||||
|
const bool loadFromFiles
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
obr_(obr),
|
||||||
|
active_(true)
|
||||||
|
{
|
||||||
|
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||||
|
if (!isA<fvMesh>(obr_))
|
||||||
|
{
|
||||||
|
active_ = false;
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"dsmcFields::dsmcFields"
|
||||||
|
"(const objectRegistry&, const dictionary&)"
|
||||||
|
) << "No fvMesh available, deactivating." << nl
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::dsmcFields::~dsmcFields()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::dsmcFields::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::dsmcFields::execute()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::dsmcFields::end()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::dsmcFields::write()
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
word rhoNMeanName = "rhoNMean";
|
||||||
|
word rhoMMeanName = "rhoMMean";
|
||||||
|
word momentumMeanName = "momentumMean";
|
||||||
|
word linearKEMeanName = "linearKEMean";
|
||||||
|
word internalEMeanName = "internalEMean";
|
||||||
|
word iDofMeanName = "iDofMean";
|
||||||
|
|
||||||
|
const volScalarField& rhoNMean = obr_.lookupObject<volScalarField>
|
||||||
|
(
|
||||||
|
rhoNMeanName
|
||||||
|
);
|
||||||
|
|
||||||
|
const volScalarField& rhoMMean = obr_.lookupObject<volScalarField>
|
||||||
|
(
|
||||||
|
rhoMMeanName
|
||||||
|
);
|
||||||
|
|
||||||
|
const volVectorField& momentumMean = obr_.lookupObject<volVectorField>
|
||||||
|
(
|
||||||
|
momentumMeanName
|
||||||
|
);
|
||||||
|
|
||||||
|
const volScalarField& linearKEMean = obr_.lookupObject<volScalarField>
|
||||||
|
(
|
||||||
|
linearKEMeanName
|
||||||
|
);
|
||||||
|
|
||||||
|
const volScalarField& internalEMean = obr_.lookupObject<volScalarField>
|
||||||
|
(
|
||||||
|
internalEMeanName
|
||||||
|
);
|
||||||
|
|
||||||
|
const volScalarField& iDofMean = obr_.lookupObject<volScalarField>
|
||||||
|
(
|
||||||
|
iDofMeanName
|
||||||
|
);
|
||||||
|
|
||||||
|
if (min(rhoNMean).value() > VSMALL)
|
||||||
|
{
|
||||||
|
Info<< "Calculating dsmcFields." << endl;
|
||||||
|
|
||||||
|
Info<< " Calculating UMean field." << endl;
|
||||||
|
volVectorField UMean
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"UMean",
|
||||||
|
obr_.time().timeName(),
|
||||||
|
obr_,
|
||||||
|
IOobject::NO_READ
|
||||||
|
),
|
||||||
|
momentumMean/rhoMMean
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " Calculating translationalT field." << endl;
|
||||||
|
volScalarField translationalT
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"translationalT",
|
||||||
|
obr_.time().timeName(),
|
||||||
|
obr_,
|
||||||
|
IOobject::NO_READ
|
||||||
|
),
|
||||||
|
2.0/(3.0*dsmcCloud::kb*rhoNMean)
|
||||||
|
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean))
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " Calculating internalT field." << endl;
|
||||||
|
volScalarField internalT
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"internalT",
|
||||||
|
obr_.time().timeName(),
|
||||||
|
obr_,
|
||||||
|
IOobject::NO_READ
|
||||||
|
),
|
||||||
|
2.0/(dsmcCloud::kb*iDofMean)*internalEMean
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " Calculating overallT field." << endl;
|
||||||
|
volScalarField overallT
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"overallT",
|
||||||
|
obr_.time().timeName(),
|
||||||
|
obr_,
|
||||||
|
IOobject::NO_READ
|
||||||
|
),
|
||||||
|
2.0/(dsmcCloud::kb*(3.0*rhoNMean + iDofMean))
|
||||||
|
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean) + internalEMean)
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " mag(UMean) max/min : "
|
||||||
|
<< max(mag(UMean)).value() << " "
|
||||||
|
<< min(mag(UMean)).value() << endl;
|
||||||
|
|
||||||
|
Info<< " translationalT max/min : "
|
||||||
|
<< max(translationalT).value() << " "
|
||||||
|
<< min(translationalT).value() << endl;
|
||||||
|
|
||||||
|
Info<< " internalT max/min : "
|
||||||
|
<< max(internalT).value() << " "
|
||||||
|
<< min(internalT).value() << endl;
|
||||||
|
|
||||||
|
Info<< " overallT max/min : "
|
||||||
|
<< max(overallT).value() << " "
|
||||||
|
<< min(overallT).value() << endl;
|
||||||
|
|
||||||
|
UMean.write();
|
||||||
|
|
||||||
|
translationalT.write();
|
||||||
|
|
||||||
|
internalT.write();
|
||||||
|
|
||||||
|
overallT.write();
|
||||||
|
|
||||||
|
Info<< "dsmcFields written." << nl << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Small or negative value (" << min(rhoNMean)
|
||||||
|
<< ") found in rhoNMean field. "
|
||||||
|
<< "Not calculating dsmcFields to avoid division by zero "
|
||||||
|
<< "or invalid results."
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,144 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::dsmcFields
|
||||||
|
|
||||||
|
Description
|
||||||
|
Calculate intensive fields:
|
||||||
|
- UMean
|
||||||
|
- translationalT
|
||||||
|
- internalT
|
||||||
|
- overallT
|
||||||
|
from averaged extensive fields from a DSMC calculation.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
dsmcFields.C
|
||||||
|
IOdsmcFields.H
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef dsmcFields_H
|
||||||
|
#define dsmcFields_H
|
||||||
|
|
||||||
|
#include "pointFieldFwd.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
class objectRegistry;
|
||||||
|
class dictionary;
|
||||||
|
class mapPolyMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class dsmcFields Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class dsmcFields
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of this set of dsmcFields objects
|
||||||
|
word name_;
|
||||||
|
|
||||||
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
|
//- on/off switch
|
||||||
|
bool active_;
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
dsmcFields(const dsmcFields&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const dsmcFields&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("dsmcFields");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct for given objectRegistry and dictionary.
|
||||||
|
// Allow the possibility to load fields from files
|
||||||
|
dsmcFields
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry&,
|
||||||
|
const dictionary&,
|
||||||
|
const bool loadFromFiles = false
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~dsmcFields();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return name of the set of dsmcFields
|
||||||
|
virtual const word& name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Read the dsmcFields data
|
||||||
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
|
//- Execute, currently does nothing
|
||||||
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
|
//- Calculate the dsmcFields and write
|
||||||
|
virtual void write();
|
||||||
|
|
||||||
|
//- Update for changes of mesh
|
||||||
|
virtual void updateMesh(const mapPolyMesh&)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Update for changes of mesh
|
||||||
|
virtual void movePoints(const pointField&)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "dsmcFieldsFunctionObject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineNamedTemplateTypeNameAndDebug(dsmcFieldsFunctionObject, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
dsmcFieldsFunctionObject,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::dsmcFieldsFunctionObject
|
||||||
|
|
||||||
|
Description
|
||||||
|
FunctionObject wrapper around dsmcFields to allow it to be created via
|
||||||
|
the functions list within controlDict.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
dsmcFieldsFunctionObject.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef dsmcFieldsFunctionObject_H
|
||||||
|
#define dsmcFieldsFunctionObject_H
|
||||||
|
|
||||||
|
#include "dsmcFields.H"
|
||||||
|
#include "OutputFilterFunctionObject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef OutputFilterFunctionObject<dsmcFields>
|
||||||
|
dsmcFieldsFunctionObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user