void Foam::fv::interRegionExplicitPorositySource::addSup ( fvMatrix<vector>& eqn, const label fieldI ) { initialise(); const fvMesh& nbrMesh = mesh_.time().lookupObject<fvMesh>(nbrRegionName_); const volVectorField& U = eqn.psi(); volVectorField UNbr ( IOobject ( name_ + ":UNbr", nbrMesh.time().timeName(), nbrMesh, IOobject::NO_READ, IOobject::NO_WRITE ), nbrMesh, dimensionedVector("zero", U.dimensions(), vector::zero) ); // map local velocity onto neighbour region meshInterp().mapSrcToTgt ( U.internalField(), plusEqOp<vector>(), UNbr.internalField() ); fvMatrix<vector> nbrEqn(UNbr, eqn.dimensions()); porosityPtr_->addResistance(nbrEqn); // convert source from neighbour to local region fvMatrix<vector> porosityEqn(U, eqn.dimensions()); scalarField& Udiag = porosityEqn.diag(); vectorField& Usource = porosityEqn.source(); Udiag.setSize(eqn.diag().size(), 0.0); Usource.setSize(eqn.source().size(), vector::zero); meshInterp().mapTgtToSrc(nbrEqn.diag(), plusEqOp<scalar>(), Udiag); meshInterp().mapTgtToSrc(nbrEqn.source(), plusEqOp<vector>(), Usource); eqn -= porosityEqn; }
void Foam::fv::matrixChangeBeforeFvOption::setResidual( const fvMatrix<T>& matrix, autoPtr<GeometricField<T,fvPatchField,volMesh> >& val ) { Info << this->name() << " setting residual for " << matrix.psi().name() << " to " << this->fieldName() << endl; if(!val.valid()) { val.set( new GeometricField<T,fvPatchField,volMesh>( IOobject( this->fieldName(), matrix.psi().mesh().time().timeName(), matrix.psi().mesh(), IOobject::NO_READ, IOobject::AUTO_WRITE ), matrix.psi().mesh(), dimensioned<T>( "no", matrix.dimensions()/dimVolume, pTraits<T>::zero ) ) ); } val()=this->calcResiduum(matrix); }
void Foam::fv::explicitPorositySource::addSup ( fvMatrix<vector>& eqn, const label fieldi ) { fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions()); porosityPtr_->addResistance(porosityEqn); eqn -= porosityEqn; }
void Foam::fv::explicitPorositySource::addSup ( const volScalarField& alpha, const volScalarField& rho, fvMatrix<vector>& eqn, const label fieldi ) { fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions()); porosityPtr_->addResistance(porosityEqn); eqn -= alpha*porosityEqn; }
void Foam::fv::explicitPorositySource::addSup ( fvMatrix<vector>& eqn, const label fieldI ) { fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions()); if (eqn.dimensions() == dimForce) { const volScalarField& rho = mesh_.lookupObject<volScalarField>(rhoName_); const volScalarField& mu = mesh_.lookupObject<volScalarField>(muName_); porosityPtr_->addResistance(porosityEqn, rho, mu); } else { porosityPtr_->addResistance(porosityEqn); } eqn -= porosityEqn; }
void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn) { if (cellZoneID_ == -1) { return; } bool compressible = false; if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0)) { compressible = true; } const labelList& cells = mesh_.cellZones()[cellZoneID_]; const scalarField& V = this->mesh().V(); vectorField& Usource = UEqn.source(); const vectorField& U = UEqn.psi(); if (compressible) { addActuationDiskAxialInertialResistance ( Usource, cells, V, this->mesh().lookupObject<volScalarField>("rho"), U ); } else { addActuationDiskAxialInertialResistance ( Usource, cells, V, geometricOneField(), U ); } }
void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn) { bool compressible = false; if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0)) { compressible = true; } const scalarField& cellsV = this->mesh().V(); vectorField& Usource = UEqn.source(); const vectorField& U = UEqn.psi(); if (V() > VSMALL) { if (compressible) { addActuationDiskAxialInertialResistance ( Usource, cells_, cellsV, this->mesh().lookupObject<volScalarField>("rho"), U ); } else { addActuationDiskAxialInertialResistance ( Usource, cells_, cellsV, geometricOneField(), U ); } } }