DarcyForchheimerTemplates.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2012-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29
30template<class RhoFieldType>
32(
33 scalarField& Udiag,
34 vectorField& Usource,
35 const scalarField& V,
36 const RhoFieldType& rho,
37 const scalarField& mu,
38 const vectorField& U
39) const
40{
41 forAll(cellZoneIDs_, zoneI)
42 {
43 const tensorField& dZones = D_[zoneI];
44 const tensorField& fZones = F_[zoneI];
45
46 const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]];
47
48 forAll(cells, i)
49 {
50 const label celli = cells[i];
51 const label j = this->fieldIndex(i);
52 const tensor Cd =
53 mu[celli]*dZones[j] + (rho[celli]*mag(U[celli]))*fZones[j];
54
55 const scalar isoCd = tr(Cd);
56
57 Udiag[celli] += V[celli]*isoCd;
58 Usource[celli] -= V[celli]*((Cd - I*isoCd) & U[celli]);
59 }
60 }
61}
62
63
64template<class RhoFieldType>
66(
67 tensorField& AU,
68 const RhoFieldType& rho,
69 const scalarField& mu,
70 const vectorField& U
71) const
72{
73 forAll(cellZoneIDs_, zoneI)
74 {
75 const tensorField& dZones = D_[zoneI];
76 const tensorField& fZones = F_[zoneI];
77
78 const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]];
79
80 forAll(cells, i)
81 {
82 const label celli = cells[i];
83 const label j = this->fieldIndex(i);
84 const tensor D = dZones[j];
85 const tensor F = fZones[j];
86
87 AU[celli] += mu[celli]*D + (rho[celli]*mag(U[celli]))*F;
88 }
89 }
90}
91
92
93// ************************************************************************* //
virtual void apply()=0
Apply bins.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
Definition: polyMesh.H:504
const fvMesh & mesh_
Reference to the mesh database.
Definition: porosityModel.H:69
labelList cellZoneIDs_
Cell zone IDs.
Definition: porosityModel.H:84
label fieldIndex(const label index) const
Return label index.
Tensor of scalars, i.e. Tensor<scalar>.
U
Definition: pEqn.H:72
const volScalarField & mu
const cellShapeList & cells
volVectorField F(fluid.F())
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
List< label > labelList
A List of labels.
Definition: List.H:66
static const Identity< scalar > I
Definition: Identity.H:94
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Field< vector > vectorField
Specialisation of Field<T> for vector.
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
const dimensionedScalar & D
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333