Commit cf74575f authored by Andrew Heather's avatar Andrew Heather
Browse files

INT: Minor integration updates

parent 230d7681
...@@ -31,10 +31,11 @@ License ...@@ -31,10 +31,11 @@ License
#include "PrimitivePatchInterpolation.H" #include "PrimitivePatchInterpolation.H"
#include "syncTools.H" #include "syncTools.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "faCFD.H" #include "faMatrices.H"
#include "fixedValueFaPatchFieldsFwd.H" #include "famSup.H"
#include "famLaplacian.H"
#include "volSurfaceMapping.H"
#include "fixedValueFaPatchFields.H" #include "fixedValueFaPatchFields.H"
#include "zeroGradientFaPatchFieldsFwd.H"
#include "zeroGradientFaPatchFields.H" #include "zeroGradientFaPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...@@ -79,7 +80,7 @@ void sensitivitySurface::addGeometricSens() ...@@ -79,7 +80,7 @@ void sensitivitySurface::addGeometricSens()
for (const label patchI : sensitivityPatchIDs_) for (const label patchI : sensitivityPatchIDs_)
{ {
const fvPatch& patch = mesh_.boundary()[patchI]; const fvPatch& patch = mesh_.boundary()[patchI];
vectorField nf(patch.nf()); const vectorField nf(patch.nf());
// point sens result for patch // point sens result for patch
vectorField& patchdSdb = pointSensdSdb()[patchI]; vectorField& patchdSdb = pointSensdSdb()[patchI];
...@@ -87,14 +88,10 @@ void sensitivitySurface::addGeometricSens() ...@@ -87,14 +88,10 @@ void sensitivitySurface::addGeometricSens()
vectorField dSdbMultiplierTot(patch.size(), Zero); vectorField dSdbMultiplierTot(patch.size(), Zero);
vectorField dndbMultiplierTot(patch.size(), Zero); vectorField dndbMultiplierTot(patch.size(), Zero);
forAll(functions, funcI) for (auto& fun : functions)
{ {
dSdbMultiplierTot += dSdbMultiplierTot += fun.weight()*fun.dSdbMultiplier(patchI);
functions[funcI].weight() dndbMultiplierTot += fun.weight()*fun.dndbMultiplier(patchI);
*functions[funcI].dSdbMultiplier(patchI);
dndbMultiplierTot +=
functions[funcI].weight()
*functions[funcI].dndbMultiplier(patchI);
} }
// Correspondence of local point addressing to global point // Correspondence of local point addressing to global point
// addressing // addressing
...@@ -114,13 +111,12 @@ void sensitivitySurface::addGeometricSens() ...@@ -114,13 +111,12 @@ void sensitivitySurface::addGeometricSens()
forAll(meshPoints, ppI) forAll(meshPoints, ppI)
{ {
const labelList& pointFaces = patchPointFaces[ppI]; const labelList& pointFaces = patchPointFaces[ppI];
forAll(pointFaces, pfI) for (label localFaceIndex : pointFaces)
{ {
label localFaceIndex = pointFaces[pfI];
label globalFaceIndex = patchStartIndex + localFaceIndex; label globalFaceIndex = patchStartIndex + localFaceIndex;
const face& faceI = faces[globalFaceIndex]; const face& faceI = faces[globalFaceIndex];
// Point coordinates. All indices in global numbering // Point coordinates. All indices in global numbering
pointField p(faceI.points(mesh_.points())); const pointField p(faceI.points(mesh_.points()));
tensorField p_d(faceI.size(), Zero); tensorField p_d(faceI.size(), Zero);
forAll(faceI, facePointI) forAll(faceI, facePointI)
{ {
...@@ -129,8 +125,10 @@ void sensitivitySurface::addGeometricSens() ...@@ -129,8 +125,10 @@ void sensitivitySurface::addGeometricSens()
p_d[facePointI] = tensor::I; p_d[facePointI] = tensor::I;
} }
} }
tensorField deltaNormals = const tensorField deltaNormals
dBoundary.makeFaceCentresAndAreas_d(p, p_d); (
dBoundary.makeFaceCentresAndAreas_d(p, p_d)
);
// Element [1] is the variation in the (dimensional) normal // Element [1] is the variation in the (dimensional) normal
const tensor& deltaSf = deltaNormals[1]; const tensor& deltaSf = deltaNormals[1];
...@@ -139,7 +137,7 @@ void sensitivitySurface::addGeometricSens() ...@@ -139,7 +137,7 @@ void sensitivitySurface::addGeometricSens()
// Element [2] is the variation in the unit normal // Element [2] is the variation in the unit normal
const tensor& deltaNf = deltaNormals[2]; const tensor& deltaNf = deltaNormals[2];
patchdndb[ppI] += patchdndb[ppI] +=
dndbMultiplierTot[localFaceIndex] & deltaNf; dndbMultiplierTot[localFaceIndex] & deltaNf;
} }
} }
...@@ -231,8 +229,8 @@ void sensitivitySurface::smoothSensitivities() ...@@ -231,8 +229,8 @@ void sensitivitySurface::smoothSensitivities()
"faceLabels", "faceLabels",
mesh_.time().findInstance mesh_.time().findInstance
( (
mesh_.dbDir()/faMesh::meshSubDir, mesh_.dbDir()/faMesh::meshSubDir,
"faceLabels", "faceLabels",
IOobject::READ_IF_PRESENT IOobject::READ_IF_PRESENT
), ),
faMesh::meshSubDir, faMesh::meshSubDir,
...@@ -260,7 +258,7 @@ void sensitivitySurface::smoothSensitivities() ...@@ -260,7 +258,7 @@ void sensitivitySurface::smoothSensitivities()
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
); );
// If the faMeshDefinitionDict exists, use it to construct the mesh // If the faMeshDefinitionDict exists, use it to construct the mesh
if (faMeshDefinitionDict.typeHeaderOk<IOdictionary>(false)) if (faMeshDefinitionDict.typeHeaderOk<IOdictionary>(false))
{ {
...@@ -271,16 +269,16 @@ void sensitivitySurface::smoothSensitivities() ...@@ -271,16 +269,16 @@ void sensitivitySurface::smoothSensitivities()
// sensitivities // sensitivities
else else
{ {
Info<< "Constructing faMeshDefinition from sensitivity patches" Info<< "Constructing faMeshDefinition from sensitivity patches"
<< endl; << endl;
wordList polyMeshPatches(sensitivityPatchIDs_.size()); wordList polyMeshPatches(sensitivityPatchIDs_.size());
label i(0); label i(0);
for (const label patchID : sensitivityPatchIDs_) for (const label patchID : sensitivityPatchIDs_)
{ {
polyMeshPatches[i++] = mesh_.boundary()[patchID].name(); polyMeshPatches[i++] = mesh_.boundary()[patchID].name();
} }
faMeshDefinition.add<wordList>("polyMeshPatches", polyMeshPatches); faMeshDefinition.add<wordList>("polyMeshPatches", polyMeshPatches);
dictionary& boundary = faMeshDefinition.subDictOrAdd("boundary"); (void)faMeshDefinition.subDictOrAdd("boundary");
} }
// Construct faMesh // Construct faMesh
...@@ -293,10 +291,10 @@ void sensitivitySurface::smoothSensitivities() ...@@ -293,10 +291,10 @@ void sensitivitySurface::smoothSensitivities()
const scalar Rphysical const scalar Rphysical
(dict().getOrDefault<scalar>("radius", computeRadius(aMesh))); (dict().getOrDefault<scalar>("radius", computeRadius(aMesh)));
DebugInfo DebugInfo
<< "Physical radius of the sensitivity smoothing " << "Physical radius of the sensitivity smoothing "
<< Rphysical << nl << endl; << Rphysical << nl << endl;
// Radius used as the diffusivity in the Helmholtz filter, computed as a // Radius used as the diffusivity in the Helmholtz filter, computed as a
// function of the physical radius // function of the physical radius
const dimensionedScalar RpdeSqr const dimensionedScalar RpdeSqr
( (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment