Removed superfluous; Synced duplicated files; Converted binary files

This commit is contained in:
Henrik Rusche 2016-06-21 11:09:08 +02:00
parent f3349eb31b
commit d5852c09da
52 changed files with 0 additions and 157050 deletions

View file

@ -1,701 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "extrapolatedFvPatchField.H"
#include "surfaceFields.H"
#include "dictionary.H"
#include "emptyPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "scalarMatrices.H"
#include "volFields.H"
#include "skewCorrectionVectors.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
extrapolatedFvPatchField<Type>::extrapolatedFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
mixedFvPatchField<Type>(p, iF),
iPoints_(p.size()),
zeroGradient_(true),
fixesValue_(false)
{}
template<class Type>
extrapolatedFvPatchField<Type>::extrapolatedFvPatchField
(
const extrapolatedFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchField<Type>(ptf, p, iF, mapper),
iPoints_(p.size()),
zeroGradient_(ptf.zeroGradient_),
fixesValue_(ptf.fixesValue_)
{}
template<class Type>
extrapolatedFvPatchField<Type>::extrapolatedFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchField<Type>(p, iF),
iPoints_(p.size()),
zeroGradient_(true),
fixesValue_(false)
{
if (dict.found("zeroGradient"))
{
zeroGradient_ = Switch(dict.lookup("zeroGradient"));
}
this->valueFraction() = 0;
if (dict.found("fixesValue"))
{
fixesValue_ = Switch(dict.lookup("fixesValue"));
this->valueFraction() = 1.0;
}
if (dict.found("refValue"))
{
this->refValue() = Field<Type>("refValue", dict, p.size());
}
else
{
this->refValue() = pTraits<Type>::zero;
}
if (dict.found("refGradient"))
{
this->refGrad() = Field<Type>("refGradient", dict, p.size());
}
else
{
this->refGrad() = pTraits<Type>::zero;
}
if (dict.found("value"))
{
Field<Type>::operator=(Field<Type>("value", dict, p.size()));
}
else
{
mixedFvPatchField<Type>::evaluate();
}
// this->refValue() = pTraits<Type>::zero;
// this->refGrad() = pTraits<Type>::zero;
}
template<class Type>
extrapolatedFvPatchField<Type>::extrapolatedFvPatchField
(
const extrapolatedFvPatchField<Type>& ptf
)
:
mixedFvPatchField<Type>(ptf),
iPoints_(ptf.size()),
zeroGradient_(ptf.zeroGradient_),
fixesValue_(ptf.fixesValue_)
{}
template<class Type>
extrapolatedFvPatchField<Type>::extrapolatedFvPatchField
(
const extrapolatedFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
mixedFvPatchField<Type>(ptf, iF),
iPoints_(ptf.size()),
zeroGradient_(ptf.zeroGradient_),
fixesValue_(ptf.fixesValue_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void extrapolatedFvPatchField<Type>::autoMap
(
const fvPatchFieldMapper& m
)
{
mixedFvPatchField<Type>::autoMap(m);
// gradient_.autoMap(m);
}
template<class Type>
void extrapolatedFvPatchField<Type>::rmap
(
const fvPatchField<Type>& ptf,
const labelList& addr
)
{
mixedFvPatchField<Type>::rmap(ptf, addr);
// const extrapolatedFvPatchField<Type>& fgptf =
// refCast<const extrapolatedFvPatchField<Type> >(ptf);
// gradient_.rmap(fgptf.gradient_, addr);
}
template<class Type>
void extrapolatedFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
const fvMesh& mesh = this->patch().boundaryMesh().mesh();
const cellList& cells = mesh.cells();
const unallocLabelList& owner = mesh.owner();
const unallocLabelList& neighbour = mesh.neighbour();
const unallocLabelList& patchCells = this->patch().faceCells();
const surfaceScalarField& weights = mesh.weights();
const vectorField& faceCentres = mesh.faceCentres();
const vectorField& cellCentres = mesh.cellCentres();
skewCorrectionVectors scv(mesh);
vectorField n = this->patch().nf();
iPoints_.clear();
iPoints_.setSize(this->patch().size());
forAll(patchCells, faceI)
{
label curCell = patchCells[faceI];
const labelList& curCellFaces = cells[curCell];
iPoints_.set(faceI, new DynamicList<vector>());
// Add face centre points
forAll(curCellFaces, fI)
{
label curFace = curCellFaces[fI];
label patchID = mesh.boundaryMesh().whichPatch(curFace);
if(mesh.isInternalFace(curFace))
{
vector curFaceIntersection =
weights[curFace]
*(
cellCentres[owner[curFace]]
- cellCentres[neighbour[curFace]]
)
+ cellCentres[neighbour[curFace]];
iPoints_[faceI].append(curFaceIntersection);
}
else if (patchID != this->patch().index())
{
if
(
mesh.boundaryMesh()[patchID].type()
== cyclicPolyPatch::typeName
)
{
label start = mesh.boundaryMesh()[patchID].start();
label localFaceID = curFace - start;
const unallocLabelList& cycPatchCells =
mesh.boundaryMesh()[patchID].faceCells();
label sizeby2 = cycPatchCells.size()/2;
if (localFaceID < sizeby2)
{
vector curFaceIntersection =
weights[curFace]
*(
cellCentres[cycPatchCells[localFaceID]]
- cellCentres
[
cycPatchCells[localFaceID + sizeby2]
]
)
+ cellCentres
[
cycPatchCells[localFaceID + sizeby2]
];
iPoints_[faceI].append(curFaceIntersection);
}
else
{
vector curFaceIntersection =
weights[curFace]
*(
cellCentres[cycPatchCells[localFaceID]]
- cellCentres
[
cycPatchCells[localFaceID - sizeby2]
]
)
+ cellCentres
[
cycPatchCells[localFaceID - sizeby2]
];
iPoints_[faceI].append(curFaceIntersection);
}
}
else if
(
mesh.boundaryMesh()[patchID].type()
== processorPolyPatch::typeName
)
{
label start = mesh.boundaryMesh()[patchID].start();
label localFaceID = curFace - start;
const unallocLabelList& procPatchCells =
mesh.boundaryMesh()[patchID].faceCells();
iPoints_[faceI].append
(
weights.boundaryField()[patchID][localFaceID]
*(
cellCentres[procPatchCells[localFaceID]]
- mesh.C().boundaryField()[patchID][localFaceID]
)
+ mesh.C().boundaryField()[patchID][localFaceID]
);
}
else if
(
mesh.boundaryMesh()[patchID].type()
== emptyPolyPatch::typeName
)
{
iPoints_[faceI].append(faceCentres[curFace]);
}
else
{
// Normal patches
iPoints_[faceI].append(faceCentres[curFace]);
}
}
}
}
mixedFvPatchField<Type>::updateCoeffs();
}
template<class Type>
void extrapolatedFvPatchField<Type>::evaluate(const Pstream::commsTypes)
{
if (!this->updated())
{
this->updateCoeffs();
}
const fvMesh& mesh = this->patch().boundaryMesh().mesh();
const cellList& cells = mesh.cells();
const unallocLabelList& owner = mesh.owner();
const unallocLabelList& neighbour = mesh.neighbour();
const unallocLabelList& patchCells = this->patch().faceCells();
const surfaceScalarField& weights = mesh.weights();
// const vectorField& faceCentres = mesh.faceCentres();
const vectorField& cellCentres = mesh.cellCentres();
const Field<Type>& phiI = this->internalField();
word fieldName =
this->dimensionedInternalField().name();
const GeometricField<Type, fvPatchField, volMesh>& phi =
mesh.lookupObject<GeometricField<Type, fvPatchField, volMesh> >
(
fieldName
);
vectorField n = this->patch().nf();
const vectorField& C = this->patch().Cf();
Field<Type> patchPhi(this->patch().size(), pTraits<Type>::zero);
forAll(patchCells, faceI)
{
label curCell = patchCells[faceI];
const labelList& curCellFaces = cells[curCell];
DynamicList<Type> iPhi;
// DynamicList<vector> iPoint;
// // Add first cell centre point
// iPhi.append(phiI[curCell]);
// iPoint.append(cellCentres[curCell]);
// Add face centre points
forAll(curCellFaces, fI)
{
label curFace = curCellFaces[fI];
label patchID = mesh.boundaryMesh().whichPatch(curFace);
if(mesh.isInternalFace(curFace))
{
iPhi.append
(
weights[curFace]
*(
phiI[owner[curFace]]
- phiI[neighbour[curFace]]
)
+ phiI[neighbour[curFace]]
);
// vector curFaceIntersection =
// weights[curFace]
// *(
// cellCentres[owner[curFace]]
// - cellCentres[neighbour[curFace]]
// )
// + cellCentres[neighbour[curFace]];
// iPoint.append(curFaceIntersection);
}
else if (patchID != this->patch().index())
{
if
(
mesh.boundaryMesh()[patchID].type()
== cyclicPolyPatch::typeName
)
{
label start = mesh.boundaryMesh()[patchID].start();
label localFaceID = curFace - start;
const unallocLabelList& cycPatchCells =
mesh.boundaryMesh()[patchID].faceCells();
label sizeby2 = cycPatchCells.size()/2;
if (localFaceID < sizeby2)
{
iPhi.append
(
weights.boundaryField()[patchID][localFaceID]
*(
phiI[cycPatchCells[localFaceID]]
- phiI[cycPatchCells[localFaceID + sizeby2]]
)
+ phiI[cycPatchCells[localFaceID + sizeby2]]
);
// vector curFaceIntersection =
// weights[curFace]
// *(
// cellCentres[cycPatchCells[localFaceID]]
// - cellCentres
// [
// cycPatchCells[localFaceID + sizeby2]
// ]
// )
// + cellCentres
// [
// cycPatchCells[localFaceID + sizeby2]
// ];
// iPoint.append(curFaceIntersection);
}
else
{
iPhi.append
(
weights.boundaryField()[patchID][localFaceID]
*(
phiI[cycPatchCells[localFaceID]]
- phiI[cycPatchCells[localFaceID - sizeby2]]
)
+ phiI[cycPatchCells[localFaceID - sizeby2]]
);
// vector curFaceIntersection =
// weights[curFace]
// *(
// cellCentres[cycPatchCells[localFaceID]]
// - cellCentres
// [
// cycPatchCells[localFaceID - sizeby2]
// ]
// )
// + cellCentres
// [
// cycPatchCells[localFaceID - sizeby2]
// ];
// iPoint.append(curFaceIntersection);
}
}
else if
(
mesh.boundaryMesh()[patchID].type()
== processorPolyPatch::typeName
)
{
label start = mesh.boundaryMesh()[patchID].start();
label localFaceID = curFace - start;
const unallocLabelList& procPatchCells =
mesh.boundaryMesh()[patchID].faceCells();
iPhi.append
(
weights.boundaryField()[patchID][localFaceID]
*(
phiI[procPatchCells[localFaceID]]
- phi.boundaryField()[patchID][localFaceID]
)
+ phi.boundaryField()[patchID][localFaceID]
);
// const processorPolyPatch& procPatch =
// refCast<const processorPolyPatch>
// (
// mesh.boundaryMesh()[patchID]
// );
// vector ngbCellCentre =
// procPatch.neighbFaceCellCentres()[localFaceID];
// vector curFaceIntersection =
// faceCentres[curFace];
// iPoint.append(curFaceIntersection);
}
else if
(
mesh.boundaryMesh()[patchID].type()
== emptyPolyPatch::typeName
)
{
iPhi.append(phiI[curCell]);
// iPoint.append(faceCentres[curFace]);
}
else
{
// Normal patches
label start = mesh.boundaryMesh()[patchID].start();
label localFaceID = curFace - start;
iPhi.append
(
phi.boundaryField()[patchID][localFaceID]
);
// iPoint.append(faceCentres[curFace]);
}
}
}
Type avgPhi = phiI[curCell];
vector avgPoint = cellCentres[curCell];
// Type avgPhi = average(iPhi);
// vector avgPoint = average(iPoint);
// Weights
scalarField W(iPoints_[faceI].size(), 1.0);
label nCoeffs = 3;
scalarRectangularMatrix M
(
iPoints_[faceI].size(),
nCoeffs,
0.0
);
// vector origin = C[faceI];
scalar L = max(mag(iPoints_[faceI]-avgPoint));
for (label i=0; i<iPoints_[faceI].size(); i++)
{
scalar X = (iPoints_[faceI][i].x() - avgPoint.x())/L;
scalar Y = (iPoints_[faceI][i].y() - avgPoint.y())/L;
scalar Z = (iPoints_[faceI][i].z() - avgPoint.z())/L;
M[i][0] = X;
M[i][1] = Y;
M[i][2] = Z;
}
// Applying weights
for (label i=0; i<M.n(); i++)
{
for (label j=0; j<M.m(); j++)
{
M[i][j] *= W[i];
}
}
tensor lsM = tensor::zero;
for (label i=0; i<3; i++)
{
for (label j=0; j<3; j++)
{
for (label k=0; k<M.n(); k++)
{
lsM(i,j) += M[k][i]*M[k][j];
}
}
}
// Calculate inverse
// Info << M << endl;
// Info << lsM << endl;
// Info << det(lsM) << endl;
tensor invLsM = inv(lsM);
scalarRectangularMatrix curInvMatrix
(
nCoeffs,
iPoints_[faceI].size(),
0.0
);
for (label i=0; i<3; i++)
{
for (label j=0; j<M.n(); j++)
{
for (label k=0; k<3; k++)
{
curInvMatrix[i][j] += invLsM(i,k)*M[j][k]*W[j];
}
}
}
Field<Type> coeffs(nCoeffs, pTraits<Type>::zero);
Field<Type> source(iPoints_[faceI].size(), pTraits<Type>::zero);
for (label i=0; i<iPoints_[faceI].size(); i++)
{
// source[i] = iPhi[i];
source[i] = iPhi[i] - avgPhi;
}
for (label i=0; i<nCoeffs; i++)
{
for (label j=0; j<source.size(); j++)
{
coeffs[i] += curInvMatrix[i][j]*source[j];
}
}
// vector dr = C[faceI] - origin;
vector dr = (C[faceI] - avgPoint)/L;
patchPhi[faceI] =
avgPhi
+ coeffs[0]*dr.x()
+ coeffs[1]*dr.y()
+ coeffs[2]*dr.z();
}
Field<Type>::operator=(patchPhi);
this->refValue() = patchPhi;
if (!fixesValue_)
{
if (zeroGradient_)
{
this->refGrad() = pTraits<Type>::zero;
}
else
{
this->refGrad() =
(patchPhi - this->patchInternalField())
*this->patch().deltaCoeffs();
}
}
fvPatchField<Type>::evaluate();
}
template<class Type>
void extrapolatedFvPatchField<Type>::write(Ostream& os) const
{
mixedFvPatchField<Type>::write(os);
// this->writeEntry("value", os);
os.writeKeyword("zeroGradient")
<< zeroGradient_ << token::END_STATEMENT << nl;
os.writeKeyword("fixesValue")
<< fixesValue_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,196 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::extrapolatedFvPatchField
Description
Foam::extrapolatedFvPatchField
SourceFiles
extrapolatedFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef extrapolatedFvPatchField_H
#define extrapolatedFvPatchField_H
#include "mixedFvPatchField.H"
#include "PtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class extrapolatedFvPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class extrapolatedFvPatchField
:
public mixedFvPatchField<Type>
{
// Private data
//- Interpolation points
PtrList<DynamicList<vector> > iPoints_;
//- Return zero gradient
Switch zeroGradient_;
//- Fixes value
Switch fixesValue_;
public:
//- Runtime type information
TypeName("extrapolated");
// Constructors
//- Construct from patch and internal field
extrapolatedFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
extrapolatedFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping the given extrapolatedFvPatchField
// onto a new patch
extrapolatedFvPatchField
(
const extrapolatedFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
extrapolatedFvPatchField
(
const extrapolatedFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new extrapolatedFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
extrapolatedFvPatchField
(
const extrapolatedFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new extrapolatedFvPatchField<Type>(*this, iF)
);
}
// Member functions
// Access
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return fixesValue_;
}
// Return defining fields
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const fvPatchFieldMapper&
);
//- Reverse map the given fvPatchField onto this fvPatchField
virtual void rmap
(
const fvPatchField<Type>&,
const labelList&
);
// Evaluation functions
//- Update the coefficients associated with the patch field
// Sets Updated to true
virtual void updateCoeffs();
//- Evaluate the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "extrapolatedFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,43 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "extrapolatedFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(extrapolated);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,49 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef extrapolatedFvPatchFields_H
#define extrapolatedFvPatchFields_H
#include "extrapolatedFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(extrapolated)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef extrapolatedFvPatchFieldsFwd_H
#define extrapolatedFvPatchFieldsFwd_H
#include "fvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class extrapolatedFvPatchField;
makePatchTypeFieldTypedefs(extrapolated)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,59 +0,0 @@
forAll(p().boundaryField(), patchI)
{
if
(
(
isA<elasticWallPressureFvPatchScalarField>(p().boundaryField()[patchI])
&& isA<elasticSlipWallVelocityFvPatchVectorField>(U().boundaryField()[patchI])
)
|| (
isA<elasticWallPressureFvPatchScalarField>(p().boundaryField()[patchI])
&& isA<elasticWallVelocityFvPatchVectorField>(U().boundaryField()[patchI])
)
)
{
word ddtScheme
(
mesh.schemesDict().ddtScheme("ddt(" + U().name() +')')
);
if
(
ddtScheme
== fv::EulerDdtScheme<vector>::typeName
)
{
phi().boundaryField()[patchI] = phi().oldTime().boundaryField()[patchI];
rAUf.boundaryField()[patchI] = runTime().deltaT().value();
}
else if
(
ddtScheme
== fv::backwardDdtScheme<vector>::typeName
)
{
if(runTime().timeIndex() == 1)
{
phi().boundaryField()[patchI] = phi().oldTime().boundaryField()[patchI];
rAUf.boundaryField()[patchI] = runTime().deltaT().value();
phi().oldTime().oldTime();
}
else
{
scalar deltaT = runTime().deltaT().value();
scalar deltaT0 = runTime().deltaT0().value();
scalar Cn = 1 + deltaT/(deltaT + deltaT0);
scalar Coo = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
scalar Co = Cn + Coo;
phi().boundaryField()[patchI] =
(Co/Cn)*phi().oldTime().boundaryField()[patchI]
- (Coo/Cn)*phi().oldTime().oldTime().boundaryField()[patchI];
rAUf.boundaryField()[patchI] = runTime().deltaT().value()/Cn;
}
}
}
}

View file

@ -1,884 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 "fvcGradf.H"
#include "fvMesh.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "pointFields.H"
#include "ggiFvPatch.H"
#include "wedgeFvPatch.H"
#include "leastSquaresVolPointInterpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fvc
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
tmp
<
GeometricField
<
typename outerProduct<vector, Type>::type,
fvsPatchField,
surfaceMesh
>
> fGrad
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, pointPatchField, pointMesh>& pf
)
{
typedef typename outerProduct<vector, Type>::type GradType;
const fvMesh& mesh = vf.mesh();
tmp<GeometricField<GradType, fvsPatchField, surfaceMesh> > tGrad
(
new GeometricField<GradType, fvsPatchField, surfaceMesh>
(
IOobject
(
"grad" + vf.name() + "f",
vf.instance(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensioned<GradType>
(
"0",
vf.dimensions()/dimLength,
pTraits<GradType>::zero
)
)
);
Field<GradType>& gradI = tGrad().internalField();
const vectorField& points = mesh.points();
const faceList& faces = mesh.faces();
surfaceVectorField n = mesh.Sf()/mesh.magSf();
const vectorField& nI = n.internalField();
const Field<Type>& pfI = pf.internalField();
forAll(gradI, faceI)
{
const face& curFace = faces[faceI];
vector Rf = curFace.centre(points);
scalar mag = curFace.mag(points);
const edgeList curFaceEdges = curFace.edges();
gradI[faceI] = pTraits<GradType>::zero;
scalar faceArea = 0;
forAll(curFaceEdges, edgeI)
{
const edge& curEdge = curFaceEdges[edgeI];
// Projected edge vector
vector e = curEdge.vec(points);
e -= nI[faceI]*(nI[faceI]&e);
// Edge length vector
vector Le = (e^nI[faceI]);
Le *= curFace.edgeDirection(curEdge);
// Edge-centre field value
Type fe =
0.5
*(
pfI[curEdge.start()]
+ pfI[curEdge.end()]
);
// Gradient
gradI[faceI] += Le*fe;
// Area
vector Re = curEdge.centre(points) - Rf;
Re -= nI[faceI]*(nI[faceI]&Re);
faceArea += (Le&Re);
}
faceArea /= 2.0;
gradI[faceI] /= mag; // faceArea; // mag
}
forAll(tGrad().boundaryField(), patchI)
{
Field<GradType>& patchGrad = tGrad().boundaryField()[patchI];
const vectorField& patchN = n.boundaryField()[patchI];
forAll(patchGrad, faceI)
{
label globalFaceID = mesh.boundaryMesh()[patchI].start() + faceI;
const face& curFace = mesh.faces()[globalFaceID];
vector Rf = curFace.centre(points);
scalar mag = curFace.mag(points);
const edgeList curFaceEdges = curFace.edges();
patchGrad[faceI] = pTraits<GradType>::zero;
scalar faceArea = 0;
forAll(curFaceEdges, edgeI)
{
const edge& curEdge = curFaceEdges[edgeI];
// Projected edge vector
vector e = curEdge.vec(points);
e -= patchN[faceI]*(patchN[faceI]&e);
// Edge length vector
vector Le = (e^patchN[faceI]);
Le *= curFace.edgeDirection(curEdge);
// Edge-centre field value
Type fe =
0.5
*(
pfI[curEdge.start()]
+ pfI[curEdge.end()]
);
// Gradient
patchGrad[faceI] += Le*fe;
// Area
vector Re = curEdge.centre(points) - Rf;
Re -= patchN[faceI]*(patchN[faceI]&Re);
faceArea += (Le&Re);
}
faceArea /= 2.0;
patchGrad[faceI] /= mag; //faceArea; //mag
}
}
forAll(mesh.boundary(), patchI)
{
if (mesh.boundary()[patchI].type() == ggiFvPatch::typeName)
{
const ggiFvPatch& ggiPatch =
refCast<const ggiFvPatch>(mesh.boundary()[patchI]);
if (!ggiPatch.master())
{
Field<GradType>& slaveGrad =
tGrad().boundaryField()[patchI];
const Field<GradType>& masterGrad =
tGrad().boundaryField()[ggiPatch.shadowIndex()];
slaveGrad = ggiPatch.interpolate(masterGrad);
}
}
}
// // Calculate boundary gradient
// forAll(mesh.boundary(), patchI)
// {
// Field<Type> ppf = pf.boundaryField()[patchI].patchInternalField();
// tGrad().boundaryField()[patchI] ==
// fGrad(mesh.boundaryMesh()[patchI], ppf);
// }
// const GeometricField<GradType, fvPatchField, volMesh>& gradU =
// mesh.lookupObject<GeometricField<GradType, fvPatchField, volMesh> >
// (
// "grad(" + vf.name() + ")"
// );
// tGrad() = ((I - n*n)&fvc::interpolate(gradU));
// Add normal component of the gradient
// tGrad() -= n*(n&tGrad());
tGrad() += n*fvc::snGrad(vf);
return tGrad;
}
template<class Type>
tmp
<
GeometricField
<
typename outerProduct<vector, Type>::type,
fvsPatchField,
surfaceMesh
>
>
fGrad
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, pointPatchField, pointMesh>& pf,
const GeometricField
<
typename outerProduct<vector, Type>::type,
fvPatchField,
volMesh
>& gradVf
)
{
const fvMesh& mesh = vf.mesh();
const leastSquaresVolPointInterpolation& vpi =
mesh.lookupObject<leastSquaresVolPointInterpolation>
(
"leastSquaresVolPointInterpolation"
);
labelList axisPoints = vpi.pointAxisEdges().toc();
// const labelListList& pCells = mesh.pointCells();
// GeometricField<Type, pointPatchField, pointMesh>& pf_ =
// const_cast<GeometricField<Type, pointPatchField, pointMesh>&>(pf);
// forAll(axisPoints, pointI)
// {
// label curPoint = axisPoints[pointI];
// const labelList& curPointCells = pCells[curPoint];
// pf_[curPoint] = pTraits<Type>::zero;
// forAll (curPointCells, cellI)
// {
// label curCell = curPointCells[cellI];
// vector delta =
// mesh.points()[curPoint]
// - mesh.cellCentres()[curCell];
// pf_[curPoint] += vf[curCell] + (delta&gradVf[curCell]);
// }
// pf_[curPoint] /= curPointCells.size();
// pf_[curPoint] =
// transform
// (
// sqr(vector(0, 1, 0)),
// pf[curPoint]
// );
// }
// pf_.correctBoundaryConditions();
typedef typename outerProduct<vector, Type>::type GradType;
tmp<GeometricField<GradType, fvsPatchField, surfaceMesh> > tGrad =
fsGrad(vf, pf);
GeometricField<GradType, fvsPatchField, surfaceMesh> fGradVf =
fvc::interpolate(gradVf);
surfaceVectorField n = mesh.Sf()/mesh.magSf();
fGradVf -= n*(n & fGradVf);
// fGradVf += n*fvc::snGrad(vf);
// forAll(tGrad().internalField(), faceI)
// {
// if (mesh.faceCentres()[faceI].x() < 0.1)
// {
// tGrad()[faceI] = fGradVf[faceI];
// }
// }
// const labelListList& pFaces = mesh.pointFaces();
// forAll(axisPoints, pointI)
// {
// label curPoint = axisPoints[pointI];
// const labelList& curPointFaces = pFaces[curPoint];
// forAll(curPointFaces, faceI)
// {
// label curFace = curPointFaces[faceI];
// if (curFace < mesh.nInternalFaces())
// {
// tGrad()[curFace] = fGradVf[curFace];
// }
// }
// }
tGrad() = fGradVf;
// tGrad().internalField() = fGradVf.internalField();
// forAll(tGrad().boundaryField(), patchI)
// {
// if (isA<wedgeFvPatch>(mesh.boundary()[patchI]))
// {
// tGrad().boundaryField()[patchI] =
// fGradVf.boundaryField()[patchI];
// }
// }
tGrad() += n*fvc::snGrad(vf);
// forAll(fGradVf.internalField(), faceI)
// {
// tGrad()[faceI] = fGradVf[faceI];
// }
return tGrad;
}
template<class Type>
tmp
<
GeometricField
<
typename outerProduct<vector, Type>::type,
fvsPatchField,
surfaceMesh
>
> fsGrad
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, pointPatchField, pointMesh>& pf
)
{
typedef typename outerProduct<vector, Type>::type GradType;
const fvMesh& mesh = vf.mesh();
tmp<GeometricField<GradType, fvsPatchField, surfaceMesh> > tGrad
(
new GeometricField<GradType, fvsPatchField, surfaceMesh>
(
IOobject
(
"grad" + vf.name() + "f",
vf.instance(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensioned<GradType>
(
"0",
vf.dimensions()/dimLength,
pTraits<GradType>::zero
)
)
);
Field<GradType>& gradI = tGrad().internalField();
const vectorField& points = mesh.points();
const faceList& faces = mesh.faces();
surfaceVectorField n = mesh.Sf()/mesh.magSf();
const vectorField& nI = n.internalField();
const Field<Type>& pfI = pf.internalField();
forAll(gradI, faceI)
{
const face& curFace = faces[faceI];
vector Rf = curFace.centre(points);
scalar mag = curFace.mag(points);
const edgeList curFaceEdges = curFace.edges();
gradI[faceI] = pTraits<GradType>::zero;
scalar faceArea = 0;
forAll(curFaceEdges, edgeI)
{
const edge& curEdge = curFaceEdges[edgeI];
// Projected edge vector
vector e = curEdge.vec(points);
e -= nI[faceI]*(nI[faceI]&e);
// Edge length vector
vector Le = (e^nI[faceI]);
Le *= curFace.edgeDirection(curEdge);
// Edge-centre field value
Type fe =
0.5
*(
pfI[curEdge.start()]
+ pfI[curEdge.end()]
);
// Gradient
gradI[faceI] += Le*fe;
// Area
vector Re = curEdge.centre(points) - Rf;
Re -= nI[faceI]*(nI[faceI]&Re);
faceArea += (Le&Re);
}
faceArea /= 2.0;
gradI[faceI] /= mag; // faceArea; // mag
}
forAll(tGrad().boundaryField(), patchI)
{
Field<GradType>& patchGrad = tGrad().boundaryField()[patchI];
const vectorField& patchN = n.boundaryField()[patchI];
forAll(patchGrad, faceI)
{
label globalFaceID = mesh.boundaryMesh()[patchI].start() + faceI;
const face& curFace = mesh.faces()[globalFaceID];
vector Rf = curFace.centre(points);
scalar mag = curFace.mag(points);
const edgeList curFaceEdges = curFace.edges();
patchGrad[faceI] = pTraits<GradType>::zero;
scalar faceArea = 0;
forAll(curFaceEdges, edgeI)
{
const edge& curEdge = curFaceEdges[edgeI];
// Projected edge vector
vector e = curEdge.vec(points);
e -= patchN[faceI]*(patchN[faceI]&e);
// Edge length vector
vector Le = (e^patchN[faceI]);
Le *= curFace.edgeDirection(curEdge);
// Edge-centre field value
Type fe =
0.5
*(
pfI[curEdge.start()]
+ pfI[curEdge.end()]
);
// Gradient
patchGrad[faceI] += Le*fe;
// Area
vector Re = curEdge.centre(points) - Rf;
Re -= patchN[faceI]*(patchN[faceI]&Re);
faceArea += (Le&Re);
}
faceArea /= 2.0;
patchGrad[faceI] /= mag; //faceArea; //mag
}
}
forAll(mesh.boundary(), patchI)
{
if (mesh.boundary()[patchI].type() == ggiFvPatch::typeName)
{
const ggiFvPatch& ggiPatch =
refCast<const ggiFvPatch>(mesh.boundary()[patchI]);
if (!ggiPatch.master())
{
Field<GradType>& slaveGrad =
tGrad().boundaryField()[patchI];
const Field<GradType>& masterGrad =
tGrad().boundaryField()[ggiPatch.shadowIndex()];
slaveGrad = ggiPatch.interpolate(masterGrad);
}
}
}
return tGrad;
}
template<class Type, template<class> class FaceList>
tmp<Field<typename outerProduct<vector, Type>::type> > fGrad
(
const PrimitivePatch<face, FaceList, const pointField&>& patch,
const Field<Type>& ppf
)
{
typedef typename outerProduct<vector, Type>::type GradType;
tmp<Field<GradType> > tGrad
(
new Field<GradType>
(
patch.size(),
pTraits<GradType>::zero
)
);
Field<GradType>& grad = tGrad();
const vectorField& points = patch.localPoints();
const faceList& faces = patch.localFaces();
forAll(grad, faceI)
{
const face& curFace = faces[faceI];
vector n = curFace.normal(points);
n /= mag(n);
vector Rf = curFace.centre(points);
scalar mag = curFace.mag(points);
const edgeList curFaceEdges = curFace.edges();
scalar faceArea = 0;
forAll(curFaceEdges, edgeI)
{
const edge& curEdge = curFaceEdges[edgeI];
// Projected edge vector
vector e = curEdge.vec(points);
e -= n*(n&e);
// Edge length vector
vector Le = (e^n);
Le *= curFace.edgeDirection(curEdge);
// Edge-centre displacement
Type fe =
0.5
*(
ppf[curEdge.start()]
+ ppf[curEdge.end()]
);
// Gradient
grad[faceI] += Le*fe;
// Area
vector Re = curEdge.centre(points) - Rf;
Re -= n*(n&Re);
faceArea += (Le&Re);
}
faceArea /= 2.0;
grad[faceI] /= mag; //faceArea;
}
return tGrad;
}
template<class Type>
tmp
<
GeometricField
<
typename outerProduct<vector, Type>::type,
fvPatchField,
volMesh
>
> grad
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, pointPatchField, pointMesh>& pf
)
{
typedef typename outerProduct<vector, Type>::type GradType;
const fvMesh& mesh = vf.mesh();
tmp<GeometricField<GradType, fvPatchField, volMesh> > tGrad
(
new GeometricField<GradType, fvPatchField, volMesh>
(
IOobject
(
"grad(" + vf.name() + ")",
vf.instance(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensioned<GradType>
(
"0",
vf.dimensions()/dimLength,
pTraits<GradType>::zero
)
)
);
Field<GradType>& iGrad = tGrad().internalField();
const vectorField& points = mesh.points();
const faceList& faces = mesh.faces();
const Field<Type>& pfI = pf.internalField();
const unallocLabelList& owner = mesh.owner();
const unallocLabelList& neighbour = mesh.neighbour();
scalarField V(iGrad.size(), 0.0);
forAll(owner, faceI)
{
const face& curFace = faces[faceI];
// If the face is a triangle, do a direct calculation
if (curFace.size() == 3)
{
GradType SF =
curFace.normal(points)*curFace.average(points, pfI);
iGrad[owner[faceI]] += SF;
iGrad[neighbour[faceI]] -= SF;
scalar SR = (curFace.normal(points)&curFace.centre(points));
V[owner[faceI]] += SR;
V[neighbour[faceI]] -= SR;
}
else
{
label nPoints = curFace.size();
point centrePoint = point::zero;
Type cf = pTraits<Type>::zero;
for (register label pI=0; pI<nPoints; pI++)
{
centrePoint += points[curFace[pI]];
cf += pfI[curFace[pI]];
}
centrePoint /= nPoints;
cf /= nPoints;
for (register label pI=0; pI<nPoints; pI++)
{
// Calculate triangle centre field value
Type ttcf =
(
pfI[curFace[pI]]
+ pfI[curFace[(pI + 1) % nPoints]]
+ cf
);
ttcf /= 3.0;
// Calculate triangle area
vector St =
(
(points[curFace[pI]] - centrePoint)
^ (
points[curFace[(pI + 1) % nPoints]]
- centrePoint
)
);
St /= 2.0;
// Calculate triangle centre
vector Ct =
(
centrePoint
+ points[curFace[pI]]
+ points[curFace[(pI + 1) % nPoints]]
)/3;
iGrad[owner[faceI]] += St*ttcf;
iGrad[neighbour[faceI]] -= St*ttcf;
V[owner[faceI]] += (St&Ct);
V[neighbour[faceI]] -= (St&Ct);
}
}
}
forAll(mesh.boundaryMesh(), patchI)
{
const unallocLabelList& pFaceCells =
mesh.boundaryMesh()[patchI].faceCells();
forAll(mesh.boundaryMesh()[patchI], faceI)
{
label globalFaceID =
mesh.boundaryMesh()[patchI].start() + faceI;
const face& curFace = faces[globalFaceID];
if (isA<wedgeFvPatch>(mesh.boundary()[patchI]))
{
iGrad[pFaceCells[faceI]] +=
curFace.normal(points)*vf.boundaryField()[patchI][faceI];
V[pFaceCells[faceI]] +=
(curFace.normal(points)&curFace.centre(points));
}
else if (curFace.size() == 3)
{
// If the face is a triangle, do a direct calculation
iGrad[pFaceCells[faceI]] +=
curFace.normal(points)*curFace.average(points, pfI);
V[pFaceCells[faceI]] +=
(curFace.normal(points)&curFace.centre(points));
}
else
{
label nPoints = curFace.size();
point centrePoint = point::zero;
Type cf = pTraits<Type>::zero;
for (register label pI=0; pI<nPoints; pI++)
{
centrePoint += points[curFace[pI]];
cf += pfI[curFace[pI]];
}
centrePoint /= nPoints;
cf /= nPoints;
for (register label pI=0; pI<nPoints; pI++)
{
// Calculate triangle centre field value
Type ttcf =
(
pfI[curFace[pI]]
+ pfI[curFace[(pI + 1) % nPoints]]
+ cf
);
ttcf /= 3.0;
// Calculate triangle area
vector St =
(
(points[curFace[pI]] - centrePoint)
^ (
points[curFace[(pI + 1) % nPoints]]
- centrePoint
)
);
St /= 2.0;
// Calculate triangle centre
vector Ct =
(
centrePoint
+ points[curFace[pI]]
+ points[curFace[(pI + 1) % nPoints]]
)/3;
iGrad[pFaceCells[faceI]] += St*ttcf;
V[pFaceCells[faceI]] += (St&Ct);
}
}
}
}
V /= 3;
iGrad /= V;
// iGrad /= mesh.V();
// iGrad = fv::gaussGrad<vector>(mesh).grad(vf)().internalField();
tGrad().correctBoundaryConditions();
// Calculate boundary gradient
forAll(mesh.boundary(), patchI)
{
if
(
mesh.boundary()[patchI].size()
&& !vf.boundaryField()[patchI].coupled()
&& !isA<wedgeFvPatch>(mesh.boundary()[patchI])
)
{
Field<Type> ppf =
pf.boundaryField()[patchI].patchInternalField();
tGrad().boundaryField()[patchI] ==
fGrad(mesh.boundaryMesh()[patchI], ppf);
}
}
// Normal gradient
fv::gaussGrad<Type>(mesh).correctBoundaryConditions(vf, tGrad());
return tGrad;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fvc
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,264 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright held by original author
\\/ 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 "fvcGradf.H"
#include "fvMesh.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "pointFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fvc
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
tmp
<
GeometricField
<
typename outerProduct<vector, Type>::type,
fvsPatchField,
surfaceMesh
>
> grad
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, pointPatchField, pointMesh>& pf
)
{
typedef typename outerProduct<vector, Type>::type GradType;
const fvMesh& mesh = vf.mesh();
tmp<GeometricField<GradType, fvsPatchField, surfaceMesh> > tGrad
(
new GeometricField<GradType, fvsPatchField, surfaceMesh>
(
IOobject
(
"grad" + vf.name() + "f",
vf.instance(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensioned<GradType>
(
"0",
vf.dimensions()/dimLength,
pTraits<GradType>::zero
)
)
);
Field<GradType>& gradI = tGrad().internalField();
const vectorField& points = mesh.points();
const faceList& faces = mesh.faces();
// const vectorField& faceCentres = mesh.faceCentres();
const labelList& owner = mesh.owner();
const labelList& neighbour = mesh.neighbour();
const volVectorField& C = mesh.C();
const surfaceVectorField& Cf = mesh.Cf();
const GeometricField<GradType, fvPatchField, volMesh>& gradVf =
mesh.lookupObject<GeometricField<GradType, fvPatchField, volMesh> >
(
"grad(" + vf.name() + ")"
);
surfaceVectorField n = mesh.Sf()/mesh.magSf();
// const vectorField& nI = n.internalField();
const Field<Type>& pfI = pf.internalField();
forAll(gradI, faceI)
{
const face& curFace = faces[faceI];
const edgeList curFaceEdges = curFace.edges();
Type curFaceFieldValue = pTraits<Type>::zero;
// Owner contribution
label own = owner[faceI];
curFaceFieldValue +=
0.5*(vf[own] + ((Cf[faceI] - C[own]) & gradVf[own]));
// Neighbour contribution
label nei = neighbour[faceI];
curFaceFieldValue +=
0.5*(vf[nei] + ((Cf[faceI] - C[nei]) & gradVf[nei]));
gradI[faceI] = pTraits<GradType>::zero;
scalar faceArea = 0;
forAll(curFaceEdges, edgeI)
{
const edge& curEdge = curFaceEdges[edgeI];
vectorField p(3, vector::zero);
p[0] = points[curEdge.start()];
p[1] = points[curEdge.end()];
p[2] = Cf[faceI];
Field<Type> f(3, pTraits<Type>::zero);
f[0] = pfI[curEdge.start()];
f[1] = pfI[curEdge.end()];
f[2] = curFaceFieldValue;
triFace tri(0, 1, 2);
vector triCentre = tri.centre(p);
vector triNormal = tri.normal(p);
triNormal /= mag(triNormal);
edgeList triEdges = tri.edges();
GradType triGrad = pTraits<GradType>::zero;
forAll(triEdges, eI)
{
vector e = triEdges[eI].vec(p);
vector Le = (e^triNormal);
Le *= tri.edgeDirection(triEdges[eI]);
// Edge-centre value of the field
Type fe =
0.5*(f[triEdges[eI].start()] + f[triEdges[eI].end()]);
// Gradient
triGrad += Le*fe;
}
// Gradient
gradI[faceI] += triGrad;
// Area
faceArea += tri.mag(p);
}
gradI[faceI] /= faceArea;
}
forAll(tGrad().boundaryField(), patchI)
{
Field<GradType>& patchGrad = tGrad().boundaryField()[patchI];
const vectorField& pCf = Cf.boundaryField()[patchI];
forAll(patchGrad, faceI)
{
label globalFaceID = mesh.boundaryMesh()[patchI].start() + faceI;
const face& curFace = mesh.faces()[globalFaceID];
const edgeList curFaceEdges = curFace.edges();
const Type& curFaceFieldValue =
vf.boundaryField()[patchI][faceI];
patchGrad[faceI] = pTraits<GradType>::zero;
scalar faceArea = 0;
forAll(curFaceEdges, edgeI)
{
const edge& curEdge = curFaceEdges[edgeI];
vectorField p(3, vector::zero);
p[0] = points[curEdge.start()];
p[1] = points[curEdge.end()];
p[2] = pCf[faceI];
Field<Type> f(3, pTraits<Type>::zero);
f[0] = pfI[curEdge.start()];
f[1] = pfI[curEdge.end()];
f[2] = curFaceFieldValue;
triFace tri(0, 1, 2);
vector triCentre = tri.centre(p);
vector triNormal = tri.normal(p);
triNormal /= mag(triNormal);
edgeList triEdges = tri.edges();
GradType triGrad = pTraits<GradType>::zero;
forAll(triEdges, eI)
{
vector e = triEdges[eI].vec(p);
vector Le = (e^triNormal);
Le *= tri.edgeDirection(triEdges[eI]);
// Edge-centre value of the field
Type fe =
0.5*(f[triEdges[eI].start()] + f[triEdges[eI].end()]);
// Gradient
triGrad += Le*fe;
}
// Gradient
patchGrad[faceI] += triGrad;
// Area
faceArea += tri.mag(p);
}
patchGrad[faceI] /= faceArea;
}
}
// Add normal component of the gradient
tGrad() += n*fvc::snGrad(vf);
return tGrad;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fvc
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.toolchain.gnu.base.487904684">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.487904684" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" id="cdt.managedbuild.toolchain.gnu.base.487904684" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
<folderInfo id="cdt.managedbuild.toolchain.gnu.base.487904684.503514498" name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.base.1893306594" name="cdt.managedbuild.toolchain.gnu.base" superClass="cdt.managedbuild.toolchain.gnu.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1304117584" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
<builder id="cdt.managedbuild.target.gnu.builder.base.227643906" managedBuildOn="false" name="Gnu Make Builder.Default" superClass="cdt.managedbuild.target.gnu.builder.base"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.475368644" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.758011200" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1423750360" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base"/>
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.1494542762" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.590138482" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.base.304660451" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="freesteam.null.2007861953" name="freesteam"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</storageModule>
</cproject>

View file

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>freesteam</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>

View file

@ -1,123 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
class faceSet;
location "constant/polyMesh/sets";
object interface-solid-zone;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100
(
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
)
// ************************************************************************* //

View file

@ -1,40 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
3
(
loadedEnd
{
type wall;
nFaces 100;
startFace 27900;
}
freeSurface
{
type wall;
nFaces 4000;
startFace 28000;
}
fixedEnd
{
type wall;
nFaces 100;
startFace 32000;
}
)
// ************************************************************************* //

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,21 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class regIOobject;
location "constant/polyMesh";
object pointZones;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
0
()
// ************************************************************************* //

File diff suppressed because it is too large Load diff

View file

@ -1,32 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class wordList;
location "constant/polyMesh";
object zoneToPatchName;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
8
(
unknown
unknown
unknown
loadedEnd
freeSurface
fixedEnd
unknown
unknown
)
// ************************************************************************* //