Skip to content

Commit

Permalink
Merge branch 'master' of github.com:OpenFOAM/OpenFOAM-2.3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
sergio committed Oct 14, 2014
2 parents 488c7a8 + 086b092 commit 5d8318b
Show file tree
Hide file tree
Showing 36 changed files with 601 additions and 378 deletions.
12 changes: 2 additions & 10 deletions applications/solvers/multiphase/driftFluxFoam/alphaEqn.H
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,7 @@
).fvmDiv(phi, alpha1)
);

solve
(
alpha1Eqn
- fv::gaussLaplacianScheme<scalar, scalar>
(
mesh,
linear<scalar>(mesh),
fv::uncorrectedSnGrad<scalar>(mesh)
).fvmLaplacian(fvc::interpolate(turbulence->nut()), alpha1)
);
solve(alpha1Eqn);

Info<< "Phase-1 volume fraction = "
<< alpha1.weightedAverage(mesh.Vsc()).value()
Expand All @@ -42,6 +33,7 @@
if (alphaApplyPrevCorr && tphiAlphaCorr0.valid())
{
Info<< "Applying the previous iteration correction flux" << endl;

#ifdef LTSSOLVE
MULES::LTScorrect
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@

// Apply the diffusion term separately to allow implicit solution
// and boundedness of the explicit advection
if (!MULESCorr)
{
fvScalarMatrix alpha1Eqn
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ addLayersControls
// - overall thickness and firstLayerThickness
// - overall thickness and finalLayerThickness
// - overall thickness and expansionRatio
//
// Note: the mode thus selected is global, i.e. one cannot override the
// mode on a per-patch basis (only the values can be overridden)

// Expansion factor for layer mesh
expansionRatio 1.0;
Expand Down
2 changes: 1 addition & 1 deletion applications/utilities/surface/surfaceCheck/surfaceCheck.C
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ int main(int argc, char *argv[])
faces,
"zone",
scalarFaceZone,
true
false // face based data
);
}

Expand Down
185 changes: 96 additions & 89 deletions src/OpenFOAM/meshes/primitiveMesh/PatchTools/PatchToolsNormals.C
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -45,9 +45,6 @@ Foam::PatchTools::pointNormals
const PrimitivePatch<Face, FaceList, PointField, PointType>& p
)
{
// Assume patch is smaller than the globalData().coupledPatch() (?) so
// loop over patch meshPoints.

const globalMeshData& globalData = mesh.globalData();
const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch();
const Map<label>& coupledPatchMP = coupledPatch.meshPointMap();
Expand All @@ -56,121 +53,131 @@ Foam::PatchTools::pointNormals
globalData.globalTransforms();


// 1. Start off with local normals (note:without calculating pointNormals
// to avoid them being stored)

tmp<pointField> textrudeN(new pointField(p.nPoints(), vector::zero));
pointField& extrudeN = textrudeN();
{
const faceList& localFaces = p.localFaces();
const vectorField& faceNormals = p.faceNormals();

forAll(localFaces, faceI)
{
const face& f = localFaces[faceI];
const vector& n = faceNormals[faceI];
forAll(f, fp)
{
extrudeN[f[fp]] += n;
}
}
extrudeN /= mag(extrudeN)+VSMALL;
}
// Combine normals. Note: do on all master points. Cannot just use
// patch points since the master point does not have to be on the
// patch!

pointField coupledPointNormals(map.constructSize(), vector::zero);

// Collect local pointFaces
List<List<point> > pointFaceNormals(map.constructSize());
forAll(p.meshPoints(), patchPointI)
{
label meshPointI = p.meshPoints()[patchPointI];
Map<label>::const_iterator fnd = coupledPatchMP.find(meshPointI);
if (fnd != coupledPatchMP.end())
// Collect local pointFaces (sized on patch points only)
List<List<point> > pointFaceNormals(map.constructSize());
forAll(p.meshPoints(), patchPointI)
{
label coupledPointI = fnd();

List<point>& pNormals = pointFaceNormals[coupledPointI];
const labelList& pFaces = p.pointFaces()[patchPointI];
pNormals.setSize(pFaces.size());
forAll(pFaces, i)
label meshPointI = p.meshPoints()[patchPointI];
Map<label>::const_iterator fnd = coupledPatchMP.find(meshPointI);
if (fnd != coupledPatchMP.end())
{
pNormals[i] = p.faceNormals()[pFaces[i]];
label coupledPointI = fnd();

List<point>& pNormals = pointFaceNormals[coupledPointI];
const labelList& pFaces = p.pointFaces()[patchPointI];
pNormals.setSize(pFaces.size());
forAll(pFaces, i)
{
pNormals[i] = p.faceNormals()[pFaces[i]];
}
}
}
}


// Pull remote data into local slots
map.distribute
(
transforms,
pointFaceNormals,
mapDistribute::transform()
);

// Pull remote data into local slots
map.distribute
(
transforms,
pointFaceNormals,
mapDistribute::transform()
);

// Combine normals
const labelListList& slaves = globalData.globalPointSlaves();
const labelListList& transformedSlaves =
globalData.globalPointTransformedSlaves();

// Combine all face normals (-local, -remote,untransformed,
// -remote,transformed)

pointField coupledPointNormals(map.constructSize(), vector::zero);
const labelListList& slaves = globalData.globalPointSlaves();
const labelListList& transformedSlaves =
globalData.globalPointTransformedSlaves();

forAll(p.meshPoints(), patchPointI)
{
label meshPointI = p.meshPoints()[patchPointI];
Map<label>::const_iterator fnd = coupledPatchMP.find(meshPointI);
if (fnd != coupledPatchMP.end())
forAll(slaves, coupledPointI)
{
label coupledPointI = fnd();
const labelList& slaveSlots =
slaves[coupledPointI];
const labelList& slaveSlots = slaves[coupledPointI];
const labelList& transformedSlaveSlots =
transformedSlaves[coupledPointI];

label nFaces = slaveSlots.size()+transformedSlaveSlots.size();
if (nFaces > 0)
{
// Combine
point& n = coupledPointNormals[coupledPointI];
point& n = coupledPointNormals[coupledPointI];

n += sum(pointFaceNormals[coupledPointI]);
// Local entries
const List<point>& local = pointFaceNormals[coupledPointI];

forAll(slaveSlots, i)
{
n += sum(pointFaceNormals[slaveSlots[i]]);
}
forAll(transformedSlaveSlots, i)
{
n += sum(pointFaceNormals[transformedSlaveSlots[i]]);
}
label nFaces =
local.size()
+ slaveSlots.size()
+ transformedSlaveSlots.size();

n = sum(local);

// Add any remote face normals
forAll(slaveSlots, i)
{
n += sum(pointFaceNormals[slaveSlots[i]]);
}
forAll(transformedSlaveSlots, i)
{
n += sum(pointFaceNormals[transformedSlaveSlots[i]]);
}

if (nFaces >= 1)
{
n /= mag(n)+VSMALL;
}

// Put back into slave slots
forAll(slaveSlots, i)
{
coupledPointNormals[slaveSlots[i]] = n;
}
forAll(transformedSlaveSlots, i)
{
coupledPointNormals[transformedSlaveSlots[i]] = n;
}
// Put back into slave slots
forAll(slaveSlots, i)
{
coupledPointNormals[slaveSlots[i]] = n;
}
forAll(transformedSlaveSlots, i)
{
coupledPointNormals[transformedSlaveSlots[i]] = n;
}
}


// Send back
map.reverseDistribute
(
transforms,
coupledPointNormals.size(),
coupledPointNormals,
mapDistribute::transform()
);
}


// Send back
map.reverseDistribute
(
transforms,
coupledPointNormals.size(),
coupledPointNormals,
mapDistribute::transform()
);
// 1. Start off with local normals (note:without calculating pointNormals
// to avoid them being stored)

tmp<pointField> textrudeN(new pointField(p.nPoints(), vector::zero));
pointField& extrudeN = textrudeN();
{
const faceList& localFaces = p.localFaces();
const vectorField& faceNormals = p.faceNormals();

forAll(localFaces, faceI)
{
const face& f = localFaces[faceI];
const vector& n = faceNormals[faceI];
forAll(f, fp)
{
extrudeN[f[fp]] += n;
}
}
extrudeN /= mag(extrudeN)+VSMALL;
}


// Override patch normals
// 2. Override patch normals on coupled points
forAll(p.meshPoints(), patchPointI)
{
label meshPointI = p.meshPoints()[patchPointI];
Expand Down
12 changes: 11 additions & 1 deletion src/dynamicMesh/motionSmoother/motionSmootherAlgo.C
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -528,6 +528,16 @@ void Foam::motionSmootherAlgo::setDisplacement
}


// Combine any coupled points
syncTools::syncPointList
(
mesh,
displacement,
maxMagEqOp(), // combine op
vector::zero // null value
);


// Adapt the fixedValue bc's (i.e. copy internal point data to
// boundaryField for all affected patches)
setDisplacementPatchFields(patchIDs, displacement);
Expand Down
14 changes: 11 additions & 3 deletions src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
Expand Down Expand Up @@ -107,6 +107,7 @@ void Foam::MULES::correct
psiMax, psiMin,
nLimiterIter
);

correct(rDeltaT, rho, psi, phi, phiCorr, Sp, Su);
}

Expand Down Expand Up @@ -172,6 +173,13 @@ void Foam::MULES::limiterCorr

const fvMesh& mesh = psi.mesh();

const dictionary& MULEScontrols = mesh.solverDict(psi.name());

scalar extremaCoeff
(
MULEScontrols.lookupOrDefault<scalar>("extremaCoeff", 0.0)
);

const labelUList& owner = mesh.owner();
const labelUList& neighb = mesh.neighbour();
tmp<volScalarField::DimensionedInternalField> tVsc = mesh.Vsc();
Expand Down Expand Up @@ -283,8 +291,8 @@ void Foam::MULES::limiterCorr
}
}

psiMaxn = min(psiMaxn, psiMax);
psiMinn = max(psiMinn, psiMin);
psiMaxn = min(psiMaxn + extremaCoeff*(psiMax - psiMin), psiMax);
psiMinn = max(psiMinn - extremaCoeff*(psiMax - psiMin), psiMin);

// scalar smooth = 0.5;
// psiMaxn = min((1.0 - smooth)*psiIf + smooth*psiMaxn, psiMax);
Expand Down
2 changes: 1 addition & 1 deletion src/mesh/autoMesh/Make/files
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ autoHexMesh = autoHexMesh
autoHexMeshDriver = $(autoHexMesh)/autoHexMeshDriver

$(autoHexMeshDriver)/autoLayerDriver.C
$(autoHexMeshDriver)/autoLayerDriverShrink.C
/* $(autoHexMeshDriver)/autoLayerDriverShrink.C */
$(autoHexMeshDriver)/autoSnapDriver.C
$(autoHexMeshDriver)/autoSnapDriverFeature.C
$(autoHexMeshDriver)/autoRefineDriver.C
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,7 +29,6 @@ Description
SourceFiles
autoLayerDriver.C
autoLayerDriverShrink.C
\*---------------------------------------------------------------------------*/

Expand Down
Loading

0 comments on commit 5d8318b

Please sign in to comment.