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))
151 const fvMatrix<Type>& m
162 const FieldField<Field, Type>& internalCoeffs = m.internalCoeffs();
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];
169 const scalarField cmptCoeffs(intCoeffs.component(cmpt));
172 norm[fc[i]] += cmptCoeffs[i];
181 const scalar&
n = norm[celli];
191 reduce(nZeroDiag, sumOp<label>());
195 Pout<<
"For field " << m.psi().
name() <<
" have zero diagonals for "
196 << nZeroDiag <<
" cells" <<
endl;
214 extrapolatedNorm[celli] = -GREAT;
219 bitSet isFront(nFaces());
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
295 reduce(nChanged, sumOp<label>());
302 extrapolatedNorm.transfer(newNorm);
303 isFront.transfer(newIsFront);
310 scalar&
n = norm[celli];
320 n = extrapolatedNorm[celli];
346 Field<Type>& source = m.source();
352 const lduAddressing& addr = lduAddr();
353 const labelUList& upperAddr = addr.upperAddr();
354 const labelUList& lowerAddr = addr.lowerAddr();
355 const labelUList& ownerStartAddr = addr.ownerStartAddr();
356 const labelUList& losortAddr = addr.losortAddr();
359 if (!isA<fvMeshPrimitiveLduAddressing>(addr))
362 <<
"Problem : addressing is not fvMeshPrimitiveLduAddressing"
369 upper.setSize(upperAddr.size(), 0.0);
371 lower.setSize(lowerAddr.size(), 0.0);
379 if (interfaces.size() > nOldInterfaces)
382 m.internalCoeffs().setSize(interfaces.size());
383 m.boundaryCoeffs().setSize(interfaces.size());
388 label patchi = nOldInterfaces;
389 patchi < interfaces.size();
393 const labelUList& fc = interfaces[patchi].faceCells();
394 m.internalCoeffs().set(patchi,
new Field<Type>(fc.size(),
Zero));
395 m.boundaryCoeffs().set(patchi,
new Field<Type>(fc.size(),
Zero));
400 typedef GeometricField<Type, fvPatchField, volMesh> GeoField;
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();
431 new calculatedProcessorFvPatchField<Type>
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)
472 const labelUList& fc = addr.patchAddr(patchi);
473 Field<Type>& intCoeffs = m.internalCoeffs()[patchi];
474 Field<Type>& bouCoeffs = m.boundaryCoeffs()[patchi];
481 scalar
f = factor[celli];
482 intCoeffs[i] *= 1.0-
f;
483 bouCoeffs[i] *= 1.0-
f;
487 intCoeffs[i] = pTraits<Type>::zero;
488 bouCoeffs[i] = pTraits<Type>::zero;
504 label startLabel = ownerStartAddr[celli];
505 label endLabel = ownerStartAddr[celli + 1];
507 for (label facei = startLabel; facei < endLabel; facei++)
512 startLabel = addr.losortStartAddr()[celli];
513 endLabel = addr.losortStartAddr()[celli + 1];
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];
603 m.boundaryCoeffs()[patchi][facei] += pTraits<Type>::one*
s;
604 m.internalCoeffs()[patchi][facei] += pTraits<Type>::one*
s;
648 const dictionary&
dict
651 typedef GeometricField<Type, fvPatchField, volMesh> GeoField;
653 typename GeoField::Boundary& bpsi =
654 const_cast<GeoField&
>(m.psi()).boundaryFieldRef();
656 bool hasOverset =
false;
659 if (
isA<oversetFvPatchField<Type>>(bpsi[patchi]))
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(),
704 scale.ref().field() = norm;
708 oversetFvPatchField<scalar>
709 >(scale.boundaryFieldRef(),
false);
714 Pout<<
"dynamicOversetFvMesh::solve() :"
715 <<
" writing matrix normalisation for field " << m.psi().
name()
728 FieldField<Field, Type> oldInt(m.internalCoeffs());
729 FieldField<Field, Type> oldBou(m.boundaryCoeffs());
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);
760 m.internalCoeffs().transfer(oldInt);
761 m.boundaryCoeffs().transfer(oldBou);
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
856 <<
" size:" << fc.size() <<
endl;
859 interfaces.
set(patchi)
860 && isA<processorLduInterface>(interfaces[patchi])
863 const processorLduInterface& ppp =
864 refCast<const processorLduInterface>(interfaces[patchi]);
865 os <<
"(processor with my:" << ppp.myProcNo()
866 <<
" nbr:" << ppp.neighbProcNo()
872 os <<
" cell:" << fc[i]
882 m.
psi().boundaryField().scalarInterfaces();
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;