mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge master, fixing conflicts
This commit is contained in:
@ -7,6 +7,5 @@ wmake libso forces
|
||||
wmake libso IO
|
||||
wmake libso utilities
|
||||
wmake libso systemCall
|
||||
wmake libso zones
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -6,4 +6,16 @@ fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.C
|
||||
fieldMinMax/fieldMinMax.C
|
||||
fieldMinMax/fieldMinMaxFunctionObject.C
|
||||
|
||||
fieldValues/fieldValue/fieldValue.C
|
||||
fieldValues/face/faceSource.C
|
||||
fieldValues/face/faceSourceFunctionObject.C
|
||||
fieldValues/cell/cellSource.C
|
||||
fieldValues/cell/cellSourceFunctionObject.C
|
||||
|
||||
streamLine/streamLine.C
|
||||
streamLine/streamLineParticle.C
|
||||
streamLine/streamLineParticleCloud.C
|
||||
streamLine/streamLineFunctionObject.C
|
||||
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-llagrangian \
|
||||
-lsampling
|
||||
|
||||
@ -23,24 +23,25 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Typedef
|
||||
Foam::IOfaceZonesIntegration
|
||||
Foam::IOcellSource
|
||||
|
||||
|
||||
Description
|
||||
Instance of the generic IOOutputFilter for faceZonesIntegration.
|
||||
Instance of the generic IOOutputFilter for cellSource.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IOfaceZonesIntegration_H
|
||||
#define IOfaceZonesIntegration_H
|
||||
#ifndef IOcellSource_H
|
||||
#define IOcellSource_H
|
||||
|
||||
#include "faceZonesIntegration.H"
|
||||
#include "cellSource.H"
|
||||
#include "IOOutputFilter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef IOOutputFilter<faceZonesIntegration> IOfaceZonesIntegration;
|
||||
typedef IOOutputFilter<cellSource> IOcellSource;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -0,0 +1,257 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "cellSource.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "IOList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fieldValues
|
||||
{
|
||||
defineTypeNameAndDebug(cellSource, 0);
|
||||
}
|
||||
|
||||
template<>
|
||||
const char* NamedEnum<fieldValues::cellSource::sourceType, 1>::
|
||||
names[] = {"cellZone"};
|
||||
|
||||
const NamedEnum<fieldValues::cellSource::sourceType, 1>
|
||||
fieldValues::cellSource::sourceTypeNames_;
|
||||
|
||||
template<>
|
||||
const char* NamedEnum<fieldValues::cellSource::operationType, 4>::
|
||||
names[] = {"none", "sum", "volAverage", "volIntegrate"};
|
||||
|
||||
const NamedEnum<fieldValues::cellSource::operationType, 4>
|
||||
fieldValues::cellSource::operationTypeNames_;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::cellSource::setCellZoneCells()
|
||||
{
|
||||
label zoneId = mesh().cellZones().findZoneID(sourceName_);
|
||||
|
||||
if (zoneId < 0)
|
||||
{
|
||||
FatalErrorIn("cellSource::cellSource::setCellZoneCells()")
|
||||
<< "Unknown cell zone name: " << sourceName_
|
||||
<< ". Valid cell zones are: " << mesh().cellZones().names()
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
|
||||
const cellZone& cZone = mesh().cellZones()[zoneId];
|
||||
|
||||
cellId_.setSize(cZone.size());
|
||||
|
||||
label count = 0;
|
||||
forAll(cZone, i)
|
||||
{
|
||||
label cellI = cZone[i];
|
||||
cellId_[count] = cellI;
|
||||
count++;
|
||||
}
|
||||
|
||||
cellId_.setSize(count);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Original cell zone size = " << cZone.size()
|
||||
<< ", new size = " << count << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::cellSource::initialise()
|
||||
{
|
||||
switch (source_)
|
||||
{
|
||||
case stCellZone:
|
||||
{
|
||||
setCellZoneCells();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn("cellSource::constructCellAddressing()")
|
||||
<< "Unknown source type. Valid source types are:"
|
||||
<< sourceTypeNames_ << nl << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< type() << " " << name_ << ":" << nl
|
||||
<< " total cells = " << cellId_.size() << nl
|
||||
<< " total volume = " << sum(filterField(mesh().V()))
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::cellSource::makeFile()
|
||||
{
|
||||
// Create the forces file if not already created
|
||||
if (outputFilePtr_.empty())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Creating output file." << endl;
|
||||
}
|
||||
|
||||
// File update
|
||||
if (Pstream::master())
|
||||
{
|
||||
fileName outputDir;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
outputDir =
|
||||
obr_.time().path()/".."/name_/obr_.time().timeName();
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDir = obr_.time().path()/name_/obr_.time().timeName();
|
||||
}
|
||||
|
||||
// Create directory if does not exist
|
||||
mkDir(outputDir);
|
||||
|
||||
// Open new file at start up
|
||||
outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat")));
|
||||
|
||||
// Add headers to output data
|
||||
writeFileHeader();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::cellSource::writeFileHeader()
|
||||
{
|
||||
if (outputFilePtr_.valid())
|
||||
{
|
||||
outputFilePtr_()
|
||||
<< "# Source : " << sourceTypeNames_[source_] << " "
|
||||
<< sourceName_ << nl << "# Cells : " << cellId_.size() << nl
|
||||
<< "# Time" << tab << "sum(V)";
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
outputFilePtr_()
|
||||
<< tab << operationTypeNames_[operation_]
|
||||
<< "(" << fields_[i] << ")";
|
||||
}
|
||||
|
||||
outputFilePtr_() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValues::cellSource::cellSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
fieldValue(name, obr, dict, loadFromFiles),
|
||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||
cellId_(),
|
||||
outputFilePtr_(NULL)
|
||||
{
|
||||
initialise();
|
||||
|
||||
if (active_)
|
||||
{
|
||||
// Create the output file if not already created
|
||||
makeFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValues::cellSource::~cellSource()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::cellSource::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
fieldValue::read(dict);
|
||||
initialise();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::cellSource::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
if (log_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
}
|
||||
|
||||
outputFilePtr_()
|
||||
<< obr_.time().value() << tab
|
||||
<< sum(filterField(mesh().V()));
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
writeValues<scalar>(fields_[i]);
|
||||
writeValues<vector>(fields_[i]);
|
||||
writeValues<sphericalTensor>(fields_[i]);
|
||||
writeValues<symmTensor>(fields_[i]);
|
||||
writeValues<tensor>(fields_[i]);
|
||||
}
|
||||
|
||||
outputFilePtr_()<< endl;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,227 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::fieldValues::cellSource
|
||||
|
||||
Description
|
||||
Cell source variant of field value function object. Values of user-
|
||||
specified fields reported for collections of cells.
|
||||
|
||||
cellObj1 // Name also used to identify output folder
|
||||
{
|
||||
type cellSource;
|
||||
functionObjectLibs ("libfieldValueFunctionObjects.so");
|
||||
enabled true;
|
||||
outputControl outputTime;
|
||||
log true; // log to screen?
|
||||
valueOutput true; // Write values at run-time output times?
|
||||
source cellZone; // Type of cell source
|
||||
sourceName c0;
|
||||
operation volAverage; // none, sum, volAverage, volIntegrate
|
||||
fields
|
||||
(
|
||||
p
|
||||
U
|
||||
);
|
||||
}
|
||||
|
||||
SourceFiles
|
||||
cellSource.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef cellSource_H
|
||||
#define cellSource_H
|
||||
|
||||
#include "NamedEnum.H"
|
||||
#include "fieldValue.H"
|
||||
#include "labelList.H"
|
||||
#include "OFstream.H"
|
||||
#include "volFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fieldValues
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cellSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cellSource
|
||||
:
|
||||
public fieldValue
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Public data types
|
||||
|
||||
//- Source type enumeration
|
||||
enum sourceType
|
||||
{
|
||||
stCellZone
|
||||
};
|
||||
|
||||
//- Source type names
|
||||
static const NamedEnum<sourceType, 1> sourceTypeNames_;
|
||||
|
||||
|
||||
//- Operation type enumeration
|
||||
enum operationType
|
||||
{
|
||||
opNone,
|
||||
opSum,
|
||||
opVolAverage,
|
||||
opVolIntegrate
|
||||
};
|
||||
|
||||
//- Operation type names
|
||||
static const NamedEnum<operationType, 4> operationTypeNames_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Set cells to evaluate based on a cell zone
|
||||
void setCellZoneCells();
|
||||
|
||||
//- Set cells to evaluate based on a patch
|
||||
void setPatchCells();
|
||||
|
||||
//- Create the output file if not already created
|
||||
void makeFile();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Source type
|
||||
sourceType source_;
|
||||
|
||||
//- Operation to apply to values
|
||||
operationType operation_;
|
||||
|
||||
//- Local list of cell IDs
|
||||
labelList cellId_;
|
||||
|
||||
//- Output file pointer
|
||||
autoPtr<OFstream> outputFilePtr_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Initialise, e.g. cell addressing
|
||||
void initialise();
|
||||
|
||||
//- Insert field values into values list
|
||||
template<class Type>
|
||||
bool setFieldValues
|
||||
(
|
||||
const word& fieldName,
|
||||
List<Type>& values
|
||||
) const;
|
||||
|
||||
//- Apply the 'operation' to the values
|
||||
template<class Type>
|
||||
Type processValues(const List<Type>& values) const;
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Run-time type information
|
||||
TypeName("cellSource");
|
||||
|
||||
|
||||
//- Construct from components
|
||||
cellSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cellSource();
|
||||
|
||||
|
||||
// Public member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the source type
|
||||
inline const sourceType& source() const;
|
||||
|
||||
//- Return the local list of cell IDs
|
||||
inline const labelList& cellId() const;
|
||||
|
||||
|
||||
// Function object functions
|
||||
|
||||
//- Read from dictionary
|
||||
virtual void read(const dictionary&);
|
||||
|
||||
//- Calculate and write
|
||||
virtual void write();
|
||||
|
||||
//- Templated helper function to output field values
|
||||
template<class Type>
|
||||
bool writeValues(const word& fieldName);
|
||||
|
||||
//- Filter a field according to cellIds
|
||||
template<class Type>
|
||||
tmp<Field<Type> > filterField(const Field<Type>& field) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fieldValues
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "cellSourceI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "cellSourceTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -24,18 +24,22 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faceZonesIntegrationFunctionObject.H"
|
||||
#include "cellSourceFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(faceZonesIntegrationFunctionObject, 0);
|
||||
defineNamedTemplateTypeNameAndDebug
|
||||
(
|
||||
cellSourceFunctionObject,
|
||||
0
|
||||
);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
faceZonesIntegrationFunctionObject,
|
||||
cellSourceFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
@ -23,29 +23,29 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Typedef
|
||||
Foam::faceZonesIntegrationFunctionObject
|
||||
Foam::cellSourceFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around faceZonesIntegration to allow them to be
|
||||
FunctionObject wrapper around cellSource to allow it to be
|
||||
created via the functions list within controlDict.
|
||||
|
||||
SourceFiles
|
||||
faceZonesIntegrationFunctionObject.C
|
||||
cellSourceFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faceZonesIntegrationFunctionObject_H
|
||||
#define faceZonesIntegrationFunctionObject_H
|
||||
#ifndef cellSourceFunctionObject_H
|
||||
#define cellSourceFunctionObject_H
|
||||
|
||||
#include "faceZonesIntegration.H"
|
||||
#include "cellSource.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<faceZonesIntegration>
|
||||
faceZonesIntegrationFunctionObject;
|
||||
typedef OutputFilterFunctionObject<fieldValues::cellSource>
|
||||
cellSourceFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -0,0 +1,46 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "cellSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::fieldValues::cellSource::sourceType&
|
||||
Foam::fieldValues::cellSource::source() const
|
||||
{
|
||||
return source_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::fieldValues::cellSource::cellId() const
|
||||
{
|
||||
return cellId_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,162 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "cellSource.H"
|
||||
#include "volFields.H"
|
||||
#include "IOList.H"
|
||||
#include "ListListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
bool Foam::fieldValues::cellSource::setFieldValues
|
||||
(
|
||||
const word& fieldName,
|
||||
List<Type>& values
|
||||
) const
|
||||
{
|
||||
values.setSize(cellId_.size(), pTraits<Type>::zero);
|
||||
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||
|
||||
if (obr_.foundObject<vf>(fieldName))
|
||||
{
|
||||
const vf& field = obr_.lookupObject<vf>(fieldName);
|
||||
|
||||
values = UIndirectList<Type>(field, cellId_);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::fieldValues::cellSource::processValues
|
||||
(
|
||||
const List<Type>& values
|
||||
) const
|
||||
{
|
||||
Type result = pTraits<Type>::zero;
|
||||
switch (operation_)
|
||||
{
|
||||
case opSum:
|
||||
{
|
||||
result = sum(values);
|
||||
break;
|
||||
}
|
||||
case opVolAverage:
|
||||
{
|
||||
tmp<scalarField> V = filterField(mesh().V());
|
||||
result = sum(values*V())/sum(V());
|
||||
break;
|
||||
}
|
||||
case opVolIntegrate:
|
||||
{
|
||||
result = sum(values*filterField(mesh().V()));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
bool Foam::fieldValues::cellSource::writeValues(const word& fieldName)
|
||||
{
|
||||
List<List<Type> > allValues(Pstream::nProcs());
|
||||
|
||||
bool validField =
|
||||
setFieldValues<Type>(fieldName, allValues[Pstream::myProcNo()]);
|
||||
|
||||
if (validField)
|
||||
{
|
||||
Pstream::gatherList(allValues);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
List<Type> values =
|
||||
ListListOps::combine<List<Type> >
|
||||
(
|
||||
allValues,
|
||||
accessOp<List<Type> >()
|
||||
);
|
||||
|
||||
Type result = processValues(values);
|
||||
|
||||
if (valueOutput_)
|
||||
{
|
||||
IOList<Type>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName + "_" + sourceTypeNames_[source_] + "-"
|
||||
+ sourceName_,
|
||||
obr_.time().timeName(),
|
||||
obr_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
values
|
||||
).write();
|
||||
}
|
||||
|
||||
|
||||
outputFilePtr_()<< tab << result;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " " << operationTypeNames_[operation_]
|
||||
<< "(" << sourceName_ << ") for " << fieldName
|
||||
<< " = " << result << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return validField;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type> > Foam::fieldValues::cellSource::filterField
|
||||
(
|
||||
const Field<Type>& field
|
||||
) const
|
||||
{
|
||||
return tmp<Field<Type> >(new Field<Type>(field, cellId_));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
108
src/postProcessing/functionObjects/field/fieldValues/controlDict
Normal file
108
src/postProcessing/functionObjects/field/fieldValues/controlDict
Normal file
@ -0,0 +1,108 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.6 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application icoFoam;
|
||||
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 0.5;
|
||||
|
||||
deltaT 0.005;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 20;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 6;
|
||||
|
||||
writeCompression uncompressed;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable yes;
|
||||
|
||||
functions
|
||||
(
|
||||
faceObj1
|
||||
{
|
||||
type faceSource;
|
||||
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||
enabled true;
|
||||
outputControl outputTime;
|
||||
log true;
|
||||
valueOutput true;
|
||||
source patch;
|
||||
sourceName movingWall;
|
||||
// source faceZone;
|
||||
// sourceName f0;
|
||||
operation areaAverage;
|
||||
fields
|
||||
(
|
||||
p
|
||||
phi
|
||||
U
|
||||
);
|
||||
}
|
||||
|
||||
faceObj2
|
||||
{
|
||||
type faceSource;
|
||||
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||
enabled true;
|
||||
outputControl outputTime;
|
||||
log true;
|
||||
valueOutput true;
|
||||
source faceZone;
|
||||
sourceName f0;
|
||||
operation sum;
|
||||
fields
|
||||
(
|
||||
phi
|
||||
);
|
||||
}
|
||||
|
||||
cellObj1
|
||||
{
|
||||
type cellSource;
|
||||
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||
enabled true;
|
||||
outputControl outputTime;
|
||||
log true;
|
||||
valueOutput true;
|
||||
source cellZone;
|
||||
sourceName c0;
|
||||
operation volAverage;
|
||||
fields
|
||||
(
|
||||
p
|
||||
U
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::IOfaceSource
|
||||
|
||||
|
||||
Description
|
||||
Instance of the generic IOOutputFilter for faceSource.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IOfaceSource_H
|
||||
#define IOfaceSource_H
|
||||
|
||||
#include "faceSource.H"
|
||||
#include "IOOutputFilter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef IOOutputFilter<faceSource> IOfaceSource;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,368 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "faceSource.H"
|
||||
#include "fvMesh.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "processorPolyPatch.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "volFields.H"
|
||||
#include "IOList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fieldValues
|
||||
{
|
||||
defineTypeNameAndDebug(faceSource, 0);
|
||||
}
|
||||
|
||||
template<>
|
||||
const char* NamedEnum<fieldValues::faceSource::sourceType, 2>::
|
||||
names[] = {"faceZone", "patch"};
|
||||
|
||||
const NamedEnum<fieldValues::faceSource::sourceType, 2>
|
||||
fieldValues::faceSource::sourceTypeNames_;
|
||||
|
||||
template<>
|
||||
const char* NamedEnum<fieldValues::faceSource::operationType, 4>::
|
||||
names[] = {"none", "sum", "areaAverage", "areaIntegrate"};
|
||||
|
||||
const NamedEnum<fieldValues::faceSource::operationType, 4>
|
||||
fieldValues::faceSource::operationTypeNames_;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::faceSource::setFaceZoneFaces()
|
||||
{
|
||||
label zoneId = mesh().faceZones().findZoneID(sourceName_);
|
||||
|
||||
if (zoneId < 0)
|
||||
{
|
||||
FatalErrorIn("faceSource::faceSource::setFaceZoneFaces()")
|
||||
<< "Unknown face zone name: " << sourceName_
|
||||
<< ". Valid face zones are: " << mesh().faceZones().names()
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
|
||||
const faceZone& fZone = mesh().faceZones()[zoneId];
|
||||
|
||||
faceId_.setSize(fZone.size());
|
||||
facePatchId_.setSize(fZone.size());
|
||||
flipMap_.setSize(fZone.size());
|
||||
|
||||
label count = 0;
|
||||
forAll(fZone, i)
|
||||
{
|
||||
label faceI = fZone[i];
|
||||
|
||||
label faceId = -1;
|
||||
label facePatchId = -1;
|
||||
if (mesh().isInternalFace(faceI))
|
||||
{
|
||||
faceId = faceI;
|
||||
facePatchId = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
facePatchId = mesh().boundaryMesh().whichPatch(faceI);
|
||||
const polyPatch& pp = mesh().boundaryMesh()[facePatchId];
|
||||
if (isA<processorPolyPatch>(pp))
|
||||
{
|
||||
if (refCast<const processorPolyPatch>(pp).owner())
|
||||
{
|
||||
faceId = pp.whichFace(faceI);
|
||||
}
|
||||
else
|
||||
{
|
||||
faceId = -1;
|
||||
}
|
||||
}
|
||||
else if (isA<cyclicPolyPatch>(pp))
|
||||
{
|
||||
label patchFaceI = faceI - pp.start();
|
||||
if (patchFaceI < pp.size()/2)
|
||||
{
|
||||
faceId = patchFaceI;
|
||||
}
|
||||
else
|
||||
{
|
||||
faceId = -1;
|
||||
}
|
||||
}
|
||||
else if (!isA<emptyPolyPatch>(pp))
|
||||
{
|
||||
faceId = faceI - pp.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
faceId = -1;
|
||||
facePatchId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (faceId >= 0)
|
||||
{
|
||||
if (fZone.flipMap()[i])
|
||||
{
|
||||
flipMap_[count] = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
flipMap_[count] = 1;
|
||||
}
|
||||
faceId_[count] = faceId;
|
||||
facePatchId_[count] = facePatchId;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
faceId_.setSize(count);
|
||||
facePatchId_.setSize(count);
|
||||
flipMap_.setSize(count);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Original face zone size = " << fZone.size()
|
||||
<< ", new size = " << count << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::faceSource::setPatchFaces()
|
||||
{
|
||||
label patchId = mesh().boundaryMesh().findPatchID(sourceName_);
|
||||
|
||||
if (patchId < 0)
|
||||
{
|
||||
FatalErrorIn("faceSource::constructFaceAddressing()")
|
||||
<< "Unknown patch name: " << sourceName_
|
||||
<< ". Valid patch names are: "
|
||||
<< mesh().boundaryMesh().names() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const polyPatch& pp = mesh().boundaryMesh()[patchId];
|
||||
|
||||
label nFaces = pp.size();
|
||||
if (isA<cyclicPolyPatch>(pp))
|
||||
{
|
||||
nFaces /= 2;
|
||||
}
|
||||
else if (isA<emptyPolyPatch>(pp))
|
||||
{
|
||||
nFaces = 0;
|
||||
}
|
||||
|
||||
faceId_.setSize(nFaces);
|
||||
facePatchId_.setSize(nFaces);
|
||||
flipMap_.setSize(nFaces);
|
||||
|
||||
forAll(faceId_, faceI)
|
||||
{
|
||||
faceId_[faceI] = faceI;
|
||||
facePatchId_[faceI] = patchId;
|
||||
flipMap_[faceI] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::faceSource::initialise()
|
||||
{
|
||||
switch (source_)
|
||||
{
|
||||
case stFaceZone:
|
||||
{
|
||||
setFaceZoneFaces();
|
||||
break;
|
||||
}
|
||||
case stPatch:
|
||||
{
|
||||
setPatchFaces();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn("faceSource::constructFaceAddressing()")
|
||||
<< "Unknown source type. Valid source types are:"
|
||||
<< sourceTypeNames_ << nl << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< type() << " " << name_ << ":" << nl
|
||||
<< " total faces = " << faceId_.size() << nl
|
||||
<< " total area = " << sum(filterField(mesh().magSf()))
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::faceSource::makeFile()
|
||||
{
|
||||
// Create the forces file if not already created
|
||||
if (outputFilePtr_.empty())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Creating output file." << endl;
|
||||
}
|
||||
|
||||
// File update
|
||||
if (Pstream::master())
|
||||
{
|
||||
fileName outputDir;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
outputDir =
|
||||
obr_.time().path()/".."/name_/obr_.time().timeName();
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDir = obr_.time().path()/name_/obr_.time().timeName();
|
||||
}
|
||||
|
||||
// Create directory if does not exist
|
||||
mkDir(outputDir);
|
||||
|
||||
// Open new file at start up
|
||||
outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat")));
|
||||
|
||||
// Add headers to output data
|
||||
writeFileHeader();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::faceSource::writeFileHeader()
|
||||
{
|
||||
if (outputFilePtr_.valid())
|
||||
{
|
||||
outputFilePtr_()
|
||||
<< "# Source : " << sourceTypeNames_[source_] << " "
|
||||
<< sourceName_ << nl << "# Faces : " << faceId_.size() << nl
|
||||
<< "# Time" << tab << "sum(magSf)";
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
outputFilePtr_()
|
||||
<< tab << operationTypeNames_[operation_]
|
||||
<< "(" << fields_[i] << ")";
|
||||
}
|
||||
|
||||
outputFilePtr_() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValues::faceSource::faceSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
fieldValue(name, obr, dict, loadFromFiles),
|
||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||
faceId_(),
|
||||
facePatchId_(),
|
||||
flipMap_(),
|
||||
outputFilePtr_(NULL)
|
||||
{
|
||||
initialise();
|
||||
|
||||
if (active_)
|
||||
{
|
||||
// Create the output file if not already created
|
||||
makeFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValues::faceSource::~faceSource()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValues::faceSource::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
fieldValue::read(dict);
|
||||
initialise();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValues::faceSource::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
if (log_)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
}
|
||||
|
||||
outputFilePtr_()
|
||||
<< obr_.time().value() << tab
|
||||
<< sum(filterField(mesh().magSf()));
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
writeValues<scalar>(fields_[i]);
|
||||
writeValues<vector>(fields_[i]);
|
||||
writeValues<sphericalTensor>(fields_[i]);
|
||||
writeValues<symmTensor>(fields_[i]);
|
||||
writeValues<tensor>(fields_[i]);
|
||||
}
|
||||
|
||||
outputFilePtr_()<< endl;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,252 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::fieldValues::faceSource
|
||||
|
||||
Description
|
||||
Face source variant of field value function object. Values of user-
|
||||
specified fields reported for collections of faces.
|
||||
|
||||
cellObj1 // Name also used to identify output folder
|
||||
{
|
||||
type cellSource;
|
||||
functionObjectLibs ("libfieldValueFunctionObjects.so");
|
||||
enabled true;
|
||||
outputControl outputTime;
|
||||
log true; // log to screen?
|
||||
valueOutput true; // Write values at run-time output times?
|
||||
source faceZone; // Type of face source: faceZone, patch
|
||||
sourceName f0;
|
||||
operation sum; // none, sum, areaAverage, areaIntegrate
|
||||
fields
|
||||
(
|
||||
p
|
||||
phi
|
||||
U
|
||||
);
|
||||
}
|
||||
|
||||
SourceFiles
|
||||
faceSource.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faceSource_H
|
||||
#define faceSource_H
|
||||
|
||||
#include "NamedEnum.H"
|
||||
#include "fieldValue.H"
|
||||
#include "labelList.H"
|
||||
#include "OFstream.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "volFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fieldValues
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class faceSource Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class faceSource
|
||||
:
|
||||
public fieldValue
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Public data types
|
||||
|
||||
//- Source type enumeration
|
||||
enum sourceType
|
||||
{
|
||||
stFaceZone,
|
||||
stPatch
|
||||
};
|
||||
|
||||
//- Source type names
|
||||
static const NamedEnum<sourceType, 2> sourceTypeNames_;
|
||||
|
||||
|
||||
//- Operation type enumeration
|
||||
enum operationType
|
||||
{
|
||||
opNone,
|
||||
opSum,
|
||||
opAreaAverage,
|
||||
opAreaIntegrate
|
||||
};
|
||||
|
||||
//- Operation type names
|
||||
static const NamedEnum<operationType, 4> operationTypeNames_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Set faces to evaluate based on a face zone
|
||||
void setFaceZoneFaces();
|
||||
|
||||
//- Set faces to evaluate based on a patch
|
||||
void setPatchFaces();
|
||||
|
||||
//- Create the output file if not already created
|
||||
void makeFile();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Source type
|
||||
sourceType source_;
|
||||
|
||||
//- Operation to apply to values
|
||||
operationType operation_;
|
||||
|
||||
//- Local list of face IDs
|
||||
labelList faceId_;
|
||||
|
||||
//- Local list of patch ID per face
|
||||
labelList facePatchId_;
|
||||
|
||||
//- List of +1/-1 representing face flip map
|
||||
labelList flipMap_;
|
||||
|
||||
//- Output file pointer
|
||||
autoPtr<OFstream> outputFilePtr_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Initialise, e.g. face addressing
|
||||
void initialise();
|
||||
|
||||
//- Insert field values into values list
|
||||
template<class Type>
|
||||
bool setFieldValues
|
||||
(
|
||||
const word& fieldName,
|
||||
List<Type>& values
|
||||
) const;
|
||||
|
||||
//- Apply the 'operation' to the values
|
||||
template<class Type>
|
||||
Type processValues(const List<Type>& values) const;
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Run-time type information
|
||||
TypeName("faceSource");
|
||||
|
||||
|
||||
//- Construct from components
|
||||
faceSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~faceSource();
|
||||
|
||||
|
||||
// Public member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the source type
|
||||
inline const sourceType& source() const;
|
||||
|
||||
//- Return the local list of face IDs
|
||||
inline const labelList& faceId() const;
|
||||
|
||||
//- Return the local list of patch ID per face
|
||||
inline const labelList& facePatch() const;
|
||||
|
||||
//- Return the list of +1/-1 representing face flip map
|
||||
inline const labelList& flipMap() const;
|
||||
|
||||
|
||||
// Function object functions
|
||||
|
||||
//- Read from dictionary
|
||||
virtual void read(const dictionary&);
|
||||
|
||||
//- Calculate and write
|
||||
virtual void write();
|
||||
|
||||
//- Templated helper function to output field values
|
||||
template<class Type>
|
||||
bool writeValues(const word& fieldName);
|
||||
|
||||
//- Filter a surface field according to faceIds
|
||||
template<class Type>
|
||||
tmp<Field<Type> > filterField
|
||||
(
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
|
||||
) const;
|
||||
|
||||
//- Filter a volume field according to faceIds
|
||||
template<class Type>
|
||||
tmp<Field<Type> > filterField
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& field
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace fieldValues
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "faceSourceI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "faceSourceTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,47 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "faceSourceFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug
|
||||
(
|
||||
faceSourceFunctionObject,
|
||||
0
|
||||
);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
faceSourceFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,55 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::faceSourceFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around faceSource to allow it to be
|
||||
created via the functions list within controlDict.
|
||||
|
||||
SourceFiles
|
||||
faceSourceFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faceSourceFunctionObject_H
|
||||
#define faceSourceFunctionObject_H
|
||||
|
||||
#include "faceSource.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<fieldValues::faceSource>
|
||||
faceSourceFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,60 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "faceSource.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::fieldValues::faceSource::sourceType&
|
||||
Foam::fieldValues::faceSource::source() const
|
||||
{
|
||||
return source_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::fieldValues::faceSource::faceId() const
|
||||
{
|
||||
return faceId_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::fieldValues::faceSource::facePatch() const
|
||||
{
|
||||
return facePatchId_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::fieldValues::faceSource::flipMap() const
|
||||
{
|
||||
return flipMap_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,269 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "faceSource.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "volFields.H"
|
||||
#include "IOList.H"
|
||||
#include "ListListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
bool Foam::fieldValues::faceSource::setFieldValues
|
||||
(
|
||||
const word& fieldName,
|
||||
List<Type>& values
|
||||
) const
|
||||
{
|
||||
values.setSize(faceId_.size(), pTraits<Type>::zero);
|
||||
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||
|
||||
if (obr_.foundObject<sf>(fieldName))
|
||||
{
|
||||
const sf& field = obr_.lookupObject<sf>(fieldName);
|
||||
|
||||
forAll(values, i)
|
||||
{
|
||||
label faceI = faceId_[i];
|
||||
label patchI = facePatchId_[i];
|
||||
if (patchI >= 0)
|
||||
{
|
||||
values[i] = field.boundaryField()[patchI][faceI];
|
||||
}
|
||||
else
|
||||
{
|
||||
values[i] = field[faceI];
|
||||
}
|
||||
|
||||
values[i] *= flipMap_[i];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (obr_.foundObject<vf>(fieldName))
|
||||
{
|
||||
const vf& field = obr_.lookupObject<vf>(fieldName);
|
||||
|
||||
forAll(values, i)
|
||||
{
|
||||
label faceI = faceId_[i];
|
||||
label patchI = facePatchId_[i];
|
||||
if (patchI >= 0)
|
||||
{
|
||||
values[i] = field.boundaryField()[patchI][faceI];
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"fieldValues::faceSource::setFieldValues"
|
||||
"("
|
||||
"const word&, "
|
||||
"List<Type>&"
|
||||
") const"
|
||||
) << type() << " " << name_ << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
||||
<< nl
|
||||
<< " Unable to process internal faces for volume field "
|
||||
<< fieldName << nl << abort(FatalError);
|
||||
}
|
||||
|
||||
values[i] *= flipMap_[i];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::fieldValues::faceSource::processValues
|
||||
(
|
||||
const List<Type>& values
|
||||
) const
|
||||
{
|
||||
Type result = pTraits<Type>::zero;
|
||||
switch (operation_)
|
||||
{
|
||||
case opSum:
|
||||
{
|
||||
result = sum(values);
|
||||
break;
|
||||
}
|
||||
case opAreaAverage:
|
||||
{
|
||||
tmp<scalarField> magSf = filterField(mesh().magSf());
|
||||
result = sum(values*magSf())/sum(magSf());
|
||||
break;
|
||||
}
|
||||
case opAreaIntegrate:
|
||||
{
|
||||
result = sum(values*filterField(mesh().magSf()));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
|
||||
{
|
||||
List<List<Type> > allValues(Pstream::nProcs());
|
||||
|
||||
bool validField =
|
||||
setFieldValues<Type>(fieldName, allValues[Pstream::myProcNo()]);
|
||||
|
||||
if (validField)
|
||||
{
|
||||
Pstream::gatherList(allValues);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
List<Type> values =
|
||||
ListListOps::combine<List<Type> >
|
||||
(
|
||||
allValues,
|
||||
accessOp<List<Type> >()
|
||||
);
|
||||
|
||||
Type result = processValues(values);
|
||||
|
||||
if (valueOutput_)
|
||||
{
|
||||
IOList<Type>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName + "_" + sourceTypeNames_[source_] + "-"
|
||||
+ sourceName_,
|
||||
obr_.time().timeName(),
|
||||
obr_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
values
|
||||
).write();
|
||||
}
|
||||
|
||||
|
||||
outputFilePtr_()<< tab << result;
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< " " << operationTypeNames_[operation_]
|
||||
<< "(" << sourceName_ << ") for " << fieldName
|
||||
<< " = " << result << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return validField;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& field
|
||||
) const
|
||||
{
|
||||
tmp<Field<Type> > tvalues(new Field<Type>(faceId_.size()));
|
||||
Field<Type>& values = tvalues();
|
||||
|
||||
forAll(values, i)
|
||||
{
|
||||
label faceI = faceId_[i];
|
||||
label patchI = facePatchId_[i];
|
||||
if (patchI >= 0)
|
||||
{
|
||||
values[i] = field.boundaryField()[patchI][faceI];
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"fieldValues::faceSource::filterField"
|
||||
"("
|
||||
"const GeometricField<Type, fvPatchField, volMesh>&"
|
||||
") const"
|
||||
) << type() << " " << name_ << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
||||
<< nl
|
||||
<< " Unable to process internal faces for volume field "
|
||||
<< field.name() << nl << abort(FatalError);
|
||||
}
|
||||
|
||||
values[i] *= flipMap_[i];
|
||||
}
|
||||
|
||||
return tvalues;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
||||
(
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
|
||||
) const
|
||||
{
|
||||
tmp<Field<Type> > tvalues(new Field<Type>(faceId_.size()));
|
||||
Field<Type>& values = tvalues();
|
||||
|
||||
forAll(values, i)
|
||||
{
|
||||
label faceI = faceId_[i];
|
||||
label patchI = facePatchId_[i];
|
||||
if (patchI >= 0)
|
||||
{
|
||||
values[i] = field.boundaryField()[patchI][faceI];
|
||||
}
|
||||
else
|
||||
{
|
||||
values[i] = field[faceI];
|
||||
}
|
||||
|
||||
values[i] *= flipMap_[i];
|
||||
}
|
||||
|
||||
return tvalues;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,177 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "fieldValue.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(fieldValue, 0);
|
||||
|
||||
defineTemplateTypeNameAndDebug(IOList<vector>, 0);
|
||||
defineTemplateTypeNameAndDebug(IOList<sphericalTensor>, 0);
|
||||
defineTemplateTypeNameAndDebug(IOList<symmTensor>, 0);
|
||||
defineTemplateTypeNameAndDebug(IOList<tensor>, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValue::updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValue::movePoints(const Field<point>&)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValue::fieldValue
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
log_(false),
|
||||
sourceName_(dict.lookup("sourceName")),
|
||||
fields_(dict.lookup("fields")),
|
||||
valueOutput_(dict.lookup("valueOutput"))
|
||||
{
|
||||
// Only active if obr is an fvMesh
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"fieldValue::fieldValue"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating."
|
||||
<< nl << endl;
|
||||
active_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValue::~fieldValue()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word& Foam::fieldValue::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::objectRegistry& Foam::fieldValue::obr() const
|
||||
{
|
||||
return obr_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::fieldValue::active() const
|
||||
{
|
||||
return active_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::Switch& Foam::fieldValue::log() const
|
||||
{
|
||||
return log_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::word& Foam::fieldValue::sourceName() const
|
||||
{
|
||||
return sourceName_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::wordList& Foam::fieldValue::fields() const
|
||||
{
|
||||
return fields_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::Switch& Foam::fieldValue::valueOutput() const
|
||||
{
|
||||
return valueOutput_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::fvMesh& Foam::fieldValue::mesh() const
|
||||
{
|
||||
return refCast<const fvMesh>(obr_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValue::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
log_ = dict.lookupOrDefault<Switch>("log", false);
|
||||
dict.lookup("fields") >> fields_;
|
||||
dict.lookup("valueOutput") >> valueOutput_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValue::execute()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValue::end()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,165 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::fieldValue
|
||||
|
||||
Description
|
||||
Base class for field value -based function objects.
|
||||
|
||||
SourceFiles
|
||||
fieldValue.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fieldValue_H
|
||||
#define fieldValue_H
|
||||
|
||||
#include "Switch.H"
|
||||
#include "pointFieldFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class dictionary;
|
||||
class objectRegistry;
|
||||
class fvMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fieldValue Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fieldValue
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of this fieldValue object
|
||||
word name_;
|
||||
|
||||
//- Database this class is registered to
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Active flag
|
||||
bool active_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
//- Name of source object
|
||||
word sourceName_;
|
||||
|
||||
//- List of field names to operate on
|
||||
wordList fields_;
|
||||
|
||||
//- Output field values flag
|
||||
Switch valueOutput_;
|
||||
|
||||
|
||||
// Functions to be over-ridden from IOoutputFilter class
|
||||
|
||||
//- Update mesh
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
//- Move points
|
||||
virtual void movePoints(const Field<point>&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Run-time type information
|
||||
TypeName("fieldValue");
|
||||
|
||||
|
||||
//- Construct from components
|
||||
fieldValue
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~fieldValue();
|
||||
|
||||
|
||||
// Public member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the name of the geometric source
|
||||
const word& name() const;
|
||||
|
||||
//- Return the reference to the object registry
|
||||
const objectRegistry& obr() const;
|
||||
|
||||
//- Return the active flag
|
||||
bool active() const;
|
||||
|
||||
//- Return the switch to send output to Info as well as to file
|
||||
const Switch& log() const;
|
||||
|
||||
//- Return the source name
|
||||
const word& sourceName() const;
|
||||
|
||||
//- Return the list of field names
|
||||
const wordList& fields() const;
|
||||
|
||||
//- Return the output field values flag
|
||||
const Switch& valueOutput() const;
|
||||
|
||||
//- Helper funvction to return the reference to the mesh
|
||||
const fvMesh& mesh() const;
|
||||
|
||||
|
||||
// Function object functions
|
||||
|
||||
//- Read from dictionary
|
||||
virtual void read(const dictionary& dict);
|
||||
|
||||
//- Execute
|
||||
virtual void execute();
|
||||
|
||||
//- Execute the at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
622
src/postProcessing/functionObjects/field/streamLine/streamLine.C
Normal file
622
src/postProcessing/functionObjects/field/streamLine/streamLine.C
Normal file
@ -0,0 +1,622 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "Pstream.H"
|
||||
#include "functionObjectList.H"
|
||||
#include "streamLine.H"
|
||||
#include "fvMesh.H"
|
||||
#include "streamLineParticleCloud.H"
|
||||
#include "ReadFields.H"
|
||||
#include "meshSearch.H"
|
||||
#include "sampledSet.H"
|
||||
#include "globalIndex.H"
|
||||
#include "mapDistribute.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::streamLine, 0);
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::streamLine::track()
|
||||
{
|
||||
const Time& runTime = const_cast<Time&>(obr_.time());
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
IDLList<streamLineParticle> initialParticles;
|
||||
streamLineParticleCloud particles
|
||||
(
|
||||
mesh,
|
||||
cloudName_,
|
||||
initialParticles
|
||||
);
|
||||
|
||||
//Pout<< "Seeding particles." << endl;
|
||||
|
||||
const sampledSet& seedPoints = sampledSetPtr_();
|
||||
forAll(seedPoints, i)
|
||||
{
|
||||
//Pout<< "Seeded particle at " << seedPoints[i]
|
||||
// << " at cell:" << seedPoints.cells()[i]
|
||||
// << endl;
|
||||
|
||||
particles.addParticle
|
||||
(
|
||||
new streamLineParticle
|
||||
(
|
||||
particles,
|
||||
seedPoints[i],
|
||||
seedPoints.cells()[i],
|
||||
lifeTime_ // lifetime
|
||||
)
|
||||
);
|
||||
}
|
||||
label nSeeds = returnReduce(particles.size(), sumOp<label>());
|
||||
Info<< "Seeded " << nSeeds
|
||||
<< " particles." << endl;
|
||||
|
||||
|
||||
// Read or lookup fields
|
||||
PtrList<volScalarField> vsFlds;
|
||||
PtrList<interpolationCellPoint<scalar> > vsInterp;
|
||||
PtrList<volVectorField> vvFlds;
|
||||
PtrList<interpolationCellPoint<vector> > vvInterp;
|
||||
|
||||
|
||||
label UIndex = -1;
|
||||
|
||||
if (loadFromFiles_)
|
||||
{
|
||||
IOobjectList allObjects(mesh, runTime.timeName());
|
||||
|
||||
IOobjectList objects(2*fields_.size());
|
||||
forAll(fields_, i)
|
||||
{
|
||||
objects.add(*allObjects[fields_[i]]);
|
||||
}
|
||||
|
||||
ReadFields(mesh, objects, vsFlds);
|
||||
vsInterp.setSize(vsFlds.size());
|
||||
forAll(vsFlds, i)
|
||||
{
|
||||
vsInterp.set(i, new interpolationCellPoint<scalar>(vsFlds[i]));
|
||||
}
|
||||
ReadFields(mesh, objects, vvFlds);
|
||||
vvInterp.setSize(vvFlds.size());
|
||||
forAll(vvFlds, i)
|
||||
{
|
||||
vvInterp.set(i, new interpolationCellPoint<vector>(vvFlds[i]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
label nScalar = 0;
|
||||
label nVector = 0;
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
nScalar++;
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
nVector++;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("streamLine::execute()")
|
||||
<< "Cannot find field " << fields_[i] << endl
|
||||
<< "Valid scalar fields are:"
|
||||
<< mesh.names(volScalarField::typeName) << endl
|
||||
<< "Valid vector fields are:"
|
||||
<< mesh.names(volVectorField::typeName)
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
vsInterp.setSize(nScalar);
|
||||
nScalar = 0;
|
||||
vvInterp.setSize(nVector);
|
||||
nVector = 0;
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
const volScalarField& f = mesh.lookupObject<volScalarField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
vsInterp.set
|
||||
(
|
||||
nScalar++,
|
||||
new interpolationCellPoint<scalar>(f)
|
||||
);
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
const volVectorField& f = mesh.lookupObject<volVectorField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
|
||||
if (f.name() == UName_)
|
||||
{
|
||||
UIndex = nVector;
|
||||
}
|
||||
|
||||
vvInterp.set
|
||||
(
|
||||
nVector++,
|
||||
new interpolationCellPoint<vector>(f)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store the names
|
||||
scalarNames_.setSize(vsInterp.size());
|
||||
forAll(vsInterp, i)
|
||||
{
|
||||
scalarNames_[i] = vsInterp[i].psi().name();
|
||||
}
|
||||
vectorNames_.setSize(vvInterp.size());
|
||||
forAll(vvInterp, i)
|
||||
{
|
||||
vectorNames_[i] = vvInterp[i].psi().name();
|
||||
}
|
||||
|
||||
|
||||
// Check that we know the index of U in the interpolators.
|
||||
|
||||
if (UIndex == -1)
|
||||
{
|
||||
FatalErrorIn("streamLine::execute()")
|
||||
<< "Cannot find field to move particles with : " << UName_
|
||||
<< endl
|
||||
<< "This field has to be present in the sampled fields "
|
||||
<< fields_
|
||||
<< " and in the objectRegistry." << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Sampled data
|
||||
// ~~~~~~~~~~~~
|
||||
|
||||
// Size to maximum expected sizes.
|
||||
allTracks_.clear();
|
||||
allTracks_.setCapacity(nSeeds);
|
||||
allScalars_.setSize(vsInterp.size());
|
||||
forAll(allScalars_, i)
|
||||
{
|
||||
allScalars_[i].clear();
|
||||
allScalars_[i].setCapacity(nSeeds);
|
||||
}
|
||||
allVectors_.setSize(vvInterp.size());
|
||||
forAll(allVectors_, i)
|
||||
{
|
||||
allVectors_[i].clear();
|
||||
allVectors_[i].setCapacity(nSeeds);
|
||||
}
|
||||
|
||||
// additional particle info
|
||||
streamLineParticle::trackData td
|
||||
(
|
||||
particles,
|
||||
vsInterp,
|
||||
vvInterp,
|
||||
UIndex, // index of U in vvInterp
|
||||
trackForward_, // track in +u direction
|
||||
allTracks_,
|
||||
allScalars_,
|
||||
allVectors_
|
||||
);
|
||||
|
||||
// Track
|
||||
//Pout<< "Tracking particles." << endl;
|
||||
particles.move(td);
|
||||
//Pout<< "Finished tracking particles." << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::streamLine::streamLine
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
dict_(dict),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
loadFromFiles_(loadFromFiles),
|
||||
active_(true)
|
||||
{
|
||||
// Only active if a fvMesh is available
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict_);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"streamLine::streamLine\n"
|
||||
"(\n"
|
||||
"const word&,\n"
|
||||
"const objectRegistry&,\n"
|
||||
"const dictionary&,\n"
|
||||
"const bool\n"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating."
|
||||
<< nl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::streamLine::~streamLine()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::streamLine::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
//dict_ = dict;
|
||||
dict.lookup("fields") >> fields_;
|
||||
UName_ = dict.lookupOrDefault<word>("U", "U");
|
||||
dict.lookup("trackForward") >> trackForward_;
|
||||
dict.lookup("lifeTime") >> lifeTime_;
|
||||
cloudName_ = dict.lookupOrDefault<word>("cloudName", "streamLine");
|
||||
dict.lookup("seedSampleSet") >> seedSet_;
|
||||
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
meshSearchPtr_.reset(new meshSearch(mesh, false));
|
||||
|
||||
const dictionary& coeffsDict = dict.subDict(seedSet_ + "Coeffs");
|
||||
sampledSetPtr_ = sampledSet::New
|
||||
(
|
||||
seedSet_,
|
||||
mesh,
|
||||
meshSearchPtr_(),
|
||||
coeffsDict
|
||||
);
|
||||
coeffsDict.lookup("axis") >> sampledSetAxis_;
|
||||
|
||||
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
|
||||
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::execute()
|
||||
{
|
||||
// const Time& runTime = const_cast<Time&>(obr_.time());
|
||||
// Pout<< "**streamLine::execute : time:" << runTime.timeName() << endl;
|
||||
// Pout<< "**streamLine::execute : time:" << runTime.timeIndex() << endl;
|
||||
//
|
||||
// bool isOutputTime = false;
|
||||
//
|
||||
// const functionObjectList& fobs = runTime.functionObjects();
|
||||
//
|
||||
// forAll(fobs, i)
|
||||
// {
|
||||
// if (isA<streamLineFunctionObject>(fobs[i]))
|
||||
// {
|
||||
// const streamLineFunctionObject& fo =
|
||||
// dynamic_cast<const streamLineFunctionObject&>(fobs[i]);
|
||||
//
|
||||
// if (fo.name() == name_)
|
||||
// {
|
||||
// Pout<< "found me:" << i << endl;
|
||||
// if (fo.outputControl().output())
|
||||
// {
|
||||
// isOutputTime = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (active_ && isOutputTime)
|
||||
// {
|
||||
// track();
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::end()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::write()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
const Time& runTime = const_cast<Time&>(obr_.time());
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
|
||||
// Do all injection and tracking
|
||||
track();
|
||||
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Append slave tracks to master ones
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
globalIndex globalTrackIDs(allTracks_.size());
|
||||
|
||||
// Construct a distribution map to pull all to the master.
|
||||
labelListList sendMap(Pstream::nProcs());
|
||||
labelListList recvMap(Pstream::nProcs());
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Master: receive all. My own first, then consecutive
|
||||
// processors.
|
||||
label trackI = 0;
|
||||
|
||||
forAll(recvMap, procI)
|
||||
{
|
||||
labelList& fromProc = recvMap[procI];
|
||||
fromProc.setSize(globalTrackIDs.localSize(procI));
|
||||
forAll(fromProc, i)
|
||||
{
|
||||
fromProc[i] = trackI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
labelList& toMaster = sendMap[0];
|
||||
toMaster.setSize(globalTrackIDs.localSize());
|
||||
forAll(toMaster, i)
|
||||
{
|
||||
toMaster[i] = i;
|
||||
}
|
||||
|
||||
const mapDistribute distMap
|
||||
(
|
||||
globalTrackIDs.size(),
|
||||
sendMap.xfer(),
|
||||
recvMap.xfer()
|
||||
);
|
||||
|
||||
|
||||
// Distribute the track positions
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allTracks_
|
||||
);
|
||||
|
||||
// Distribute the scalars
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allScalars_[scalarI]
|
||||
);
|
||||
}
|
||||
// Distribute the vectors
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allVectors_[vectorI]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
label n = 0;
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
n += allTracks_[trackI].size();
|
||||
}
|
||||
|
||||
Info<< "Tracks:" << allTracks_.size()
|
||||
<< " total samples:" << n << endl;
|
||||
|
||||
|
||||
// Massage into form suitable for writers
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (Pstream::master() && allTracks_.size())
|
||||
{
|
||||
// Make output directory
|
||||
|
||||
fileName vtkPath
|
||||
(
|
||||
Pstream::parRun()
|
||||
? runTime.path()/".."/"sets"/name()
|
||||
: runTime.path()/"sets"/name()
|
||||
);
|
||||
if (mesh.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
vtkPath = vtkPath/mesh.name();
|
||||
}
|
||||
vtkPath = vtkPath/mesh.time().timeName();
|
||||
|
||||
mkDir(vtkPath);
|
||||
|
||||
|
||||
// Convert track positions
|
||||
|
||||
PtrList<coordSet> tracks(allTracks_.size());
|
||||
forAll(allTracks_, trackI)
|
||||
{
|
||||
tracks.set
|
||||
(
|
||||
trackI,
|
||||
new coordSet
|
||||
(
|
||||
"track" + Foam::name(trackI),
|
||||
sampledSetAxis_ //"xyz"
|
||||
)
|
||||
);
|
||||
tracks[trackI].transfer(allTracks_[trackI]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Convert scalar values
|
||||
|
||||
if (allScalars_.size() > 0)
|
||||
{
|
||||
List<List<scalarField> > scalarValues(allScalars_.size());
|
||||
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
DynamicList<scalarList>& allTrackVals =
|
||||
allScalars_[scalarI];
|
||||
scalarValues[scalarI].setSize(allTrackVals.size());
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
scalarList& trackVals = allTrackVals[trackI];
|
||||
scalarValues[scalarI][trackI].transfer(trackVals);
|
||||
}
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
(
|
||||
vtkPath
|
||||
/ scalarFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
scalarNames_
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Writing data to " << vtkFile.path() << endl;
|
||||
|
||||
scalarFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
scalarNames_,
|
||||
scalarValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
|
||||
// Convert vector values
|
||||
|
||||
if (allVectors_.size() > 0)
|
||||
{
|
||||
List<List<vectorField> > vectorValues(allVectors_.size());
|
||||
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
DynamicList<vectorList>& allTrackVals =
|
||||
allVectors_[vectorI];
|
||||
vectorValues[vectorI].setSize(allTrackVals.size());
|
||||
|
||||
forAll(allTrackVals, trackI)
|
||||
{
|
||||
vectorList& trackVals = allTrackVals[trackI];
|
||||
vectorValues[vectorI][trackI].transfer(trackVals);
|
||||
}
|
||||
}
|
||||
|
||||
fileName vtkFile
|
||||
(
|
||||
vtkPath
|
||||
/ vectorFormatterPtr_().getFileName
|
||||
(
|
||||
tracks[0],
|
||||
vectorNames_
|
||||
)
|
||||
);
|
||||
|
||||
//Info<< "Writing vector data to " << vtkFile << endl;
|
||||
|
||||
vectorFormatterPtr_().write
|
||||
(
|
||||
true, // writeTracks
|
||||
tracks,
|
||||
vectorNames_,
|
||||
vectorValues,
|
||||
OFstream(vtkFile)()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLine::movePoints(const pointField&)
|
||||
{
|
||||
// Moving mesh affects the search tree
|
||||
read(dict_);
|
||||
}
|
||||
|
||||
|
||||
//void Foam::streamLine::readUpdate(const polyMesh::readUpdateState state)
|
||||
//{
|
||||
// if (state != UNCHANGED)
|
||||
// {
|
||||
// read(dict_);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
219
src/postProcessing/functionObjects/field/streamLine/streamLine.H
Normal file
219
src/postProcessing/functionObjects/field/streamLine/streamLine.H
Normal file
@ -0,0 +1,219 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::streamLine
|
||||
|
||||
Description
|
||||
Generation of streamlines. Samples along track of passive particle.
|
||||
|
||||
SourceFiles
|
||||
streamLine.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef streamLine_H
|
||||
#define streamLine_H
|
||||
|
||||
#include "volFieldsFwd.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "Switch.H"
|
||||
#include "DynamicList.H"
|
||||
#include "scalarList.H"
|
||||
#include "vectorList.H"
|
||||
#include "polyMesh.H"
|
||||
#include "writer.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
class meshSearch;
|
||||
class sampledSet;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class streamLine Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class streamLine
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Input dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- Name of this set of field averages.
|
||||
word name_;
|
||||
|
||||
//- Database this class is registered to
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Load fields from files (not from objectRegistry)
|
||||
bool loadFromFiles_;
|
||||
|
||||
//- On/off switch
|
||||
bool active_;
|
||||
|
||||
|
||||
//- List of fields to sample
|
||||
wordList fields_;
|
||||
|
||||
//- Field to transport particle with
|
||||
word UName_;
|
||||
|
||||
//- Whether to use +u or -u
|
||||
bool trackForward_;
|
||||
|
||||
//- Maximum lifetime (= number of cells) of particle
|
||||
label lifeTime_;
|
||||
|
||||
//- Optional specified name of particles
|
||||
word cloudName_;
|
||||
|
||||
//- Type of seed
|
||||
word seedSet_;
|
||||
|
||||
//- Names of scalar fields
|
||||
wordList scalarNames_;
|
||||
|
||||
//- Names of vector fields
|
||||
wordList vectorNames_;
|
||||
|
||||
|
||||
|
||||
// Demand driven
|
||||
|
||||
//- Mesh searching enigne
|
||||
autoPtr<meshSearch> meshSearchPtr_;
|
||||
|
||||
//- Seed set engine
|
||||
autoPtr<sampledSet> sampledSetPtr_;
|
||||
|
||||
//- Axis of the sampled points to output
|
||||
word sampledSetAxis_;
|
||||
|
||||
//- File output writer
|
||||
autoPtr<writer<scalar> > scalarFormatterPtr_;
|
||||
|
||||
autoPtr<writer<vector> > vectorFormatterPtr_;
|
||||
|
||||
|
||||
// Generated data
|
||||
|
||||
//- All tracks. Per particle the points it passed through
|
||||
DynamicList<List<point> > allTracks_;
|
||||
|
||||
//- Per scalarField, per particle, the sampled value.
|
||||
List<DynamicList<scalarList> > allScalars_;
|
||||
|
||||
//- Per scalarField, per particle, the sampled value.
|
||||
List<DynamicList<vectorList> > allVectors_;
|
||||
|
||||
|
||||
|
||||
//- Do all seeding and tracking
|
||||
void track();
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
streamLine(const streamLine&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const streamLine&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("streamLine");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
streamLine
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
virtual ~streamLine();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of field averages
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the field average data
|
||||
virtual void read(const dictionary&);
|
||||
|
||||
//- Execute the averaging
|
||||
virtual void execute();
|
||||
|
||||
//- Execute the averaging at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Calculate the field average data and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
//- Update for mesh point-motion
|
||||
virtual void movePoints(const pointField&);
|
||||
|
||||
////- Update for changes of mesh due to readUpdate
|
||||
//virtual void readUpdate(const polyMesh::readUpdateState state);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//#ifdef NoRepository
|
||||
//# include "streamLineTemplates.C"
|
||||
//#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#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 "streamLineFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(streamLineFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
streamLineFunctionObject,
|
||||
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::streamLineFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around streamLines to allow them to be created via
|
||||
the functions list within controlDict.
|
||||
|
||||
SourceFiles
|
||||
streamLineFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef streamLineFunctionObject_H
|
||||
#define streamLineFunctionObject_H
|
||||
|
||||
#include "streamLine.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<streamLine>
|
||||
streamLineFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,480 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "streamLineParticle.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(streamLineParticle, 0);
|
||||
defineParticleTypeNameAndDebug(streamLineParticle, 0);
|
||||
defineTemplateTypeNameAndDebugWithName
|
||||
(
|
||||
IOField<vectorField>,
|
||||
"vectorFieldField",
|
||||
0
|
||||
);
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::vector Foam::streamLineParticle::interpolateFields
|
||||
(
|
||||
const streamLineParticle::trackData& td,
|
||||
const point& position,
|
||||
const label cellI
|
||||
)
|
||||
{
|
||||
if (cellI == -1)
|
||||
{
|
||||
FatalErrorIn("streamLineParticle::interpolateFields(..)")
|
||||
<< "Cell:" << cellI << abort(FatalError);
|
||||
}
|
||||
|
||||
sampledScalars_.setSize(td.vsInterp_.size());
|
||||
forAll(td.vsInterp_, scalarI)
|
||||
{
|
||||
sampledScalars_[scalarI].append
|
||||
(
|
||||
td.vsInterp_[scalarI].interpolate
|
||||
(
|
||||
position,
|
||||
cellI
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
sampledVectors_.setSize(td.vvInterp_.size());
|
||||
forAll(td.vvInterp_, vectorI)
|
||||
{
|
||||
sampledVectors_[vectorI].append
|
||||
(
|
||||
td.vvInterp_[vectorI].interpolate
|
||||
(
|
||||
position,
|
||||
cellI
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const DynamicList<vector>& U = sampledVectors_[td.UIndex_];
|
||||
|
||||
return U[U.size()-1];
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
//- Construct from components
|
||||
Foam::streamLineParticle::streamLineParticle
|
||||
(
|
||||
const Cloud<streamLineParticle>& c,
|
||||
const vector& position,
|
||||
const label celli,
|
||||
const label lifeTime
|
||||
)
|
||||
:
|
||||
Particle<streamLineParticle>(c, position, celli),
|
||||
lifeTime_(lifeTime)
|
||||
{}
|
||||
|
||||
|
||||
//- Construct from Istream
|
||||
Foam::streamLineParticle::streamLineParticle
|
||||
(
|
||||
const Cloud<streamLineParticle>& c,
|
||||
Istream& is,
|
||||
bool readFields
|
||||
)
|
||||
:
|
||||
Particle<streamLineParticle>(c, is, readFields)
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
//if (is.format() == IOstream::ASCII)
|
||||
List<scalarList> sampledScalars;
|
||||
List<vectorList> sampledVectors;
|
||||
|
||||
is >> lifeTime_ >> sampledPositions_ >> sampledScalars
|
||||
>> sampledVectors;
|
||||
|
||||
sampledScalars_.setSize(sampledScalars.size());
|
||||
forAll(sampledScalars, i)
|
||||
{
|
||||
sampledScalars_[i].transfer(sampledScalars[i]);
|
||||
}
|
||||
sampledVectors_.setSize(sampledVectors.size());
|
||||
forAll(sampledVectors, i)
|
||||
{
|
||||
sampledVectors_[i].transfer(sampledVectors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Check state of Istream
|
||||
is.check
|
||||
(
|
||||
"streamLineParticle::streamLineParticle"
|
||||
"(const Cloud<streamLineParticle>&, Istream&, bool)"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Construct copy
|
||||
Foam::streamLineParticle::streamLineParticle
|
||||
(
|
||||
const streamLineParticle& c
|
||||
)
|
||||
:
|
||||
Particle<streamLineParticle>(c),
|
||||
lifeTime_(c.lifeTime_),
|
||||
sampledPositions_(c.sampledPositions_),
|
||||
sampledScalars_(c.sampledScalars_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::streamLineParticle::move(streamLineParticle::trackData& td)
|
||||
{
|
||||
td.switchProcessor = false;
|
||||
td.keepParticle = true;
|
||||
|
||||
scalar deltaT = GREAT; //cloud().pMesh().time().deltaT().value();
|
||||
scalar tEnd = (1.0 - stepFraction())*deltaT;
|
||||
scalar dtMax = tEnd;
|
||||
|
||||
while
|
||||
(
|
||||
td.keepParticle
|
||||
&& !td.switchProcessor
|
||||
&& lifeTime_ > 0
|
||||
&& tEnd > ROOTVSMALL
|
||||
)
|
||||
{
|
||||
// set the lagrangian time-step
|
||||
scalar dt = min(dtMax, tEnd);
|
||||
|
||||
// Store current position and sampled velocity.
|
||||
--lifeTime_;
|
||||
sampledPositions_.append(position());
|
||||
vector U = interpolateFields(td, position(), cell());
|
||||
|
||||
if (!td.trackForward_)
|
||||
{
|
||||
U = -U;
|
||||
}
|
||||
|
||||
dt *= trackToFace(position()+dt*U, td);
|
||||
|
||||
tEnd -= dt;
|
||||
stepFraction() = 1.0 - tEnd/deltaT;
|
||||
}
|
||||
|
||||
if (!td.keepParticle || lifeTime_ == 0)
|
||||
{
|
||||
if (lifeTime_ == 0)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "streamLineParticle : Removing stagnant particle:"
|
||||
<< static_cast<Particle<streamLineParticle> >(*this)
|
||||
<< " sampled positions:" << sampledPositions_.size()
|
||||
<< endl;
|
||||
}
|
||||
td.keepParticle = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal exit. Store last position and fields
|
||||
sampledPositions_.append(position());
|
||||
interpolateFields(td, position(), cell());
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "streamLineParticle : Removing particle:"
|
||||
<< static_cast<Particle<streamLineParticle> >(*this)
|
||||
<< " sampled positions:" << sampledPositions_.size()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Transfer particle data into trackData.
|
||||
//td.allPositions_.append(sampledPositions_);
|
||||
td.allPositions_.append(vectorList());
|
||||
vectorList& top = td.allPositions_[td.allPositions_.size()-1];
|
||||
top.transfer(sampledPositions_);
|
||||
|
||||
forAll(sampledScalars_, i)
|
||||
{
|
||||
//td.allScalars_[i].append(sampledScalars_[i]);
|
||||
td.allScalars_[i].append(scalarList());
|
||||
scalarList& top = td.allScalars_[i][td.allScalars_[i].size()-1];
|
||||
top.transfer(sampledScalars_[i]);
|
||||
}
|
||||
forAll(sampledVectors_, i)
|
||||
{
|
||||
//td.allVectors_[i].append(sampledVectors_[i]);
|
||||
td.allVectors_[i].append(vectorList());
|
||||
vectorList& top = td.allVectors_[i][td.allVectors_[i].size()-1];
|
||||
top.transfer(sampledVectors_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return td.keepParticle;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::streamLineParticle::hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
streamLineParticle::trackData& td,
|
||||
const label patchI
|
||||
)
|
||||
{
|
||||
// Disable generic patch interaction
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::streamLineParticle::hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
int&,
|
||||
const label
|
||||
)
|
||||
{
|
||||
// Disable generic patch interaction
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::hitWedgePatch
|
||||
(
|
||||
const wedgePolyPatch& pp,
|
||||
streamLineParticle::trackData& td
|
||||
)
|
||||
{
|
||||
// Remove particle
|
||||
td.keepParticle = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::hitWedgePatch
|
||||
(
|
||||
const wedgePolyPatch&,
|
||||
int&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::hitSymmetryPatch
|
||||
(
|
||||
const symmetryPolyPatch& pp,
|
||||
streamLineParticle::trackData& td
|
||||
)
|
||||
{
|
||||
// Remove particle
|
||||
td.keepParticle = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::hitSymmetryPatch
|
||||
(
|
||||
const symmetryPolyPatch&,
|
||||
int&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::hitCyclicPatch
|
||||
(
|
||||
const cyclicPolyPatch& pp,
|
||||
streamLineParticle::trackData& td
|
||||
)
|
||||
{
|
||||
// Remove particle
|
||||
td.keepParticle = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::hitCyclicPatch
|
||||
(
|
||||
const cyclicPolyPatch&,
|
||||
int&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::hitProcessorPatch
|
||||
(
|
||||
const processorPolyPatch&,
|
||||
streamLineParticle::trackData& td
|
||||
)
|
||||
{
|
||||
// Switch particle
|
||||
td.switchProcessor = true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::hitProcessorPatch
|
||||
(
|
||||
const processorPolyPatch&,
|
||||
int&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::hitWallPatch
|
||||
(
|
||||
const wallPolyPatch& wpp,
|
||||
streamLineParticle::trackData& td
|
||||
)
|
||||
{
|
||||
// Remove particle
|
||||
td.keepParticle = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::hitWallPatch
|
||||
(
|
||||
const wallPolyPatch& wpp,
|
||||
int&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::hitPatch
|
||||
(
|
||||
const polyPatch& wpp,
|
||||
streamLineParticle::trackData& td
|
||||
)
|
||||
{
|
||||
// Remove particle
|
||||
td.keepParticle = false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::hitPatch
|
||||
(
|
||||
const polyPatch& wpp,
|
||||
int&
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::readFields(Cloud<streamLineParticle>& c)
|
||||
{
|
||||
if (!c.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IOField<label> lifeTime
|
||||
(
|
||||
c.fieldIOobject("lifeTime", IOobject::MUST_READ)
|
||||
);
|
||||
c.checkFieldIOobject(c, lifeTime);
|
||||
|
||||
IOField<pointField> sampledPositions
|
||||
(
|
||||
c.fieldIOobject("sampledPositions", IOobject::MUST_READ)
|
||||
);
|
||||
c.checkFieldIOobject(c, sampledPositions);
|
||||
|
||||
// IOField<pointField> sampleVelocity
|
||||
// (
|
||||
// c.fieldIOobject("sampleVelocity", IOobject::MUST_READ)
|
||||
// );
|
||||
// c.checkFieldIOobject(c, sampleVelocity);
|
||||
|
||||
label i = 0;
|
||||
forAllIter(Cloud<streamLineParticle>, c, iter)
|
||||
{
|
||||
iter().lifeTime_ = lifeTime[i];
|
||||
iter().sampledPositions_.transfer(sampledPositions[i]);
|
||||
// iter().sampleVelocity_.transfer(sampleVelocity[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::streamLineParticle::writeFields(const Cloud<streamLineParticle>& c)
|
||||
{
|
||||
Particle<streamLineParticle>::writeFields(c);
|
||||
|
||||
label np = c.size();
|
||||
|
||||
IOField<label> lifeTime
|
||||
(
|
||||
c.fieldIOobject("lifeTime", IOobject::NO_READ),
|
||||
np
|
||||
);
|
||||
IOField<pointField> sampledPositions
|
||||
(
|
||||
c.fieldIOobject("sampledPositions", IOobject::NO_READ),
|
||||
np
|
||||
);
|
||||
// IOField<pointField> sampleVelocity
|
||||
// (
|
||||
// c.fieldIOobject("sampleVelocity", IOobject::NO_READ),
|
||||
// np
|
||||
// );
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter(Cloud<streamLineParticle>, c, iter)
|
||||
{
|
||||
lifeTime[i] = iter().lifeTime_;
|
||||
sampledPositions[i] = iter().sampledPositions_;
|
||||
// sampleVelocity[i] = iter().sampleVelocity_;
|
||||
i++;
|
||||
}
|
||||
|
||||
lifeTime.write();
|
||||
sampledPositions.write();
|
||||
// sampleVelocity.write();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const streamLineParticle& p)
|
||||
{
|
||||
os << static_cast<const Particle<streamLineParticle>&>(p)
|
||||
<< token::SPACE << p.lifeTime_
|
||||
<< token::SPACE << p.sampledPositions_
|
||||
<< token::SPACE << p.sampledScalars_
|
||||
<< token::SPACE << p.sampledVectors_;
|
||||
|
||||
// Check state of Ostream
|
||||
os.check("Ostream& operator<<(Ostream&, const streamLineParticle&)");
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,300 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::streamLineParticle
|
||||
|
||||
Description
|
||||
Particle class that samples fields as it passes through. Used in streamline
|
||||
calculation.
|
||||
|
||||
SourceFiles
|
||||
streamLineParticle.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef streamLineParticle_H
|
||||
#define streamLineParticle_H
|
||||
|
||||
#include "Particle.H"
|
||||
#include "autoPtr.H"
|
||||
#include "interpolationCellPoint.H"
|
||||
#include "vectorList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class streamLineParticleCloud;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class streamLineParticle Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class streamLineParticle
|
||||
:
|
||||
public Particle<streamLineParticle>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Class used to pass tracking data to the trackToFace function
|
||||
class trackData
|
||||
:
|
||||
public Particle<streamLineParticle>::trackData
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
const PtrList<interpolationCellPoint<scalar> >& vsInterp_;
|
||||
const PtrList<interpolationCellPoint<vector> >& vvInterp_;
|
||||
const label UIndex_;
|
||||
const bool trackForward_;
|
||||
|
||||
DynamicList<vectorList>& allPositions_;
|
||||
List<DynamicList<scalarList> >& allScalars_;
|
||||
List<DynamicList<vectorList> >& allVectors_;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
trackData
|
||||
(
|
||||
Cloud<streamLineParticle>& cloud,
|
||||
const PtrList<interpolationCellPoint<scalar> >& vsInterp,
|
||||
const PtrList<interpolationCellPoint<vector> >& vvInterp,
|
||||
const label UIndex,
|
||||
const bool trackForward,
|
||||
DynamicList<List<point> >& allPositions,
|
||||
List<DynamicList<scalarList> >& allScalars,
|
||||
List<DynamicList<vectorList> >& allVectors
|
||||
)
|
||||
:
|
||||
Particle<streamLineParticle>::trackData(cloud),
|
||||
vsInterp_(vsInterp),
|
||||
vvInterp_(vvInterp),
|
||||
UIndex_(UIndex),
|
||||
trackForward_(trackForward),
|
||||
allPositions_(allPositions),
|
||||
allScalars_(allScalars),
|
||||
allVectors_(allVectors)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Lifetime of particle. Particle dies when reaches 0.
|
||||
label lifeTime_;
|
||||
|
||||
//- sampled positions
|
||||
DynamicList<point> sampledPositions_;
|
||||
|
||||
//- sampled scalars
|
||||
List<DynamicList<scalar> > sampledScalars_;
|
||||
|
||||
//- sampled vectors
|
||||
List<DynamicList<vector> > sampledVectors_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Interpolate all quantities; return interpolated velocity.
|
||||
vector interpolateFields
|
||||
(
|
||||
const streamLineParticle::trackData&,
|
||||
const point&,
|
||||
const label cellI
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Run-time type information
|
||||
TypeName("streamLineParticle");
|
||||
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
streamLineParticle
|
||||
(
|
||||
const Cloud<streamLineParticle>& c,
|
||||
const vector& position,
|
||||
const label celli,
|
||||
const label lifeTime
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
streamLineParticle
|
||||
(
|
||||
const Cloud<streamLineParticle>& c,
|
||||
Istream& is,
|
||||
bool readFields = true
|
||||
);
|
||||
|
||||
//- Construct copy
|
||||
streamLineParticle(const streamLineParticle& c);
|
||||
|
||||
//- Construct and return a clone
|
||||
autoPtr<streamLineParticle> clone() const
|
||||
{
|
||||
return autoPtr<streamLineParticle>
|
||||
(
|
||||
new streamLineParticle(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
|
||||
// Tracking
|
||||
|
||||
//- Track all particles to their end point
|
||||
bool move(trackData&);
|
||||
|
||||
|
||||
//- Overridable function to handle the particle hitting a patch
|
||||
// Executed before other patch-hitting functions
|
||||
bool hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
streamLineParticle::trackData& td,
|
||||
const label patchI
|
||||
);
|
||||
bool hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
int&,
|
||||
const label patchI
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a wedge
|
||||
void hitWedgePatch
|
||||
(
|
||||
const wedgePolyPatch&,
|
||||
streamLineParticle::trackData& td
|
||||
);
|
||||
void hitWedgePatch
|
||||
(
|
||||
const wedgePolyPatch&,
|
||||
int&
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a
|
||||
// symmetryPlane
|
||||
void hitSymmetryPatch
|
||||
(
|
||||
const symmetryPolyPatch&,
|
||||
streamLineParticle::trackData& td
|
||||
);
|
||||
void hitSymmetryPatch
|
||||
(
|
||||
const symmetryPolyPatch&,
|
||||
int&
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a cyclic
|
||||
void hitCyclicPatch
|
||||
(
|
||||
const cyclicPolyPatch&,
|
||||
streamLineParticle::trackData& td
|
||||
);
|
||||
void hitCyclicPatch
|
||||
(
|
||||
const cyclicPolyPatch&,
|
||||
int&
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a
|
||||
//- processorPatch
|
||||
void hitProcessorPatch
|
||||
(
|
||||
const processorPolyPatch&,
|
||||
streamLineParticle::trackData& td
|
||||
);
|
||||
void hitProcessorPatch
|
||||
(
|
||||
const processorPolyPatch&,
|
||||
int&
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a wallPatch
|
||||
void hitWallPatch
|
||||
(
|
||||
const wallPolyPatch&,
|
||||
streamLineParticle::trackData& td
|
||||
);
|
||||
void hitWallPatch
|
||||
(
|
||||
const wallPolyPatch&,
|
||||
int&
|
||||
);
|
||||
|
||||
//- Overridable function to handle the particle hitting a polyPatch
|
||||
void hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
streamLineParticle::trackData& td
|
||||
);
|
||||
void hitPatch
|
||||
(
|
||||
const polyPatch&,
|
||||
int&
|
||||
);
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Read
|
||||
static void readFields(Cloud<streamLineParticle>&);
|
||||
|
||||
//- Write
|
||||
static void writeFields(const Cloud<streamLineParticle>&);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const streamLineParticle&);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,65 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "streamLineParticleCloud.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTemplateTypeNameAndDebug(Cloud<streamLineParticle>, 0);
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::streamLineParticleCloud::streamLineParticleCloud
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& cloudName,
|
||||
bool readFields
|
||||
)
|
||||
:
|
||||
Cloud<streamLineParticle>(mesh, cloudName, false)
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
streamLineParticle::readFields(*this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::streamLineParticleCloud::streamLineParticleCloud
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& cloudName,
|
||||
const IDLList<streamLineParticle>& particles
|
||||
)
|
||||
:
|
||||
Cloud<streamLineParticle>(mesh, cloudName, particles)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,97 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::streamLineCloud
|
||||
|
||||
Description
|
||||
A Cloud of streamLine particles
|
||||
|
||||
SourceFiles
|
||||
streamLineCloud.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef streamLineCloud_H
|
||||
#define streamLineCloud_H
|
||||
|
||||
#include "Cloud.H"
|
||||
#include "streamLineParticle.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class streamLineCloud Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class streamLineParticleCloud
|
||||
:
|
||||
public Cloud<streamLineParticle>
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
streamLineParticleCloud(const streamLineParticleCloud&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const streamLineParticleCloud&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Type of parcel the cloud was instantiated for
|
||||
typedef streamLineParticle parcelType;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given mesh
|
||||
streamLineParticleCloud
|
||||
(
|
||||
const polyMesh&,
|
||||
const word& cloudName = "defaultCloud",
|
||||
bool readFields = true
|
||||
);
|
||||
|
||||
//- Construct from mesh, cloud name, and a list of particles
|
||||
streamLineParticleCloud
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const word& cloudName,
|
||||
const IDLList<streamLineParticle>& particles
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -190,6 +190,7 @@ Foam::forces::forces
|
||||
directForceDensity_(false),
|
||||
fDName_(""),
|
||||
rhoRef_(VGREAT),
|
||||
pRef_(0),
|
||||
CofR_(vector::zero),
|
||||
forcesFilePtr_(NULL)
|
||||
{
|
||||
@ -211,12 +212,6 @@ Foam::forces::forces
|
||||
}
|
||||
|
||||
read(dict);
|
||||
|
||||
if (active_)
|
||||
{
|
||||
// Create the forces file if not already created
|
||||
makeFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -288,13 +283,15 @@ void Foam::forces::read(const dictionary& dict)
|
||||
Info<< " or " << rhoName_;
|
||||
}
|
||||
|
||||
Info<< " in database." << nl
|
||||
<< " De-activating forces."
|
||||
Info<< " in database." << nl << " De-activating forces."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Reference density needed for incompressible calculations
|
||||
rhoRef_ = readScalar(dict.lookup("rhoInf"));
|
||||
|
||||
// Reference pressure, 0 by default
|
||||
pRef_ = dict.lookupOrDefault<scalar>("pRef", 0.0);
|
||||
}
|
||||
|
||||
// Centre of rotation for moment calculations
|
||||
@ -317,16 +314,18 @@ void Foam::forces::makeFile()
|
||||
if (Pstream::master())
|
||||
{
|
||||
fileName forcesDir;
|
||||
word startTimeName =
|
||||
obr_.time().timeName(obr_.time().startTime().value());
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
forcesDir =
|
||||
obr_.time().path()/".."/name_/obr_.time().timeName();
|
||||
forcesDir = obr_.time().path()/".."/name_/startTimeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
forcesDir = obr_.time().path()/name_/obr_.time().timeName();
|
||||
forcesDir = obr_.time().path()/name_/startTimeName;
|
||||
}
|
||||
|
||||
// Create directory if does not exist.
|
||||
@ -447,13 +446,16 @@ Foam::forces::forcesMoments Foam::forces::calcForcesMoment() const
|
||||
const volSymmTensorField::GeometricBoundaryField& devRhoReffb
|
||||
= tdevRhoReff().boundaryField();
|
||||
|
||||
// Scale pRef by density for incompressible simulations
|
||||
scalar pRef = pRef_/rho(p);
|
||||
|
||||
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||
{
|
||||
label patchi = iter.key();
|
||||
|
||||
vectorField Md = mesh.C().boundaryField()[patchi] - CofR_;
|
||||
|
||||
vectorField pf = Sfb[patchi]*p.boundaryField()[patchi];
|
||||
vectorField pf = Sfb[patchi]*(p.boundaryField()[patchi] - pRef);
|
||||
|
||||
fm.first().first() += rho(p)*sum(pf);
|
||||
fm.second().first() += rho(p)*sum(Md ^ pf);
|
||||
|
||||
@ -144,6 +144,9 @@ protected:
|
||||
//- Reference density needed for incompressible calculations
|
||||
scalar rhoRef_;
|
||||
|
||||
//- Reference pressure
|
||||
scalar pRef_;
|
||||
|
||||
//- Centre of rotation
|
||||
vector CofR_;
|
||||
|
||||
|
||||
@ -29,6 +29,10 @@ License
|
||||
#include "dictionary.H"
|
||||
#include "dsmcCloud.H"
|
||||
|
||||
#include "constants.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -170,7 +174,8 @@ void Foam::dsmcFields::write()
|
||||
obr_,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
2.0/(3.0*dsmcCloud::kb*rhoNMean)
|
||||
|
||||
2.0/(3.0*physicoChemical::k.value()*rhoNMean)
|
||||
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean))
|
||||
);
|
||||
|
||||
@ -184,7 +189,7 @@ void Foam::dsmcFields::write()
|
||||
obr_,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
(2.0/dsmcCloud::kb)*(internalEMean/iDofMean)
|
||||
(2.0/physicoChemical::k.value())*(internalEMean/iDofMean)
|
||||
);
|
||||
|
||||
Info<< " Calculating overallT field." << endl;
|
||||
@ -197,7 +202,7 @@ void Foam::dsmcFields::write()
|
||||
obr_,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
2.0/(dsmcCloud::kb*(3.0*rhoNMean + iDofMean))
|
||||
2.0/(physicoChemical::k.value()*(3.0*rhoNMean + iDofMean))
|
||||
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean) + internalEMean)
|
||||
);
|
||||
|
||||
@ -211,7 +216,7 @@ void Foam::dsmcFields::write()
|
||||
obr_,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
dsmcCloud::kb*rhoNMean*translationalT
|
||||
physicoChemical::k.value()*rhoNMean*translationalT
|
||||
);
|
||||
|
||||
const fvMesh& mesh = fDMean.mesh();
|
||||
|
||||
@ -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,331 +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),
|
||||
faceZonesSet_(),
|
||||
fItems_(),
|
||||
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") >> fItems_;
|
||||
|
||||
dict.lookup("faceZones") >> faceZonesSet_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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(fItems_.size());
|
||||
|
||||
forAll(fItems_, Ifields)
|
||||
{
|
||||
const word& fieldName = fItems_[Ifields];
|
||||
|
||||
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 (faceZonesSet_, zoneI)
|
||||
{
|
||||
const word name = faceZonesSet_[zoneI];
|
||||
os << name << 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(fItems_, fieldI)
|
||||
{
|
||||
const word& fieldName = fItems_[fieldI];
|
||||
|
||||
const surfaceScalarField& sField =
|
||||
obr_.lookupObject<surfaceScalarField>(fieldName);
|
||||
|
||||
const fvMesh& mesh = sField.mesh();
|
||||
|
||||
// 1. integrate over all face zones
|
||||
|
||||
scalarField integralVals(faceZonesSet_.size());
|
||||
|
||||
forAll(faceZonesSet_, setI)
|
||||
{
|
||||
const word name = faceZonesSet_[setI];
|
||||
|
||||
label zoneID = mesh.faceZones().findZoneID(name);
|
||||
|
||||
const faceZone& fZone = mesh.faceZones()[zoneID];
|
||||
|
||||
integralVals[setI] = 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, setI)
|
||||
{
|
||||
os << ' ' << setw(w) << integralVals[setI];
|
||||
|
||||
if (log_)
|
||||
{
|
||||
Info<< "faceZonesIntegration output:" << nl
|
||||
<< " Integration[" << setI << "] "
|
||||
<< integralVals[setI] << 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_;
|
||||
|
||||
//- faceZones to integrate over
|
||||
wordList faceZonesSet_;
|
||||
|
||||
//- Names of the surface fields
|
||||
wordList fItems_;
|
||||
|
||||
|
||||
//- 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
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user