48 if (psi_.needReference())
50 if (Pstream::master())
52 internalCoeffs_[patchi][facei] +=
53 diag()[psi_.mesh().boundary()[patchi].faceCells()[facei]];
55 boundaryCoeffs_[patchi][facei] +=
56 diag()[psi_.mesh().boundary()[patchi].faceCells()[facei]]
67 const dictionary& solverControls
71 if (psi_.mesh().name() != polyMesh::defaultRegion)
80 <<
"fvMatrix<scalar>::solver(const dictionary& solverControls) : " 81 "solver for fvMatrix<scalar>" 86 addBoundaryDiag(
diag(), 0);
89 psi_.boundaryField().scalarInterfaces();
92 autoPtr<fvMatrix<scalar>::fvSolver> solverPtr
94 new fvMatrix<scalar>::fvSolver
135 fvMat_.addBoundaryDiag(fvMat_.diag(), 0);
138 fvMat_.addBoundarySource(totalSource,
false);
141 solver_->read(solverControls);
145 psi.primitiveFieldRef(),
154 fvMat_.diag() = saveDiag;
156 psi.correctBoundaryConditions();
158 psi.mesh().setSolverPerformance(
psi.name(), solverPerf);
173 <<
"fvMatrix<scalar>::solveSegregated" 174 "(const dictionary& solverControls) : " 175 "solving fvMatrix<scalar>" 193 if (psi_.
mesh().fluxRequired(psi_.
name()))
217 PtrDynList<lduInterfaceField> newInterfaces;
220 interfaces = this->
psi(0).boundaryField().scalarInterfaces();
227 tmp<scalarField> tpsi;
232 const_cast<GeometricField<scalar, fvPatchField, volMesh>&
> 243 for (label fieldi = 0; fieldi <
nMatrices(); fieldi++)
246 const auto& psiInternal = this->
psi(fieldi).primitiveField();
248 forAll(psiInternal, localCellI)
250 psi[cellOffset + localCellI] = psiInternal[localCellI];
265 )->solve(
psi, totalSource);
269 for (label fieldi = 0; fieldi <
nMatrices(); fieldi++)
272 const_cast<GeometricField<scalar, fvPatchField, volMesh>&
> 279 forAll(psiInternal, localCellI)
281 psiInternal[localCellI] =
psi[localCellI + cellOffset];
295 if (psi_.
mesh().fluxRequired(psi_.
name()))
311 for (label fieldi = 0; fieldi <
nMatrices(); fieldi++)
314 const_cast<GeometricField<scalar, fvPatchField, volMesh>&
> 319 localPsi.correctBoundaryConditions();
320 localPsi.mesh().setSolverPerformance(localPsi.name(), solverPerf);
334 ConstPrecisionAdaptor<solveScalar, scalar> tpsi(psif);
337 tmp<solveScalarField> tres
342 source_ - boundaryDiag*psif,
349 ConstPrecisionAdaptor<scalar, solveScalar> tres_s(tres);
365 "H("+psi_.
name()+
')',
373 extrapolatedCalculatedFvPatchScalarField::typeName
405 extrapolatedCalculatedFvPatchScalarField::typeName
413 H1_.primitiveFieldRef() /= psi_.
mesh().V();
414 H1_.correctBoundaryConditions();
UPtrList< const lduInterfaceField > lduInterfaceFieldPtrsList
List of coupled interface fields to be used in coupling.
void size(const label n)
Older name for setAddressableSize.
#define addProfiling(name, descr)
Define profiling trigger with specified name and description string.
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
void addBoundaryDiag(scalarField &diag, const direction cmpt) const
void createOrUpdateLduPrimitiveAssembly()
Create or update ldu assembly.
Field< solveScalar > solveScalarField
A list of keyword definitions, which are a keyword followed by a number of values (eg...
const labelList & cellOffsets() const
Return cellOffsets.
const word & name() const noexcept
Return the object name.
void residual(solveScalarField &rA, const solveScalarField &psi, const scalarField &source, const FieldField< Field, scalar > &interfaceBouCoeffs, const lduInterfaceFieldPtrsList &interfaces, const direction cmpt) const
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
lduInterfaceFieldPtrsList scalarInterfaces() const
Return a list of pointers for each patch field with only those pointing to interfaces being set...
void manipulateMatrix(direction cmp)
Manipulate matrix.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< GeometricField< Type, fvPatchField, volMesh > > H() const
Return the H operation source.
const dimensionSet dimVol(dimVolume)
Older spelling for dimVolume.
tmp< volScalarField > H1() const
Return H(1)
Ignore writing from objectRegistry::writeObject()
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
tmp< scalarField > H1() const
conserve primitiveFieldRef()+
#define forAll(list, i)
Loop across all elements in list.
Foam::word regionName(Foam::polyMesh::defaultRegion)
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
const GeometricField< Type, fvPatchField, volMesh > & psi(const label i=0) const
Return psi.
void setSize(const label n)
Alias for resize()
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
SolverPerformance< Type > solve()
Solve returning the solution statistics.
void setInterfaces(lduInterfaceFieldPtrsList &, PtrDynList< lduInterfaceField > &newInterfaces)
Set interfaces.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
void transferFvMatrixCoeffs()
Transfer lower, upper, diag and source to this fvMatrix.
static autoPtr< solver > New(const word &fieldName, const lduMatrix &matrix, const FieldField< Field, scalar > &interfaceBouCoeffs, const FieldField< Field, scalar > &interfaceIntCoeffs, const lduInterfaceFieldPtrsList &interfaces, const dictionary &solverControls)
Return a new solver.
bool asymmetric() const noexcept
const Mesh & mesh() const noexcept
Return mesh.
int debug
Static debugging option.
const fileName & instance() const noexcept
Read access to instance path component.
lduPrimitiveMeshAssembly * lduMeshPtr()
Access to lduPrimitiveMeshAssembly.
OSstream & masterStream(const label communicator)
Return OSstream for output operations on the master process only, Snull on other processes.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
const lduMesh & mesh() const noexcept
Return the LDU mesh from which the addressing is obtained.
const lduAddressing & lduAddr() const
Return the LDU addressing.
A scalar instance of fvMatrix.
autoPtr< fvSolver > solver()
Construct and return the solver.
void setLduMesh(const lduMesh &m)
Set the LDU mesh containing the addressing is obtained.
void correctBoundaryConditions()
Correct boundary field.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef()
void addBoundarySource(Field< Type > &source, const bool couples=true) const
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
void setComponentReference(const label patchi, const label facei, const direction cmpt, const scalar value)
Set reference level for a component of the solution on a given patch face.
SolverPerformance< Type > solveSegregated(const dictionary &)
Solve segregated returning the solution statistics.
tmp< Field< Type > > H(const Field< Type > &) const
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
A class for managing temporary objects.
Defines the attributes of an object for which implicit objectRegistry management is supported...
tmp< Field< Type > > residual() const
Return the matrix residual.
void setBounAndInterCoeffs()
Manipulate boundary/internal coeffs for coupling.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
SolverPerformance< scalar > solverPerformance
SolverPerformance instantiated for a scalar.
const dimensionSet & dimensions() const noexcept
Return dimensions.
static constexpr const zero Zero
Global zero (0)