Merge remote-tracking branch 'origin/proposal/famTutorialReorganization' into nextRelease

This commit is contained in:
Dominik Christ 2013-07-08 11:52:32 +01:00
commit e72ecd6fcf
40 changed files with 849 additions and 35 deletions

8
.gitignore vendored
View file

@ -93,4 +93,12 @@ src/lduSolvers/amg/amgPolicy/samgPolicy.H
src/lduSolvers/amg/amgPolicy/aamgPolicy.C src/lduSolvers/amg/amgPolicy/aamgPolicy.C
src/lduSolvers/amg/amgPolicy/aamgPolicy.H src/lduSolvers/amg/amgPolicy/aamgPolicy.H
# The following files are blacklisted because of a DMCA complaint by ANSYS.
src/lduSolvers/tools/PriorityArray.C
src/lduSolvers/tools/PriorityArray.H
src/lduSolvers/amg/amgPolicy/samgPolicy.C
src/lduSolvers/amg/amgPolicy/samgPolicy.H
src/lduSolvers/amg/amgPolicy/aamgPolicy.C
src/lduSolvers/amg/amgPolicy/aamgPolicy.H
# end-of-file # end-of-file

View file

@ -12,26 +12,28 @@ areaScalarField Cs
aMesh aMesh
); );
dimensioned<scalar> Cs0 Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
( (
"Cs0", IOobject
dimensionSet(1, -2, 0, 0, 0, 0, 0), (
1.0 "transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
); );
const areaVectorField& R = aMesh.areaCentres();
Cs = Cs0*(1.0 + R.component(vector::X)/mag(R)); Info<< "Reading diffusivity D\n" << endl;
dimensionedScalar Ds
dimensioned<scalar> Ds
( (
"Ds", transportProperties.lookup("Ds")
dimensionSet(0, 2, -1, 0, 0, 0, 0),
1.0
); );
areaVectorField Us areaVectorField Us
( (
IOobject IOobject
@ -39,29 +41,12 @@ areaVectorField Us
"Us", "Us",
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::NO_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
aMesh, aMesh
dimensioned<vector>("Us", dimVelocity, vector::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 edgeScalarField phis
( (

View file

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class areaScalarField;
location "0";
object Cs;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -2 0 0 0 0 0];
internalField uniform 0;
referenceLevel 0;
boundaryField
{
inlet {
type fixedValue;
value uniform 1;
}
outlet {
type inletOutlet;
value uniform 1;
phi phis;
inletValue uniform 0;
}
bound {
type symmetryPlane;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object Cvf;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 -1 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type calculated;
value uniform 0;
}
bound
{
type calculated;
value uniform 0;
}
outlet
{
type calculated;
value uniform 0;
}
bottom
{
type calculated;
value uniform 0;
}
top
{
type calculated;
value uniform 0;
}
}
// ************************************************************************* //

View file

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type calculated;
value uniform (0 0 0);
}
bound
{
type calculated;
value uniform (0 0 0);
}
outlet
{
type calculated;
value uniform (0 0 0);
}
bottom
{
type calculated;
value uniform (0 0 0);
}
top
{
type calculated;
value uniform (0.05 0 0);
}
}
// ************************************************************************* //

View file

@ -0,0 +1,36 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class areaVectorField;
location "0";
object Us;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0.05 0 0);
boundaryField
{
inlet {
type fixedValue;
value $internalField;
}
outlet {
type zeroGradient;
}
bound {
type symmetryPlane;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -4,5 +4,6 @@
application="surfactantFoam" application="surfactantFoam"
runApplication blockMesh
runApplication makeFaMesh runApplication makeFaMesh
runApplication $application runApplication $application

View file

@ -0,0 +1,40 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object faMeshDefinition;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
polyMeshPatches 1( top );
boundary
{
inlet {
type patch;
ownerPolyPatch top;
neighbourPolyPatch inlet;
}
outlet {
type patch;
ownerPolyPatch top;
neighbourPolyPatch outlet;
}
bound {
type symmetryPlane;
ownerPolyPatch top;
neighbourPolyPatch bound;
}
}
// ************************************************************************** //

View file

@ -0,0 +1,69 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.1;
vertices
(
(0 0 0)
(3 0 0)
(3 1 0)
(0 1 0)
(0 0 0.1)
(3 0 0.1)
(3 1 0.1)
(0 1 0.1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (60 20 1) simpleGrading (1 1 1)
);
edges
(
);
patches
(
patch inlet
(
(0 4 7 3)
)
wall bound
(
(3 7 6 2)
(1 5 4 0)
)
patch outlet
(
(2 6 5 1)
)
patch bottom
(
(0 3 2 1)
)
patch top
(
(4 5 6 7)
)
);
mergePatchPairs
(
);
// ************************************************************************* //

View file

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
5
(
inlet
{
type patch;
nFaces 20;
startFace 2320;
}
bound
{
type wall;
nFaces 120;
startFace 2340;
}
outlet
{
type patch;
nFaces 20;
startFace 2460;
}
bottom
{
type patch;
nFaces 1200;
startFace 2480;
}
top
{
type patch;
nFaces 1200;
startFace 3680;
}
)
// ************************************************************************* //

View file

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Ds Ds [ 0 2 -1 0 0 0 0 ] 0.00001;
// ************************************************************************* //

View file

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application surfactantFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 6;
deltaT 0.1;
writeControl runTime;
writeInterval 0.2;
purgeWrite 0;
writeFormat ascii;
writeCompression uncompressed;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
// ************************************************************************* //

View file

@ -0,0 +1,57 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object faSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
}
divSchemes
{
default none;
div(phis,Cs) Gauss linear;
}
laplacianSchemes
{
default none;
laplacian(Ds,Cs) Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
p;
}
// ************************************************************************* //

View file

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object faSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
Cs
{
solver PBiCG;
preconditioner DILU;
minIter 0;
maxIter 2000;
tolerance 1e-06;
relTol 0;
}
}
PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}
SIMPLE
{
nTimeCorrectors 6;
nNonOrthogonalCorrectors 1;
}
relaxationFactors
{
p 0.7;
U 0.7;
k 0.7;
epsilon 0.7;
R 0.7;
}
// ************************************************************************* //

View file

@ -0,0 +1,47 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
}
gradSchemes
{
}
divSchemes
{
}
laplacianSchemes
{
}
interpolationSchemes
{
}
snGradSchemes
{
}
fluxRequired
{
}
// ************************************************************************* //

View file

@ -0,0 +1,23 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
}
// ************************************************************************* //

View file

@ -0,0 +1,3 @@
surfactantFoam.C
EXE = $(FOAM_USER_APPBIN)/sphereSurfactantFoam

View file

@ -0,0 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/cfdTools/general/lnInclude
EXE_LIBS = \
-lfiniteArea \
-lfiniteVolume \
-llduSolvers

View file

@ -0,0 +1,78 @@
Info << "Reading field Cs" << endl;
areaScalarField Cs
(
IOobject
(
"Cs",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
aMesh
);
dimensioned<scalar> Cs0
(
"Cs0",
dimensionSet(1, -2, 0, 0, 0, 0, 0),
1.0
);
const areaVectorField& R = aMesh.areaCentres();
Cs = Cs0*(1.0 + R.component(vector::X)/mag(R));
dimensioned<scalar> Ds
(
"Ds",
dimensionSet(0, 2, -1, 0, 0, 0, 0),
1.0
);
areaVectorField Us
(
IOobject
(
"Us",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
aMesh,
dimensioned<vector>("Us", dimVelocity, vector::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()
);

View file

@ -0,0 +1,2 @@
// Create Finite Area mesh
faMesh aMesh(mesh);

View file

@ -0,0 +1,36 @@
// Create volume-to surface mapping object
volSurfaceMapping vsm(aMesh);
volScalarField Cvf
(
IOobject
(
"Cvf",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("0", dimless/dimLength, 0)
);
vsm.mapToVolume(Cs, Cvf.boundaryField());
Cvf.write();
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedVector("zero", dimVelocity, vector::zero)
);
vsm.mapToVolume(Us, U.boundaryField());
U.write();

View file

@ -0,0 +1,83 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2007 Z. Tukovic and H. Jasak
\\/ M anipulation |
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
finiteAreaFoam
Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "faCFD.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
# include "setRootCase.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 << "\nStarting time loop\n" << endl;
for (runTime++; !runTime.end(); runTime++)
{
Info << "Time = " << runTime.value() << endl;
faScalarMatrix CsEqn
(
fam::ddt(Cs)
+ fam::div(phis, Cs)
- fam::laplacian(Ds, Cs)
);
CsEqn.solve();
if (runTime.outputTime())
{
vsm.mapToVolume(Cs, Cvf.boundaryField());
runTime.write();
}
Info<< "Total mass of surfactant: "
<< sum(Cs.internalField()*aMesh.S()) << endl;
Info << "ExecutionTime = "
<< scalar(runTime.elapsedCpuTime())
<< " s\n" << endl << endl;
}
return(0);
}
// ************************************************************************* //

View file

@ -1,6 +1,6 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | | \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext | | \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de | | \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | | | \\/ M anipulation | |
@ -632,4 +632,5 @@ boundaryField
} }
} }
// ************************************************************************* // // ************************************************************************* //

View file

@ -1,6 +1,6 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | | \\ / F ield | OpenFOAM Extend Project: Open source CFD |
| \\ / O peration | Version: 1.6-ext | | \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de | | \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | | | \\/ M anipulation | |
@ -632,4 +632,5 @@ boundaryField
} }
} }
// ************************************************************************* // // ************************************************************************* //

View file

@ -0,0 +1,7 @@
#!/bin/sh
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanTimeDirectories
cleanFaMesh

View file

@ -0,0 +1,10 @@
#!/bin/sh
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
application="sphereSurfactantFoam"
wmake ../$application
runApplication makeFaMesh
runApplication $application