33 template<
class Type,
class DType,
class LUType>
51 template<
class Type,
class DType,
class LUType>
54 const Field<LUType>& Lower =
const_cast<const LduMatrix&
>(*this).lower();
55 const Field<LUType>& Upper =
const_cast<const LduMatrix&
>(*this).upper();
56 Field<DType>& Diag =
diag();
61 for (label face=0; face<l.size(); face++)
63 Diag[l[face]] -= Lower[face];
69 template<
class Type,
class DType,
class LUType>
75 const Field<LUType>& Lower =
const_cast<const LduMatrix&
>(*this).lower();
76 const Field<LUType>& Upper =
const_cast<const LduMatrix&
>(*this).upper();
81 for (label face = 0; face < l.size(); face++)
83 sumOff[u[face]] +=
cmptMag(Lower[face]);
89 template<
class Type,
class DType,
class LUType>
95 if (hasLower() || hasUpper())
97 Type* __restrict__ HpsiPtr = tHpsi.ref().begin();
99 const Type* __restrict__ psiPtr =
psi.begin();
101 const label* __restrict__ uPtr = lduAddr().upperAddr().begin();
102 const label* __restrict__ lPtr = lduAddr().lowerAddr().begin();
104 const LUType* __restrict__ lowerPtr =
lower().begin();
105 const LUType* __restrict__ upperPtr =
upper().begin();
107 const label nFaces =
upper().size();
109 for (label face=0; face<nFaces; face++)
111 HpsiPtr[uPtr[face]] -= lowerPtr[face]*psiPtr[lPtr[face]];
112 HpsiPtr[lPtr[face]] -= upperPtr[face]*psiPtr[uPtr[face]];
119 template<
class Type,
class DType,
class LUType>
123 tmp<Field<Type>> tHpsi(
H(tpsi()));
129 template<
class Type,
class DType,
class LUType>
141 auto& faceHpsi = tfaceHpsi.ref();
152 template<
class Type,
class DType,
class LUType>
164 template<
class Type,
class DType,
class LUType>
183 upperPtr_.reset(
nullptr);
192 lowerPtr_.reset(
nullptr);
197 source() =
A.source();
200 interfacesUpper_ =
A.interfacesUpper_;
201 interfacesLower_ =
A.interfacesLower_;
205 template<
class Type,
class DType,
class LUType>
213 diagPtr_ = std::move(
A.diagPtr_);
214 upperPtr_ = std::move(
A.upperPtr_);
215 lowerPtr_ = std::move(
A.lowerPtr_);
216 sourcePtr_ = std::move(
A.sourcePtr_);
218 interfacesUpper_ = std::move(
A.interfacesUpper_);
219 interfacesLower_ = std::move(
A.interfacesLower_);
223 template<
class Type,
class DType,
class LUType>
243 sourcePtr_->negate();
251 template<
class Type,
class DType,
class LUType>
261 source() +=
A.source();
264 if (symmetric() &&
A.symmetric())
268 else if (symmetric() &&
A.asymmetric())
282 else if (asymmetric() &&
A.symmetric())
296 else if (asymmetric() &&
A.asymmetric())
313 else if (
A.diagonal())
319 <<
"Unknown matrix type combination" 323 interfacesUpper_ +=
A.interfacesUpper_;
324 interfacesLower_ +=
A.interfacesLower_;
328 template<
class Type,
class DType,
class LUType>
338 source() -=
A.source();
341 if (symmetric() &&
A.symmetric())
345 else if (symmetric() &&
A.asymmetric())
359 else if (asymmetric() &&
A.symmetric())
373 else if (asymmetric() &&
A.asymmetric())
390 else if (
A.diagonal())
396 <<
"Unknown matrix type combination" 400 interfacesUpper_ -=
A.interfacesUpper_;
401 interfacesLower_ -=
A.interfacesLower_;
405 template<
class Type,
class DType,
class LUType>
423 if (symmetric() || asymmetric())
431 for (label face=0; face<
upper.size(); face++)
433 upper[face] *= sf[l[face]];
436 for (label face=0; face<
lower.size(); face++)
438 lower[face] *= sf[u[face]];
443 <<
"Scaling a matrix by scalarField is not currently supported\n" 444 "because scaling interfacesUpper_ and interfacesLower_ " 445 "require special transfers" 453 template<
class Type,
class DType,
class LUType>
476 interfacesUpper_ *=
s;
477 interfacesLower_ *=
s;
void size(const label n)
Older name for setAddressableSize.
A face is a list of labels corresponding to mesh vertices.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void sumMagOffDiag(Field< LUType > &sumOff) const
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
UList< label > labelUList
A UList of labels.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
Generic templated field type.
tmp< Field< Type > > H(const Field< Type > &) const
void operator*=(const scalarField &)
void negate(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1)
errorManip< error > abort(error &err)
void operator-=(const LduMatrix< Type, DType, LUType > &)
void cmptMag(FieldField< Field, Type > &cf, const FieldField< Field, Type > &f)
const Field< LUType > & upper() const
const Field< LUType > & lower() const
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
LduMatrix is a general matrix class in which the coefficients are stored as three arrays...
void operator+=(const LduMatrix< Type, DType, LUType > &)
tmp< Field< Type > > faceH(const Field< Type > &) const
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
const volScalarField & psi
A class for managing temporary objects.
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))
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
volScalarField H(IOobject("H", runTime.timeName(), mesh.thisDb(), IOobject::NO_READ, IOobject::AUTO_WRITE), mesh, dimensionedScalar(dimLength, Zero))
void operator=(const LduMatrix< Type, DType, LUType > &)
Copy assignment.