Loading...
Searching...
No Matches
surfactantFoam.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) 2016-2017 Wikki Ltd
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
26Application
27 surfactantFoam
28
29Group
30 grpFiniteAreaSolvers
31
32Description
33 Passive scalar transport finiteArea equation solver.
34
35 \heading Solver details
36 The equation is given by:
37
38 \f[
39 \ddt{Cs} + \div \left(\vec{U} Cs\right) - \div \left(D_T \grad Cs \right)
40 = 0
41 \f]
42
43 Where:
44 \vartable
45 Cs | Passive scalar
46 Ds | Diffusion coefficient
47 \endvartable
48
49 \heading Required fields
50 \plaintable
51 Cs | Passive scalar
52 Us | Velocity [m/s]
53 \endplaintable
54
55Author
56 Zeljko Tukovic, FMENA
57 Hrvoje Jasak, Wikki Ltd.
58
59\*---------------------------------------------------------------------------*/
60
61#include "fvCFD.H"
62#include "faCFD.H"
63
64// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65
66int main(int argc, char *argv[])
67{
68 argList::addNote
69 (
70 "Passive scalar transport finiteArea equation solver."
71 );
72
73 #include "setRootCaseLists.H"
74 #include "createTime.H"
75 #include "createMesh.H"
76 #include "createFaMesh.H"
77 #include "createFaFields.H"
78 #include "createVolFields.H"
79
80 Info<< "Total mass of surfactant: "
81 << sum(Cs.internalField()*aMesh.S()) << endl;
82
83 Info<< "\nStarting time loop\n" << endl;
84
85 while (runTime.loop())
86 {
87 Info<< "Time = " << runTime.value() << endl;
88
89 faScalarMatrix CsEqn
90 (
91 fam::ddt(Cs)
92 + fam::div(phis, Cs)
93 - fam::laplacian(Ds, Cs)
94 );
95
96 CsEqn.solve();
97
98 if (runTime.writeTime())
99 {
100 vsm.mapToVolume(Cs, Cvf.boundaryFieldRef());
101
102 runTime.write();
103 }
104
105 Info<< "Total mass of surfactant: "
106 << sum(Cs.internalField()*aMesh.S()) << endl;
107
108 runTime.printExecutionTime(Info);
109 }
110
111 Info<< "End\n" << endl;
112
113 return 0;
114}
115
116
117// ************************************************************************* //
Template specialisation for scalar faMatrix.
engineTime & runTime
Required Variables.
const volSurfaceMapping vsm(aMesh)
Required Classes.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
const scalarField & Cs
edgeScalarField phis(IOobject("phis", runTime.timeName(), aMesh.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE), linearEdgeInterpolate(Us) &aMesh.Le())
volScalarField Cvf(IOobject("Cvf", runTime.timeName(), mesh.thisDb(), IOobject::NO_READ, IOobject::AUTO_WRITE), mesh, dimensionedScalar(dimless/dimLength, Zero))