mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
staticPressure/staticPressure.C
|
||||
staticPressure/staticPressureFunctionObject.C
|
||||
|
||||
dsmcFields/dsmcFields.C
|
||||
dsmcFields/dsmcFieldsFunctionObject.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
EXE_INC = \
|
||||
-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)/sampling/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-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