1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*----------------------------------------------------------------------------*/
27 #include "porousZone.H"
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33 void Foam::porousZone::modifyDdt(fvMatrix<Type>& m) const
37 const labelList& cells = mesh_.cellZones()[cellZoneID_];
41 m.diag()[cells[i]] *= porosity_;
42 m.source()[cells[i]] *= porosity_;
48 template<class RhoFieldType>
49 void Foam::porousZone::addPowerLawResistance
52 const labelList& cells,
54 const RhoFieldType& rho,
58 const scalar C0 = C0_;
59 const scalar C1m1b2 = (C1_ - 1.0)/2.0;
64 V[cells[i]]*rho[cells[i]]*C0*pow(magSqr(U[cells[i]]), C1m1b2);
69 template<class RhoFieldType>
70 void Foam::porousZone::addViscousInertialResistance
74 const labelList& cells,
76 const RhoFieldType& rho,
77 const scalarField& mu,
81 const tensor& D = D_.value();
82 const tensor& F = F_.value();
86 tensor dragCoeff = mu[cells[i]]*D + (rho[cells[i]]*mag(U[cells[i]]))*F;
87 scalar isoDragCoeff = tr(dragCoeff);
89 Udiag[cells[i]] += V[cells[i]]*isoDragCoeff;
91 V[cells[i]]*((dragCoeff - I*isoDragCoeff) & U[cells[i]]);
96 template<class RhoFieldType>
97 void Foam::porousZone::addPowerLawResistance
100 const labelList& cells,
101 const RhoFieldType& rho,
105 const scalar C0 = C0_;
106 const scalar C1m1b2 = (C1_ - 1.0)/2.0;
110 AU[cells[i]] = AU[cells[i]]
111 + I*(rho[cells[i]]*C0*pow(magSqr(U[cells[i]]), C1m1b2));
116 template<class RhoFieldType>
117 void Foam::porousZone::addViscousInertialResistance
120 const labelList& cells,
121 const RhoFieldType& rho,
122 const scalarField& mu,
126 const tensor& D = D_.value();
127 const tensor& F = F_.value();
131 AU[cells[i]] += mu[cells[i]]*D + (rho[cells[i]]*mag(U[cells[i]]))*F;
136 // ************************************************************************* //