Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2010-08-27 10:42:11 +01:00
85 changed files with 2303 additions and 506 deletions

View File

@ -321,7 +321,7 @@ endOfSection {space}")"{space}
pointGroupEndIndex.append(strtol(endPtr, &endPtr, 16) - 1);
// point group type skipped
strtol(endPtr, &endPtr, 16);
(void)strtol(endPtr, &endPtr, 16);
pointi = pointGroupStartIndex.last();
@ -435,7 +435,7 @@ endOfSection {space}")"{space}
faceGroupEndIndex.append(strtol(endPtr, &endPtr, 16) - 1);
// face group type
strtol(endPtr, &endPtr, 16);
(void)strtol(endPtr, &endPtr, 16);
faceGroupElementType = strtol(endPtr, &endPtr, 16);
@ -583,7 +583,7 @@ endOfSection {space}")"{space}
cellGroupType.append(strtol(endPtr, &endPtr, 16));
// Note. Potentially skip cell set if type is zero.
strtol(endPtr, &endPtr, 16);
(void)strtol(endPtr, &endPtr, 16);
Info<< "CellGroup: "
<< cellGroupZoneID.last()

View File

@ -955,6 +955,12 @@ int main(int argc, char *argv[])
argList::validArgs.append("faceZones");
argList::validArgs.append("thickness");
Foam::argList::addBoolOption
(
"oneD",
"generate columns of 1D cells"
);
#include "addRegionOption.H"
#include "addOverwriteOption.H"
#include "setRootCase.H"
@ -966,6 +972,7 @@ int main(int argc, char *argv[])
const wordList zoneNames(IStringStream(args.additionalArgs()[1])());
scalar thickness = readScalar(IStringStream(args.additionalArgs()[2])());
bool overwrite = args.optionFound("overwrite");
bool oneD = args.optionFound("oneD");
Info<< "Extruding zones " << zoneNames
@ -1225,9 +1232,25 @@ int main(int argc, char *argv[])
label nSide = 0;
forAll(zoneSidePatch, zoneI)
{
if (zoneSidePatch[zoneI] > 0)
if (oneD)
{
// Always add empty patches, one per zone.
word patchName = faceZones[zoneI].name() + "_" + "side";
zoneSidePatch[zoneI] = addPatch<emptyPolyPatch>
(
mesh,
patchName
);
Info<< zoneSidePatch[zoneI] << '\t' << patchName << nl;
nSide++;
}
else if (zoneSidePatch[zoneI] > 0)
{
word patchName = faceZones[zoneI].name() + "_" + "side";
zoneSidePatch[zoneI] = addPatch<polyPatch>
(
mesh,
@ -1257,6 +1280,8 @@ int main(int argc, char *argv[])
);
label nInter = 0;
if (!oneD)
{
forAll(zoneZonePatch_min, minZone)
{
for (label maxZone = minZone; maxZone < faceZones.size(); maxZone++)
@ -1273,6 +1298,7 @@ int main(int argc, char *argv[])
faceZones[maxZone].name()
+ "_to_"
+ faceZones[minZone].name();
{
transformDict.set("neighbourPatch", maxToMin);
zoneZonePatch_min[index] =
@ -1282,7 +1308,8 @@ int main(int argc, char *argv[])
minToMax,
transformDict
);
Info<< zoneZonePatch_min[index] << '\t' << minToMax << nl;
Info<< zoneZonePatch_min[index] << '\t' << minToMax
<< nl;
nInter++;
}
{
@ -1294,13 +1321,15 @@ int main(int argc, char *argv[])
maxToMin,
transformDict
);
Info<< zoneZonePatch_max[index] << '\t' << maxToMin << nl;
Info<< zoneZonePatch_max[index] << '\t' << maxToMin
<< nl;
nInter++;
}
}
}
}
}
Info<< "Added " << nInter << " inter-zone patches." << nl
<< endl;
@ -1323,7 +1352,16 @@ int main(int argc, char *argv[])
labelList& ePatches = extrudeEdgePatches[edgeI];
if (eFaces.size() == 2)
if (oneD)
{
nonManifoldEdge[edgeI] = 1;
ePatches.setSize(eFaces.size());
forAll(eFaces, i)
{
ePatches[i] = zoneSidePatch[zoneID[eFaces[i]]];
}
}
else if (eFaces.size() == 2)
{
label zone0 = zoneID[eFaces[0]];
label zone1 = zoneID[eFaces[1]];

View File

@ -1171,7 +1171,11 @@ int main(int argc, char *argv[])
+ "_"
+ procFile.name()
);
system(cmd.c_str());
if (system(cmd.c_str()) == -1)
{
WarningIn(args.executable())
<< "Could not execute command " << cmd << endl;
}
}
}
}

View File

@ -6,6 +6,13 @@ if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then
case "$ParaView_VERSION" in
3* | git)
if [ ! -d "${PV_PLUGIN_PATH}" ]
then
echo "$0 : PV_PLUGIN_PATH not a valid directory."
exit 1
fi
wmake libso vtkPV3Readers
PV3blockMeshReader/Allwmake
PV3FoamReader/Allwmake

View File

@ -398,7 +398,12 @@ int main(int argc, char *argv[])
)
{
// Make the eigenvectors a right handed orthogonal triplet
eVec.z() *= sign((eVec.x() ^ eVec.y()) & eVec.z());
eVec = tensor
(
eVec.x(),
eVec.y(),
eVec.z() * sign((eVec.x() ^ eVec.y()) & eVec.z())
);
// Finding the most natural transformation. Using Lists
// rather than tensors to allow indexed permutation.
@ -557,9 +562,7 @@ int main(int argc, char *argv[])
eVal = tEVal;
}
eVec.x() = principal[0];
eVec.y() = principal[1];
eVec.z() = principal[2];
eVec = tensor(principal[0], principal[1], principal[2]);
// {
// tensor R = rotationTensor(vector(1, 0, 0), eVec.x());

View File

@ -239,6 +239,11 @@ MPICH)
cmd="${cmd} -n 1 ${procXtermCmdFile}"
done < $PWD/mpirun.schema
;;
*)
echo
echo "Unsupported WM_MPLIB setting : $WM_MPLIB"
printUsage
exit 1
esac
echo "Constructed $PWD/mpirun.schema file."

8
bin/tools/scanpackages Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
#
# Generate Packages file on debian repositories.
for D in `find . -mindepth 4 -type d`
do
dpkg-scanpackages $D | gzip -9c > ${D}/Packages.gz
done

View File

@ -32,14 +32,12 @@ parallel/decompose/AllwmakeLnInclude
# dummyThirdParty (dummy metisDecomp, scotchDecomp etc) needed by e.g. meshTools
dummyThirdParty/Allwmake
# Build the proper scotchDecomp, metisDecomp etc.
parallel/decompose/Allwmake
wmake libso meshTools
wmake libso finiteVolume
wmake libso genericPatchFields
parallel/reconstruct/Allwmake
# Build the proper scotchDecomp, metisDecomp etc.
parallel/Allwmake
wmake libso sampling

View File

@ -530,6 +530,7 @@ $(constraintPointPatchFields)/processorCyclic/processorCyclicPointPatchFields.C
derivedPointPatchFields = $(pointPatchFields)/derived
$(derivedPointPatchFields)/slip/slipPointPatchFields.C
$(derivedPointPatchFields)/fixedNormalSlip/fixedNormalSlipPointPatchFields.C
/*
$(derivedPointPatchFields)/global/globalPointPatchFields.C
*/

View File

@ -66,7 +66,7 @@ template<class Type>
Field<Type>::Field
(
const UList<Type>& mapF,
const labelList& mapAddressing
const UList<label>& mapAddressing
)
:
List<Type>(mapAddressing.size())
@ -78,7 +78,7 @@ template<class Type>
Field<Type>::Field
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing
const UList<label>& mapAddressing
)
:
List<Type>(mapAddressing.size())
@ -297,7 +297,7 @@ template<class Type>
void Field<Type>::map
(
const UList<Type>& mapF,
const labelList& mapAddressing
const UList<label>& mapAddressing
)
{
Field<Type>& f = *this;
@ -326,7 +326,7 @@ template<class Type>
void Field<Type>::map
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing
const UList<label>& mapAddressing
)
{
map(tmapF(), mapAddressing);
@ -455,7 +455,7 @@ template<class Type>
void Field<Type>::rmap
(
const UList<Type>& mapF,
const labelList& mapAddressing
const UList<label>& mapAddressing
)
{
Field<Type>& f = *this;
@ -475,7 +475,7 @@ template<class Type>
void Field<Type>::rmap
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing
const UList<label>& mapAddressing
)
{
rmap(tmapF(), mapAddressing);
@ -487,8 +487,8 @@ template<class Type>
void Field<Type>::rmap
(
const UList<Type>& mapF,
const labelList& mapAddressing,
const scalarList& mapWeights
const UList<label>& mapAddressing,
const UList<scalar>& mapWeights
)
{
Field<Type>& f = *this;
@ -505,8 +505,8 @@ template<class Type>
void Field<Type>::rmap
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing,
const scalarList& mapWeights
const UList<label>& mapAddressing,
const UList<scalar>& mapWeights
)
{
rmap(tmapF(), mapAddressing, mapWeights);

View File

@ -127,14 +127,14 @@ public:
Field
(
const UList<Type>& mapF,
const labelList& mapAddressing
const UList<label>& mapAddressing
);
//- Construct by 1 to 1 mapping from the given tmp field
Field
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing
const UList<label>& mapAddressing
);
//- Construct by interpolative mapping from the given field
@ -208,14 +208,14 @@ public:
void map
(
const UList<Type>& mapF,
const labelList& mapAddressing
const UList<label>& mapAddressing
);
//- 1 to 1 map from the given tmp field
void map
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing
const UList<label>& mapAddressing
);
//- Interpolative map from the given field
@ -258,30 +258,30 @@ public:
void rmap
(
const UList<Type>& mapF,
const labelList& mapAddressing
const UList<label>& mapAddressing
);
//- 1 to 1 reverse-map from the given tmp field
void rmap
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing
const UList<label>& mapAddressing
);
//- Interpolative reverse map from the given field
void rmap
(
const UList<Type>& mapF,
const labelList& mapAddressing,
const scalarList& weights
const UList<label>& mapAddressing,
const UList<scalar>& weights
);
//- Interpolative reverse map from the given tmp field
void rmap
(
const tmp<Field<Type> >& tmapF,
const labelList& mapAddressing,
const scalarList& weights
const UList<label>& mapAddressing,
const UList<scalar>& weights
);
//- Negate this field

View File

@ -0,0 +1,114 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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 "fixedNormalSlipPointPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
)
:
slipPointPatchField<Type>(p, iF),
n_(vector::max)
{}
template<class Type>
fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict
)
:
slipPointPatchField<Type>(p, iF, dict),
n_(dict.lookup("n"))
{}
template<class Type>
fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
(
const fixedNormalSlipPointPatchField<Type>& ptf,
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const pointPatchFieldMapper& mapper
)
:
slipPointPatchField<Type>(ptf, p, iF, mapper),
n_(ptf.n_)
{}
template<class Type>
fixedNormalSlipPointPatchField<Type>::fixedNormalSlipPointPatchField
(
const fixedNormalSlipPointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
)
:
slipPointPatchField<Type>(ptf, iF),
n_(ptf.n_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void fixedNormalSlipPointPatchField<Type>::evaluate(const Pstream::commsTypes)
{
tmp<Field<Type> > tvalues =
transform(I - n_*n_, this->patchInternalField());
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
setInInternalField(iF, tvalues());
}
template<class Type>
void fixedNormalSlipPointPatchField<Type>::write(Ostream& os) const
{
slipPointPatchField<Type>::write(os);
os.writeKeyword("n")
<< n_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,170 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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::fixedNormalSlipPointPatchField
Description
slip with user-specified normal
SourceFiles
fixedNormalSlipPointPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef fixedNormalSlipPointPatchField_H
#define fixedNormalSlipPointPatchField_H
#include "slipPointPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
template<class Type>
class fixedNormalSlipPointPatchField;
template<class Type>
Ostream& operator<<
(
Ostream&,
const fixedNormalSlipPointPatchField<Type>&
);
/*---------------------------------------------------------------------------*\
Class fixedNormalSlipPointPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class fixedNormalSlipPointPatchField
:
public slipPointPatchField<Type>
{
// Private data
//- User specified normal
vector n_;
public:
//- Runtime type information
TypeName("fixedNormalSlip");
// Constructors
//- Construct from patch and internal field
fixedNormalSlipPointPatchField
(
const pointPatch&,
const DimensionedField<Type, pointMesh>&
);
//- Construct from patch, internal field and dictionary
fixedNormalSlipPointPatchField
(
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
fixedNormalSlipPointPatchField
(
const fixedNormalSlipPointPatchField<Type>&,
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const pointPatchFieldMapper&
);
//- Construct and return a clone
virtual autoPtr<pointPatchField<Type> > clone() const
{
return autoPtr<pointPatchField<Type> >
(
new fixedNormalSlipPointPatchField<Type>
(
*this
)
);
}
//- Construct as copy setting internal field reference
fixedNormalSlipPointPatchField
(
const fixedNormalSlipPointPatchField<Type>&,
const DimensionedField<Type, pointMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<pointPatchField<Type> > clone
(
const DimensionedField<Type, pointMesh>& iF
) const
{
return autoPtr<pointPatchField<Type> >
(
new fixedNormalSlipPointPatchField<Type>
(
*this,
iF
)
);
}
// Member functions
// Evaluation functions
//- Update the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "fixedNormalSlipPointPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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 "fixedNormalSlipPointPatchFields.H"
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(fixedNormalSlip);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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/>.
\*---------------------------------------------------------------------------*/
#ifndef fixedNormalSlipPointPatchFields_H
#define fixedNormalSlipPointPatchFields_H
#include "fixedNormalSlipPointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(fixedNormalSlip);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -65,6 +65,16 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
// Map the list
newMotionPoints.map(oldMotionPoints, mpm.pointMap());
// Any points created out-of-nothing get set to the current coordinate
// for lack of anything better.
forAll(mpm.pointMap(), newPointI)
{
if (mpm.pointMap()[newPointI] == -1)
{
newMotionPoints[newPointI] = points_[newPointI];
}
}
}
// Reset valid directions (could change by faces put into empty patches)

View File

@ -624,7 +624,18 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
}
else if (separated())
{
l -= separation();
const vectorField& s = separation();
if (s.size() == 1)
{
forAll(l, i)
{
l[i] -= s[0];
}
}
else
{
l -= s;
}
}
}

View File

@ -100,6 +100,14 @@ public:
//- Construct given SymmTensor
inline Tensor(const SymmTensor<Cmpt>&);
//- Construct given the three vector components
inline Tensor
(
const Vector<Cmpt>& x,
const Vector<Cmpt>& y,
const Vector<Cmpt>& z
);
//- Construct given the nine components
inline Tensor
(
@ -116,14 +124,6 @@ public:
// Access
inline const Vector<Cmpt>& x() const;
inline const Vector<Cmpt>& y() const;
inline const Vector<Cmpt>& z() const;
inline Vector<Cmpt>& x();
inline Vector<Cmpt>& y();
inline Vector<Cmpt>& z();
inline const Cmpt& xx() const;
inline const Cmpt& xy() const;
inline const Cmpt& xz() const;
@ -144,6 +144,13 @@ public:
inline Cmpt& zy();
inline Cmpt& zz();
// Access vector components.
// Note: returning const only to find out lhs usage
inline const Vector<Cmpt> x() const;
inline const Vector<Cmpt> y() const;
inline const Vector<Cmpt> z() const;
//- Transpose
inline Tensor<Cmpt> T() const;

View File

@ -64,6 +64,21 @@ inline Tensor<Cmpt>::Tensor(const SymmTensor<Cmpt>& st)
}
//- Construct given the three vector components
template <class Cmpt>
inline Tensor<Cmpt>::Tensor
(
const Vector<Cmpt>& x,
const Vector<Cmpt>& y,
const Vector<Cmpt>& z
)
{
this->v_[XX] = x.x(); this->v_[XY] = x.y(); this->v_[XZ] = x.z();
this->v_[YX] = y.x(); this->v_[YY] = y.y(); this->v_[YZ] = y.z();
this->v_[ZX] = z.x(); this->v_[ZY] = z.y(); this->v_[ZZ] = z.z();
}
//- Construct from components
template <class Cmpt>
inline Tensor<Cmpt>::Tensor
@ -90,40 +105,21 @@ inline Tensor<Cmpt>::Tensor(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template <class Cmpt>
inline const Vector<Cmpt>& Tensor<Cmpt>::x() const
inline const Vector<Cmpt> Tensor<Cmpt>::x() const
{
return reinterpret_cast<const Vector<Cmpt>&>(this->v_[XX]);
return Vector<Cmpt>(this->v_[XX], this->v_[XY], this->v_[XZ]);
}
template <class Cmpt>
inline const Vector<Cmpt>& Tensor<Cmpt>::y() const
inline const Vector<Cmpt> Tensor<Cmpt>::y() const
{
return reinterpret_cast<const Vector<Cmpt>&>(this->v_[YX]);
return Vector<Cmpt>(this->v_[YX], this->v_[YY], this->v_[YZ]);
}
template <class Cmpt>
inline const Vector<Cmpt>& Tensor<Cmpt>::z() const
inline const Vector<Cmpt> Tensor<Cmpt>::z() const
{
return reinterpret_cast<const Vector<Cmpt>&>(this->v_[ZX]);
}
template <class Cmpt>
inline Vector<Cmpt>& Tensor<Cmpt>::x()
{
return reinterpret_cast<Vector<Cmpt>&>(this->v_[XX]);
}
template <class Cmpt>
inline Vector<Cmpt>& Tensor<Cmpt>::y()
{
return reinterpret_cast<Vector<Cmpt>&>(this->v_[YX]);
}
template <class Cmpt>
inline Vector<Cmpt>& Tensor<Cmpt>::z()
{
return reinterpret_cast<Vector<Cmpt>&>(this->v_[ZX]);
return Vector<Cmpt>(this->v_[ZX], this->v_[ZY], this->v_[ZZ]);
}

View File

@ -269,10 +269,12 @@ tensor eigenVectors(const tensor& t)
{
vector evals(eigenValues(t));
tensor evs;
evs.x() = eigenVector(t, evals.x());
evs.y() = eigenVector(t, evals.y());
evs.z() = eigenVector(t, evals.z());
tensor evs
(
eigenVector(t, evals.x()),
eigenVector(t, evals.y()),
eigenVector(t, evals.z())
);
return evs;
}
@ -468,10 +470,12 @@ tensor eigenVectors(const symmTensor& t)
{
vector evals(eigenValues(t));
tensor evs;
evs.x() = eigenVector(t, evals.x());
evs.y() = eigenVector(t, evals.y());
evs.z() = eigenVector(t, evals.z());
tensor evs
(
eigenVector(t, evals.x()),
eigenVector(t, evals.y()),
eigenVector(t, evals.z())
);
return evs;
}

View File

@ -92,7 +92,14 @@ public:
//- Construct given SphericalTensor2D
inline Tensor2D(const SphericalTensor2D<Cmpt>&);
//- Construct given the nine components
//- Construct given the two vectors
inline Tensor2D
(
const Vector2D<Cmpt>& x,
const Vector2D<Cmpt>& y
);
//- Construct given the four components
inline Tensor2D
(
const Cmpt txx, const Cmpt txy,
@ -107,12 +114,6 @@ public:
// Access
inline const Vector2D<Cmpt>& x() const;
inline const Vector2D<Cmpt>& y() const;
inline Vector2D<Cmpt>& x();
inline Vector2D<Cmpt>& y();
inline const Cmpt& xx() const;
inline const Cmpt& xy() const;
inline const Cmpt& yx() const;
@ -123,6 +124,11 @@ public:
inline Cmpt& yx();
inline Cmpt& yy();
// Access vector components.
inline Vector2D<Cmpt> x() const;
inline Vector2D<Cmpt> y() const;
//- Transpose
inline Tensor2D<Cmpt> T() const;

View File

@ -50,6 +50,18 @@ inline Tensor2D<Cmpt>::Tensor2D(const SphericalTensor2D<Cmpt>& st)
}
template <class Cmpt>
inline Tensor2D<Cmpt>::Tensor2D
(
const Vector2D<Cmpt>& x,
const Vector2D<Cmpt>& y
)
{
this->v_[XX] = x.x(); this->v_[XY] = x.y();
this->v_[YX] = y.x(); this->v_[YY] = y.y();
}
template <class Cmpt>
inline Tensor2D<Cmpt>::Tensor2D
(
@ -72,28 +84,15 @@ inline Tensor2D<Cmpt>::Tensor2D(Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template <class Cmpt>
inline const Vector2D<Cmpt>& Tensor2D<Cmpt>::x() const
inline Vector2D<Cmpt> Tensor2D<Cmpt>::x() const
{
return reinterpret_cast<const Vector2D<Cmpt>&>(this->v_[XX]);
return Vector2D<Cmpt>(this->v_[XX], this->v_[XY]);
}
template <class Cmpt>
inline const Vector2D<Cmpt>& Tensor2D<Cmpt>::y() const
inline Vector2D<Cmpt> Tensor2D<Cmpt>::y() const
{
return reinterpret_cast<const Vector2D<Cmpt>&>(this->v_[YX]);
}
template <class Cmpt>
inline Vector2D<Cmpt>& Tensor2D<Cmpt>::x()
{
return reinterpret_cast<Vector2D<Cmpt>&>(this->v_[XX]);
}
template <class Cmpt>
inline Vector2D<Cmpt>& Tensor2D<Cmpt>::y()
{
return reinterpret_cast<Vector2D<Cmpt>&>(this->v_[YX]);
return Vector2D<Cmpt>(this->v_[YX], this->v_[YY]);
}

View File

@ -158,9 +158,11 @@ tensor2D eigenVectors(const tensor2D& t)
{
vector2D evals(eigenValues(t));
tensor2D evs;
evs.x() = eigenVector(t, evals.x());
evs.y() = eigenVector(t, evals.y());
tensor2D evs
(
eigenVector(t, evals.x()),
eigenVector(t, evals.y())
);
return evs;
}

View File

@ -196,6 +196,8 @@ $(interpolation)/interpolationCellPoint/makeInterpolationCellPoint.C
$(interpolation)/interpolationCellPointFace/makeInterpolationCellPointFace.C
$(interpolation)/interpolationCellPointWallModified/cellPointWeightWallModified/cellPointWeightWallModified.C
$(interpolation)/interpolationCellPointWallModified/makeInterpolationCellPointWallModified.C
$(interpolation)/interpolationPoint/pointMVCWeight.C
$(interpolation)/interpolationPoint/makeInterpolationPoint.C
volPointInterpolation = interpolation/volPointInterpolation
/*

View File

@ -95,7 +95,7 @@ void Foam::MRFZone::absoluteRhoFlux
forAll(internalFaces_, i)
{
label facei = internalFaces_[i];
phi[facei] += (Omega ^ (Cf[facei] - origin)) & Sf[facei];
phi[facei] += rho[facei]*(Omega ^ (Cf[facei] - origin)) & Sf[facei];
}
// Included patches
@ -106,7 +106,8 @@ void Foam::MRFZone::absoluteRhoFlux
label patchFacei = includedFaces_[patchi][i];
phi.boundaryField()[patchi][patchFacei] +=
(Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin))
rho.boundaryField()[patchi][patchFacei]
* (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin))
& Sf.boundaryField()[patchi][patchFacei];
}
}
@ -119,7 +120,8 @@ void Foam::MRFZone::absoluteRhoFlux
label patchFacei = excludedFaces_[patchi][i];
phi.boundaryField()[patchi][patchFacei] +=
(Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin))
rho.boundaryField()[patchi][patchFacei]
* (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin))
& Sf.boundaryField()[patchi][patchFacei];
}
}

View File

@ -287,7 +287,7 @@ public:
}
//- Return axis
const vector& axis() const
vector axis() const
{
return coordSys_.axis();
}

View File

@ -168,9 +168,11 @@ void wedgeFvPatchField<Type>::evaluate(const Pstream::commsTypes)
template<class Type>
tmp<Field<Type> > wedgeFvPatchField<Type>::snGradTransformDiag() const
{
diagTensor diagT =
const diagTensor diagT =
0.5*diag(I - refCast<const wedgeFvPatch>(this->patch()).cellT());
const vector diagV(diagT.xx(), diagT.yy(), diagT.zz());
return tmp<Field<Type> >
(
new Field<Type>
@ -180,7 +182,7 @@ tmp<Field<Type> > wedgeFvPatchField<Type>::snGradTransformDiag() const
(
pow
(
reinterpret_cast<const vector&>(diagT),
diagV,
pTraits<typename powProduct<vector, pTraits<Type>::rank>
::type>::zero
)

View File

@ -346,9 +346,12 @@ Foam::fv::cellLimitedGrad<Foam::vector>::calcGrad
forAll(gIf, celli)
{
gIf[celli].x() = cmptMultiply(limiter[celli], gIf[celli].x());
gIf[celli].y() = cmptMultiply(limiter[celli], gIf[celli].y());
gIf[celli].z() = cmptMultiply(limiter[celli], gIf[celli].z());
gIf[celli] = tensor
(
cmptMultiply(limiter[celli], gIf[celli].x()),
cmptMultiply(limiter[celli], gIf[celli].y()),
cmptMultiply(limiter[celli], gIf[celli].z())
);
}
g.correctBoundaryConditions();

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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 "interpolationPoint.H"
#include "volPointInterpolation.H"
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::interpolationPoint<Type>::interpolationPoint
(
const GeometricField<Type, fvPatchField, volMesh>& psi
)
:
interpolation<Type>(psi),
psip_(volPointInterpolation::New(psi.mesh()).interpolate(psi))
{}
// ************************************************************************* //

View File

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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::interpolationPoint
Description
Given cell centre values interpolates to vertices and uses these to
do a Mean Value Coordinates interpolation.
\*---------------------------------------------------------------------------*/
#ifndef interpolationPoint_H
#define interpolationPoint_H
#include "interpolation.H"
#include "pointMVCWeight.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class interpolationPoint Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class interpolationPoint
:
public interpolation<Type>
{
protected:
// Protected data
//- Interpolated volfield
const GeometricField<Type, pointPatchField, pointMesh> psip_;
public:
//- Runtime type information
TypeName("cellPoint");
// Constructors
//- Construct from components
interpolationPoint
(
const GeometricField<Type, fvPatchField, volMesh>& psi
);
// Member Functions
//- Interpolate field for the given cellPointWeight
inline Type interpolate(const pointMVCWeight& cpw) const;
//- Interpolate field to the given point in the given cell
inline Type interpolate
(
const vector& position,
const label nCell,
const label facei = -1
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "interpolationPointI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "interpolationPoint.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
inline Type Foam::interpolationPoint<Type>::interpolate
(
const pointMVCWeight& cpw
) const
{
return cpw.interpolate(psip_);
}
template<class Type>
inline Type Foam::interpolationPoint<Type>::interpolate
(
const vector& position,
const label celli,
const label facei
) const
{
return interpolate
(
pointMVCWeight(this->pMesh_, position, celli, facei)
);
}
// ************************************************************************* //

View File

@ -0,0 +1,35 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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 "interpolationPoint.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeInterpolation(interpolationPoint);
}
// ************************************************************************* //

View File

@ -0,0 +1,324 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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 "pointMVCWeight.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
int Foam::pointMVCWeight::debug
(
debug::debugSwitch("pointMVCWeight", 0)
);
Foam::scalar Foam::pointMVCWeight::tol(SMALL);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void Foam::pointMVCWeight::calcWeights
(
const Map<label>& toLocal,
const face& f,
const DynamicList<point>& u,
const scalarField& dist,
scalarField& weights
) const
{
weights.setSize(toLocal.size());
weights = 0.0;
scalarField theta(f.size());
// recompute theta, the theta computed previously are not robust
forAll(f, j)
{
label jPlus1 = f.fcIndex(j);
scalar l = mag(u[j]-u[jPlus1]);
theta[j] = 2.0*Foam::asin(l/2.0);
}
scalar sumWeight = 0;
forAll(f, j)
{
label pid = toLocal[f[j]];
label jMin1 = f.rcIndex(j);
weights[pid] =
1.0
/ dist[pid]
* (Foam::tan(theta[jMin1]/2.0)+Foam::tan(theta[j]/2.0));
sumWeight += weights[pid];
}
if (sumWeight >= tol)
{
weights /= sumWeight;
}
}
void Foam::pointMVCWeight::calcWeights
(
const polyMesh& mesh,
const labelList& toGlobal,
const Map<label>& toLocal,
const vector& position,
const vectorField& uVec,
const scalarField& dist,
scalarField& weights
) const
{
// Loop over all triangles of all polygons of cell to compute weights
DynamicList<scalar> alpha(100);
DynamicList<scalar> theta(100);
DynamicList<point> u(100);
const Foam::cell& cFaces = mesh.cells()[cellIndex_];
forAll(cFaces, iter)
{
label faceI = cFaces[iter];
const face& f = mesh.faces()[faceI];
//Pout<< "face:" << faceI << " at:"
// << pointField(mesh.points(), f)
// << endl;
// Collect the uVec for the face
forAll(f, j)
{
u(j) = uVec[toLocal[f[j]]];
}
vector v(point::zero);
forAll(f, j)
{
label jPlus1 = f.fcIndex(j);
//Pout<< " uj:" << u[j] << " ujPlus1:" << u[jPlus1] << endl;
vector temp = u[j] ^ u[jPlus1];
temp /= mag(temp);
//Pout<< " uj:" << u[j] << " ujPlus1:" << u[jPlus1]
// << " temp:" << temp << endl;
scalar l = mag(u[j]-u[jPlus1]);
scalar angle = 2.0*Foam::asin(l/2.0);
//Pout<< " j:" << j << " l:" << l
// << " angle:" << angle << endl;
v += 0.5*angle*temp;
}
scalar vNorm = mag(v);
v /= vNorm;
// Make sure v points towards the polygon
//if (((v&u[0]) < 0) != (mesh.faceOwner()[faceI] != cellIndex_))
//{
// FatalErrorIn("pointMVCWeight::calcWeights(..)")
// << "v:" << v << " u[0]:" << u[0]
// << exit(FatalError);
//}
if ((v&u[0]) < 0)
{
v = -v;
}
//Pout<< " v:" << v << endl;
// angles between edges
forAll(f, j)
{
label jPlus1 = f.fcIndex(j);
//Pout<< " uj:" << u[j] << " ujPlus1:" << u[jPlus1] << endl;
vector n0 = u[j] ^ v;
n0 /= mag(n0);
vector n1 = u[jPlus1] ^ v;
n1 /= mag(n1);
scalar l = mag(n0-n1);
//Pout<< " l:" << l << endl;
alpha(j) = 2.0*Foam::asin(l/2.0);
vector temp = n0 ^ n1;
if ((temp&v) < 0.0)
{
alpha[j] = -alpha[j];
}
l = mag(u[j]-v);
//Pout<< " l:" << l << endl;
theta(j) = 2.0*Foam::asin(l/2.0);
}
bool outlierFlag = false;
forAll(f, j)
{
if (mag(theta[j]) < tol)
{
outlierFlag = true;
label pid = toLocal[f[j]];
weights[pid] += vNorm / dist[pid];
break;
}
}
if (outlierFlag)
{
continue;
}
scalar sum = 0.0;
forAll(f, j)
{
label jMin1 = f.rcIndex(j);
sum +=
1.0
/ Foam::tan(theta[j])
* (Foam::tan(alpha[j]/2.0)+Foam::tan(alpha[jMin1]/2.0));
}
// The special case when x lies on the polygon, handle it using 2D mvc.
// In the 2D case, alpha = theta
if (mag(sum) < tol)
{
// Calculate weights using face vertices only
calcWeights(toLocal, f, u, dist, weights);
return;
}
// Normal 3D case
forAll(f, j)
{
label pid = toLocal[f[j]];
label jMin1 = f.rcIndex(j);
weights[pid] +=
vNorm
/ sum
/ dist[pid]
/ Foam::sin(theta[j])
* (Foam::tan(alpha[j]/2.0)+Foam::tan(alpha[jMin1]/2.0));
}
}
// normalise weights
scalar sumWeight = sum(weights);
if (mag(sumWeight) < tol)
{
return;
}
weights /= sumWeight;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointMVCWeight::pointMVCWeight
(
const polyMesh& mesh,
const vector& position,
const label cellIndex,
const label faceIndex
)
:
cellIndex_((cellIndex != -1) ? cellIndex : mesh.faceOwner()[faceIndex])
{
// Addressing - face vertices to local points and vice versa
const labelList& toGlobal = mesh.cellPoints()[cellIndex_];
Map<label> toLocal(2*toGlobal.size());
forAll(toGlobal, i)
{
toLocal.insert(toGlobal[i], i);
}
// Initialise weights
weights_.setSize(toGlobal.size());
weights_ = 0.0;
// Point-to-vertex vectors and distances
vectorField uVec(toGlobal.size());
scalarField dist(toGlobal.size());
forAll(toGlobal, pid)
{
const point& pt = mesh.points()[toGlobal[pid]];
uVec[pid] = pt-position;
dist[pid] = mag(uVec[pid]);
// Special case: point is close to vertex
if (dist[pid] < tol)
{
weights_[pid] = 1.0;
return;
}
}
// Project onto unit sphere
uVec /= dist;
if (faceIndex < 0)
{
// Face data not supplied
calcWeights
(
mesh,
toGlobal,
toLocal,
position,
uVec,
dist,
weights_
);
}
else
{
DynamicList<point> u(100);
const face& f = mesh.faces()[faceIndex];
// Collect the uVec for the face
forAll(f, j)
{
u(j) = uVec[toLocal[f[j]]];
}
// Calculate weights for face only
calcWeights(toLocal, f, u, dist, weights_);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,162 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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::pointMVCWeight
Description
Container to calculate weights for interpolating directly from vertices
of cell using Mean Value Coordinates.
Based on (VTK's vtkMeanValueCoordinatesInterpolator's) implementation
of "Spherical Barycentric Coordinates"
2006 paper Eurographics Symposium on Geometry Processing
by Torsten Langer, Alexander Belyaev and Hans-Peter Seide
SourceFiles
pointMVCWeight.C
\*---------------------------------------------------------------------------*/
#ifndef pointMVCWeight_H
#define pointMVCWeight_H
#include "scalarField.H"
#include "vectorField.H"
#include "Map.H"
#include "DynamicList.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyMesh;
class pointMesh;
template<class T> class pointPatchField;
template<class Type, template<class> class PatchField, class GeoMesh>
class GeometricField;
class face;
/*---------------------------------------------------------------------------*\
Class pointMVCWeight Declaration
\*---------------------------------------------------------------------------*/
class pointMVCWeight
{
protected:
// Protected data
//- Cell index
const label cellIndex_;
//- Weights applied to cell vertices
scalarField weights_;
// Protected Member Functions
//- Calculate weights from single face's vertices only
void calcWeights
(
const Map<label>& toLocal,
const face& f,
const DynamicList<point>& u,
const scalarField& dist,
scalarField& weights
) const;
//- Calculate weights from all cell's vertices
void calcWeights
(
const polyMesh& mesh,
const labelList& toGlobal,
const Map<label>& toLocal,
const vector& position,
const vectorField& uVec,
const scalarField& dist,
scalarField& weights
) const;
public:
//- Debug switch
static int debug;
//- Tolerance used in calculating barycentric co-ordinates
// (applied to normalised values)
static scalar tol;
// Constructors
//- Construct from components
pointMVCWeight
(
const polyMesh& mesh,
const vector& position,
const label nCell,
const label facei = -1
);
// Member Functions
//- Cell index
inline label cell() const
{
return cellIndex_;
}
//- interpolation weights (in order of cellPoints)
inline const scalarField& weights() const
{
return weights_;
}
//- Interpolate field
template<class Type>
inline Type interpolate
(
const GeometricField<Type, pointPatchField, pointMesh>& psip
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "pointMVCWeightI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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 "pointFields.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
inline Type Foam::pointMVCWeight::interpolate
(
const GeometricField<Type, pointPatchField, pointMesh>& psip
) const
{
const labelList& vertices = psip.mesh()().cellPoints()[cellIndex_];
Type t = pTraits<Type>::zero;
forAll(vertices, i)
{
t += psip[vertices[i]]*weights_[i];
}
return t;
}
// ************************************************************************* //

View File

@ -220,6 +220,7 @@ void Foam::FreeStream<CloudType>::inflow()
// Cumulative triangle area fractions
List<scalar> cTriAFracs(nVertices);
cTriAFracs[0] = 0.0;
for (label v = 0; v < nVertices - 1; v++)
{

View File

@ -13,4 +13,5 @@ LIB_LIBS = \
-llagrangian \
-lmeshTools \
-ledgeMesh \
-ltriSurface
-ltriSurface \
-ldistributed

View File

@ -55,7 +55,6 @@ indexedOctree/treeDataPrimitivePatchName.C
indexedOctree/treeDataTriSurface.C
searchableSurface = searchableSurface
$(searchableSurface)/distributedTriSurfaceMesh.C
$(searchableSurface)/searchableBox.C
$(searchableSurface)/searchableCylinder.C
$(searchableSurface)/searchablePlane.C

View File

@ -1,9 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude
LIB_LIBS = \
-ltriSurface \
-ldecompositionMethods \
-llagrangian

View File

@ -66,27 +66,23 @@ void Foam::coordinateRotation::calcTransform
switch (order)
{
case e1e2:
Rtr.x() = a;
Rtr.y() = b;
Rtr.z() = c;
Rtr = tensor(a, b, c);
break;
case e2e3:
Rtr.x() = c;
Rtr.y() = a;
Rtr.z() = b;
Rtr = tensor(c, a, b);
break;
case e3e1:
Rtr.x() = b;
Rtr.y() = c;
Rtr.z() = a;
Rtr = tensor(b, c, a);
break;
default:
FatalErrorIn("coordinateRotation::calcTransform()")
<< "programmer error" << endl
<< abort(FatalError);
// To satisfy compiler warnings
Rtr = tensor::zero;
break;
}

View File

@ -172,19 +172,19 @@ public:
}
//- Return local Cartesian x-axis
vector& e1() const
const vector e1() const
{
return tensor::T().x();
}
//- Return local Cartesian y-axis
vector& e2() const
const vector e2() const
{
return tensor::T().y();
}
//- Return local Cartesian z-axis
vector& e3() const
const vector e3() const
{
return tensor::T().z();
}

View File

@ -346,33 +346,33 @@ public:
}
//- Return local Cartesian x-axis
const vector& e1() const
const vector e1() const
{
return Rtr_.x();
}
//- Return local Cartesian y-axis
const vector& e2() const
const vector e2() const
{
return Rtr_.y();
}
//- Return local Cartesian z-axis
const vector& e3() const
const vector e3() const
{
return Rtr_.z();
}
//- Return axis (e3: local Cartesian z-axis)
// @deprecated method e3 is preferred (deprecated Apr 2008)
const vector& axis() const
const vector axis() const
{
return Rtr_.z();
}
//- Return direction (e1: local Cartesian x-axis)
// @deprecated method e1 is preferred (deprecated Apr 2008)
const vector& direction() const
const vector direction() const
{
return Rtr_.x();
}

10
src/parallel/Allwmake Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
decompose/Allwmake
reconstruct/Allwmake
wmake libso distributed
# ----------------------------------------------------------------- end-of-file

View File

@ -4,5 +4,7 @@ simpleGeomDecomp/simpleGeomDecomp.C
hierarchGeomDecomp/hierarchGeomDecomp.C
manualDecomp/manualDecomp.C
multiLevelDecomp/multiLevelDecomp.C
structuredDecomp/topoDistanceData.C
structuredDecomp/structuredDecomp.C
LIB = $(FOAM_LIBBIN)/libdecompositionMethods

View File

@ -1,4 +1,6 @@
EXE_INC =
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS =
LIB_LIBS = \
-lfiniteVolume

View File

@ -53,7 +53,7 @@ protected:
// Protected data
const dictionary& decompositionDict_;
const dictionary decompositionDict_;
label nProcessors_;

View File

@ -269,10 +269,10 @@ void Foam::hierarchGeomDecomp::findBinary
while (true)
{
label weightedSize = returnReduce
scalar weightedSize = returnReduce
(
sortedWeightedSizes[mid] - sortedWeightedSizes[minIndex],
sumOp<label>()
sumOp<scalar>()
);
if (debug)

View File

@ -0,0 +1,201 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-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 "structuredDecomp.H"
#include "addToRunTimeSelectionTable.H"
#include "IFstream.H"
#include "FaceCellWave.H"
#include "topoDistanceData.H"
#include "fvMeshSubset.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(structuredDecomp, 0);
addToRunTimeSelectionTable
(
decompositionMethod,
structuredDecomp,
dictionary
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::structuredDecomp::structuredDecomp(const dictionary& decompositionDict)
:
decompositionMethod(decompositionDict)
{
dictionary myDict = decompositionDict_.subDict(typeName + "Coeffs");
myDict.set("numberOfSubdomains", nDomains());
method_ = decompositionMethod::New(myDict);
patches_ = wordList(myDict.lookup("patches"));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::structuredDecomp::parallelAware() const
{
return method_().parallelAware();
}
Foam::labelList Foam::structuredDecomp::decompose
(
const polyMesh& mesh,
const pointField& cc,
const scalarField& cWeights
)
{
labelList patchIDs(patches_.size());
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
label nFaces = 0;
forAll(patches_, i)
{
patchIDs[i] = pbm.findPatchID(patches_[i]);
if (patchIDs[i] == -1)
{
FatalErrorIn("structuredDecomp::decompose(..)")
<< "Cannot find patch " << patches_[i] << endl
<< "Valid patches are " << pbm.names()
<< exit(FatalError);
}
nFaces += pbm[patchIDs[i]].size();
}
// Extract a submesh.
labelHashSet patchCells(2*nFaces);
forAll(patchIDs, i)
{
const unallocLabelList& fc = pbm[patchIDs[i]].faceCells();
forAll(fc, i)
{
patchCells.insert(fc[i]);
}
}
// Subset the layer of cells next to the patch
fvMeshSubset subsetter(dynamic_cast<const fvMesh&>(mesh));
subsetter.setLargeCellSubset(patchCells);
const fvMesh& subMesh = subsetter.subMesh();
pointField subCc(cc, subsetter.cellMap());
scalarField subWeights(cWeights, subsetter.cellMap());
// Decompose the layer of cells
labelList subDecomp(method_().decompose(subMesh, subCc, subWeights));
// Transfer to final decomposition
labelList finalDecomp(cc.size(), -1);
forAll(subDecomp, i)
{
finalDecomp[subsetter.cellMap()[i]] = subDecomp[i];
}
// Field on cells and faces.
List<topoDistanceData> cellData(mesh.nCells());
List<topoDistanceData> faceData(mesh.nFaces());
// Start of changes
labelList patchFaces(nFaces);
List<topoDistanceData> patchData(nFaces);
nFaces = 0;
forAll(patchIDs, i)
{
const polyPatch& pp = pbm[patchIDs[i]];
const unallocLabelList& fc = pp.faceCells();
forAll(fc, i)
{
patchFaces[nFaces] = pp.start()+i;
patchData[nFaces] = topoDistanceData(finalDecomp[fc[i]], 0);
nFaces++;
}
}
// Propagate information inwards
FaceCellWave<topoDistanceData> deltaCalc
(
mesh,
patchFaces,
patchData,
faceData,
cellData,
mesh.globalData().nTotalCells()
);
// And extract
bool haveWarned = false;
forAll(finalDecomp, cellI)
{
if (!cellData[cellI].valid())
{
if (!haveWarned)
{
WarningIn("structuredDecomp::decompose(..)")
<< "Did not visit some cells, e.g. cell " << cellI
<< " at " << mesh.cellCentres()[cellI] << endl
<< "Assigning these cells to domain 0." << endl;
haveWarned = true;
}
finalDecomp[cellI] = 0;
}
else
{
finalDecomp[cellI] = cellData[cellI].data();
}
}
return finalDecomp;
}
Foam::labelList Foam::structuredDecomp::decompose
(
const labelListList& globalPointPoints,
const pointField& points,
const scalarField& pointWeights
)
{
notImplemented
(
"structuredDecomp::decompose\n"
"(\n"
" const labelListList&,\n"
" const pointField&,\n"
" const scalarField&\n"
")\n"
);
return labelList::null();
}
// ************************************************************************* //

View File

@ -0,0 +1,142 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-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::structuredDecomp
Description
Decomposition given using consecutive application of decomposers.
SourceFiles
structuredDecomp.C
\*---------------------------------------------------------------------------*/
#ifndef structuredDecomp_H
#define structuredDecomp_H
#include "decompositionMethod.H"
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class structuredDecomp Declaration
\*---------------------------------------------------------------------------*/
class structuredDecomp
:
public decompositionMethod
{
// Private data
autoPtr<decompositionMethod> method_;
wordList patches_;
// Private Member Functions
//- Given connectivity across processors work out connectivity
// for a (consistent) subset
void subsetGlobalCellCells
(
const label nDomains,
const label domainI,
const labelList& dist,
const labelListList& cellCells,
const labelList& set,
labelListList& subCellCells,
labelList& cutConnections
) const;
//- Decompose level methodI without addressing
void decompose
(
const labelListList& pointPoints,
const pointField& points,
const scalarField& pointWeights,
const labelList& pointMap, // map back to original points
const label levelI,
labelField& finalDecomp
);
//- Disallow default bitwise copy construct and assignment
void operator=(const structuredDecomp&);
structuredDecomp(const structuredDecomp&);
public:
//- Runtime type information
TypeName("structured");
// Constructors
//- Construct given the decomposition dictionary
structuredDecomp(const dictionary& decompositionDict);
//- Destructor
virtual ~structuredDecomp()
{}
// Member Functions
//- Is method parallel aware (i.e. does it synchronize domains across
// proc boundaries)
virtual bool parallelAware() const;
//- Return for every coordinate the wanted processor number. Use the
// mesh connectivity (if needed)
virtual labelList decompose
(
const polyMesh& mesh,
const pointField& points,
const scalarField& pointWeights
);
//- Return for every coordinate the wanted processor number. Explicitly
// provided connectivity - does not use mesh_.
virtual labelList decompose
(
const labelListList& globalCellCells,
const pointField& cc,
const scalarField& cWeights
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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 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 "topoDistanceData.H"
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Foam::Ostream& os,
const Foam::topoDistanceData& wDist
)
{
return os << wDist.data_ << token::SPACE << wDist.distance_;
}
Foam::Istream& Foam::operator>>
(
Foam::Istream& is,
Foam::topoDistanceData& wDist
)
{
return is >> wDist.data_ >> wDist.distance_;
}
// ************************************************************************* //

View File

@ -0,0 +1,192 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::topoDistanceData
Description
For use with FaceCellWave. Determines topological distance to starting faces
SourceFiles
topoDistanceDataI.H
topoDistanceData.C
\*---------------------------------------------------------------------------*/
#ifndef topoDistanceData_H
#define topoDistanceData_H
#include "point.H"
#include "tensor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class polyPatch;
class polyMesh;
/*---------------------------------------------------------------------------*\
Class topoDistanceData Declaration
\*---------------------------------------------------------------------------*/
class topoDistanceData
{
// Private data
//- Starting data
label data_;
//- Distance
label distance_;
public:
// Constructors
//- Construct null
inline topoDistanceData();
//- Construct from count
inline topoDistanceData
(
const label data,
const label distance
);
// Member Functions
// Access
inline label data() const
{
return data_;
}
inline label distance() const
{
return distance_;
}
// Needed by FaceCellWave
//- Check whether origin has been changed at all or
// still contains original (invalid) value.
inline bool valid() const;
//- Check for identical geometrical data. Used for cyclics checking.
inline bool sameGeometry
(
const polyMesh&,
const topoDistanceData&,
const scalar
) const;
//- Convert any absolute coordinates into relative to (patch)face
// centre
inline void leaveDomain
(
const polyMesh&,
const polyPatch&,
const label patchFaceI,
const point& faceCentre
);
//- Reverse of leaveDomain
inline void enterDomain
(
const polyMesh&,
const polyPatch&,
const label patchFaceI,
const point& faceCentre
);
//- Apply rotation matrix to any coordinates
inline void transform
(
const polyMesh&,
const tensor&
);
//- Influence of neighbouring face.
inline bool updateCell
(
const polyMesh&,
const label thisCellI,
const label neighbourFaceI,
const topoDistanceData& neighbourInfo,
const scalar tol
);
//- Influence of neighbouring cell.
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const label neighbourCellI,
const topoDistanceData& neighbourInfo,
const scalar tol
);
//- Influence of different value on same face.
inline bool updateFace
(
const polyMesh&,
const label thisFaceI,
const topoDistanceData& neighbourInfo,
const scalar tol
);
// Member Operators
// Needed for List IO
inline bool operator==(const topoDistanceData&) const;
inline bool operator!=(const topoDistanceData&) const;
// IOstream Operators
friend Ostream& operator<<(Ostream&, const topoDistanceData&);
friend Istream& operator>>(Istream&, topoDistanceData&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "topoDistanceDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,194 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-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 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 "polyMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::topoDistanceData::topoDistanceData()
:
data_(-1),
distance_(-1)
{}
// Construct from components
inline Foam::topoDistanceData::topoDistanceData
(
const label data,
const label distance
)
:
data_(data),
distance_(distance)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline bool Foam::topoDistanceData::valid() const
{
return distance_ != -1;
}
// No geometric data so never any problem on cyclics
inline bool Foam::topoDistanceData::sameGeometry
(
const polyMesh&,
const topoDistanceData&,
const scalar
) const
{
return true;
}
// No geometric data.
inline void Foam::topoDistanceData::leaveDomain
(
const polyMesh&,
const polyPatch& patch,
const label patchFaceI,
const point& faceCentre
)
{}
// No geometric data.
inline void Foam::topoDistanceData::transform
(
const polyMesh&,
const tensor& rotTensor
)
{}
// No geometric data.
inline void Foam::topoDistanceData::enterDomain
(
const polyMesh&,
const polyPatch& patch,
const label patchFaceI,
const point& faceCentre
)
{}
// Update cell with neighbouring face information
inline bool Foam::topoDistanceData::updateCell
(
const polyMesh&,
const label thisCellI,
const label neighbourFaceI,
const topoDistanceData& neighbourInfo,
const scalar tol
)
{
if (distance_ == -1)
{
data_ = neighbourInfo.data_;
distance_ = neighbourInfo.distance_ + 1;
return true;
}
else
{
return false;
}
}
// Update face with neighbouring cell information
inline bool Foam::topoDistanceData::updateFace
(
const polyMesh& mesh,
const label thisFaceI,
const label neighbourCellI,
const topoDistanceData& neighbourInfo,
const scalar tol
)
{
// From cell to its faces.
if (distance_ == -1)
{
operator=(neighbourInfo);
return true;
}
else
{
return false;
}
}
// Update face with coupled face information
inline bool Foam::topoDistanceData::updateFace
(
const polyMesh&,
const label thisFaceI,
const topoDistanceData& neighbourInfo,
const scalar tol
)
{
// From face to face (e.g. coupled faces)
if (distance_ == -1)
{
operator=(neighbourInfo);
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline bool Foam::topoDistanceData::operator==
(
const Foam::topoDistanceData& rhs
) const
{
return data() == rhs.data() && distance() == rhs.distance();
}
inline bool Foam::topoDistanceData::operator!=
(
const Foam::topoDistanceData& rhs
) const
{
return !(*this == rhs);
}
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
distributedTriSurfaceMesh/distributedTriSurfaceMesh.C
LIB = $(FOAM_LIBBIN)/libdistributed

View File

@ -0,0 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-ltriSurface \
-ldecompositionMethods \
-lmeshTools

View File

@ -313,7 +313,7 @@ void Foam::cuttingPlane::walkCellCuts
face f(faceVerts);
// Orient face to point in the same direction as the plane normal
if ((f.normal(cutPoints) && normal()) < 0)
if ((f.normal(cutPoints) & normal()) < 0)
{
f = f.reverseFace();
}

View File

@ -1008,7 +1008,7 @@ Foam::surfaceFilmModels::kinematicSingleLayer::T() const
"const volScalarField& kinematicSingleLayer::T() const"
) << "T field not available for " << type() << abort(FatalError);
return reinterpret_cast<const volScalarField&>(null);
return volScalarField::null();
}
@ -1020,7 +1020,7 @@ Foam::surfaceFilmModels::kinematicSingleLayer::cp() const
"const volScalarField& kinematicSingleLayer::cp() const"
) << "cp field not available for " << type() << abort(FatalError);
return reinterpret_cast<const volScalarField&>(null);
return volScalarField::null();
}

View File

@ -137,7 +137,7 @@ const Foam::volVectorField& Foam::surfaceFilmModels::noFilm::U() const
"const volScalarField& noFilm::U() const"
) << "U field not available for " << type() << abort(FatalError);
return reinterpret_cast<const volVectorField&>(null);
return volVectorField::null();
}
@ -148,7 +148,7 @@ const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::rho() const
"const volScalarField& noFilm::rho() const"
) << "rho field not available for " << type() << abort(FatalError);
return reinterpret_cast<const volScalarField&>(null);
return volScalarField::null();
}
@ -159,7 +159,7 @@ const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::T() const
"const Foam::volScalarField& Foam::noFilm::T() const"
) << "T field not available for " << type() << abort(FatalError);
return reinterpret_cast<const volScalarField&>(null);
return volScalarField::null();
}
@ -170,7 +170,7 @@ const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::cp() const
"const volScalarField& noFilm::cp() const"
) << "cp field not available for " << type() << abort(FatalError);
return reinterpret_cast<const volScalarField&>(null);
return volScalarField::null();
}
@ -183,7 +183,7 @@ Foam::surfaceFilmModels::noFilm::massForPrimary() const
) << "massForPrimary field not available for " << type()
<< abort(FatalError);
return reinterpret_cast<const volScalarField&>(null);
return volScalarField::null();
}
@ -196,7 +196,7 @@ Foam::surfaceFilmModels::noFilm::diametersForPrimary() const
) << "diametersForPrimary field not available for " << type()
<< abort(FatalError);
return reinterpret_cast<const volScalarField&>(null);
return volScalarField::null();
}

View File

@ -75,6 +75,12 @@ tmp<volScalarField> SpalartAllmarasDDES::fd(const volScalarField& S) const
}
tmp<volScalarField> SpalartAllmarasDDES::S(const volTensorField& gradU) const
{
return sqrt(2.0)*mag(symm(gradU));
}
tmp<volScalarField> SpalartAllmarasDDES::dTilda(const volScalarField& S) const
{
return max

View File

@ -81,6 +81,8 @@ protected:
//- Length scale
virtual tmp<volScalarField> dTilda(const volScalarField& S) const;
virtual tmp<volScalarField> S(const volTensorField& gradU) const;
public:

View File

@ -59,7 +59,8 @@ int main(int argc, char *argv[])
UA = uInfX*(dimensionedVector(vector(1,0,0))
- pow((radius/magCentres),2)*cs2theta);
runTime.write();
// Force writing of UA (since time has not changed)
UA.write();
Info<< "end" << endl;

View File

@ -1,177 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 0)
(4 0 0)
(0 1 0)
(4 1 0)
(0 2 0)
(4 2 0)
(0 0 2)
(4 0 2)
(0 1 2)
(4 1 2)
(0 2 2)
(4 2 2)
);
blocks
(
hex (0 1 3 2 6 7 9 8) (40 25 30) simpleGrading (1 10.7028 1)
hex (2 3 5 4 8 9 11 10) (40 25 30) simpleGrading (1 0.0984 1)
);
edges
(
);
//patches
//(
// wall bottomWall
// (
// (0 1 7 6)
// )
// wall topWall
// (
// (4 10 11 5)
// )
// cyclic sides1
// (
// (0 2 3 1)
// (6 7 9 8)
// )
// cyclic sides2
// (
// (2 4 5 3)
// (8 9 11 10)
// )
// cyclic inout1
// (
// (1 3 9 7)
// (0 6 8 2)
// )
// cyclic inout2
// (
// (3 5 11 9)
// (2 8 10 4)
// )
//);
boundary
(
bottomWall
{
type wall;
faces
(
(0 1 7 6)
);
}
topWall
{
type wall;
faces
(
(4 10 11 5)
);
}
sides1_half0
{
type cyclic;
neighbourPatch sides1_half1;
faces
(
(0 2 3 1)
);
}
sides1_half1
{
type cyclic;
neighbourPatch sides1_half0;
faces
(
(6 7 9 8)
);
}
sides2_half0
{
type cyclic;
neighbourPatch sides2_half1;
faces
(
(2 4 5 3)
);
}
sides2_half1
{
type cyclic;
neighbourPatch sides2_half0;
faces
(
(8 9 11 10)
);
}
inout1_half0
{
type cyclic;
neighbourPatch inout1_half1;
faces
(
(1 3 9 7)
);
}
inout1_half1
{
type cyclic;
neighbourPatch inout1_half0;
faces
(
(0 6 8 2)
);
}
inout2_half0
{
type cyclic;
neighbourPatch inout2_half1;
faces
(
(3 5 11 9)
);
}
inout2_half1
{
type cyclic;
neighbourPatch inout2_half0;
faces
(
(2 8 10 4)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -2,4 +2,4 @@
set -x
m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
blockMesh >& log.blockMesh
blockMesh > log.blockMesh 2>&1

View File

@ -1,97 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.1;
vertices
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 0.1)
(1 0 0.1)
(1 1 0.1)
(0 1 0.1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (20 20 1) simpleGrading (1 1 1)
);
edges
(
);
//patches
//(
// wall movingWall
// (
// (3 7 6 2)
// )
// wall fixedWalls
// (
// (0 4 7 3)
// (2 6 5 1)
// (1 5 4 0)
// )
// empty frontAndBack
// (
// (0 3 2 1)
// (4 5 6 7)
// )
//);
boundary
(
movingWall
{
type wall;
faces
(
(3 7 6 2)
);
}
fixedWalls
{
type wall;
faces
(
(0 4 7 3)
(2 6 5 1)
(1 5 4 0)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(4 5 6 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -15,6 +15,8 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application porousExplicitSourceReactingParcelFoam;
startFoam startTime;
startTime 0;

View File

@ -84,22 +84,26 @@ boundaryField
maxX
{
type slip;
type fixedNormalSlip;
n (1 0 0);
}
minX
{
type slip;
type fixedNormalSlip;
n (1 0 0);
}
minY
{
type slip;
type fixedNormalSlip;
n (0 1 0);
}
maxY
{
type slip;
type fixedNormalSlip;
n (0 1 0);
}
}

View File

@ -20,15 +20,13 @@ dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolverLibs ("libfvMotionSolvers.so");
solver displacementSBRStress; //displacementLaplacian; //displacementSBRStress;
diffusivity quadratic quadratic inverseDistance 1(minZ);
solver displacementSBRStress; //displacementLaplacian;
//solver velocityComponentLaplacian z;
//diffusivity uniform;
//diffusivity directional (1 200 0);
//diffusivity motionDirectional (1 1000 0);
//diffusivity file motionDiffusivity;
diffusivity quadratic inverseDistance 1(minZ);
// diffusivity exponential 2000 inverseDistance 1(movingWall);
// ************************************************************************* //

View File

@ -19,14 +19,14 @@ convertToMeters 1;
vertices
(
( 659531 4.7513e+06 1028)
( 659531 4.7513e+06 2100)
( 662381 4.7513e+06 2100)
( 662381 4.7513e+06 1028)
( 659531 4.75454e+06 1028)
( 659531 4.75454e+06 2100)
( 662381 4.75454e+06 2100)
( 662381 4.75454e+06 1028)
( 659600 4.7514e+06 1028)
( 659600 4.7514e+06 2100)
( 662300 4.7514e+06 2100)
( 662300 4.7514e+06 1028)
( 659600 4.7545e+06 1028)
( 659600 4.7545e+06 2100)
( 662300 4.7545e+06 2100)
( 662300 4.7545e+06 1028)
);
blocks
(
@ -34,33 +34,34 @@ blocks
);
edges
edges
(
);
patches
(
wall maxX
patch maxX
(
(3 7 6 2)
)
wall minZ
patch minZ
(
(0 4 7 3)
)
wall maxZ
patch maxZ
(
(2 6 5 1)
)
wall minX
patch minX
(
(1 5 4 0)
)
wall minY
patch minY
(
(0 3 2 1)
)
wall maxY
patch maxY
(
(4 5 6 7)
)

View File

@ -33,17 +33,17 @@ writeInterval 5;
purgeWrite 0;
writeFormat ascii;
writeFormat binary;
writePrecision 6;
writeCompression off;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
runTimeModifiable yes;
// ************************************************************************* //

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -mabi=64
#CC = scg++ -mabi=64

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -m64

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor
CC = g++ -m64

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -m64

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -m64

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -m64

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -m32

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -m32

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -m32

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -m32

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast
CC = g++ -m64 -mcpu=power5+

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter
c++WARN = -Wall -Wextra -Wno-unused-parameter
CC = mingw32-g++

View File

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter
c++WARN = -Wall -Wextra -Wno-unused-parameter
CC = g++