36 scalar maxCmpt =
max(0,
cmptMax(resist.value()));
42 "Foam::porousZone::porousZone::adjustNegativeResistance"
43 "(dimensionedVector&)"
44 ) <<
"negative resistances! " << resist
49 vector& val = resist.value();
54 val[cmpt] *= -maxCmpt;
63 Foam::porousZone::porousZone
73 cellZoneID_(mesh_.cellZones().findZoneID(name)),
74 coordSys_(dict, mesh),
81 Info<<
"Creating porous zone: " << name_ <<
endl;
83 bool foundZone = (cellZoneID_ != -1);
90 "Foam::porousZone::porousZone"
91 "(const fvMesh&, const word&, const dictionary&)"
92 ) <<
"cannot find porous cellZone " << name_
98 if (dict_.readIfPresent(
"porosity", porosity_))
100 if (porosity_ <= 0.0 || porosity_ > 1.0)
104 "Foam::porousZone::porousZone"
105 "(const fvMesh&, const word&, const dictionary&)",
108 <<
"out-of-range porosity value " << porosity_
116 dictPtr->readIfPresent(
"C0", C0_);
117 dictPtr->readIfPresent(
"C1", C1_);
124 const tensor&
E = coordSys_.R();
127 if (dictPtr->readIfPresent(
"d", d))
133 "Foam::porousZone::porousZone"
134 "(const fvMesh&, const word&, const dictionary&)",
136 ) <<
"incorrect dimensions for d: " << d.
dimensions()
137 <<
" should be " << D_.dimensions()
141 adjustNegativeResistance(d);
143 D_.value().xx() = d.
value().
x();
144 D_.value().yy() = d.
value().
y();
145 D_.value().zz() = d.
value().
z();
146 D_.value() = (E & D_ & E.
T()).value();
150 if (dictPtr->readIfPresent(
"f", f))
156 "Foam::porousZone::porousZone"
157 "(const fvMesh&, const word&, const dictionary&)",
159 ) <<
"incorrect dimensions for f: " << f.
dimensions()
160 <<
" should be " << F_.dimensions()
164 adjustNegativeResistance(f);
167 F_.value().xx() = 0.5*f.
value().
x();
168 F_.value().yy() = 0.5*f.
value().
y();
169 F_.value().zz() = 0.5*f.
value().
z();
170 F_.value() = (E & F_ & E.
T()).value();
181 &&
magSqr(D_.value()) <= VSMALL
182 &&
magSqr(F_.value()) <= VSMALL
187 "Foam::porousZone::porousZone"
188 "(const fvMesh&, const word&, const dictionary&)",
190 ) <<
"neither powerLaw (powerLaw C0/C1) "
191 "nor Darcy-Forchheimer law (Darcy d/f) specified"
201 if (cellZoneID_ == -1)
222 addPowerLawResistance
233 addPowerLawResistance
244 const tensor& D = D_.value();
245 const tensor& F = F_.value();
251 addViscousInertialResistance
264 addViscousInertialResistance
286 if (cellZoneID_ == -1)
304 addPowerLawResistance
314 addPowerLawResistance
324 const tensor& D = D_.value();
325 const tensor& F = F_.value();
331 addViscousInertialResistance
342 addViscousInertialResistance
376 if (dict_.found(
"note"))
382 coordSys_.writeDict(os,
true);
384 if (dict_.found(
"porosity"))
392 os <<
indent <<
"powerLaw";