Merge branch 'master' of github.com:OpenFOAM/OpenFOAM-2.3.x
This commit is contained in:
commit
b061067198
10 changed files with 123 additions and 124 deletions
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -56,7 +56,7 @@ timeVaryingUniformFixedValuePointPatchField
|
|||
fixedValuePointPatchField<Type>(ptf, p, iF, mapper),
|
||||
timeSeries_(ptf.timeSeries_)
|
||||
{
|
||||
updateCoeffs();
|
||||
this->operator==(timeSeries_(this->db().time().timeOutputValue()));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ timeVaryingUniformFixedValuePointPatchField
|
|||
fixedValuePointPatchField<Type>(p, iF),
|
||||
timeSeries_(dict)
|
||||
{
|
||||
updateCoeffs();
|
||||
this->operator==(timeSeries_(this->db().time().timeOutputValue()));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,15 @@ Foam::label Foam::dynamicRefineFvMesh::count
|
|||
{
|
||||
n++;
|
||||
}
|
||||
|
||||
// debug also serves to get-around Clang compiler trying to optimsie
|
||||
// out this forAll loop under O3 optimisation
|
||||
if (debug)
|
||||
{
|
||||
Info<< "n=" << n << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
@ -659,11 +667,11 @@ Foam::dynamicRefineFvMesh::maxPointField(const scalarField& pFld) const
|
|||
}
|
||||
|
||||
|
||||
// Get min of connected cell
|
||||
// Get max of connected cell
|
||||
Foam::scalarField
|
||||
Foam::dynamicRefineFvMesh::minCellField(const volScalarField& vFld) const
|
||||
Foam::dynamicRefineFvMesh::maxCellField(const volScalarField& vFld) const
|
||||
{
|
||||
scalarField pFld(nPoints(), GREAT);
|
||||
scalarField pFld(nPoints(), -GREAT);
|
||||
|
||||
forAll(pointCells(), pointI)
|
||||
{
|
||||
|
|
@ -671,7 +679,7 @@ Foam::dynamicRefineFvMesh::minCellField(const volScalarField& vFld) const
|
|||
|
||||
forAll(pCells, i)
|
||||
{
|
||||
pFld[pointI] = min(pFld[pointI], vFld[pCells[i]]);
|
||||
pFld[pointI] = max(pFld[pointI], vFld[pCells[i]]);
|
||||
}
|
||||
}
|
||||
return pFld;
|
||||
|
|
@ -774,10 +782,11 @@ Foam::labelList Foam::dynamicRefineFvMesh::selectRefineCells
|
|||
calculateProtectedCells(unrefineableCell);
|
||||
|
||||
// Count current selection
|
||||
label nCandidates = returnReduce(count(candidateCell, 1), sumOp<label>());
|
||||
label nLocalCandidates = count(candidateCell, 1);
|
||||
label nCandidates = returnReduce(nLocalCandidates, sumOp<label>());
|
||||
|
||||
// Collect all cells
|
||||
DynamicList<label> candidates(nCells());
|
||||
DynamicList<label> candidates(nLocalCandidates);
|
||||
|
||||
if (nCandidates < nTotToRefine)
|
||||
{
|
||||
|
|
@ -1167,7 +1176,7 @@ Foam::dynamicRefineFvMesh::dynamicRefineFvMesh(const IOobject& io)
|
|||
}
|
||||
|
||||
Info<< "Detected " << returnReduce(nProtected, sumOp<label>())
|
||||
<< " cells that are projected from refinement."
|
||||
<< " cells that are protected from refinement."
|
||||
<< " Writing these to cellSet "
|
||||
<< protectedCells.name()
|
||||
<< "." << endl;
|
||||
|
|
@ -1263,25 +1272,28 @@ bool Foam::dynamicRefineFvMesh::update()
|
|||
readScalar(refineDict.lookup("lowerRefineLevel"));
|
||||
const scalar upperRefineLevel =
|
||||
readScalar(refineDict.lookup("upperRefineLevel"));
|
||||
const scalar unrefineLevel =
|
||||
readScalar(refineDict.lookup("unrefineLevel"));
|
||||
const scalar unrefineLevel = refineDict.lookupOrDefault<scalar>
|
||||
(
|
||||
"unrefineLevel",
|
||||
GREAT
|
||||
);
|
||||
const label nBufferLayers =
|
||||
readLabel(refineDict.lookup("nBufferLayers"));
|
||||
|
||||
// Cells marked for refinement or otherwise protected from unrefinement.
|
||||
PackedBoolList refineCell(nCells());
|
||||
|
||||
// Determine candidates for refinement (looking at field only)
|
||||
selectRefineCandidates
|
||||
(
|
||||
lowerRefineLevel,
|
||||
upperRefineLevel,
|
||||
vFld,
|
||||
refineCell
|
||||
);
|
||||
|
||||
if (globalData().nTotalCells() < maxCells)
|
||||
{
|
||||
// Determine candidates for refinement (looking at field only)
|
||||
selectRefineCandidates
|
||||
(
|
||||
lowerRefineLevel,
|
||||
upperRefineLevel,
|
||||
vFld,
|
||||
refineCell
|
||||
);
|
||||
|
||||
// Select subset of candidates. Take into account max allowable
|
||||
// cells, refinement level, protected cells.
|
||||
labelList cellsToRefine
|
||||
|
|
@ -1352,7 +1364,7 @@ bool Foam::dynamicRefineFvMesh::update()
|
|||
(
|
||||
unrefineLevel,
|
||||
refineCell,
|
||||
minCellField(vFld)
|
||||
maxCellField(vFld)
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ Description
|
|||
// Refine field inbetween lower..upper
|
||||
lowerRefineLevel 0.001;
|
||||
upperRefineLevel 0.999;
|
||||
// If value < unrefineLevel unrefine
|
||||
unrefineLevel 10;
|
||||
// If value < unrefineLevel (default=GREAT) unrefine
|
||||
//unrefineLevel 10;
|
||||
// Have slower than 2:1 refinement
|
||||
nBufferLayers 1;
|
||||
// Refine cells only up to maxRefinement levels
|
||||
|
|
@ -79,7 +79,7 @@ namespace Foam
|
|||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class dynamicRefineFvMesh Declaration
|
||||
Class dynamicRefineFvMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class dynamicRefineFvMesh
|
||||
|
|
@ -139,8 +139,8 @@ protected:
|
|||
//- Get per cell max of connected point
|
||||
scalarField maxPointField(const scalarField&) const;
|
||||
|
||||
//- Get point min of connected cell
|
||||
scalarField minCellField(const volScalarField&) const;
|
||||
//- Get point max of connected cell
|
||||
scalarField maxCellField(const volScalarField&) const;
|
||||
|
||||
scalarField cellToPoint(const scalarField& vFld) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -75,9 +75,9 @@ Foam::solidBodyMotionFunctions::rotatingMotion::transformation() const
|
|||
scalar t = time_.value();
|
||||
|
||||
// Rotation around axis
|
||||
vector eulerAngles = omega_->integrate(0, t)*axis_;
|
||||
scalar angle = omega_->integrate(0, t);
|
||||
|
||||
quaternion R(eulerAngles.x(), eulerAngles.y(), eulerAngles.z());
|
||||
quaternion R(axis_, angle);
|
||||
septernion TR(septernion(origin_)*R*septernion(-origin_));
|
||||
|
||||
Info<< "solidBodyMotionFunctions::rotatingMotion::transformation(): "
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -107,7 +107,7 @@ void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs()
|
|||
|
||||
const fvMesh& mesh = dimensionedInternalField().mesh();
|
||||
|
||||
if (mesh.changing())
|
||||
if (mesh.moving())
|
||||
{
|
||||
const fvPatch& p = patch();
|
||||
const polyPatch& pp = p.patch();
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ bool Foam::KinematicParcel<ParcelType>::move
|
|||
const scalar maxCo = td.cloud().solution().maxCo();
|
||||
|
||||
scalar tEnd = (1.0 - p.stepFraction())*trackTime;
|
||||
const scalar dtMax = tEnd;
|
||||
const scalar dtMax = maxCo*trackTime;
|
||||
|
||||
bool tracking = true;
|
||||
label nTrackingStalled = 0;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -76,20 +76,8 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
|
|||
}
|
||||
else
|
||||
{
|
||||
is.read
|
||||
(
|
||||
reinterpret_cast<char*>(&active_),
|
||||
sizeof(active_)
|
||||
+ sizeof(typeId_)
|
||||
+ sizeof(nParticle_)
|
||||
+ sizeof(d_)
|
||||
+ sizeof(dTarget_)
|
||||
+ sizeof(U_)
|
||||
+ sizeof(rho_)
|
||||
+ sizeof(age_)
|
||||
+ sizeof(tTurb_)
|
||||
+ sizeof(UTurb_)
|
||||
);
|
||||
label size = long(&UTurb_) - long(&active_) + sizeof(UTurb_);
|
||||
is.read(reinterpret_cast<char*>(&active_), size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -248,20 +236,9 @@ Foam::Ostream& Foam::operator<<
|
|||
else
|
||||
{
|
||||
os << static_cast<const ParcelType&>(p);
|
||||
os.write
|
||||
(
|
||||
reinterpret_cast<const char*>(&p.active_),
|
||||
sizeof(p.active())
|
||||
+ sizeof(p.typeId())
|
||||
+ sizeof(p.nParticle())
|
||||
+ sizeof(p.d())
|
||||
+ sizeof(p.dTarget())
|
||||
+ sizeof(p.U())
|
||||
+ sizeof(p.rho())
|
||||
+ sizeof(p.age())
|
||||
+ sizeof(p.tTurb())
|
||||
+ sizeof(p.UTurb())
|
||||
);
|
||||
|
||||
label size = long(&p.UTurb_) - long(&p.active_) + sizeof(p.UTurb_);
|
||||
os.write(reinterpret_cast<const char*>(&p.active_), size);
|
||||
}
|
||||
|
||||
// Check state of Ostream
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
|
@ -58,12 +58,8 @@ Foam::ThermoParcel<ParcelType>::ThermoParcel
|
|||
}
|
||||
else
|
||||
{
|
||||
is.read
|
||||
(
|
||||
reinterpret_cast<char*>(&T_),
|
||||
+ sizeof(T_)
|
||||
+ sizeof(Cp_)
|
||||
);
|
||||
label size = long(&Cp_) - long(&T_) + sizeof(Cp_);
|
||||
is.read(reinterpret_cast<char*>(&T_), size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,11 +145,9 @@ Foam::Ostream& Foam::operator<<
|
|||
else
|
||||
{
|
||||
os << static_cast<const ParcelType&>(p);
|
||||
os.write
|
||||
(
|
||||
reinterpret_cast<const char*>(&p.T_),
|
||||
sizeof(p.T()) + sizeof(p.Cp())
|
||||
);
|
||||
|
||||
label size = long(&p.Cp_) - long(&p.T_) + sizeof(p.Cp_);
|
||||
os.write(reinterpret_cast<const char*>(&p.T_), size);
|
||||
}
|
||||
|
||||
// Check state of Ostream
|
||||
|
|
|
|||
|
|
@ -381,70 +381,82 @@ Foam::labelList Foam::meshRefinement::nearestPatch
|
|||
{
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
// Count number of faces in adaptPatchIDs
|
||||
label nFaces = 0;
|
||||
forAll(adaptPatchIDs, i)
|
||||
labelList nearestAdaptPatch;
|
||||
|
||||
if (adaptPatchIDs.size())
|
||||
{
|
||||
const polyPatch& pp = patches[adaptPatchIDs[i]];
|
||||
nFaces += pp.size();
|
||||
}
|
||||
nearestAdaptPatch.setSize(mesh_.nFaces(), adaptPatchIDs[0]);
|
||||
|
||||
// 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(adaptPatchIDs, i)
|
||||
{
|
||||
label patchI = adaptPatchIDs[i];
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
forAll(pp, i)
|
||||
// Count number of faces in adaptPatchIDs
|
||||
label nFaces = 0;
|
||||
forAll(adaptPatchIDs, i)
|
||||
{
|
||||
patchFaces[nFaces] = pp.start()+i;
|
||||
patchData[nFaces] = topoDistanceData(patchI, 0);
|
||||
nFaces++;
|
||||
const polyPatch& pp = patches[adaptPatchIDs[i]];
|
||||
nFaces += pp.size();
|
||||
}
|
||||
}
|
||||
|
||||
// Propagate information inwards
|
||||
FaceCellWave<topoDistanceData> deltaCalc
|
||||
(
|
||||
mesh_,
|
||||
patchFaces,
|
||||
patchData,
|
||||
faceData,
|
||||
cellData,
|
||||
mesh_.globalData().nTotalCells()+1
|
||||
);
|
||||
// Field on cells and faces.
|
||||
List<topoDistanceData> cellData(mesh_.nCells());
|
||||
List<topoDistanceData> faceData(mesh_.nFaces());
|
||||
|
||||
// And extract
|
||||
labelList nearestAdaptPatch(mesh_.nFaces(), adaptPatchIDs[0]);
|
||||
|
||||
bool haveWarned = false;
|
||||
forAll(faceData, faceI)
|
||||
{
|
||||
if (!faceData[faceI].valid(deltaCalc.data()))
|
||||
// Start of changes
|
||||
labelList patchFaces(nFaces);
|
||||
List<topoDistanceData> patchData(nFaces);
|
||||
nFaces = 0;
|
||||
forAll(adaptPatchIDs, i)
|
||||
{
|
||||
if (!haveWarned)
|
||||
label patchI = adaptPatchIDs[i];
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
WarningIn("meshRefinement::nearestPatch(..)")
|
||||
<< "Did not visit some faces, e.g. face " << faceI
|
||||
<< " at " << mesh_.faceCentres()[faceI] << endl
|
||||
<< "Assigning these cells to patch "
|
||||
<< adaptPatchIDs[0]
|
||||
<< endl;
|
||||
haveWarned = true;
|
||||
patchFaces[nFaces] = pp.start()+i;
|
||||
patchData[nFaces] = topoDistanceData(patchI, 0);
|
||||
nFaces++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
// Propagate information inwards
|
||||
FaceCellWave<topoDistanceData> deltaCalc
|
||||
(
|
||||
mesh_,
|
||||
patchFaces,
|
||||
patchData,
|
||||
faceData,
|
||||
cellData,
|
||||
mesh_.globalData().nTotalCells()+1
|
||||
);
|
||||
|
||||
// And extract
|
||||
|
||||
bool haveWarned = false;
|
||||
forAll(faceData, faceI)
|
||||
{
|
||||
nearestAdaptPatch[faceI] = faceData[faceI].data();
|
||||
if (!faceData[faceI].valid(deltaCalc.data()))
|
||||
{
|
||||
if (!haveWarned)
|
||||
{
|
||||
WarningIn("meshRefinement::nearestPatch(..)")
|
||||
<< "Did not visit some faces, e.g. face " << faceI
|
||||
<< " at " << mesh_.faceCentres()[faceI] << endl
|
||||
<< "Assigning these cells to patch "
|
||||
<< adaptPatchIDs[0]
|
||||
<< endl;
|
||||
haveWarned = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nearestAdaptPatch[faceI] = faceData[faceI].data();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use patch 0
|
||||
nearestAdaptPatch.setSize(mesh_.nFaces(), 0);
|
||||
}
|
||||
|
||||
return nearestAdaptPatch;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion()
|
|||
constraints_(),
|
||||
tConstraints_(tensor::I),
|
||||
rConstraints_(tensor::I),
|
||||
initialCentreOfMass_(vector::zero),
|
||||
initialCentreOfRotation_(vector::zero),
|
||||
initialQ_(I),
|
||||
mass_(VSMALL),
|
||||
|
|
@ -157,6 +158,9 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
|||
motionState0_(sDoFRBM.motionState0_),
|
||||
restraints_(sDoFRBM.restraints_),
|
||||
constraints_(sDoFRBM.constraints_),
|
||||
tConstraints_(sDoFRBM.tConstraints_),
|
||||
rConstraints_(sDoFRBM.rConstraints_),
|
||||
initialCentreOfMass_(sDoFRBM.initialCentreOfMass_),
|
||||
initialCentreOfRotation_(sDoFRBM.initialCentreOfRotation_),
|
||||
initialQ_(sDoFRBM.initialQ_),
|
||||
mass_(sDoFRBM.mass_),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue