143 nCells += lduMatrices[i].
size();
148 convert(lduMatrices);
156 convert(ldum, interfaceCoeffs, interfaces);
166 Pout<<
"LUscalarMatrix : size:" << mRows <<
endl;
167 for (
label rowI = 0; rowI < mRows; rowI++)
171 Pout<<
"cell:" << rowI <<
" diagCoeff:" << row[rowI] <<
endl;
173 Pout<<
" connects to upper cells :";
174 for (
label columnI = rowI+1; columnI < nColumns; columnI++)
176 if (
mag(row[columnI]) > small)
178 Pout<<
' ' << columnI <<
" (coeff:" << row[columnI]
183 Pout<<
" connects to lower cells :";
184 for (
label columnI = 0; columnI < rowI; columnI++)
186 if (
mag(row[columnI]) > small)
188 Pout<<
' ' << columnI <<
" (coeff:" << row[columnI]
205 void Foam::LUscalarMatrix::convert
215 const scalar* __restrict__ diagPtr = ldum.
diag().
begin();
216 const scalar* __restrict__ upperPtr = ldum.
upper().
begin();
217 const scalar* __restrict__ lowerPtr = ldum.
lower().
begin();
238 if (interfaces.
set(inti))
240 const lduInterface&
interface = interfaces[inti].interface();
244 const label* __restrict__ lPtr = interface.faceCells().
begin();
247 refCast<const cyclicLduInterface>(interface);
249 const label* __restrict__ uPtr =
250 interfaces[nbrInt].interface().faceCells().
begin();
252 const scalar* __restrict__ nbrUpperLowerPtr =
253 interfaceCoeffs[nbrInt].
begin();
255 label inFaces = interface.faceCells().size();
269 void Foam::LUscalarMatrix::convert
277 forAll(lduMatrices, ldumi)
279 procOffsets_[ldumi+1] = procOffsets_[ldumi] + lduMatrices[ldumi].
size();
282 forAll(lduMatrices, ldumi)
285 label offset = procOffsets_[ldumi];
287 const label* __restrict__ uPtr = lduMatrixi.upperAddr_.
begin();
288 const label* __restrict__ lPtr = lduMatrixi.lowerAddr_.
begin();
290 const scalar* __restrict__ diagPtr = lduMatrixi.diag_.
begin();
291 const scalar* __restrict__ upperPtr = lduMatrixi.upper_.
begin();
292 const scalar* __restrict__ lowerPtr = lduMatrixi.lower_.
begin();
295 const label nFaces = lduMatrixi.upper_.
size();
313 lduMatrixi.interfaces_;
319 if (interface.myProcNo_ == interface.neighbProcNo_)
321 const label* __restrict__ ulPtr = interface.faceCells_.
begin();
323 const scalar* __restrict__ upperLowerPtr =
324 interface.coeffs_.begin();
326 label inFaces = interface.faceCells_.size()/2;
331 label lCell = ulPtr[
face + inFaces] + offset;
337 else if (interface.myProcNo_ < interface.neighbProcNo_)
345 lduMatrices[interface.neighbProcNo_].interfaces_;
347 label neiInterfacei = -1;
349 forAll(neiInterfaces, ninti)
354 neiInterfaces[ninti].neighbProcNo_
355 == interface.myProcNo_
357 && (neiInterfaces[ninti].tag_ == interface.tag_)
360 neiInterfacei = ninti;
365 if (neiInterfacei == -1)
371 neiInterfaces[neiInterfacei];
373 const label* __restrict__ uPtr = interface.faceCells_.
begin();
374 const label* __restrict__ lPtr =
375 neiInterface.faceCells_.
begin();
377 const scalar* __restrict__ upperPtr = interface.coeffs_.begin();
378 const scalar* __restrict__ lowerPtr =
379 neiInterface.coeffs_.
begin();
381 label inFaces = interface.faceCells_.size();
382 label neiOffset = procOffsets_[interface.neighbProcNo_];
398 void Foam::LUscalarMatrix::printDiagonalDominance()
const 400 for (
label i=0; i<
m(); i++)
403 for (
label j=0; j<
m(); j++)
434 for (
label j=0; j<
m(); j++)
439 for (
label i=0; i<
m(); i++)
IO interface for processorLduInterface.
label n() const
Return the number of columns.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static int masterNo()
Process index of the master.
bool set(const label) const
Is element set.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual label nbrPatchID() const =0
Return neighbour.
A face is a list of labels corresponding to mesh vertices.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void LUDecompose(scalarSquareMatrix &matrix, labelList &pivotIndices)
LU decompose the matrix with pivoting.
static int firstSlave()
Process index of first slave.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
An abstract base class for cyclic coupled interfaces.
static bool master(const label communicator=0)
Am I the master process.
static int & msgType()
Message tag of standard messages.
void operator=(const zero)
Assignment of all elements to zero.
virtual label comm() const =0
Return communicator used for parallel communication.
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Input inter-processor communications stream.
virtual const labelUList & upperAddr() const =0
Return upper addressing.
Inter-processor communications stream.
iterator begin()
Return an iterator to begin traversing the UList.
void decompose()
Perform the LU decomposition of the matrix.
LUscalarMatrix()
Construct null.
scalar * operator[](const label)
Return subscript-checked row of Matrix.
bool set(const label) const
Is element set.
defineTypeNameAndDebug(combustionModel, 0)
Output inter-processor communications stream.
label size() const
Return the number of elements in the UPtrList.
void setSize(const label)
Reset size of List.
lduMatrix is a general matrix class in which the coefficients are stored as three arrays...
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
iterator begin()
Return an iterator to begin traversing the UPtrList.
fvModels source(alpha1, mixture.thermo1().rho())
const lduAddressing & lduAddr() const
Return the LDU addressing.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
A cell is defined as a list of faces with extra functionality.
prefixOSstream Pout(cout, "Pout")
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches...
label m() const
Return the number of rows.
dimensioned< scalar > mag(const dimensioned< Type > &)
I/O for lduMatrix and interface values.
void transfer(mType &)
Transfer the contents of the argument Matrix into this Matrix.
const lduMesh & mesh() const
Return the LDU mesh from which the addressing is obtained.
void LUBacksubstitute(const scalarSquareMatrix &luMmatrix, const labelList &pivotIndices, List< Type > &source)
LU back-substitution with given source, returning the solution.
label size() const
Return number of equations.
static int lastSlave(const label communicator=0)
Process index of last slave.
void inv(scalarSquareMatrix &M) const
Set M to the inverse of this square matrix.