Go to the documentation of this file.
45 if (stencil.size() !=
nCells())
60 label celli = cellIDs[i];
64 const scalar
f = factor[celli];
69 s += w[nbrI]*work[nbrs[nbrI]];
79 template<
class GeoField>
87 template<
class GeoField>
90 auto flds(this->lookupClass<GeoField>());
91 for (
auto fldPtr : flds)
94 if (!suppressed.found(baseName(
name)))
98 Pout<<
"dynamicOversetFvMesh::interpolate: interpolating : "
107 Pout<<
"dynamicOversetFvMesh::interpolate: skipping : " <<
name
115 template<
class GeoField,
class PatchType>
118 typename GeoField::Boundary& bfld,
126 if (typeOnly == (isA<PatchType>(bfld[patchi]) !=
nullptr))
140 if (typeOnly == (isA<PatchType>(bfld[patchi]) !=
nullptr))
163 for (
direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
165 forAll(internalCoeffs, patchi)
167 const labelUList& fc = lduAddr().patchAddr(patchi);
168 const Field<Type>& intCoeffs = internalCoeffs[patchi];
172 norm[fc[i]] += cmptCoeffs[i];
181 const scalar&
n = norm[celli];
195 Pout<<
"For field " << m.
psi().name() <<
" have zero diagonals for "
196 << nZeroDiag <<
" cells" <<
endl;
214 extrapolatedNorm[celli] = -GREAT;
220 for (label facei = 0; facei < nInternalFaces(); facei++)
222 label ownType = types[own[facei]];
223 label neiType = types[nei[facei]];
235 for (label facei = nInternalFaces(); facei < nFaces(); facei++)
237 label ownType = types[own[facei]];
238 label neiType = nbrTypes[facei-nInternalFaces()];
255 bitSet newIsFront(nFaces());
259 for (
const label facei : isFront)
261 if (extrapolatedNorm[own[facei]] == -GREAT)
264 newNorm[own[facei]] = cellAverage
277 isInternalFace(facei)
278 && extrapolatedNorm[nei[facei]] == -GREAT
282 newNorm[nei[facei]] = cellAverage
302 extrapolatedNorm.transfer(newNorm);
303 isFront.transfer(newIsFront);
310 scalar&
n = norm[celli];
320 n = extrapolatedNorm[celli];
359 if (!isA<fvMeshPrimitiveLduAddressing>(addr))
362 <<
"Problem : addressing is not fvMeshPrimitiveLduAddressing"
379 if (interfaces.
size() > nOldInterfaces)
388 label patchi = nOldInterfaces;
389 patchi < interfaces.
size();
393 const labelUList& fc = interfaces[patchi].faceCells();
402 typename GeoField::Boundary& bfld =
403 const_cast<GeoField&
>(m.
psi()).boundaryFieldRef();
405 bfld.setSize(interfaces.
size());
412 for (label patchi = 0; patchi < nOldInterfaces; patchi++)
414 if (isA<processorFvPatch>(bfld[patchi].
patch()))
423 label patchi = nOldInterfaces;
424 patchi < interfaces.
size();
434 bfld[addPatchi].
patch(),
459 label celli = upperAddr[facei];
460 lower[facei] *= 1.0-factor[celli];
465 label celli = lowerAddr[facei];
466 upper[facei] *= 1.0-factor[celli];
470 for (label patchi = 0; patchi < nOldInterfaces; ++patchi)
481 scalar
f = factor[celli];
482 intCoeffs[i] *= 1.0-
f;
483 bouCoeffs[i] *= 1.0-
f;
504 label startLabel = ownerStartAddr[celli];
505 label endLabel = ownerStartAddr[celli + 1];
507 for (label facei = startLabel; facei < endLabel; facei++)
515 for (label i = startLabel; i < endLabel; i++)
517 label facei = losortAddr[i];
521 diag[celli] = normalisation[celli];
522 source[celli] = normalisation[celli]*m.
psi()[celli];
538 label celli = cellIDs[i];
540 const scalar
f = factor[celli];
543 const labelList& nbrFaces = stencilFaces_[celli];
544 const labelList& nbrPatches = stencilPatches_[celli];
549 <<
" at:" <<
C()[celli]
550 <<
" . Should this be in interpolationCells()????"
557 diag[celli] *= (1.0-
f);
558 source[celli] *= (1.0-
f);
562 label patchi = nbrPatches[nbri];
563 label facei = nbrFaces[nbri];
567 label nbrCelli = nbrs[nbri];
570 const scalar
s = normalisation[celli]*
f*w[nbri];
572 scalar& u =
upper[facei];
573 scalar& l =
lower[facei];
574 if (celli < nbrCelli)
602 const scalar
s = normalisation[celli]*
f*w[nbri];
653 typename GeoField::Boundary& bpsi =
654 const_cast<GeoField&
>(m.
psi()).boundaryFieldRef();
656 bool hasOverset =
false;
670 Pout<<
"dynamicOversetFvMesh::solve() :"
671 <<
" bypassing matrix adjustment for field " << m.
psi().name()
680 Pout<<
"dynamicOversetFvMesh::solve() :"
681 <<
" adjusting matrix for interpolation for field "
694 m.
psi().name() +
"_normalisation",
695 this->time().timeName(),
709 >(scale.boundaryFieldRef(),
false);
714 Pout<<
"dynamicOversetFvMesh::solve() :"
715 <<
" writing matrix normalisation for field " << m.
psi().name()
716 <<
" to " << scale.name() <<
endl;
730 const label oldSize = bpsi.size();
732 addInterpolation(m, norm);
735 correctBoundaryConditions<GeoField, calculatedProcessorFvPatchField<Type>>
755 bpsi.setSize(oldSize);
758 m.upper().transfer(oldUpper);
759 m.lower().transfer(oldLower);
779 os <<
"** Matrix **" <<
endl;
795 forAll(interfaces, patchi)
797 if (interfaces.
set(patchi))
799 const labelUList& fc = interfaces[patchi].faceCells();
803 cellToPatch[fc[i]].append(patchi);
804 cellToPatchFace[fc[i]].append(i);
812 os <<
"cell:" << celli <<
" diag:" <<
diag[celli]
813 <<
" source:" << source[celli] <<
endl;
815 label startLabel = ownerStartAddr[celli];
816 label endLabel = ownerStartAddr[celli + 1];
818 for (label facei = startLabel; facei < endLabel; facei++)
820 os <<
" face:" << facei
821 <<
" nbr:" << upperAddr[facei] <<
" coeff:" <<
upper[facei]
828 for (label i = startLabel; i < endLabel; i++)
830 label facei = losortAddr[i];
831 os <<
" face:" << facei
832 <<
" nbr:" << lowerAddr[facei] <<
" coeff:" <<
lower[facei]
836 forAll(cellToPatch[celli], i)
838 label patchi = cellToPatch[celli][i];
839 label patchFacei = cellToPatchFace[celli][i];
841 os <<
" patch:" << patchi
842 <<
" patchface:" << patchFacei
854 os <<
"patch:" << patchi
859 interfaces.
set(patchi)
860 && isA<processorLduInterface>(interfaces[patchi])
864 refCast<const processorLduInterface>(interfaces[patchi]);
872 os <<
" cell:" << fc[i]
883 forAll(interfaceFields, inti)
885 if (interfaceFields.
set(inti))
887 os <<
"interface:" << inti
888 <<
" if type:" << interfaceFields[inti].interface().type()
889 <<
" fld type:" << interfaceFields[inti].type() <<
endl;
893 os <<
"** End of Matrix **" <<
endl;
897 template<
class GeoField>
900 typename GeoField::Boundary& bfld =
fld.boundaryFieldRef();
930 template<
class GeoField>
933 Pout<<
"** starting checking of " <<
fld.name() <<
endl;
935 GeoField fldCorr(
fld.name()+
"_correct",
fld);
936 correctCoupledBoundaryConditions(fldCorr);
938 const typename GeoField::Boundary& bfld =
fld.boundaryField();
939 const typename GeoField::Boundary& bfldCorr = fldCorr.boundaryField();
943 const typename GeoField::Patch& pfld = bfld[patchi];
944 const typename GeoField::Patch& pfldCorr = bfldCorr[patchi];
950 if (pfld[i] != pfldCorr[i])
952 Pout<<
" " << i <<
" orig:" << pfld[i]
953 <<
" corrected:" << pfldCorr[i] <<
endl;
int debug
Static debugging option.
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
label size() const noexcept
The number of elements in the list.
static void correctBoundaryConditions(typename GeoField::Boundary &bfld, const bool typeOnly)
Correct boundary conditions of certain type (typeOnly = true)
A class for handling words, derived from Foam::string.
A field of fields is a PtrList of fields with reference counting.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
const Field< Type > & field() const
Return field.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
An abstract base class for processor coupled interfaces.
virtual const labelUList & cellTypes() const
Return the cell type list.
static const Type & New(const Mesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
void set(const bitSet &bitset)
Set specified bits from another bitset.
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
const FieldField< Field, Type > & boundaryCoeffs() const
Ostream & endl(Ostream &os)
Add newline and flush stream.
static commsTypes defaultCommsType
Default commsType.
const labelUList & losortStartAddr() const
Return losort start addressing.
virtual const scalarList & cellInterpolationWeight() const
Per interpolated cell the interpolation factor. (0 = use.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
void interpolate(Field< T > &psi) const
Explicit interpolation of acceptor cells from donor cells.
const labelUList & ownerStartAddr() const
Return owner start addressing.
label size() const
Return number of equations.
virtual const labelUList & upperAddr() const =0
Return upper addressing.
#define forAll(list, i)
Loop across all elements in list.
const labelUList & losortAddr() const
Return losort addressing.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
virtual void write(Ostream &os) const
Write.
cellMask correctBoundaryConditions()
virtual SolverPerformance< scalar > solve(fvMatrix< scalar > &, const dictionary &) const
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
label nCells() const noexcept
Number of mesh cells.
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
virtual lduInterfacePtrsList interfaces() const
Return a list of pointers for each patch.
virtual const fileName & name() const
Get the name of the stream.
Class containing processor-to-processor mapping information.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void addInterpolation(fvMatrix< Type > &, const scalarField &norm) const
Add interpolation to matrix (coefficients)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator)
const GeometricField< Type, fvPatchField, volMesh > & psi(const label i=0) const
Return psi.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
static void correctCoupledBoundaryConditions(GeoField &fld)
Debug: correct coupled bc.
errorManip< error > abort(error &err)
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
void correctBoundaryConditions()
Correct boundary field.
A processorFvPatchField type bypassing fvPatch.
const TargetType * isA(const Type &t)
Check if dynamic_cast to TargetType is possible.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual int myProcNo() const =0
Return processor number (rank in communicator)
const T * set(const label i) const
dimensionedSymmTensor sqr(const dimensionedVector &dv)
virtual const labelListList & cellStencil() const
Per interpolated cell the neighbour cells (in terms of slots as.
static int & msgType() noexcept
Message tag of standard messages.
static label nRequests()
Get number of outstanding requests.
Calculation of interpolation stencils.
const std::string patch
OpenFOAM patch number as a std::string.
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
static void checkCoupledBC(const GeoField &fld)
Debug: check halo swap is ok.
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
tmp< scalarField > normalisation(const fvMatrix< Type > &m) const
Freeze values at holes.
static bool & parRun() noexcept
Test if this a parallel run.
A traits class, which is primarily used for primitives.
virtual const List< scalarList > & cellInterpolationWeights() const
Weights for cellStencil.
void write(Ostream &, const fvMatrix< Type > &, const lduAddressing &, const lduInterfacePtrsList &) const
Debug: print matrix.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
SolverPerformance< Type > solve(fvMatrix< Type > &, const dictionary &) const
Solve given dictionary with settings.
virtual const labelUList & patchAddr(const label patchNo) const =0
Return patch to internal addressing given patch number.
Boundary condition for use on overset patches. To be run in combination with special dynamicFvMesh ty...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
const cellCellStencilObject & overlap
virtual const labelUList & interpolationCells() const
Indices of interpolated cells.
void size(const label n)
Older name for setAddressableSize.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
const FieldField< Field, Type > & internalCoeffs() const
const volScalarField & psi
const Boundary & boundaryField() const
Return const-reference to the boundary field.
const dimensionSet dimless
Dimensionless.