0% found this document useful (0 votes)
185 views24 pages

Lecture 05

This document provides an overview and introduction to finite volume methods using OpenFOAM. It discusses kinetic energy dissipation in fluid flows as an example problem. It also provides a high-level overview of the "FOAM" framework in OpenFOAM for field operations and manipulation. Additionally, it examines code snippets from an explicit OpenFOAM solver to illustrate the finite volume discretization and time integration steps.

Uploaded by

ijaz fazil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
185 views24 pages

Lecture 05

This document provides an overview and introduction to finite volume methods using OpenFOAM. It discusses kinetic energy dissipation in fluid flows as an example problem. It also provides a high-level overview of the "FOAM" framework in OpenFOAM for field operations and manipulation. Additionally, it examines code snippets from an explicit OpenFOAM solver to illustrate the finite volume discretization and time integration steps.

Uploaded by

ijaz fazil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Lecture 5: Finite Volume Methods from OpenFOAM

Viewpoint: Part 1

V.Vuorinen
Aalto University School of Engineering
CFD Course, Spring 2017

January 30th 2017, Otaniemi


[email protected]
Lecture 5: Finite Volume Methods from OpenFOAM
Viewpoint 1/2

V.Vuorinen
Aalto University School of Engineering
CFD Course, Spring 2017

January 30th 2017, Otaniemi


[email protected]
Objective to provide overview of:
Kinetic energy and dissipation periodic flow as an example
FOAM Field Operation And Manipulation
Line by line look into an explicit OpenFOAM code
What happens to the kinetic energy of the flow if you
stop stirring/pouring milk?

dEtot
kin
= tot <0
dt

1 2
E =V
tot
kin u dV
2

tot =V | u |2 dV

Note: equation is derived by uNS


and volume integrating because
Work=Fds=Fu dt
What happens to the kinetic energy of the flow if you
stop stirring/pouring milk?

dEtot
kin
= tot <0
dt

1 2
E =V
tot
kin u dV
2

tot =V | u |2 dV

/*CodesnapshotfromtheutilitykinEcalculatingtotal
kineticenergy*/

scalarmeshVol=gSum(mesh.V());

scalarkinE=
0.5*(fvc::domainIntegrate(magSqr(U)).value())/meshVol;
Kinetic energy dissipates into heat as seen in this 2d
quasi-turbulent case (periodic boundary conditions)
t=10s t=30s

t=90s
Kinetic energy dissipates into heat as seen in this 2d
quasi-turbulent case (periodic boundary conditions)
t=10s t=30s

t=90s 2nd order FVM

Spectral method
HW2: You monitored/controlled the kinetic energy decay by numerics (numerical
diffusion due to diffusive numerical scheme)

Numerics:

dEtot
= tot
kin tot
visc num
dt

Note: the equation is derived


by: u(NS + num ) + volume
integrating

num=dispersive + diffusive
Overview of OpenFOAM CFD Code Structure (Source:
OpenFOAM User's Manual)
Overview of OpenFOAM CFD Code Structure (Source:
OpenFOAM User's Manual)

ers ion
n v
your ow n
m and le: e.g. entsOw
o m p d
the c Exam oamStu
u t ility: ico
F
a mple y
Ex icit
t
vor and
c omm
Foam
p le: the er ico
Exam neMesh e solv
i le: th
ref m p
Exa
Essentials of OpenFOAM top-level solverrk4projectionFoam
Vuorinen et al. Computers & Fluids (2014)
Vuorinen et al. Advances in Engineering Software (2015)
Essentials of OpenFOAM top-level solverrk4projectionFoam
Vuorinen et al. Computers & Fluids (2014)
Vuorinen et al. Advances in Engineering Software (2015)

4th order explicit Runge-Kutta time integration

2nd order explicit finite volumes space


Projection method (Hirsch) for pressure correction
Essentials of OpenFOAM top-level solverrk4projectionFoam
Vuorinen et al. Computers & Fluids (2014)
Vuorinen et al. Advances in Engineering Software (2015)
Essentials of OpenFOAM top-level solverrk4projectionFoam
Filename:rk4projectionFoam.C Vuorinen et al. Computers & Fluids (2014)
Vuorinen et al. Advances in Engineering Software (2015)
E.g. pimpleFoamoricoFoam
are top-level solvers

A top-level solver (e.g.


rk4projectionFoam) would
mean: storing
rk4projectionFoam.C+
some other files in folder
/rk4projectionFoam/
and compiling the solver into
executable with wmake

Part of top-level solver code


can be appended
to header files (.H extension)

Important: configure the /Make/


folder accordingly

Filename:PressureCorrection.C Filename:CreatePoissonMatrix.C
Essentials of OpenFOAM top-level solverrk4projectionFoam
Vuorinen et al. Computers & Fluids (2014)
Vuorinen et al. Advances in Engineering Software (2015)

phi=fvc::interpolate(U)&mesh.Sf();
dU=dt*(fvc::laplacian(nu,U)fvc::div(phi,U));

phi=fvc::interpolate(U)&mesh.Sf();
dU=dt*(fvc::laplacian(nu,U)fvc::div(phi,U));
Vuorinen et al. Computers & Fluids (2014)

FOAM OpenFOAM provides extremely handy data types for


storing data
Vuorinen et al. Computers & Fluids (2014)

FOAM OpenFOAM provides extremely handy data types for


storing data Snapshots from CreateFields.Hshowing how
fields p/U can be created

volScalarFieldp volVectorFieldU
( (
IOobject IOobject
( ("U",
"p", runTime.timeName(),
runTime.timeName(), mesh,
mesh, IOobject::MUST_READ,
IOobject::MUST_READ, IOobject::AUTO_WRITE
IOobject::NO_WRITE ),
), mesh
p );
);
Vuorinen et al. Computers & Fluids (2014)

FOAM Some possible examples of field operation and


manipulation (field algebra)

P=rho*R*T;//idealgaslawatcellcenters

P=correctBoundaryConditions();

U=U+dU;//onlyupdatecellcenters

U.correctBoundaryConditions();//readBCfrom/0/U

U==U+dU;//alsocorrectBC's

P.boundaryField()=
rho.boundaryField()*R.boundaryField()*T.boundaryField();

T=fvc::grad(U);//createavolTensorField

The syntax above works directly in parallel the strength of FOAM


Vuorinen et al. Computers & Fluids (2014)

Let us interpret the following lines from math viewpoint


= control volume centroid
= control volume face center

dUis a volVectorFieldvol because it


is defined at cell volume centers similar to U

dU=dt*(fvc::laplacian(nu,U)fvc::div(phi,U));

phi is a surfaceScalarFieldsurfacebecause it
is defined at cell surfaces
phi=fvc::interpolate(U)&mesh.Sf();
About interpolation and flux limiting

fB
This interpolation This interpolation
can be carried out is very commonly fC
in various ways: carried out by:
linear linear f A
GammaV fC
limitedLinearV
vanLeer FLUX LIMITERS
FLUX LIMITING is useful interpolation
technique close to high oscillating parts: how would you
numerically compute flux/derivative around point B?
BENEFIT: more stable and robust simulation!
Vuorinen et al. Computers & Fluids (2014)

Let us interpret the following lines from math viewpoint


= control volume centroid
= control volume face center

dUis a volVectorFieldvol because it


is defined at cell volume centers similar to U

dU=dt*(fvc::laplacian(nu,U)fvc::div(phi,U));

phi is a surfaceScalarFieldsurfacebecause it
is defined at cell surfaces Outer normal vectors multiplied
by surface area of face in the mesh
phi=fvc::interpolate(U)&mesh.Sf();
dot product
Motivation for HW 3: Fluid solid interfaces (boundary layers)
are crucial in heat transfer, flow friction, turbulence
production etc
s Source for pictures from instructor resources: Incropera, de Witt,
Heat and Mass Transfer
Cf = Friction coefficient
2
U /2
(local)

u
Dynamic
viscosity
=
s =
y( ) y=0
Surface
shear stress

''
q s =h(T s T ) Newton's
cooling law

T
''
q s =k T ( ) y y=0
Fourier's
law

kT Fluid thermal conductivity


= T
cp
Examples on LES/DNS simulations of flows with boundary layers

DNS of turbulent pipe flow at Vuorinen et al. (2015)


friction Reynolds number 360

https://www.youtube.com/watch?v=HDY-szDEH9s
Thank you for your attention!

You might also like