mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -157,7 +157,7 @@ void Foam::ReactingParcel<ParcelType>::writeFields
|
||||
{
|
||||
ThermoParcel<ParcelType>::writeFields(c);
|
||||
|
||||
const label np = c.size();
|
||||
const label np = c.size();
|
||||
|
||||
if (np > 0)
|
||||
{
|
||||
|
||||
@ -58,7 +58,7 @@ Foam::scalar Foam::LiquidEvaporation<CloudType>::Sh
|
||||
const scalar Sc
|
||||
) const
|
||||
{
|
||||
return 2.0 + 0.6*Foam::sqrt(Re)*pow(Sc, 0.333);
|
||||
return 2.0 + 0.6*Foam::sqrt(Re)*cbrt(Sc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -115,42 +115,42 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
// Access
|
||||
|
||||
//- Return the cloud dictionary
|
||||
const dictionary& dict() const;
|
||||
//- Return the cloud dictionary
|
||||
const dictionary& dict() const;
|
||||
|
||||
//- Return the coefficients dictionary
|
||||
const dictionary& coeffDict() const;
|
||||
//- Return the coefficients dictionary
|
||||
const dictionary& coeffDict() const;
|
||||
|
||||
//- Return the owner cloud object
|
||||
const CloudType& owner() const;
|
||||
//- Return the owner cloud object
|
||||
const CloudType& owner() const;
|
||||
|
||||
//- Return the Bird htc correction flag
|
||||
const Switch& BirdCorrection() const;
|
||||
//- Return the Bird htc correction flag
|
||||
const Switch& BirdCorrection() const;
|
||||
|
||||
//- Flag to indicate whether model activates heat transfer model
|
||||
virtual bool active() const = 0;
|
||||
//- Flag to indicate whether model activates heat transfer model
|
||||
virtual bool active() const = 0;
|
||||
|
||||
|
||||
// Evaluation
|
||||
// Evaluation
|
||||
|
||||
//- Nusselt number
|
||||
virtual scalar Nu
|
||||
(
|
||||
const scalar Re,
|
||||
const scalar Pr
|
||||
) const = 0;
|
||||
//- Nusselt number
|
||||
virtual scalar Nu
|
||||
(
|
||||
const scalar Re,
|
||||
const scalar Pr
|
||||
) const = 0;
|
||||
|
||||
//- Return heat transfer coefficient
|
||||
virtual scalar htc
|
||||
(
|
||||
const scalar dp,
|
||||
const scalar Re,
|
||||
const scalar Pr,
|
||||
const scalar kappa,
|
||||
const scalar NCpW
|
||||
) const;
|
||||
//- Return heat transfer coefficient
|
||||
virtual scalar htc
|
||||
(
|
||||
const scalar dp,
|
||||
const scalar Re,
|
||||
const scalar Pr,
|
||||
const scalar kappa,
|
||||
const scalar NCpW
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ Description
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class NoHeatTransfer Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -39,6 +39,7 @@ Description
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class RanzMarshall Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -76,9 +77,6 @@ public:
|
||||
//- Flag to indicate whether model activates heat transfer model
|
||||
virtual bool active() const;
|
||||
|
||||
//- Return the Bird correction flag
|
||||
const Switch& BirdCorrection() const;
|
||||
|
||||
|
||||
// Evaluation
|
||||
|
||||
|
||||
@ -7,6 +7,5 @@ wmake libso forces
|
||||
wmake libso IO
|
||||
wmake libso utilities
|
||||
wmake libso systemCall
|
||||
wmake libso zones
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
faceZoneIntegration/faceZonesIntegration.C
|
||||
faceZoneIntegration/faceZonesIntegrationFunctionObject.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libzoneFunctionObjects
|
||||
@ -1,9 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lsampling
|
||||
@ -1,50 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-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::IOfaceZonesIntegration
|
||||
|
||||
Description
|
||||
Instance of the generic IOOutputFilter for faceZonesIntegration.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IOfaceZonesIntegration_H
|
||||
#define IOfaceZonesIntegration_H
|
||||
|
||||
#include "faceZonesIntegration.H"
|
||||
#include "IOOutputFilter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef IOOutputFilter<faceZonesIntegration> IOfaceZonesIntegration;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,330 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-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 "faceZonesIntegration.H"
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "Time.H"
|
||||
#include "IOmanip.H"
|
||||
#include "ListListOps.H"
|
||||
#include "processorPolyPatch.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(faceZonesIntegration, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faceZonesIntegration::faceZonesIntegration
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
log_(false),
|
||||
zoneNames_(),
|
||||
fieldNames_(),
|
||||
filePtr_(NULL)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"Foam::faceZonesIntegration::faceZonesIntegration"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::faceZonesIntegration::~faceZonesIntegration()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::faceZonesIntegration::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
log_ = dict.lookupOrDefault<Switch>("log", false);
|
||||
|
||||
dict.lookup("fields") >> fieldNames_;
|
||||
|
||||
dict.lookup("faceZones") >> zoneNames_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZonesIntegration::makeFile()
|
||||
{
|
||||
// Create the face Zone file if not already created
|
||||
if (filePtr_.empty())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Creating faceZonesIntegration file." << endl;
|
||||
}
|
||||
|
||||
// File update
|
||||
if (Pstream::master())
|
||||
{
|
||||
fileName faceZonesIntegrationDir;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
faceZonesIntegrationDir =
|
||||
obr_.time().path()/".."/name_/obr_.time().timeName();
|
||||
}
|
||||
else
|
||||
{
|
||||
faceZonesIntegrationDir =
|
||||
obr_.time().path()/name_/obr_.time().timeName();
|
||||
}
|
||||
|
||||
// Create directory if does not exist.
|
||||
mkDir(faceZonesIntegrationDir);
|
||||
|
||||
// Open new file at start up
|
||||
filePtr_.resize(fieldNames_.size());
|
||||
|
||||
forAll(fieldNames_, fieldI)
|
||||
{
|
||||
const word& fieldName = fieldNames_[fieldI];
|
||||
|
||||
OFstream* sPtr = new OFstream
|
||||
(
|
||||
faceZonesIntegrationDir/fieldName
|
||||
);
|
||||
|
||||
filePtr_.insert(fieldName, sPtr);
|
||||
}
|
||||
|
||||
// Add headers to output data
|
||||
writeFileHeader();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZonesIntegration::writeFileHeader()
|
||||
{
|
||||
forAllIter(HashPtrTable<OFstream>, filePtr_, iter)
|
||||
{
|
||||
unsigned int w = IOstream::defaultPrecision() + 7;
|
||||
|
||||
OFstream& os = *filePtr_[iter.key()];
|
||||
|
||||
os << "#Time " << setw(w);
|
||||
|
||||
forAll (zoneNames_, zoneI)
|
||||
{
|
||||
os << zoneNames_[zoneI] << setw(w);
|
||||
}
|
||||
|
||||
os << nl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZonesIntegration::execute()
|
||||
{
|
||||
// Do nothing - only valid on write
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZonesIntegration::end()
|
||||
{
|
||||
// Do nothing - only valid on write
|
||||
}
|
||||
|
||||
|
||||
void Foam::faceZonesIntegration::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
makeFile();
|
||||
|
||||
forAll(fieldNames_, fieldI)
|
||||
{
|
||||
const word& fieldName = fieldNames_[fieldI];
|
||||
|
||||
const surfaceScalarField& sField =
|
||||
obr_.lookupObject<surfaceScalarField>(fieldName);
|
||||
|
||||
const fvMesh& mesh = sField.mesh();
|
||||
|
||||
// 1. integrate over all face zones
|
||||
|
||||
scalarField integralVals(zoneNames_.size());
|
||||
|
||||
forAll(integralVals, zoneI)
|
||||
{
|
||||
const word& name = zoneNames_[zoneI];
|
||||
|
||||
label zoneID = mesh.faceZones().findZoneID(name);
|
||||
|
||||
const faceZone& fZone = mesh.faceZones()[zoneID];
|
||||
|
||||
integralVals[zoneI] = returnReduce
|
||||
(
|
||||
calcIntegral(sField, fZone),
|
||||
sumOp<scalar>()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unsigned int w = IOstream::defaultPrecision() + 7;
|
||||
|
||||
// 2. Write only on master
|
||||
|
||||
if (Pstream::master() && filePtr_.found(fieldName))
|
||||
{
|
||||
OFstream& os = *filePtr_(fieldName);
|
||||
|
||||
os << obr_.time().value();
|
||||
|
||||
forAll(integralVals, zoneI)
|
||||
{
|
||||
os << ' ' << setw(w) << integralVals[zoneI];
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< "faceZonesIntegration output:" << nl
|
||||
<< " Integration[" << zoneI << "] "
|
||||
<< integralVals[zoneI] << endl;
|
||||
}
|
||||
}
|
||||
|
||||
os << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::faceZonesIntegration::calcIntegral
|
||||
(
|
||||
const surfaceScalarField& sField,
|
||||
const faceZone& fZone
|
||||
) const
|
||||
{
|
||||
scalar sum = 0.0;
|
||||
const fvMesh& mesh = sField.mesh();
|
||||
|
||||
forAll (fZone, i)
|
||||
{
|
||||
label faceI = fZone[i];
|
||||
|
||||
if (mesh.isInternalFace(faceI))
|
||||
{
|
||||
if (fZone.flipMap()[i])
|
||||
{
|
||||
sum -= sField[faceI];
|
||||
}
|
||||
else
|
||||
{
|
||||
sum += sField[faceI];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
label patchI = mesh.boundaryMesh().whichPatch(faceI);
|
||||
const polyPatch& pp = mesh.boundaryMesh()[patchI];
|
||||
const fvsPatchScalarField& bField = sField.boundaryField()[patchI];
|
||||
if (isA<processorPolyPatch>(pp))
|
||||
{
|
||||
if (refCast<const processorPolyPatch>(pp).owner())
|
||||
{
|
||||
label patchFaceI = pp.whichFace(faceI);
|
||||
if (fZone.flipMap()[i])
|
||||
{
|
||||
sum -= bField[patchFaceI];
|
||||
}
|
||||
else
|
||||
{
|
||||
sum += bField[patchFaceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isA<cyclicPolyPatch>(pp))
|
||||
{
|
||||
label patchFaceI = faceI - pp.start();
|
||||
if (patchFaceI < pp.size()/2)
|
||||
{
|
||||
if (fZone.flipMap()[i])
|
||||
{
|
||||
sum -= bField[patchFaceI];
|
||||
}
|
||||
else
|
||||
{
|
||||
sum += bField[patchFaceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!isA<emptyPolyPatch>(pp))
|
||||
{
|
||||
label patchFaceI = faceI - pp.start();
|
||||
if (fZone.flipMap()[i])
|
||||
{
|
||||
sum -= bField[patchFaceI];
|
||||
}
|
||||
else
|
||||
{
|
||||
sum += bField[patchFaceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,180 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-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::faceZonesIntegration
|
||||
|
||||
Description
|
||||
Integrates surfaceScalarFields on faceZones
|
||||
|
||||
SourceFiles
|
||||
faceZonesIntegration.C
|
||||
IOfaceZonesIntegration.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faceZonesIntegration_H
|
||||
#define faceZonesIntegration_H
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "primitiveFieldsFwd.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "HashPtrTable.H"
|
||||
#include "OFstream.H"
|
||||
#include "Switch.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faceZonesIntegration Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faceZonesIntegration
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of this set of face zone integration,
|
||||
// Also used as the name of the output directory.
|
||||
word name_;
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
|
||||
// Read from dictionary
|
||||
|
||||
//- On/off switch
|
||||
bool active_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
//- List of face zone names to integrate over
|
||||
wordList zoneNames_;
|
||||
|
||||
//- Names of the surface fields
|
||||
wordList fieldNames_;
|
||||
|
||||
|
||||
//- Current open files
|
||||
HashPtrTable<OFstream> filePtr_;
|
||||
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- If the integration file has not been created create it
|
||||
void makeFile();
|
||||
|
||||
scalar calcIntegral
|
||||
(
|
||||
const surfaceScalarField& sField,
|
||||
const faceZone& fZone
|
||||
) const;
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
faceZonesIntegration(const faceZonesIntegration&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const faceZonesIntegration&);
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("faceZonesIntegration");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
faceZonesIntegration
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~faceZonesIntegration();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of zones
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
};
|
||||
|
||||
//- Read the zone integration 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();
|
||||
|
||||
//- Write the integration
|
||||
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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,43 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-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 "faceZonesIntegrationFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(faceZonesIntegrationFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
faceZonesIntegrationFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,55 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-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::faceZonesIntegrationFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around faceZonesIntegration to allow them to be
|
||||
created via the functions list within controlDict.
|
||||
|
||||
SourceFiles
|
||||
faceZonesIntegrationFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faceZonesIntegrationFunctionObject_H
|
||||
#define faceZonesIntegrationFunctionObject_H
|
||||
|
||||
#include "faceZonesIntegration.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<faceZonesIntegration>
|
||||
faceZonesIntegrationFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -47,14 +47,15 @@ Foam::RosinRammler::RosinRammler(const dictionary& dict, Random& rndGen)
|
||||
d_(pdfDict_.lookup("d")),
|
||||
n_(pdfDict_.lookup("n")),
|
||||
ls_(d_),
|
||||
range_(maxValue_-minValue_)
|
||||
range_(maxValue_ - minValue_)
|
||||
{
|
||||
if (minValue_<0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"RosinRammler::RosinRammler(const dictionary& dict)"
|
||||
) << " minValue = " << minValue_ << ", it must be >0." << abort(FatalError);
|
||||
) << " minValue = " << minValue_ << ", it must be >0." << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (maxValue_<minValue_)
|
||||
@ -62,7 +63,8 @@ Foam::RosinRammler::RosinRammler(const dictionary& dict, Random& rndGen)
|
||||
FatalErrorIn
|
||||
(
|
||||
"RosinRammler::RosinRammler(const dictionary& dict)"
|
||||
) << " maxValue is smaller than minValue." << abort(FatalError);
|
||||
) << " maxValue is smaller than minValue." << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// find max value so that it can be normalized to 1.0
|
||||
@ -103,26 +105,20 @@ Foam::scalar Foam::RosinRammler::sample() const
|
||||
{
|
||||
scalar y = 0;
|
||||
scalar x = 0;
|
||||
label n = d_.size();
|
||||
bool success = false;
|
||||
scalar p = 0.0;
|
||||
|
||||
while (!success)
|
||||
do
|
||||
{
|
||||
x = minValue_ + range_*rndGen_.scalar01();
|
||||
y = rndGen_.scalar01();
|
||||
scalar p = 0.0;
|
||||
p = 0.0;
|
||||
|
||||
for (label i=0; i<n; i++)
|
||||
forAll(d_, i)
|
||||
{
|
||||
scalar xx = pow(x/d_[i], n_[i]);
|
||||
p += ls_[i]*xx*exp(-xx);
|
||||
}
|
||||
|
||||
if (y<p)
|
||||
{
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
} while(y>p);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
@ -46,14 +46,15 @@ Foam::exponential::exponential(const dictionary& dict, Random& rndGen)
|
||||
maxValue_(readScalar(pdfDict_.lookup("maxValue"))),
|
||||
lambda_(pdfDict_.lookup("lambda")),
|
||||
ls_(lambda_),
|
||||
range_(maxValue_-minValue_)
|
||||
range_(maxValue_ - minValue_)
|
||||
{
|
||||
if (minValue_<0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"exponential::exponential(const dictionary& dict)"
|
||||
) << " minValue = " << minValue_ << ", it must be >0." << abort(FatalError);
|
||||
) << " minValue = " << minValue_ << ", it must be >0." << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
scalar sMax = 0;
|
||||
@ -73,7 +74,7 @@ Foam::exponential::exponential(const dictionary& dict, Random& rndGen)
|
||||
sMax = max(sMax, s);
|
||||
}
|
||||
|
||||
for(label i=0; i<n; i++)
|
||||
for (label i=0; i<n; i++)
|
||||
{
|
||||
ls_[i] /= sMax;
|
||||
}
|
||||
@ -90,27 +91,21 @@ Foam::exponential::~exponential()
|
||||
|
||||
Foam::scalar Foam::exponential::sample() const
|
||||
{
|
||||
scalar y = 0;
|
||||
scalar x = 0;
|
||||
label n = lambda_.size();
|
||||
bool success = false;
|
||||
scalar y = 0.0;
|
||||
scalar x = 0.0;
|
||||
scalar p = 0.0;
|
||||
|
||||
while (!success)
|
||||
do
|
||||
{
|
||||
x = minValue_ + range_*rndGen_.scalar01();
|
||||
y = rndGen_.scalar01();
|
||||
scalar p = 0.0;
|
||||
p = 0.0;
|
||||
|
||||
for(label i=0; i<n; i++)
|
||||
forAll(lambda_, i)
|
||||
{
|
||||
p += ls_[i]*exp(-lambda_[i]*x);
|
||||
}
|
||||
|
||||
if (y<p)
|
||||
{
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
} while(p>y);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ Foam::general::general(const dictionary& dict, Random& rndGen)
|
||||
nEntries_(xy_.size()),
|
||||
minValue_(xy_[0][0]),
|
||||
maxValue_(xy_[nEntries_-1][0]),
|
||||
range_(maxValue_-minValue_)
|
||||
range_(maxValue_ - minValue_)
|
||||
{
|
||||
// normalize the pdf
|
||||
scalar yMax = 0;
|
||||
@ -72,12 +72,11 @@ Foam::general::~general()
|
||||
|
||||
Foam::scalar Foam::general::sample() const
|
||||
{
|
||||
scalar y = 0;
|
||||
scalar x = 0;
|
||||
scalar x = 0.0;
|
||||
scalar y = 0.0;
|
||||
scalar p = 0.0;
|
||||
|
||||
bool success = false;
|
||||
|
||||
while (!success)
|
||||
do
|
||||
{
|
||||
x = minValue_ + range_*rndGen_.scalar01();
|
||||
y = rndGen_.scalar01();
|
||||
@ -87,23 +86,17 @@ Foam::scalar Foam::general::sample() const
|
||||
while (!intervalFound)
|
||||
{
|
||||
i++;
|
||||
if ( (x>xy_[i][0]) && (x<xy_[i+1][0]) )
|
||||
if ((x>xy_[i][0]) && (x<xy_[i+1][0]))
|
||||
{
|
||||
intervalFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
scalar p =
|
||||
xy_[i][1]
|
||||
+ (x-xy_[i][0])
|
||||
*(xy_[i+1][1]-xy_[i][1])
|
||||
/(xy_[i+1][0]-xy_[i][0]);
|
||||
|
||||
if (y<p)
|
||||
{
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
p = xy_[i][1]
|
||||
+ (x - xy_[i][0])
|
||||
*(xy_[i+1][1] - xy_[i][1])
|
||||
/(xy_[i+1][0] - xy_[i][0]);
|
||||
} while(p>y);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ Foam::normal::normal(const dictionary& dict, Random& rndGen)
|
||||
expectation_(pdfDict_.lookup("expectation")),
|
||||
variance_(pdfDict_.lookup("variance")),
|
||||
strength_(pdfDict_.lookup("strength")),
|
||||
range_(maxValue_-minValue_)
|
||||
range_(maxValue_ - minValue_)
|
||||
{
|
||||
scalar sMax = 0;
|
||||
label n = strength_.size();
|
||||
@ -84,31 +84,26 @@ Foam::normal::~normal()
|
||||
|
||||
Foam::scalar Foam::normal::sample() const
|
||||
{
|
||||
scalar y = 0;
|
||||
scalar x = 0;
|
||||
label n = expectation_.size();
|
||||
scalar x = 0.0;
|
||||
scalar y = 0.0;
|
||||
scalar p = 0.0;
|
||||
bool success = false;
|
||||
|
||||
while (!success)
|
||||
do
|
||||
{
|
||||
x = minValue_ + range_*rndGen_.scalar01();
|
||||
y = rndGen_.scalar01();
|
||||
scalar p = 0.0;
|
||||
p = 0.0;
|
||||
|
||||
for (label i=0; i<n; i++)
|
||||
forAll(expectation_, i)
|
||||
{
|
||||
scalar nu = expectation_[i];
|
||||
scalar sigma = variance_[i];
|
||||
scalar s = strength_[i];
|
||||
scalar v = (x-nu)/sigma;
|
||||
scalar v = (x - nu)/sigma;
|
||||
p += s*exp(-0.5*v*v);
|
||||
}
|
||||
|
||||
if (y<p)
|
||||
{
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
} while (p>y);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ Foam::uniform::uniform(const dictionary& dict, Random& rndGen)
|
||||
pdfDict_(dict.subDict(typeName + "PDF")),
|
||||
minValue_(readScalar(pdfDict_.lookup("minValue"))),
|
||||
maxValue_(readScalar(pdfDict_.lookup("maxValue"))),
|
||||
range_(maxValue_-minValue_)
|
||||
range_(maxValue_ - minValue_)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user