Moved src/functionObjects/lagrangian -> src/lagrangian/functionObjects
to localise Lagrangian functionality
This commit is contained in:
@ -7,7 +7,6 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
wmake $targetType field
|
||||
wmake $targetType forces
|
||||
wmake $targetType utilities
|
||||
wmake $targetType lagrangian
|
||||
wmake $targetType solvers
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
cloudInfo/cloudInfo.C
|
||||
dsmcFields/dsmcFields.C
|
||||
particles/particles.C
|
||||
stopAtEmptyClouds/stopAtEmptyClouds.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/liblagrangianFunctionObjects
|
||||
@ -1,19 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/physicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/parcel/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/DSMC/lnInclude \
|
||||
-I$(LIB_SRC)/surfaceFilmModels/lnInclude \
|
||||
-I$(LIB_SRC)/functionObjects/utilities/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lphysicalProperties \
|
||||
-lmeshTools \
|
||||
-llagrangian \
|
||||
-llagrangianParcel \
|
||||
-llagrangianParcelTurbulence \
|
||||
-lsurfaceFilmModels \
|
||||
-lutilityFunctionObjects
|
||||
@ -1,145 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cloudInfo.H"
|
||||
#include "parcelCloud.H"
|
||||
#include "dictionary.H"
|
||||
#include "PstreamReduceOps.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(cloudInfo, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
cloudInfo,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::cloudInfo::writeFileHeader(const label i)
|
||||
{
|
||||
writeHeader(file(), "Cloud information");
|
||||
writeCommented(file(), "Time");
|
||||
writeTabbed(file(), "nParcels");
|
||||
writeTabbed(file(), "mass");
|
||||
file() << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::cloudInfo::cloudInfo
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
regionFunctionObject(name, runTime, dict),
|
||||
logFiles(obr_, name)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::cloudInfo::~cloudInfo()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::cloudInfo::read(const dictionary& dict)
|
||||
{
|
||||
regionFunctionObject::read(dict);
|
||||
|
||||
Info<< type() << " " << name() << ": ";
|
||||
if (names().size())
|
||||
{
|
||||
Info<< "applying to clouds:" << nl;
|
||||
forAll(names(), i)
|
||||
{
|
||||
Info<< " " << names()[i] << nl;
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "no clouds to be processed" << nl << endl;
|
||||
}
|
||||
|
||||
resetNames(dict.lookup("clouds"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::cloudInfo::execute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::cloudInfo::write()
|
||||
{
|
||||
logFiles::write();
|
||||
|
||||
forAll(names(), i)
|
||||
{
|
||||
const word& cloudName = names()[i];
|
||||
|
||||
const parcelCloud& cloud = obr_.lookupObject<parcelCloud>(cloudName);
|
||||
|
||||
label nParcels = returnReduce(cloud.nParcels(), sumOp<label>());
|
||||
scalar massInSystem =
|
||||
returnReduce(cloud.massInSystem(), sumOp<scalar>());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
writeTime(file(i));
|
||||
file(i)
|
||||
<< tab
|
||||
<< nParcels << tab
|
||||
<< massInSystem << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,157 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjects::cloudInfo
|
||||
|
||||
Description
|
||||
Outputs Lagrangian cloud information to a file.
|
||||
|
||||
The current outputs include:
|
||||
- total current number of parcels
|
||||
- total current mass of parcels
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
cloudInfo1
|
||||
{
|
||||
type cloudInfo;
|
||||
libs ("liblagrangianFunctionObjects.so");
|
||||
...
|
||||
clouds
|
||||
(
|
||||
cloud1
|
||||
thermoCloud1
|
||||
);
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type name: cloudInfo | yes |
|
||||
clouds | list of clouds names to process |yes |
|
||||
\endtable
|
||||
|
||||
The output data of each cloud is written to a file named \<cloudName\>.dat
|
||||
|
||||
See also
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::regionFunctionObject
|
||||
Foam::functionObjects::logFiles
|
||||
|
||||
SourceFiles
|
||||
cloudInfo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjects_cloudInfo_H
|
||||
#define functionObjects_cloudInfo_H
|
||||
|
||||
#include "regionFunctionObject.H"
|
||||
#include "logFiles.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cloudInfo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cloudInfo
|
||||
:
|
||||
public regionFunctionObject,
|
||||
public logFiles
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- File header information
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cloudInfo");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from Time and dictionary
|
||||
cloudInfo
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
cloudInfo(const cloudInfo&) = delete;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cloudInfo();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the controls
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Return the list of fields required
|
||||
virtual wordList fields() const
|
||||
{
|
||||
return wordList::null();
|
||||
}
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual bool execute();
|
||||
|
||||
//- Write
|
||||
virtual bool write();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const cloudInfo&) = delete;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,30 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object postProcessingDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
functions
|
||||
{
|
||||
cloudInfo1
|
||||
{
|
||||
type cloudInfo;
|
||||
libs ("liblagrangianFunctionObjects.so");
|
||||
enabled true;
|
||||
writeControl timeStep;
|
||||
writeInterval 1;
|
||||
|
||||
clouds (myCloud1);
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,280 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "dsmcFields.H"
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "dsmcCloud.H"
|
||||
#include "constants.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(dsmcFields, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
dsmcFields,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::dsmcFields::dsmcFields
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::dsmcFields::~dsmcFields()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::dsmcFields::read(const dictionary& dict)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::functionObjects::dsmcFields::fields() const
|
||||
{
|
||||
return wordList
|
||||
{
|
||||
"rhoNMean",
|
||||
"rhoMMean",
|
||||
"momentumMean",
|
||||
"linearKEMean",
|
||||
"internalEMean",
|
||||
"iDofMean",
|
||||
"fDMean"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::dsmcFields::execute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::dsmcFields::write()
|
||||
{
|
||||
word rhoNMeanName = "rhoNMean";
|
||||
word rhoMMeanName = "rhoMMean";
|
||||
word momentumMeanName = "momentumMean";
|
||||
word linearKEMeanName = "linearKEMean";
|
||||
word internalEMeanName = "internalEMean";
|
||||
word iDofMeanName = "iDofMean";
|
||||
word fDMeanName = "fDMean";
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
const volVectorField& fDMean = obr_.lookupObject<volVectorField>
|
||||
(
|
||||
fDMeanName
|
||||
);
|
||||
|
||||
if (min(mag(rhoNMean)).value() > vSmall)
|
||||
{
|
||||
Info<< "Calculating dsmcFields." << endl;
|
||||
|
||||
Info<< " Calculating UMean field." << endl;
|
||||
volVectorField UMean
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"UMean",
|
||||
obr_.time().name(),
|
||||
obr_,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
momentumMean/rhoMMean
|
||||
);
|
||||
|
||||
Info<< " Calculating translationalT field." << endl;
|
||||
volScalarField translationalT
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"translationalT",
|
||||
obr_.time().name(),
|
||||
obr_,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
|
||||
2.0/(3.0*physicoChemical::k.value()*rhoNMean)
|
||||
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean))
|
||||
);
|
||||
|
||||
Info<< " Calculating internalT field." << endl;
|
||||
volScalarField internalT
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"internalT",
|
||||
obr_.time().name(),
|
||||
obr_,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
(2.0/physicoChemical::k.value())*(internalEMean/iDofMean)
|
||||
);
|
||||
|
||||
Info<< " Calculating overallT field." << endl;
|
||||
volScalarField overallT
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"overallT",
|
||||
obr_.time().name(),
|
||||
obr_,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
2.0/(physicoChemical::k.value()*(3.0*rhoNMean + iDofMean))
|
||||
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean) + internalEMean)
|
||||
);
|
||||
|
||||
Info<< " Calculating pressure field." << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
obr_.time().name(),
|
||||
obr_,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
physicoChemical::k.value()*rhoNMean*translationalT
|
||||
);
|
||||
|
||||
volScalarField::Boundary& pBf = p.boundaryFieldRef();
|
||||
|
||||
forAll(mesh_.boundaryMesh(), i)
|
||||
{
|
||||
const polyPatch& patch = mesh_.boundaryMesh()[i];
|
||||
|
||||
if (isA<wallPolyPatch>(patch))
|
||||
{
|
||||
pBf[i] =
|
||||
fDMean.boundaryField()[i]
|
||||
& (patch.faceAreas()/patch.magFaceAreas());
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
Info<< " p max/min : "
|
||||
<< max(p).value() << " "
|
||||
<< min(p).value() << endl;
|
||||
|
||||
UMean.write();
|
||||
|
||||
translationalT.write();
|
||||
|
||||
internalT.write();
|
||||
|
||||
overallT.write();
|
||||
|
||||
p.write();
|
||||
|
||||
Info<< "dsmcFields written." << nl << endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Small value (" << min(mag(rhoNMean))
|
||||
<< ") found in rhoNMean field. "
|
||||
<< "Not calculating dsmcFields to avoid division by zero."
|
||||
<< endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,124 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjects::dsmcFields
|
||||
|
||||
Description
|
||||
Calculate intensive fields:
|
||||
- UMean
|
||||
- translationalT
|
||||
- internalT
|
||||
- overallT
|
||||
from averaged extensive fields from a DSMC calculation.
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
|
||||
SourceFiles
|
||||
dsmcFields.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjects_dsmcFields_H
|
||||
#define functionObjects_dsmcFields_H
|
||||
|
||||
#include "fvMeshFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class dsmcFields Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class dsmcFields
|
||||
:
|
||||
public fvMeshFunctionObject
|
||||
{
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("dsmcFields");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from Time and dictionary
|
||||
dsmcFields
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
dsmcFields(const dsmcFields&) = delete;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~dsmcFields();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the dsmcFields data
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Return the list of fields required
|
||||
virtual wordList fields() const;
|
||||
|
||||
//- Do not evaluate the state at the start of the run
|
||||
virtual bool executeAtStart() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//- Do nothing
|
||||
virtual bool execute();
|
||||
|
||||
//- Calculate and write the DSMC fields
|
||||
virtual bool write();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const dsmcFields&) = delete;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,148 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "particles.H"
|
||||
#include "viscosityModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(particles, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
particles,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::particles::particles
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
g_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"g",
|
||||
time_.constant(),
|
||||
mesh_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
dimensionedVector(dimAcceleration, Zero)
|
||||
),
|
||||
viscosity_
|
||||
(
|
||||
mesh_.lookupObject<viscosityModel>(physicalProperties::typeName)
|
||||
),
|
||||
rhoValue_
|
||||
(
|
||||
"rho",
|
||||
dimDensity,
|
||||
viscosity_
|
||||
),
|
||||
rho_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
time_.name(),
|
||||
mesh_
|
||||
),
|
||||
mesh_,
|
||||
rhoValue_
|
||||
),
|
||||
mu_("mu", rhoValue_*viscosity_.nu()),
|
||||
U_
|
||||
(
|
||||
mesh_.lookupObject<volVectorField>(dict.lookupOrDefault<word>("U", "U"))
|
||||
),
|
||||
cloudName_
|
||||
(
|
||||
dict.lookupOrDefault<word>("cloud", "cloud")
|
||||
),
|
||||
cloudPtr_
|
||||
(
|
||||
parcelCloud::New
|
||||
(
|
||||
cloudName_,
|
||||
rho_,
|
||||
U_,
|
||||
mu_,
|
||||
g_
|
||||
)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::particles::~particles()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::particles::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
fvMeshFunctionObject::read(dict);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::particles::execute()
|
||||
{
|
||||
mu_ = rhoValue_*viscosity_.nu();
|
||||
|
||||
cloudPtr_->evolve();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::particles::write()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,179 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjects::particles
|
||||
|
||||
Description
|
||||
This functionObject tracks a particle cloud in the specified velocity field
|
||||
of an incompressible flow (laminar, RANS or LES).
|
||||
|
||||
It may be used in conjunction with any transient single-phase incompressible
|
||||
flow solvers or solver modules such as incompressibleFluid and tracks the
|
||||
particles or parcels without affecting the flow-field.
|
||||
|
||||
The cloud requires the density of the fluid which is looked-up from
|
||||
constant/phaseProperties dictionary and the acceleration due to gravity
|
||||
which is read from the constant/g file if present or defaults to zero.
|
||||
|
||||
The cloud properties are read from the constant/<cloudName>Properties
|
||||
dictionary in the usual manner.
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
particles
|
||||
{
|
||||
libs ("liblagrangianFunctionObjects.so");
|
||||
type particles;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | Type name: particles | yes |
|
||||
U | Name of the velocity field | no | U
|
||||
cloud | Name of the cloud | no | cloud
|
||||
\endtable
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
|
||||
SourceFiles
|
||||
particles.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjects_particles_H
|
||||
#define functionObjects_particles_H
|
||||
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "parcelCloud.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "uniformDimensionedFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class viscosityModel;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class particles Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class particles
|
||||
:
|
||||
public fvMeshFunctionObject
|
||||
{
|
||||
// Private member data
|
||||
|
||||
//- Optional acceleration due to gravity
|
||||
uniformDimensionedVectorField g_;
|
||||
|
||||
//- Reference to the carrier fluid viscosity model
|
||||
const viscosityModel& viscosity_;
|
||||
|
||||
//- Uniform density value
|
||||
dimensionedScalar rhoValue_;
|
||||
|
||||
//- Density field needed to construct the cloud
|
||||
volScalarField rho_;
|
||||
|
||||
//- Dynamic viscosity field needed to construct the cloud
|
||||
volScalarField mu_;
|
||||
|
||||
//- Reference to the velocity field
|
||||
const volVectorField& U_;
|
||||
|
||||
//- Name of the cloud
|
||||
word cloudName_;
|
||||
|
||||
//- The cloud
|
||||
autoPtr<parcelCloud> cloudPtr_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("particles");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
particles
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
particles(const particles&) = delete;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~particles();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the controls
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Return the list of fields required
|
||||
virtual wordList fields() const
|
||||
{
|
||||
return wordList::null();
|
||||
}
|
||||
|
||||
//- Track the cloud
|
||||
virtual bool execute();
|
||||
|
||||
//- Write the cloud
|
||||
virtual bool write();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator==(const particles&) = delete;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,104 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "stopAtEmptyClouds.H"
|
||||
#include "parcelCloudList.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(stopAtEmptyClouds, 0);
|
||||
addToRunTimeSelectionTable(functionObject, stopAtEmptyClouds, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::stopAtEmptyClouds::condition() const
|
||||
{
|
||||
// Potentially nothing has been injected yet. Wait for a step. If the
|
||||
// clouds begin injection later than this, then time controls will be
|
||||
// needed to delay the execution of this function.
|
||||
if (time_.timeIndex() == time_.startTimeIndex())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Loop all regions and all clouds in each region. If a non-empty cloud is
|
||||
// found then do not stop.
|
||||
bool noClouds = true;
|
||||
|
||||
const HashTable<const polyMesh*> meshes =
|
||||
time_.lookupClass<polyMesh>();
|
||||
|
||||
forAllConstIter(HashTable<const polyMesh*>, meshes, meshIter)
|
||||
{
|
||||
const HashTable<const parcelCloud*> clouds =
|
||||
meshIter()->lookupClass<parcelCloud>();
|
||||
|
||||
forAllConstIter(HashTable<const parcelCloud*>, clouds, cloudIter)
|
||||
{
|
||||
noClouds = false;
|
||||
|
||||
if (returnReduce(cloudIter()->nParcels(), sumOp<label>()) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Either there are no clouds or there are clouds and all of them are
|
||||
// empty. Stop if the latter.
|
||||
return !noClouds;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::stopAtEmptyClouds::stopAtEmptyClouds
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
stopAt(name, runTime, dict)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::stopAtEmptyClouds::~stopAtEmptyClouds()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,120 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjects::stopAtEmptyClouds
|
||||
|
||||
Description
|
||||
Stops the run when all parcel clouds are empty.
|
||||
|
||||
The following actions are supported:
|
||||
- noWriteNow
|
||||
- writeNow
|
||||
- nextWrite (default)
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
stop
|
||||
{
|
||||
type stopAtEmptyClouds;
|
||||
libs ("liblagrangianFunctionObjects.so");
|
||||
|
||||
executeControl timeStep; // <-- Likely only to be needed if injection
|
||||
startTime 0.500001; // starts after time zero. In which case the
|
||||
// startTime should be slightly after the
|
||||
// injection start time.
|
||||
|
||||
action nextWrite;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type name: stopAtEmptyClouds | yes |
|
||||
action | Action executed | no | nextWrite
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
stopAtEmptyClouds.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef stopAtEmptyClouds_H
|
||||
#define stopAtEmptyClouds_H
|
||||
|
||||
#include "stopAt.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class stopAtEmptyClouds Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class stopAtEmptyClouds
|
||||
:
|
||||
public stopAt
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Return true when the stop condition is achieved
|
||||
virtual bool condition() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("stopAtEmptyClouds");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from Time and dictionary
|
||||
stopAtEmptyClouds
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~stopAtEmptyClouds();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user