本文整理汇总了C++中fvMatrix类的典型用法代码示例。如果您正苦于以下问题:C++ fvMatrix类的具体用法?C++ fvMatrix怎么用?C++ fvMatrix使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了fvMatrix类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Tuni
void Foam::fv::fixedTemperatureConstraint::constrain
(
fvMatrix<scalar>& eqn,
const label
)
{
const basicThermo& thermo =
mesh_.lookupObject<basicThermo>(basicThermo::dictName);
switch (mode_)
{
case tmUniform:
{
const scalar t = mesh_.time().value();
scalarField Tuni(cells_.size(), Tuniform_->value(t));
eqn.setValues(cells_, thermo.he(thermo.p(), Tuni, cells_));
break;
}
case tmLookup:
{
const volScalarField& T =
mesh().lookupObject<volScalarField>(TName_);
scalarField Tlkp(T, cells_);
eqn.setValues(cells_, thermo.he(thermo.p(), Tlkp, cells_));
break;
}
default:
{
// error handling done by NamedEnum
}
}
}
开发者ID:luguo15123,项目名称:OpenFOAM-3.0.x,代码行数:35,代码来源:fixedTemperatureConstraint.C
示例2: IOobject
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);
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Breeder2.0-libraries-swak4Foam,代码行数:28,代码来源:matrixChangeBeforeFvOption.C
示例3: porosityEqn
void Foam::fv::explicitPorositySource::addSup
(
fvMatrix<vector>& eqn,
const label fieldi
)
{
fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions());
porosityPtr_->addResistance(porosityEqn);
eqn -= porosityEqn;
}
开发者ID:iYohey,项目名称:OpenFOAM-dev,代码行数:10,代码来源:explicitPorositySource.C
示例4: forAll
void Foam::porousZone::modifyDdt(fvMatrix<Type>& m) const
{
if (porosity_ < 1)
{
const labelList& cells = mesh_.cellZones()[cellZoneID_];
forAll(cells, i)
{
m.diag()[cells[i]] *= porosity_;
m.source()[cells[i]] *= porosity_;
}
}
开发者ID:CFMS,项目名称:foam-extend-foam-extend-3.2,代码行数:12,代码来源:porousZoneTemplates.C
示例5: initialise
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;
}
开发者ID:BijanZarif,项目名称:OpenFOAM-2.4.0-MNF,代码行数:51,代码来源:interRegionExplicitPorositySource.C
示例6: coeff
void Foam::jjc2014Zone::modifyDdt(fvMatrix<Type>& m) const
{
if (porosity_ < 1)
{
const labelList& cells = mesh_.cellZones()[cellZoneID_];
scalar coeff( (1.0 + addedMassCoeff_ * ( 1 - porosity_ ) / porosity_) / porosity_ );
forAll(cells, i)
{
m.diag()[cells[i]] *= coeff;
m.source()[cells[i]] *= coeff;
}
}
开发者ID:Aidan-Bharath,项目名称:waves2Foam,代码行数:14,代码来源:jjc2014ZoneTemplates.C
示例7: acceleration
void Foam::fv::tabulatedAccelerationSource::addSup
(
const RhoFieldType& rho,
fvMatrix<vector>& eqn,
const label fieldi
)
{
Vector<vector> acceleration(motion_.acceleration());
// If gravitational force is present combine with the linear acceleration
if (mesh_.foundObject<uniformDimensionedVectorField>("g"))
{
uniformDimensionedVectorField& g =
mesh_.lookupObjectRef<uniformDimensionedVectorField>("g");
const uniformDimensionedScalarField& hRef =
mesh_.lookupObject<uniformDimensionedScalarField>("hRef");
g = g0_ - dimensionedVector("a", dimAcceleration, acceleration.x());
dimensionedScalar ghRef
(
mag(g.value()) > SMALL
? g & (cmptMag(g.value())/mag(g.value()))*hRef
: dimensionedScalar("ghRef", g.dimensions()*dimLength, 0)
);
mesh_.lookupObjectRef<volScalarField>("gh") = (g & mesh_.C()) - ghRef;
mesh_.lookupObjectRef<surfaceScalarField>("ghf") =
(g & mesh_.Cf()) - ghRef;
}
// ... otherwise include explicitly in the momentum equation
else
{
eqn -= rho*dimensionedVector("a", dimAcceleration, acceleration.x());
}
dimensionedVector Omega
(
"Omega",
dimensionSet(0, 0, -1, 0, 0),
acceleration.y()
);
dimensionedVector dOmegaDT
(
"dOmegaDT",
dimensionSet(0, 0, -2, 0, 0),
acceleration.z()
);
eqn -=
(
rho*(2*Omega ^ eqn.psi()) // Coriolis force
+ rho*(Omega ^ (Omega ^ mesh_.C())) // Centrifugal force
+ rho*(dOmegaDT ^ mesh_.C()) // Angular tabulatedAcceleration force
);
}
开发者ID:petebachant,项目名称:OpenFOAM-dev,代码行数:59,代码来源:tabulatedAccelerationSourceTemplates.C
示例8:
Foam::SolverPerformance<Type> Foam::solve
(
fvMatrix<Type>& fvm,
const word& name
)
{
return fvm.solve(name);
}
开发者ID:OpenFOAM,项目名称:OpenFOAM-dev,代码行数:8,代码来源:fvMatrixSolve.C
示例9:
void Foam::fixedInternalValueFvPatchField<Type>::manipulateMatrix
(
fvMatrix<Type>& matrix
)
{
// Apply the refValue as a constraint in the matrix
matrix.setValues(this->patch().faceCells(), refValue_);
}
开发者ID:Haider-BA,项目名称:foam-extend-3.0,代码行数:8,代码来源:fixedInternalValueFvPatchField.C
示例10: geometricOneField
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
);
}
}
}
开发者ID:Mat-moran,项目名称:OpenFOAM-2.0.x,代码行数:38,代码来源:actuationDiskSource.C
示例11: clearVariables
void forceEquation<T>::operator()(fvMatrix<T> &eq)
{
typedef GeometricField<T,fvPatchField,volMesh> resultField;
clearVariables();
DynamicList<label> cellIDs;
if(!getMask(cellIDs,eq.psi().name())) {
return;
}
Field<T> values(cellIDs.size());
parse(valueExpression_);
const resultField &calculated=getResult<resultField>();
forAll(cellIDs,i) {
values[i]=calculated[cellIDs[i]];
}
eq.setValues(cellIDs,values);
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Breeder2.0-libraries-swak4Foam,代码行数:23,代码来源:forceEquation.C
示例12:
void Foam::fv::radiation::addSup
(
const volScalarField& rho,
fvMatrix<scalar>& eqn,
const label fieldi
)
{
const basicThermo& thermo =
mesh_.lookupObject<basicThermo>(basicThermo::dictName);
radiation_->correct();
eqn += radiation_->Sh(thermo, eqn.psi());
}
开发者ID:OpenFOAM,项目名称:OpenFOAM-dev,代码行数:14,代码来源:radiation.C
示例13: 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;
}
开发者ID:Al-th,项目名称:OpenFOAM-2.2.x,代码行数:23,代码来源:explicitPorositySource.C
示例14: FatalErrorIn
void SwakSetValue<T>::setValue
(
fvMatrix<T>& eqn,
const label fieldI
)
{
this->driver().clearVariables();
this->driver().parse(this->expressions_[fieldI]);
if(
!this->driver().
FieldValueExpressionDriver::resultIsTyp<typename SwakSetValue<T>::resultField>()
) {
FatalErrorIn("SwakSetValue<"+word(pTraits<T>::typeName)+">::setValue()")
<< "Result of " << this->expressions_[fieldI] << " is not a "
<< pTraits<T>::typeName
<< endl
<< exit(FatalError);
}
typename SwakSetValue<T>::resultField result(
this->driver().
FieldValueExpressionDriver::getResult<typename SwakSetValue<T>::resultField>()
);
DynamicList<label> cellIDs;
if(useMaskExpression_) {
if(!getMask(cellIDs,eqn.psi().name())) {
return;
}
} else {
cellIDs=this->cells_;
}
List<T> values(cellIDs.size());
// UIndirectList<Type>(values, cells_) = injectionRate_[fieldI];
forAll(cellIDs,i)
{
label cellI=cellIDs[i];
values[i]=result[cellI];
}
开发者ID:adimako,项目名称:swak4foam,代码行数:43,代码来源:SwakSetValue.C
示例15: saveDiag
void fvBlockMatrix<Type>::insertDiagSource
(
const direction dir,
fvMatrix<matrixType>& matrix
)
{
matrix.completeAssembly();
// Save a copy for different components
scalarField& diag = matrix.diag();
scalarField saveDiag(diag);
// Add source boundary contribution
Field<matrixType>& source = matrix.source();
matrix.addBoundarySource(source, false);
const direction nCmpts = pTraits<matrixType>::nComponents;
direction localDir = dir;
// Get reference to this source field of block system
Field<Type>& b = this->source();
if
(
// This is needed if the matrixType is <vector>, then you need to grab
// coeffs as linear. Consider doing a matrixType check also.
// VV, 17/March/2014
this->diag().activeType() != blockCoeffBase::SQUARE
)
{
typename CoeffField<Type>::linearTypeField& blockDiag =
this->diag().asLinear();
for (direction cmptI = 0; cmptI < nCmpts; cmptI++)
{
matrix.addBoundaryDiag(diag, cmptI);
scalarField sourceCmpt(source.component(cmptI));
// FieldField<Field, scalar> bouCoeffsCmpt
// (
// matrix.boundaryCoeffs().component(cmptI)
// );
// Possible problem for coupled non-aligned boundaries.
// VV, 14/May/2014.
// matrix.correctImplicitBoundarySource
// (
// bouCoeffsCmpt,
// sourceCmpt,
// cmptI
// );
forAll (diag, cellI)
{
blockDiag[cellI](localDir) = diag[cellI];
b[cellI](localDir) += sourceCmpt[cellI];
}
localDir++;
// Reset diagonal
diag = saveDiag;
}
开发者ID:CFMS,项目名称:foam-extend-foam-extend-3.2,代码行数:63,代码来源:fvBlockMatrix.C
注:本文中的fvMatrix类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论