Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2011-02-18 17:52:42 +00:00
137 changed files with 40137 additions and 3464 deletions

View File

@ -65,8 +65,6 @@ lagrangian/Allwmake $*
postProcessing/Allwmake $*
mesh/Allwmake $*
wmake $makeOption errorEstimation
fvAgglomerationMethods/Allwmake $*
wmake $makeOption fvMotionSolver

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -137,7 +137,7 @@ Foam::IOdictionary::IOdictionary(const IOobject& io)
}
// Everyone check or just master
bool masterOnly =
bool masterOnly =
regIOobject::fileModificationChecking == timeStampMaster
|| regIOobject::fileModificationChecking == inotifyMaster;
@ -195,7 +195,7 @@ Foam::IOdictionary::IOdictionary(const IOobject& io, const dictionary& dict)
}
// Everyone check or just master
bool masterOnly =
bool masterOnly =
regIOobject::fileModificationChecking == timeStampMaster
|| regIOobject::fileModificationChecking == inotifyMaster;
@ -239,6 +239,18 @@ Foam::IOdictionary::IOdictionary(const IOobject& io, const dictionary& dict)
}
Foam::IOdictionary::IOdictionary(const IOobject& io, Istream& is)
:
regIOobject(io)
{
dictionary::name() = IOobject::objectPath();
// Note that we do construct the dictionary null and read in afterwards
// so that if there is some fancy massaging due to a functionEntry in
// the dictionary at least the type information is already complete.
is >> *this;
}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
Foam::IOdictionary::~IOdictionary()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -75,6 +75,9 @@ public:
//- Construct given an IOobject and dictionary
IOdictionary(const IOobject&, const dictionary&);
//- Construct given an IOobject and Istream
IOdictionary(const IOobject&, Istream&);
//- Destructor
virtual ~IOdictionary();

View File

@ -756,13 +756,14 @@ bool Foam::dictionary::changeKeyword
if (iter()->keyword().isPattern())
{
FatalErrorIn
FatalIOErrorIn
(
"dictionary::changeKeyword(const word&, const word&, bool)"
"dictionary::changeKeyword(const word&, const word&, bool)",
*this
) << "Old keyword "<< oldKeyword
<< " is a pattern."
<< "Pattern replacement not yet implemented."
<< exit(FatalError);
<< exit(FatalIOError);
}
@ -796,9 +797,10 @@ bool Foam::dictionary::changeKeyword
}
else
{
WarningIn
IOWarningIn
(
"dictionary::changeKeyword(const word&, const word&, bool)"
"dictionary::changeKeyword(const word&, const word&, bool)",
*this
) << "cannot rename keyword "<< oldKeyword
<< " to existing keyword " << newKeyword
<< " in dictionary " << name() << endl;
@ -830,9 +832,9 @@ bool Foam::dictionary::merge(const dictionary& dict)
// Check for assignment to self
if (this == &dict)
{
FatalErrorIn("dictionary::merge(const dictionary&)")
FatalIOErrorIn("dictionary::merge(const dictionary&)", *this)
<< "attempted merge to self for dictionary " << name()
<< abort(FatalError);
<< abort(FatalIOError);
}
bool changed = false;
@ -911,9 +913,9 @@ void Foam::dictionary::operator=(const dictionary& rhs)
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn("dictionary::operator=(const dictionary&)")
FatalIOErrorIn("dictionary::operator=(const dictionary&)", *this)
<< "attempted assignment to self for dictionary " << name()
<< abort(FatalError);
<< abort(FatalIOError);
}
name() = rhs.name();
@ -934,9 +936,9 @@ void Foam::dictionary::operator+=(const dictionary& rhs)
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn("dictionary::operator+=(const dictionary&)")
FatalIOErrorIn("dictionary::operator+=(const dictionary&)", *this)
<< "attempted addition assignment to self for dictionary " << name()
<< abort(FatalError);
<< abort(FatalIOError);
}
forAllConstIter(IDLList<entry>, rhs, iter)
@ -951,9 +953,9 @@ void Foam::dictionary::operator|=(const dictionary& rhs)
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn("dictionary::operator|=(const dictionary&)")
FatalIOErrorIn("dictionary::operator|=(const dictionary&)", *this)
<< "attempted assignment to self for dictionary " << name()
<< abort(FatalError);
<< abort(FatalIOError);
}
forAllConstIter(IDLList<entry>, rhs, iter)
@ -971,9 +973,9 @@ void Foam::dictionary::operator<<=(const dictionary& rhs)
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn("dictionary::operator<<=(const dictionary&)")
FatalIOErrorIn("dictionary::operator<<=(const dictionary&)", *this)
<< "attempted assignment to self for dictionary " << name()
<< abort(FatalError);
<< abort(FatalIOError);
}
forAllConstIter(IDLList<entry>, rhs, iter)

View File

@ -239,7 +239,7 @@ public:
//- Destructor
~dictionary();
virtual ~dictionary();
// Member functions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -95,17 +95,22 @@ Foam::tmp
>
Foam::GeometricField<Type, PatchField, GeoMesh>::readField(Istream& is)
{
if (is.version() < 2.0)
{
FatalIOErrorIn
return readField
(
IOdictionary
(
"GeometricField<Type, PatchField, GeoMesh>::readField(Istream&)",
IOobject
(
this->name(),
this->time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
is
) << "IO versions < 2.0 are not supported."
<< exit(FatalIOError);
}
return readField(dictionary(is));
)
);
}
@ -384,45 +389,6 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
}
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(
const IOobject& io,
const Mesh& mesh,
Istream& is
)
:
DimensionedField<Type, GeoMesh>(io, mesh, dimless, false),
timeIndex_(this->time().timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
boundaryField_(*this, readField(is))
{
// Check compatibility between field and mesh
if (this->size() != GeoMesh::size(this->mesh()))
{
FatalIOErrorIn
(
"GeometricField<Type, PatchField, GeoMesh>::GeometricField"
"(const IOobject&, const Mesh&, Istream&)",
is
) << " number of field elements = " << this->size()
<< " number of mesh elements = " << GeoMesh::size(this->mesh())
<< exit(FatalIOError);
}
readOldTimeIfPresent();
if (debug)
{
Info<< "Finishing read-construct of "
"GeometricField<Type, PatchField, GeoMesh>"
<< endl << this->info() << endl;
}
}
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -325,14 +325,6 @@ public:
const Mesh&
);
//- Construct and read from given stream
GeometricField
(
const IOobject&,
const Mesh&,
Istream&
);
//- Construct from dictionary
GeometricField
(

View File

@ -1,9 +0,0 @@
errorDrivenRefinement = errorDrivenRefinement
errorEstimate = errorEstimate
evaluateError = evaluateError
$(evaluateError)/evaluateError.C
$(errorDrivenRefinement)/errorDrivenRefinement.C
LIB = $(FOAM_LIBBIN)/liberrorEstimation

View File

@ -1,9 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-ldynamicMesh

View File

@ -1,277 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "errorDrivenRefinement.H"
#include "polyTopoChanger.H"
#include "polyMesh.H"
#include "primitiveMesh.H"
#include "polyTopoChange.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "evaluateError.H"
#include "fvc.H"
#include "mapPolyMesh.H"
#include "topoCellLooper.H"
#include "cellCuts.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(errorDrivenRefinement, 0);
addToRunTimeSelectionTable
(
polyMeshModifier,
errorDrivenRefinement,
dictionary
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from dictionary
Foam::errorDrivenRefinement::errorDrivenRefinement
(
const word& name,
const dictionary& dict,
const label index,
const polyTopoChanger& mme
)
:
polyMeshModifier(name, index, mme, false),
refinementEngine_(topoChanger().mesh(), true),
errorField_(dict.lookup("errorField"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::errorDrivenRefinement::~errorDrivenRefinement()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::errorDrivenRefinement::changeTopology() const
{
const Time& runTime = topoChanger().mesh().time();
if (runTime.foundObject<volVectorField>(errorField_))
{
if (debug)
{
Info<< "errorDrivenRefinement::changeTopology() : triggering topo"
<< " change since found errorField "
<< errorField_ << endl;
}
return true;
}
else
{
if (debug)
{
Info<< "errorDrivenRefinement::changeTopology() : no topo"
<< " change request from me since no errorField "
<< errorField_ << endl;
}
return false;
}
}
void Foam::errorDrivenRefinement::setRefinement(polyTopoChange& ref) const
{
// Insert the coarsen/refinement instructions into the topological change
if (debug)
{
Info<< "errorDrivenRefinement::setRefinement(polyTopoChange& ref)"
<< endl;
}
const polyMesh& mesh = topoChanger().mesh();
const Time& runTime = mesh.time();
if (debug)
{
Info<< "Looking up vector field with name " << errorField_ << endl;
}
const volVectorField& resError =
runTime.lookupObject<volVectorField>(errorField_);
const volScalarField magResError(Foam::mag(resError));
scalar min = Foam::min(magResError).value();
scalar max = Foam::max(magResError).value();
scalar avg = Foam::average(magResError).value();
if (debug)
{
Info<< "Writing magResError" << endl;
magResError.write();
Info<< "min:" << min << " max:" << max << " avg:" << avg << endl;
}
// Get faces to remove and cells to refine based on error
evaluateError refPattern
(
magResError, // Error on cells
resError, // Error vector on cells
fvc::interpolate(magResError), // Error on faces
refinementEngine_.getSplitFaces() // Current live split faces
);
// Insert mesh refinement into polyTopoChange:
// - remove split faces
// - refine cells
// Give 'hint' of faces to remove to cell splitter.
const labelList& candidates = refPattern.unsplitFaces();
////Hack:no unsplitting
//labelList candidates;
labelList removedFaces(refinementEngine_.removeSplitFaces(candidates, ref));
// Now success will be for every candidates whether face has been removed.
// Protect cells using face from refinement.
// List of protected cells
boolList markedCell(mesh.nCells(), false);
forAll(removedFaces, i)
{
label faceI = removedFaces[i];
markedCell[mesh.faceOwner()[faceI]] = true;
if (mesh.isInternalFace(faceI))
{
markedCell[mesh.faceNeighbour()[faceI]] = true;
}
}
// Repack list of cells to refine.
List<refineCell> refCells = refPattern.refCells();
label newRefCellI = 0;
forAll(refCells, refCellI)
{
label cellI = refCells[refCellI].cellNo();
if (!markedCell[cellI] && (newRefCellI != refCellI))
{
refCells[newRefCellI++] = refCells[refCellI];
}
}
if (debug)
{
Info<< "errorDrivenRefinement : shrinking refCells from "
<< refCells.size()
<< " to " << newRefCellI << endl;
}
refCells.setSize(newRefCellI);
// Determine cut pattern using topological cell walker
topoCellLooper cellWalker(mesh);
cellCuts cuts(mesh, cellWalker, refCells);
// Do actual splitting
refinementEngine_.setRefinement(cuts, ref);
}
// Has the responsability of moving my newly introduced points onto the right
// place. This is since the whole mesh might e.g. have been moved by another
// meshmodifier. So using preMotionPoints is hack for if I am only meshModifier.
// Good solution:
// - remember new point label of introduced point and vertices
// of edge it is created from (in setRefinement)
// - in here reposition point at correct position between current vertex
// position of edge endpoints.
void Foam::errorDrivenRefinement::modifyMotionPoints
(
pointField& motionPoints
) const
{
if (debug)
{
Info<< "errorDrivenRefinement::modifyMotionPoints(*pointField&)"
<< endl;
}
}
void Foam::errorDrivenRefinement::updateMesh(const mapPolyMesh& morphMap)
{
// Mesh has changed topologically. Update local topological data
if (debug)
{
Info<< "errorDrivenRefinement::updateMesh"
<< "(const mapPolyMesh& morphMap)" << endl;
}
refinementEngine_.updateMesh(morphMap);
}
void Foam::errorDrivenRefinement::write(Ostream& os) const
{
os << nl << type() << nl;
}
void Foam::errorDrivenRefinement::writeDict(Ostream& os) const
{
os << nl << name() << nl << token::BEGIN_BLOCK << nl
<< " type " << type()
<< token::END_STATEMENT << nl
<< token::END_BLOCK << endl;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -1,136 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::errorDrivenRefinement
Description
Refines and coarsens based on error estimate.
SourceFiles
errorDrivenRefinement.C
\*---------------------------------------------------------------------------*/
#ifndef errorDrivenRefinement_H
#define errorDrivenRefinement_H
#include "polyMeshModifier.H"
#include "undoableMeshCutter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
/*---------------------------------------------------------------------------*\
Class errorDrivenRefinement Declaration
\*---------------------------------------------------------------------------*/
class errorDrivenRefinement
:
public polyMeshModifier
{
// Private data
//- Refinement/coarsening engine
mutable undoableMeshCutter refinementEngine_;
//- Name of volVectorField which contains error.
word errorField_;
// Private Member Functions
//- Disallow default bitwise copy construct
errorDrivenRefinement(const errorDrivenRefinement&);
//- Disallow default bitwise assignment
void operator=(const errorDrivenRefinement&);
public:
//- Runtime type information
TypeName("errorDrivenRefinement");
// Constructors
//- Construct from dictionary
errorDrivenRefinement
(
const word& name,
const dictionary& dict,
const label index,
const polyTopoChanger& mme
);
//- Destructor
virtual ~errorDrivenRefinement();
// Member Functions
//- Check for topology change
virtual bool changeTopology() const;
//- Insert the layer addition/removal instructions
// into the topological change
virtual void setRefinement(polyTopoChange&) const;
//- Modify motion points to comply with the topological change
virtual void modifyMotionPoints(pointField& motionPoints) const;
//- Force recalculation of locally stored data on topological change
virtual void updateMesh(const mapPolyMesh&);
//- Write
virtual void write(Ostream&) const;
//- Write dictionary
virtual void writeDict(Ostream&) const;
// Access
//- Underlying mesh modifier
const undoableMeshCutter& refinementEngine() const
{
return refinementEngine_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

File diff suppressed because it is too large Load Diff

View File

@ -1,542 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::errorEstimate
Description
Residual error estimation
SourceFiles
errorEstimate.C
\*---------------------------------------------------------------------------*/
#ifndef errorEstimate_H
#define errorEstimate_H
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class errorEstimate Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class errorEstimate
:
public refCount
{
// Private data
// Reference to GeometricField<Type, fvPatchField, volMesh>
const GeometricField<Type, fvPatchField, volMesh>& psi_;
//- Dimension set
dimensionSet dimensions_;
//- Cell residual pointer
Field<Type> residual_;
//- Normalisation factor
scalarField normFactor_;
// Private Member Functions
//- Return boundary condition types for the error field
wordList errorBCTypes() const;
public:
// Static data members
ClassName("errorEstimate");
// Constructors
//- Construct from components
errorEstimate
(
const GeometricField<Type, fvPatchField, volMesh>& psi,
const dimensionSet& ds,
const Field<Type>& res,
const scalarField& norm
);
//- Construct as copy
errorEstimate(const errorEstimate<Type>&);
//- Destructor
~errorEstimate();
// Member Functions
// Access
//- Return field
const GeometricField<Type, fvPatchField, volMesh>& psi() const
{
return psi_;
}
//- Return residual dimensions
const dimensionSet& dimensions() const
{
return dimensions_;
}
// Raw residual (for calculus)
Field<Type>& res()
{
return residual_;
}
const Field<Type>& res() const
{
return residual_;
}
// Error Estimate
//- Cell residual (volume intensive)
tmp<GeometricField<Type, fvPatchField, volMesh> > residual() const;
//- Normalisation factor
tmp<volScalarField> normFactor() const;
//- Error estimate
tmp<GeometricField<Type, fvPatchField, volMesh> > error() const;
// Member Operators
void operator=(const errorEstimate<Type>&);
void operator=(const tmp<errorEstimate<Type> >&);
void negate();
void operator+=(const errorEstimate<Type>&);
void operator+=(const tmp<errorEstimate<Type> >&);
void operator-=(const errorEstimate<Type>&);
void operator-=(const tmp<errorEstimate<Type> >&);
void operator+=(const GeometricField<Type,fvPatchField,volMesh>&);
void operator+=(const tmp<GeometricField<Type,fvPatchField,volMesh> >&);
void operator-=(const GeometricField<Type,fvPatchField,volMesh>&);
void operator-=(const tmp<GeometricField<Type,fvPatchField,volMesh> >&);
void operator+=(const dimensioned<Type>&);
void operator-=(const dimensioned<Type>&);
void operator*=(const volScalarField&);
void operator*=(const tmp<volScalarField>&);
void operator*=(const dimensioned<scalar>&);
// Friend Functions
// Friend Operators
};
// * * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * //
template<class Type>
void checkMethod
(
const errorEstimate<Type>&,
const errorEstimate<Type>&,
const char*
);
template<class Type>
void checkMethod
(
const errorEstimate<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const char*
);
template<class Type>
void checkMethod
(
const errorEstimate<Type>&,
const dimensioned<Type>&,
const char*
);
// * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * //
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const errorEstimate<Type>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<errorEstimate<Type> >&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const errorEstimate<Type>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<errorEstimate<Type> >&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const errorEstimate<Type>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<errorEstimate<Type> >&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const errorEstimate<Type>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<errorEstimate<Type> >&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const errorEstimate<Type>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const tmp<errorEstimate<Type> >&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const errorEstimate<Type>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const tmp<errorEstimate<Type> >&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const errorEstimate<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<errorEstimate<Type> >&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const errorEstimate<Type>&,
const tmp<GeometricField<Type, fvPatchField, volMesh> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<errorEstimate<Type> >&,
const tmp<GeometricField<Type, fvPatchField, volMesh> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const GeometricField<Type, fvPatchField, volMesh>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const GeometricField<Type, fvPatchField, volMesh>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const errorEstimate<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<errorEstimate<Type> >&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const errorEstimate<Type>&,
const tmp<GeometricField<Type, fvPatchField, volMesh> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<errorEstimate<Type> >&,
const tmp<GeometricField<Type, fvPatchField, volMesh> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const GeometricField<Type, fvPatchField, volMesh>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const GeometricField<Type, fvPatchField, volMesh>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const tmp<errorEstimate<Type> >&,
const dimensioned<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator+
(
const dimensioned<Type>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const tmp<errorEstimate<Type> >&,
const dimensioned<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator-
(
const dimensioned<Type>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const errorEstimate<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const tmp<errorEstimate<Type> >&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const errorEstimate<Type>&,
const tmp<GeometricField<Type, fvPatchField, volMesh> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const tmp<errorEstimate<Type> >&,
const tmp<GeometricField<Type, fvPatchField, volMesh> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const errorEstimate<Type>&,
const dimensioned<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator==
(
const tmp<errorEstimate<Type> >&,
const dimensioned<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator*
(
const volScalarField&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator*
(
const volScalarField&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator*
(
const tmp<volScalarField>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator*
(
const tmp<volScalarField>&,
const tmp<errorEstimate<Type> >&
);
template<class Type>
tmp<errorEstimate<Type> > operator*
(
const dimensioned<scalar>&,
const errorEstimate<Type>&
);
template<class Type>
tmp<errorEstimate<Type> > operator*
(
const dimensioned<scalar>&,
const tmp<errorEstimate<Type> >&
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "errorEstimate.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,43 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::resError
Description
Namespace for residual error estimate operators.
\*---------------------------------------------------------------------------*/
#ifndef resError_H
#define resError_H
#include "resErrorDiv.H"
#include "resErrorLaplacian.H"
#include "resErrorSup.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,168 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "resErrorDiv.H"
#include "fvc.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace resError
{
template<class Type>
tmp<errorEstimate<Type> >
div
(
const surfaceScalarField& flux,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = vf.mesh();
const scalarField& vols = mesh.V();
const surfaceVectorField& faceCentres = mesh.Cf();
const volVectorField& cellCentres = mesh.C();
const fvPatchList& patches = mesh.boundary();
const labelUList& owner = mesh.owner();
const labelUList& neighbour = mesh.neighbour();
Field<Type> res(vols.size(), pTraits<Type>::zero);
scalarField aNorm(vols.size(), 0.0);
// Get sign of flux
const surfaceScalarField signF(pos(flux));
// Calculate gradient of the solution
GeometricField
<
typename outerProduct<vector, Type>::type, fvPatchField, volMesh
>
gradVf(fvc::grad(vf));
// Internal faces
forAll(owner, faceI)
{
// Calculate the centre of the face
const vector& curFaceCentre = faceCentres[faceI];
// Owner
vector ownD = curFaceCentre - cellCentres[owner[faceI]];
// Subtract convection
res[owner[faceI]] -=
(
vf[owner[faceI]]
+ (ownD & gradVf[owner[faceI]])
)*flux[faceI];
aNorm[owner[faceI]] += signF[faceI]*flux[faceI];
// Neighbour
vector neiD = curFaceCentre - cellCentres[neighbour[faceI]];
// Subtract convection
res[neighbour[faceI]] +=
(
vf[neighbour[faceI]]
+ (neiD & gradVf[neighbour[faceI]])
)*flux[faceI];
aNorm[neighbour[faceI]] -= (1.0 - signF[faceI])*flux[faceI];
}
forAll(patches, patchI)
{
const vectorField& patchFaceCentres =
faceCentres.boundaryField()[patchI];
const scalarField& patchFlux = flux.boundaryField()[patchI];
const scalarField& patchSignFlux = signF.boundaryField()[patchI];
const labelList& fCells = patches[patchI].faceCells();
forAll(fCells, faceI)
{
vector d =
patchFaceCentres[faceI] - cellCentres[fCells[faceI]];
// Subtract convection
res[fCells[faceI]] -=
(
vf[fCells[faceI]]
+ (d & gradVf[fCells[faceI]])
)*patchFlux[faceI];
aNorm[fCells[faceI]] += patchSignFlux[faceI]*patchFlux[faceI];
}
}
res /= vols;
aNorm /= vols;
return tmp<errorEstimate<Type> >
(
new errorEstimate<Type>
(
vf,
flux.dimensions()*vf.dimensions(),
res,
aNorm
)
);
}
template<class Type>
tmp<errorEstimate<Type> >
div
(
const tmp<surfaceScalarField>& tflux,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > Div(resError::div(tflux(), vf));
tflux.clear();
return Div;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace resError
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,80 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InNamespace
Foam::resError
Description
Residual error estimate for the fv convection operators.
SourceFiles
resErrorDiv.C
\*---------------------------------------------------------------------------*/
#ifndef resErrorDiv_H
#define resErrorDiv_H
#include "errorEstimate.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace resError
{
// Divergence terms
template<class Type>
tmp<errorEstimate<Type> > div
(
const surfaceScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > div
(
const tmp<surfaceScalarField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
} // End namespace resError
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "resErrorDiv.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,292 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "resErrorLaplacian.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace resError
{
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
surfaceScalarField Gamma
(
IOobject
(
"gamma",
vf.time().constant(),
vf.db(),
IOobject::NO_READ
),
vf.mesh(),
dimensionedScalar("1", dimless, 1.0)
);
return resError::laplacian(Gamma, vf);
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const dimensionedScalar& gamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
surfaceScalarField Gamma
(
IOobject
(
gamma.name(),
vf.time().timeName(),
vf.db(),
IOobject::NO_READ
),
vf.mesh(),
gamma
);
return resError::laplacian(Gamma, vf);
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const volScalarField& gamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return resError::laplacian(fvc::interpolate(gamma), vf);
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const tmp<volScalarField>& tgamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > Laplacian(resError::laplacian(tgamma(), vf));
tgamma.clear();
return Laplacian;
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const surfaceScalarField& gamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = vf.mesh();
const scalarField& vols = mesh.V();
const surfaceVectorField& Sf = mesh.Sf();
const surfaceScalarField magSf(mesh.magSf());
const fvPatchList& patches = mesh.boundary();
const labelUList& owner = mesh.owner();
const labelUList& neighbour = mesh.neighbour();
const surfaceScalarField& delta =
mesh.surfaceInterpolation::deltaCoeffs();
Field<Type> res(vols.size(), pTraits<Type>::zero);
scalarField aNorm(vols.size(), 0.0);
// Calculate gradient of the solution
GeometricField
<
typename outerProduct<vector, Type>::type, fvPatchField, volMesh
>
gradVf(fvc::grad(vf));
// Internal faces
forAll(owner, faceI)
{
// Owner
// Subtract diffusion
res[owner[faceI]] -=
gamma[faceI]*(Sf[faceI] & gradVf[owner[faceI]]);
aNorm[owner[faceI]] += delta[faceI]*gamma[faceI]*magSf[faceI];
// Neighbour
// Subtract diffusion
res[neighbour[faceI]] +=
gamma[faceI]*(Sf[faceI] & gradVf[neighbour[faceI]]);
aNorm[neighbour[faceI]] += delta[faceI]*gamma[faceI]*magSf[faceI];
}
forAll(patches, patchI)
{
const vectorField& patchSf = Sf.boundaryField()[patchI];
const scalarField& patchMagSf = magSf.boundaryField()[patchI];
const scalarField& patchGamma = gamma.boundaryField()[patchI];
const scalarField& patchDelta = delta.boundaryField()[patchI];
const labelList& fCells = patches[patchI].faceCells();
forAll(fCells, faceI)
{
// Subtract diffusion
res[fCells[faceI]] -=
patchGamma[faceI]*
(
patchSf[faceI] & gradVf[fCells[faceI]]
);
aNorm[fCells[faceI]] +=
patchDelta[faceI]*patchGamma[faceI]*patchMagSf[faceI];
}
}
res /= vols;
aNorm /= vols;
return tmp<errorEstimate<Type> >
(
new errorEstimate<Type>
(
vf,
delta.dimensions()*gamma.dimensions()*magSf.dimensions()
*vf.dimensions(),
res,
aNorm
)
);
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const tmp<surfaceScalarField>& tgamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > tresError(resError::laplacian(tgamma(), vf));
tgamma.clear();
return tresError;
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const volTensorField& gamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = vf.mesh();
return resError::laplacian
(
(mesh.Sf() & fvc::interpolate(gamma) & mesh.Sf())
/sqr(mesh.magSf()),
vf
);
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const tmp<volTensorField>& tgamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > Laplacian = resError::laplacian(tgamma(), vf);
tgamma.clear();
return Laplacian;
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const surfaceTensorField& gamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = vf.mesh();
return resError::laplacian
(
(mesh.Sf() & gamma & mesh.Sf())/sqr(mesh.magSf()),
vf
);
}
template<class Type>
tmp<errorEstimate<Type> >
laplacian
(
const tmp<surfaceTensorField>& tgamma,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > Laplacian = resError::laplacian(tgamma(), vf);
tgamma.clear();
return Laplacian;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace resError
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,134 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InNamespace
Foam::resError
Description
Residual error estimate for the fv laplacian operators
SourceFiles
resErrorLaplacian.C
\*---------------------------------------------------------------------------*/
#ifndef resErrorLaplacian_H
#define resErrorLaplacian_H
#include "errorEstimate.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace resError
{
// Laplacian terms
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const dimensionedScalar&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const volScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const tmp<volScalarField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const surfaceScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const tmp<surfaceScalarField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const volTensorField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const tmp<volTensorField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const surfaceTensorField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > laplacian
(
const tmp<surfaceTensorField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "resErrorLaplacian.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,130 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "resErrorSup.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace resError
{
template<class Type>
tmp<errorEstimate<Type> >
Sp
(
const volScalarField& sp,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return tmp<errorEstimate<Type> >
(
new errorEstimate<Type>
(
vf,
sp.dimensions()*vf.dimensions(),
sp.internalField()*vf.internalField(),
scalarField(vf.internalField().size(), 0)
)
);
}
template<class Type>
tmp<errorEstimate<Type> >
Sp
(
const tmp<volScalarField>& tsp,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > tee = resError::Sp(tsp(), vf);
tsp.clear();
return tee;
}
template<class Type>
tmp<errorEstimate<Type> >
Sp
(
const dimensionedScalar& sp,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return tmp<errorEstimate<Type> >
(
new errorEstimate<Type>
(
vf,
sp.dimensions()*vf.dimensions(),
sp.value()*vf.internalField(),
scalarField(vf.internalField().size(), 0)
)
);
}
template<class Type>
tmp<errorEstimate<Type> >
SuSp
(
const volScalarField& sp,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return Sp(sp, vf);
}
template<class Type>
tmp<errorEstimate<Type> >
SuSp
(
const tmp<volScalarField>& tsp,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<errorEstimate<Type> > tee = resError::SuSp(tsp(), vf);
tsp.clear();
return tee;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace resError
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,106 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InNamespace
Foam::resError
Description
Residual error estimate for the fv source operators
SourceFiles
resErrorSup.C
\*---------------------------------------------------------------------------*/
#ifndef resErrorSup_H
#define resErrorSup_H
#include "errorEstimate.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace resError
{
// Implicit source
template<class Type>
tmp<errorEstimate<Type> > Sp
(
const volScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > Sp
(
const tmp<volScalarField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > Sp
(
const dimensionedScalar&,
const GeometricField<Type, fvPatchField, volMesh>&
);
// Implicit/Explicit source depending on sign of coefficient
template<class Type>
tmp<errorEstimate<Type> > SuSp
(
const volScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<errorEstimate<Type> > SuSp
(
const tmp<volScalarField>&,
const GeometricField<Type, fvPatchField, volMesh>&
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "resErrorSup.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,164 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "evaluateError.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "refineCell.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct null
Foam::evaluateError::evaluateError()
:
unsplitFaces_(),
refCells_()
{}
// Construct from components
Foam::evaluateError::evaluateError
(
const volScalarField& cellError,
const volVectorField& gradTheta,
const surfaceScalarField& faceError,
const labelList& candidateFaces
)
:
unsplitFaces_(candidateFaces.size()),
refCells_()
{
const polyMesh& mesh = cellError.mesh();
// picks up the error field and the gradient of the variable
// and appends lists of cells to refine/unrefine based on the width of
// standard deviation of the error distribution
// calculate the average error
scalar avgError = cellError.average().value();
scalar squareError = sqr(cellError)().average().value();
scalar deviation = sqrt(squareError - sqr(avgError));
Info<< "avgError:" << avgError
<< " squareError:" << squareError
<< " deviation:" << deviation
<< endl;
scalar ref = avgError + deviation;
scalar unref = avgError - deviation;
Info<< "evaluateError : refinement criterion : " << ref << endl
<< " unrefinement criterion : " << unref << endl;
// Coarsen mesh first.
// Find out set of candidateFaces where error is above crit.
// Construct to filter unrefinement pattern
// removeFaces faceRemover(mesh);
// Keep track of unrefinement pattern.
boolList markedFace(mesh.nFaces(), false);
label unsplitFaceI = 0;
// Subset candidate faces and update refinement pattern interference pattern
forAll(candidateFaces, candidateFaceI)
{
label faceI = candidateFaces[candidateFaceI];
if (markedFace[faceI])
{
Info<< "evaluateError : protected candidate face:" << faceI
<< endl;
}
else
{
// if (faceError[faceI] < unref)
if (unsplitFaceI < (candidateFaces.size()/2 + 1))
{
unsplitFaces_[unsplitFaceI++] = faceI;
// faceRemover.markAffectedFaces(faceI, markedFace);
}
}
}
unsplitFaces_.setSize(unsplitFaceI);
// Now we have:
// -unsplitFaces_: all the faces that will be removed
// -markedFace : all the faces affected by this removal.
// From markedFace protect the cells using them.
boolList markedCells(mesh.nCells(), false);
// forAll(markedFace, faceI)
// {
// if (markedFace[faceI])
// {
// markedCells[mesh.faceOwner()[faceI]] = true;
//
// if (mesh.isInternalFace(faceI))
// {
// markedCells[mesh.faceNeighbour()[faceI]] = true;
// }
// }
// }
// Select the cells that need to be split.
// Two pass: count first, select later.
label refCellI = 0;
forAll(cellError, cellI)
{
if ((cellError[cellI] > ref) && !markedCells[cellI])
{
refCellI++;
}
}
refCells_.setSize(refCellI);
refCellI = 0;
forAll(cellError, cellI)
{
if ((cellError[cellI] > ref) && !markedCells[cellI])
{
refCells_[refCellI++] = refineCell(cellI, gradTheta[cellI]);
}
}
Info<< "evaluateError : selected " << unsplitFaces_.size()
<< " faces out of " << candidateFaces.size() << " for removal" << endl;
Info<< "evaluateError : selected " << refCells_.size()
<< " cells out of " << cellError.size() << " for refinement" << endl;
}
// ************************************************************************* //

View File

@ -1,116 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::evaluateError
Description
Foam::evaluateError
SourceFiles
evaluateError.C
\*---------------------------------------------------------------------------*/
#ifndef evaluateError_H
#define evaluateError_H
#include "labelList.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class refineCell;
/*---------------------------------------------------------------------------*\
Class evaluateError Declaration
\*---------------------------------------------------------------------------*/
class evaluateError
{
// Private data
// splitFaces to remove.
labelList unsplitFaces_;
// cells to refine.
List<refineCell> refCells_;
// Private Member Functions
public:
// Constructors
//- Construct null
evaluateError();
//- Construct from error value, error direction. Determine faces to
// remove (out of candidate faces) and cells to refine (all cells):
//
// remove all faces where the (face)error is less than
// average - standard deviation
// refine all cells where the (cell)error is more than
// average + standard deviation. gradTheta is used to determine
// direction to refine in.
evaluateError
(
const volScalarField& cellError,
const volVectorField& gradTheta,
const surfaceScalarField& faceError,
const labelList& candidateFaces
);
// Member Functions
const labelList& unsplitFaces() const
{
return unsplitFaces_;
}
const List<refineCell>& refCells() const
{
return refCells_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -35,14 +35,14 @@ namespace Foam
template<class ReactionThermo>
inline word& Reaction<ReactionThermo>::name()
{
return name();
return name_;
}
template<class ReactionThermo>
inline const word& Reaction<ReactionThermo>::name() const
{
return name();
return name_;
}

View File

@ -133,7 +133,7 @@ void Foam::ReactionList<ThermoType>::write(Ostream& os) const
const Reaction<ThermoType>& r = iter();
os << indent << r.name() << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("type") << r.type() << nl;
os.writeKeyword("type") << r.type() << token::END_STATEMENT << nl;
r.write(os);
os << decrIndent << indent << token::END_BLOCK << nl;
}