Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HPCAPPs
OpenFOAM-GPU-v2.0
Commits
ea17556c
Commit
ea17556c
authored
Mar 07, 2024
by
shunbo
Browse files
Initial commit
parents
Changes
798
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
914 additions
and
0 deletions
+914
-0
applications/solvers/financial/financialFoam/createFields.H
applications/solvers/financial/financialFoam/createFields.H
+99
-0
applications/solvers/financial/financialFoam/financialFoam.C
applications/solvers/financial/financialFoam/financialFoam.C
+100
-0
applications/solvers/financial/financialSolversDoc.H
applications/solvers/financial/financialSolversDoc.H
+32
-0
applications/solvers/finiteArea/liquidFilmFoam/Make/files
applications/solvers/finiteArea/liquidFilmFoam/Make/files
+3
-0
applications/solvers/finiteArea/liquidFilmFoam/Make/options
applications/solvers/finiteArea/liquidFilmFoam/Make/options
+10
-0
applications/solvers/finiteArea/liquidFilmFoam/calcFrictionFactor.H
...ns/solvers/finiteArea/liquidFilmFoam/calcFrictionFactor.H
+7
-0
applications/solvers/finiteArea/liquidFilmFoam/capillaryCourantNo.H
...ns/solvers/finiteArea/liquidFilmFoam/capillaryCourantNo.H
+13
-0
applications/solvers/finiteArea/liquidFilmFoam/createFaFields.H
...ations/solvers/finiteArea/liquidFilmFoam/createFaFields.H
+158
-0
applications/solvers/finiteArea/liquidFilmFoam/createFvFields.H
...ations/solvers/finiteArea/liquidFilmFoam/createFvFields.H
+31
-0
applications/solvers/finiteArea/liquidFilmFoam/liquidFilmFoam.C
...ations/solvers/finiteArea/liquidFilmFoam/liquidFilmFoam.C
+164
-0
applications/solvers/finiteArea/liquidFilmFoam/readSolutionControls.H
.../solvers/finiteArea/liquidFilmFoam/readSolutionControls.H
+1
-0
applications/solvers/finiteArea/liquidFilmFoam/readTransportProperties.H
...lvers/finiteArea/liquidFilmFoam/readTransportProperties.H
+21
-0
applications/solvers/finiteArea/liquidFilmFoam/surfaceCourantNo.H
...ions/solvers/finiteArea/liquidFilmFoam/surfaceCourantNo.H
+63
-0
applications/solvers/finiteArea/sphereSurfactantFoam/Make/files
...ations/solvers/finiteArea/sphereSurfactantFoam/Make/files
+3
-0
applications/solvers/finiteArea/sphereSurfactantFoam/Make/options
...ions/solvers/finiteArea/sphereSurfactantFoam/Make/options
+10
-0
applications/solvers/finiteArea/sphereSurfactantFoam/createFaFields.H
.../solvers/finiteArea/sphereSurfactantFoam/createFaFields.H
+65
-0
applications/solvers/finiteArea/sphereSurfactantFoam/createFaMesh.H
...ns/solvers/finiteArea/sphereSurfactantFoam/createFaMesh.H
+2
-0
applications/solvers/finiteArea/sphereSurfactantFoam/createVolFields.H
...solvers/finiteArea/sphereSurfactantFoam/createVolFields.H
+36
-0
applications/solvers/finiteArea/sphereSurfactantFoam/sphereSurfactantFoam.C
...rs/finiteArea/sphereSurfactantFoam/sphereSurfactantFoam.C
+93
-0
applications/solvers/finiteArea/surfactantFoam/Make/files
applications/solvers/finiteArea/surfactantFoam/Make/files
+3
-0
No files found.
Too many changes to show.
To preserve performance only
798 of 798+
files are displayed.
Plain diff
Email patch
applications/solvers/financial/financialFoam/createFields.H
0 → 100644
View file @
ea17556c
Info
<<
"Reading financial properties
\n
"
<<
endl
;
IOdictionary
financialProperties
(
IOobject
(
"financialProperties"
,
runTime
.
constant
(),
mesh
,
IOobject
::
MUST_READ_IF_MODIFIED
,
IOobject
::
NO_WRITE
)
);
dimensionedScalar
strike
(
"strike"
,
dimLength
,
financialProperties
);
dimensionedScalar
r
(
"r"
,
dimless
/
dimTime
,
financialProperties
);
dimensionedScalar
sigma
(
"sigma"
,
dimensionSet
(
0
,
0
,
-
0
.
5
,
0
,
0
),
financialProperties
);
dimensionedScalar
sigmaSqr
=
sqr
(
sigma
);
Info
<<
nl
<<
"Reading field V"
<<
endl
;
volScalarField
V
(
IOobject
(
"V"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
mesh
);
surfaceVectorField
Pf
(
IOobject
(
"Pf"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
mesh
.
Cf
()
);
volVectorField
P
(
IOobject
(
"P"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
mesh
.
C
()
);
V
==
max
(
P
.
component
(
Foam
::
vector
::
X
)
-
strike
,
dimensionedScalar
(
V
.
dimensions
(),
Zero
)
);
volScalarField
delta
(
IOobject
(
"delta"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
fvc
::
grad
(
V
)().
component
(
Foam
::
vector
::
X
)
);
applications/solvers/financial/financialFoam/financialFoam.C
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
financialFoam
Group
grpFinancialSolvers
Description
Solves the Black-Scholes equation to price commodities.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "writeCellGraph.H"
#include "OSspecific.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Solves the Black-Scholes equation to price commodities."
);
#define NO_CONTROL
#include "postProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
nl
<<
"Calculating value(price of comodities)"
<<
endl
;
surfaceScalarField
phi
(
"phi"
,
(
sigmaSqr
-
r
)
*
(
Pf
&
mesh
.
Sf
()));
volScalarField
DV
(
"DV"
,
0
.
5
*
sigmaSqr
*
sqr
(
P
.
component
(
Foam
::
vector
::
X
)));
Info
<<
"Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
loop
())
{
delta
==
fvc
::
grad
(
V
)().
component
(
Foam
::
vector
::
X
);
solve
(
fvm
::
ddt
(
V
)
+
fvm
::
div
(
phi
,
V
)
-
fvm
::
Sp
(
fvc
::
div
(
phi
),
V
)
-
fvm
::
laplacian
(
DV
,
V
)
==
-
fvm
::
Sp
(
r
,
V
)
);
runTime
.
write
();
if
(
runTime
.
writeTime
())
{
writeCellGraph
(
V
,
runTime
.
graphFormat
());
writeCellGraph
(
delta
,
runTime
.
graphFormat
());
}
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/financial/financialSolversDoc.H
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\defgroup grpFinancialSolvers Financial solvers
@{
\ingroup grpSolvers
This group contains financial solvers.
@}
\*---------------------------------------------------------------------------*/
applications/solvers/finiteArea/liquidFilmFoam/Make/files
0 → 100644
View file @
ea17556c
liquidFilmFoam.C
EXE = $(FOAM_APPBIN)/liquidFilmFoam
applications/solvers/finiteArea/liquidFilmFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/cfdTools/general/lnInclude
EXE_LIBS = \
-lfiniteArea \
-lfiniteVolume \
-lmeshTools
applications/solvers/finiteArea/liquidFilmFoam/calcFrictionFactor.H
0 → 100644
View file @
ea17556c
{
// Stabilisation of friction factor calculation
// Friction factor is defined with standard gravity
frictionFactor
.
primitiveFieldRef
()
=
mag
(
2
*
9
.
81
*
sqr
(
manningField
.
primitiveField
())
/
cbrt
(
mag
(
h
.
primitiveField
())
+
1e-7
));
}
applications/solvers/finiteArea/liquidFilmFoam/capillaryCourantNo.H
0 → 100644
View file @
ea17556c
{
scalar
CoNumSigma
=
max
(
sqrt
(
2
*
M_PI
*
sigma
*
sqr
(
aMesh
.
edgeInterpolation
::
deltaCoeffs
())
*
aMesh
.
edgeInterpolation
::
deltaCoeffs
()
/
rhol
)
).
value
()
*
runTime
.
deltaT
().
value
();
Info
<<
"Max Capillary Courant Number = "
<<
CoNumSigma
<<
'\n'
<<
endl
;
}
applications/solvers/finiteArea/liquidFilmFoam/createFaFields.H
0 → 100644
View file @
ea17556c
Info
<<
"Reading field h"
<<
endl
;
areaScalarField
h
(
IOobject
(
"h"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
aMesh
);
Info
<<
"Reading field Us"
<<
endl
;
areaVectorField
Us
(
IOobject
(
"Us"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
aMesh
);
edgeScalarField
phis
(
IOobject
(
"phis"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
),
fac
::
interpolate
(
Us
)
&
aMesh
.
Le
()
);
edgeScalarField
phi2s
(
IOobject
(
"phi2s"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
AUTO_WRITE
),
fac
::
interpolate
(
h
*
Us
)
&
aMesh
.
Le
()
);
const
areaVectorField
&
Ns
=
aMesh
.
faceAreaNormals
();
areaVectorField
Gs
(
g
-
Ns
*
(
Ns
&
g
));
areaScalarField
Gn
(
mag
(
g
-
Gs
));
// Mass source
areaScalarField
Sm
(
IOobject
(
"Sm"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
aMesh
,
dimensionedScalar
(
dimLength
/
dimTime
,
Zero
)
);
// Mass sink
areaScalarField
Sd
(
IOobject
(
"Sd"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
aMesh
,
dimensionedScalar
(
dimLength
/
dimTime
,
Zero
)
);
areaVectorField
Ug
(
IOobject
(
"Sg"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
aMesh
,
dimensionedVector
(
dimVelocity
,
Zero
)
);
// Surface pressure
areaScalarField
ps
(
IOobject
(
"ps"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
rhol
*
Gn
*
h
-
sigma
*
fac
::
laplacian
(
h
)
);
// Friction factor
areaScalarField
dotProduct
(
aMesh
.
faceAreaNormals
()
&
(
g
/
mag
(
g
))
);
Info
<<
"View factor: min = "
<<
min
(
dotProduct
.
internalField
())
<<
" max = "
<<
max
(
dotProduct
.
internalField
())
<<
endl
;
areaScalarField
manningField
(
IOobject
(
"manningField"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
aMesh
);
areaScalarField
frictionFactor
(
IOobject
(
"frictionFactor"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
aMesh
,
dimensionedScalar
(
"one"
,
dimless
,
0
.
01
)
);
aMesh
.
setFluxRequired
(
"h"
);
applications/solvers/finiteArea/liquidFilmFoam/createFvFields.H
0 → 100644
View file @
ea17556c
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
mesh
,
dimensionedVector
(
dimVelocity
,
Zero
)
);
volScalarField
H
(
IOobject
(
"H"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
mesh
,
dimensionedScalar
(
dimLength
,
Zero
)
);
// Create volume-to surface mapping object
volSurfaceMapping
vsm
(
aMesh
);
applications/solvers/finiteArea/liquidFilmFoam/liquidFilmFoam.C
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
liquidFilmFoam
Group
grpFiniteAreaSolvers
Description
Transient solver for incompressible, laminar flow of Newtonian fluids in
liquid film formulation.
Author
Zeljko Tukovic, FMENA
Hrvoje Jasak, Wikki Ltd.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "faCFD.H"
#include "loopControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Transient solver for incompressible, laminar flow"
" of Newtonian fluids in liquid film formulation."
);
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFaMesh.H"
#include "readGravitationalAcceleration.H"
#include "readTransportProperties.H"
#include "createFaFields.H"
#include "createFvFields.H"
#include "createTimeControls.H"
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
run
())
{
#include "readSolutionControls.H"
#include "readTimeControls.H"
#include "surfaceCourantNo.H"
#include "capillaryCourantNo.H"
#include "setDeltaT.H"
++
runTime
;
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
while
(
iters
.
loop
())
{
phi2s
=
fac
::
interpolate
(
h
)
*
phis
;
#include "calcFrictionFactor.H"
faVectorMatrix
UsEqn
(
fam
::
ddt
(
h
,
Us
)
+
fam
::
div
(
phi2s
,
Us
)
+
fam
::
Sp
(
0
.
0125
*
frictionFactor
*
mag
(
Us
),
Us
)
==
Gs
*
h
-
fam
::
Sp
(
Sd
,
Us
)
);
UsEqn
.
relax
();
solve
(
UsEqn
==
-
fac
::
grad
(
ps
*
h
)
/
rhol
+
ps
*
fac
::
grad
(
h
)
/
rhol
);
areaScalarField
UsA
(
UsEqn
.
A
());
Us
=
UsEqn
.
H
()
/
UsA
;
Us
.
correctBoundaryConditions
();
phis
=
(
fac
::
interpolate
(
Us
)
&
aMesh
.
Le
())
-
fac
::
interpolate
(
1
.
0
/
(
rhol
*
UsA
))
*
fac
::
lnGrad
(
ps
*
h
)
*
aMesh
.
magLe
()
+
fac
::
interpolate
(
ps
/
(
rhol
*
UsA
))
*
fac
::
lnGrad
(
h
)
*
aMesh
.
magLe
();
faScalarMatrix
hEqn
(
fam
::
ddt
(
h
)
+
fam
::
div
(
phis
,
h
)
==
Sm
-
fam
::
Sp
(
Sd
/
(
h
+
dimensionedScalar
(
"small"
,
dimLength
,
SMALL
)),
h
)
);
hEqn
.
relax
();
hEqn
.
solve
();
phi2s
=
hEqn
.
flux
();
// Bound h
h
.
primitiveFieldRef
()
=
max
(
max
(
h
.
primitiveField
(),
fac
::
average
(
max
(
h
,
h0
))().
primitiveField
()
*
pos
(
h0
.
value
()
-
h
.
primitiveField
())
),
h0
.
value
()
);
ps
=
rhol
*
Gn
*
h
-
sigma
*
fac
::
laplacian
(
h
);
ps
.
correctBoundaryConditions
();
Us
-=
(
1
.
0
/
(
rhol
*
UsA
))
*
fac
::
grad
(
ps
*
h
)
-
(
ps
/
(
rhol
*
UsA
))
*
fac
::
grad
(
h
);
Us
.
correctBoundaryConditions
();
}
if
(
runTime
.
writeTime
())
{
vsm
.
mapToVolume
(
h
,
H
.
boundaryFieldRef
());
vsm
.
mapToVolume
(
Us
,
U
.
boundaryFieldRef
());
runTime
.
write
();
}
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/finiteArea/liquidFilmFoam/readSolutionControls.H
0 → 100644
View file @
ea17556c
loopControl
iters
(
runTime
,
aMesh
.
solutionDict
(),
"solution"
);
applications/solvers/finiteArea/liquidFilmFoam/readTransportProperties.H
0 → 100644
View file @
ea17556c
IOdictionary
transportProperties
(
IOobject
(
"transportProperties"
,
runTime
.
constant
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
NO_WRITE
)
);
dimensionedScalar
mug
(
"mug"
,
dimViscosity
,
transportProperties
);
dimensionedScalar
mul
(
"mul"
,
dimViscosity
,
transportProperties
);
dimensionedScalar
rhog
(
"rhog"
,
dimDensity
,
transportProperties
);
dimensionedScalar
rhol
(
"rhol"
,
dimDensity
,
transportProperties
);
dimensionedScalar
sigma
(
"sigma"
,
dimMass
/
sqr
(
dimTime
),
transportProperties
);
dimensionedScalar
h0
(
"h0"
,
dimLength
,
transportProperties
);
applications/solvers/finiteArea/liquidFilmFoam/surfaceCourantNo.H
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Global
surfaceCourantNo
Author
Hrvoje Jasak, Wikki Ltd.
Description
Calculates and outputs the mean and maximum Courant Numbers for the
Finite Area method.
\*---------------------------------------------------------------------------*/
scalar
CoNum
=
0
.
0
;
scalar
meanCoNum
=
0
.
0
;
scalar
velMag
=
0
.
0
;
if
(
aMesh
.
nInternalEdges
())
{
edgeScalarField
SfUfbyDelta
(
aMesh
.
edgeInterpolation
::
deltaCoeffs
()
*
mag
(
phis
)
);
CoNum
=
max
(
SfUfbyDelta
/
aMesh
.
magLe
())
.
value
()
*
runTime
.
deltaT
().
value
();
meanCoNum
=
(
sum
(
SfUfbyDelta
)
/
sum
(
aMesh
.
magLe
()))
.
value
()
*
runTime
.
deltaT
().
value
();
velMag
=
max
(
mag
(
phis
)
/
aMesh
.
magLe
()).
value
();
}
Info
<<
"Courant Number mean: "
<<
meanCoNum
<<
" max: "
<<
CoNum
<<
" velocity magnitude: "
<<
velMag
<<
endl
;
// ************************************************************************* //
applications/solvers/finiteArea/sphereSurfactantFoam/Make/files
0 → 100644
View file @
ea17556c
sphereSurfactantFoam.C
EXE = $(FOAM_APPBIN)/sphereSurfactantFoam
applications/solvers/finiteArea/sphereSurfactantFoam/Make/options
0 → 100644
View file @
ea17556c
EXE_INC = \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/cfdTools/general/lnInclude
EXE_LIBS = \
-lfiniteArea \
-lfiniteVolume \
-lmeshTools
applications/solvers/finiteArea/sphereSurfactantFoam/createFaFields.H
0 → 100644
View file @
ea17556c
Info
<<
"Reading field Cs"
<<
endl
;
areaScalarField
Cs
(
IOobject
(
"Cs"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
MUST_READ
,
IOobject
::
AUTO_WRITE
),
aMesh
);
dimensionedScalar
Cs0
(
"Cs0"
,
dimMass
/
dimArea
,
1
.
0
);
const
areaVectorField
&
R
=
aMesh
.
areaCentres
();
Cs
=
Cs0
*
(
1
.
0
+
R
.
component
(
vector
::
X
)
/
mag
(
R
));
dimensionedScalar
Ds
(
"Ds"
,
dimViscosity
,
1
.
0
);
areaVectorField
Us
(
IOobject
(
"Us"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
aMesh
,
dimensionedVector
(
dimVelocity
,
Zero
)
);
dimensioned
<
scalar
>
Uinf
(
"Uinf"
,
dimVelocity
,
1
.
0
);
forAll
(
Us
,
faceI
)
{
Us
[
faceI
].
x
()
=
Uinf
.
value
()
*
(
0
.
25
*
(
3
.
0
+
sqr
(
R
[
faceI
].
x
()
/
mag
(
R
[
faceI
])))
-
1
.
0
);
Us
[
faceI
].
y
()
=
Uinf
.
value
()
*
0
.
25
*
R
[
faceI
].
x
()
*
R
[
faceI
].
y
()
/
sqr
(
mag
(
R
[
faceI
]));
Us
[
faceI
].
z
()
=
Uinf
.
value
()
*
0
.
25
*
R
[
faceI
].
x
()
*
R
[
faceI
].
z
()
/
sqr
(
mag
(
R
[
faceI
]));
}
Us
-=
aMesh
.
faceAreaNormals
()
*
(
aMesh
.
faceAreaNormals
()
&
Us
);
edgeScalarField
phis
(
IOobject
(
"phis"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
linearEdgeInterpolate
(
Us
)
&
aMesh
.
Le
()
);
applications/solvers/finiteArea/sphereSurfactantFoam/createFaMesh.H
0 → 100644
View file @
ea17556c
// Create Finite Area mesh
faMesh
aMesh
(
mesh
);
applications/solvers/finiteArea/sphereSurfactantFoam/createVolFields.H
0 → 100644
View file @
ea17556c
// Create volume-to surface mapping object
volSurfaceMapping
vsm
(
aMesh
);
volScalarField
Cvf
(
IOobject
(
"Cvf"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
mesh
,
dimensionedScalar
(
dimless
/
dimLength
,
Zero
)
);
vsm
.
mapToVolume
(
Cs
,
Cvf
.
boundaryFieldRef
());
Cvf
.
write
();
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
mesh
,
dimensionedVector
(
dimVelocity
,
Zero
)
);
vsm
.
mapToVolume
(
Us
,
U
.
boundaryFieldRef
());
U
.
write
();
applications/solvers/finiteArea/sphereSurfactantFoam/sphereSurfactantFoam.C
0 → 100644
View file @
ea17556c
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
surfactantFoam for sphere transport
Group
grpFiniteAreaSolvers
Description
Passive scalar transport equation solver on a sphere
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "faCFD.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
addNote
(
"Passive finiteArea scalar transport on a sphere"
);
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFaMesh.H"
#include "createFaFields.H"
#include "createVolFields.H"
Info
<<
"Total mass of surfactant: "
<<
sum
(
Cs
.
internalField
()
*
aMesh
.
S
())
<<
endl
;
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
loop
())
{
Info
<<
"Time = "
<<
runTime
.
value
()
<<
endl
;
faScalarMatrix
CsEqn
(
fam
::
ddt
(
Cs
)
+
fam
::
div
(
phis
,
Cs
)
-
fam
::
laplacian
(
Ds
,
Cs
)
);
CsEqn
.
solve
();
if
(
runTime
.
writeTime
())
{
vsm
.
mapToVolume
(
Cs
,
Cvf
.
boundaryFieldRef
());
runTime
.
write
();
}
Info
<<
"Total mass of surfactant: "
<<
sum
(
Cs
.
internalField
()
*
aMesh
.
S
())
<<
endl
;
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
applications/solvers/finiteArea/surfactantFoam/Make/files
0 → 100644
View file @
ea17556c
surfactantFoam.C
EXE = $(FOAM_APPBIN)/surfactantFoam
Prev
1
…
13
14
15
16
17
18
19
20
21
…
40
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment