This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/performEdgeCorrectedVolPointInterpolation.H

134 lines
2.8 KiB
C
Raw Normal View History

2012-09-11 15:42:55 +00:00
// Do "normal" interpolation
//volPointInterpolation::interpolate(vf, pf);
//- interpolation is done just before this file
pointVectorField& pf = pointDU;
// Do the correction
//GeometricField<Type, pointPatchField, pointMesh> pfCorr
/*pointVectorField pfCorr
(
IOobject
(
// "edgeCorrectedVolPointInterpolate(" + vf.name() + ")Corr",
"edgeCorrectedVolPointInterpolate(" + DU.name() + ")Corr",
//vf.instance(),
DU,
pMesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
pMesh,
//dimensioned<Type>("zero", pf.dimensions(), pTraits<Type>::zero),
dimensionedVector("zero", pf.dimensions(), vector::zero),
pf.boundaryField().types()
);*/
pointVectorField pfCorr
2012-09-11 15:42:55 +00:00
(
IOobject
(
"pointDUcorr",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
pMesh,
dimensionedVector("vector", dimLength, vector::zero),
"calculated"
);
//const labelList& ptc = boundaryPoints();
#include "findBoundaryPoints.H"
//const FieldField<Field, vector>& extraVecs = extrapolationVectors(); ///*********
#include "calculateExtrapolationVectors.H"
//const FieldField<Field, scalar>& w = pointBoundaryWeights(); ///*********
#include "calculatePointBoundaryWeights.H"
//Info << "w: " << w << endl;
const labelListList& PointFaces = mesh.pointFaces();
//const fvBoundaryMesh& bm = mesh.boundary(); // declared in findBoundaryPoints.H
forAll (ptc, pointI)
{
const label curPoint = ptc[pointI];
2012-09-11 15:42:55 +00:00
const labelList& curFaces = PointFaces[curPoint];
2012-09-11 15:42:55 +00:00
label fI = 0;
2012-09-11 15:42:55 +00:00
// Go through all the faces
forAll (curFaces, faceI)
{
if (!mesh.isInternalFace(curFaces[faceI]))
{
// This is a boundary face. If not in the empty patch
// or coupled calculate the extrapolation vector
label patchID =
mesh.boundaryMesh().whichPatch(curFaces[faceI]);
2012-09-11 15:42:55 +00:00
if
(
!isA<emptyFvPatch>(mesh.boundary()[patchID])
&& !mesh.boundary()[patchID].coupled()
)
{
label faceInPatchID =
bm[patchID].patch().whichFace(curFaces[faceI]);
2012-09-11 15:42:55 +00:00
pfCorr[curPoint] +=
w[pointI][fI]*
(
extraVecs[pointI][fI]
& gradDU.boundaryField()[patchID][faceInPatchID]
);
2012-09-11 15:42:55 +00:00
fI++;
}
}
}
}
// Update coupled boundaries
/*forAll (pfCorr.boundaryField(), patchI)
{
if (pfCorr.boundaryField()[patchI].coupled())
{
pfCorr.boundaryField()[patchI].initAddField();
}
}*/
/*forAll (pfCorr.boundaryField(), patchI)
{
if (pfCorr.boundaryField()[patchI].coupled())
{
pfCorr.boundaryField()[patchI].addField(pfCorr.internalField());
}
}*/
//Info << "pfCorr: " << pfCorr << endl;
pfCorr.correctBoundaryConditions();
//pfCorr.write();
//Info << "pf: " << pf << endl;
pf += pfCorr;
//- this was already commented
// Replace extrapolated values in pf
// forAll (ptc, pointI)
// {
// pf[ptc[pointI]] = pfCorr[ptc[pointI]];
// }
pf.correctBoundaryConditions();
//pf.write();