34 namespace porosityModels
44 void Foam::porosityModels::fixedCoeff::apply
64 const tensor Cd =
rho*(alphaZones[j] + betaZones[j]*
mag(
U[celli]));
65 const scalar isoCd =
tr(Cd);
67 Udiag[celli] += V[celli]*isoCd;
68 Usource[celli] -= V[celli]*((Cd -
I*isoCd) &
U[celli]);
74 void Foam::porosityModels::fixedCoeff::apply
82 forAll(cellZoneIDs_, zoneI)
92 const label j = fieldIndex(i);
94 const tensor beta = betaZones[j];
107 const word& modelType,
110 const word& cellZoneName
116 alpha_(cellZoneIDs_.size()),
117 beta_(cellZoneIDs_.size())
136 if (coordSys_.R().uniform())
138 forAll(cellZoneIDs_, zoneI)
140 alpha_[zoneI].setSize(1);
141 beta_[zoneI].setSize(1);
143 alpha_[zoneI][0] =
Zero;
144 alpha_[zoneI][0].xx() = alphaXYZ_.value().x();
145 alpha_[zoneI][0].yy() = alphaXYZ_.value().y();
146 alpha_[zoneI][0].zz() = alphaXYZ_.value().z();
147 alpha_[zoneI][0] = coordSys_.R().transform(
Zero, alpha_[zoneI][0]);
149 beta_[zoneI][0] =
Zero;
150 beta_[zoneI][0].xx() = betaXYZ_.value().x();
151 beta_[zoneI][0].yy() = betaXYZ_.value().y();
152 beta_[zoneI][0].zz() = betaXYZ_.value().z();
153 beta_[zoneI][0] = coordSys_.R().transform(
Zero, beta_[zoneI][0]);
158 forAll(cellZoneIDs_, zoneI)
162 alpha_[zoneI].setSize(
cells.size());
163 beta_[zoneI].setSize(
cells.size());
167 alpha_[zoneI][i] =
Zero;
168 alpha_[zoneI][i].xx() = alphaXYZ_.value().x();
169 alpha_[zoneI][i].yy() = alphaXYZ_.value().y();
170 alpha_[zoneI][i].zz() = alphaXYZ_.value().z();
172 beta_[zoneI][i] =
Zero;
173 beta_[zoneI][i].xx() = betaXYZ_.value().x();
174 beta_[zoneI][i].yy() = betaXYZ_.value().y();
175 beta_[zoneI][i].zz() = betaXYZ_.value().z();
183 alpha_[zoneI] =
R.transform(alpha_[zoneI]);
184 beta_[zoneI] =
R.transform(beta_[zoneI]);
201 scalar rhoRef = coeffs_.lookup<scalar>(
"rhoRef");
203 apply(Udiag, Usource, V,
U, rhoRef);
205 force = Udiag*
U - Usource;
222 coeffs_.lookup(
"rhoRef") >>
rho;
225 apply(Udiag, Usource, V,
U,
rho);
240 coeffs_.lookup(
"rhoRef") >>
rho;
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & write(const char)=0
Write character.
A List with indirect addressing.
Abstract base class for coordinate rotation.
A list of keyword definitions, which are a keyword followed by any number of values (e....
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Mesh data needed to do the Finite Volume discretisation.
const meshCellZones & cellZones() const
Return cell zones.
Top level model for porosity models.
const fvMesh & mesh_
Reference to the mesh database.
void adjustNegativeResistance(dimensionedVector &resist)
Adjust negative resistance values to be multiplier of max value.
labelList cellZoneIDs_
Cell zone IDs.
label fieldIndex(const label index) const
Return label index.
Fixed coefficient form of porosity model.
virtual void calcForce(const volVectorField &U, const volScalarField &rho, const volScalarField &mu, vectorField &force) const
Calculate the porosity force.
bool writeData(Ostream &os) const
Write.
virtual ~fixedCoeff()
Destructor.
virtual void correct(fvVectorMatrix &UEqn) const
Add resistance.
fixedCoeff(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict, const word &cellZoneName)
virtual void calcTransformModelData()
Transform the model data wrt mesh changes.
A class for handling words, derived from string.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
volScalarField scalarField(fieldObject, mesh)
volVectorField vectorField(fieldObject, mesh)
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
const dimensionedScalar mu
Atomic mass unit.
addToRunTimeSelectionTable(porosityModel, powerLawLopesdaCosta, mesh)
defineTypeNameAndDebug(powerLawLopesdaCosta, 0)
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Tensor< scalar > tensor
Tensor of scalars.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
const dimensionSet dimless
const dimensionSet dimLength
static const Identity< scalar > I
const dimensionSet dimForce
const dimensionSet dimTime
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static scalar R(const scalar a, const scalar x)
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
Ostream & indent(Ostream &os)
Indent stream.