19
H ˚ akan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 1 Assignment1 C ASE 1: CAVITY Generate the mesh by typing blockMesh Run the cavity case by typing icoFoam >& log & in the case folder Start post-processing by typing paraFoam in the case-folder Apply to load the default items and set up the visualisation properties Here, I used surface+edges, switched to the last timestep and changed the colour- ing with red representing the maximum

Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

  • Upload
    others

  • View
    29

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 1

Assignment1

CASE1: CAVITY

• Generate the mesh by typing blockMesh

• Run the cavity case by typing

icoFoam >& log & in the case folder

• Start post-processing by typing paraFoamin the case-folder

• Apply to load the default items and set up

the visualisation properties

• Here, I used surface+edges, switched to

the last timestep and changed the colour-

ing with red representing the maximum

Page 2: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 2

Assignment1

Martin Gramlich

CASE2: CAVITYFINE

• Copy the folder cavity to cavityFine

• Adapt the mesh resolution and generate

the mesh by typing blockMesh

• Adapt the following settings in the

controlDict (startTime: 0.5; endTime:0.7; deltaT: 0.0025; writeControl: run-

Time; writeInterval: 0.1;) and run the case

by typing icoFoam >& log& in the casefolder

• Start post-processing by typing paraFoamin the case-folder

Page 3: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 3

Assignment1

Martin Gramlich

CASE3: CAVITYGRADE

• Copy the folder cavityGrade from the

tutorials-folder of OpenFOAM

• Check the grade of the mesh in the

blockMeshDict and run blockMesh af-terwards

• Adapt the settings in the controlDict(startTime: 0.7; endTime: 0.8; deltaT:

0.0025; writeControl: timeStep; writeIn-

terval: 40;) to get a courant number less

then 1 and run the cavity case by typing

icoFoam in the case folder

• Start post-processing by typing paraFoamin the case-folder

Page 4: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 4

Assignment1

Martin Gramlich

CASE4 - A): CAVITYHIGHRE

CASE: CAVITY CASE: CAVITYHIGHRE

Page 5: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 5

Assignment1

Martin Gramlich

CASE4 - B): CAVITYHIGHRE

• Copy the folder cavity to cavityHighRe

• Decrease nu by factor 100 in the file transportProperties to increase Re bythe same factor

• Adapt the settings in the controlDict (startTime: latestTime; endTime: 8; write-

Control: runTime; writeInterval: 1;) and run the cavity case by typing icoFoamin the case folder

• Check in the log file if convergence is achieved for p and U

• Start post-processing by typing paraFoam in the case-folder

Page 6: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 6

Assignment1

Martin Gramlich

CASE5 - A): CAVITYRAS

CASE: CAVITY CASE: CAVITYRAS

Page 7: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 7

Assignment1

Martin Gramlich

CASE5 - B): CAVITYRAS

• Copy the folder cavity from $FOAM_TUTORIALS/incompressible/pisoFoam/to $FOAM_RUN/cavityRAS/

• Generate the mesh running blockMesh

• Check the settings in the k-file, epsilon-file, transportProperties-file,controlDict and the RASProperties-file

• Adapt the settings in the controlDict (startTime: latestTime; endTime: 20; deltaT:

0.02; writeControl: runTime; writeInterval: 2;) and run the cavityRAS case by

typing pisoFoam in the case folder

• Start post-processing by typing paraFoam in the case-folder

Page 8: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 8

Assignment1

Martin Gramlich

CASE6 - A): CAVITYCLIPPED

TIMESTEP: 0.5 TIMESTEP: 0.6

Page 9: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 9

Assignment1

Martin Gramlich

CASE6 - B): CAVITYCLIPPED

• Copy the folder cavityClipped from $FOAM_TUTORIALS/incompressible/icoFoam/to $FOAM_RUN/

• Generate the mesh running blockMesh

• Copy the folder 0/ to 0.5/

• Check the patches for the boundary values

• Run mapFields ../cavity/ in the cavityClipped-folder and change theboundary values for the fixedWalls in the U-field to uniform (0 0 0);

• Start post-processing by typing paraFoam in the case-folder

• To visualize the Outline of cavityClipped, load the needed patches and add them

to the ”Extract Blocks”-filter

Page 10: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 10

Assignment1

Martin Gramlich

CASE7 - A): DAMBREAK

TIMESTEP: 0.5 TIMESTEP: 0.6

Page 11: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 11

Assignment1

Martin Gramlich

CASE7 - B): DAMBREAK

• Copy the folder damBreak from $FOAM_TUTORIALS/multiphase/interFoam/laminar/to $FOAM_RUN/

• Generate the mesh running blockMesh

• Copy 0/alpha1.org to alpha1 and excute setFields, to set the non-uniform,initial conditions for the phase fraction

• Run the simulation by typing interFoam >& log & in the case-folder

• Start post-processing by typing paraFoam in the case-folder

Page 12: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 12

Assignment1

Martin Gramlich

CASE8 - A): DAMBREAKFINE

TIMESTEP: 0.5 TIMESTEP: 0.6

Page 13: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 13

Assignment1

Martin Gramlich

CASE8 - B): DAMBREAKFINE

• Create the directory damBreakFine in $FOAM_RUN

• Copy the folders 0/, constant/ and system/ from $FOAM_RUN/damBreak/to $FOAM_RUN/damBreakFine/

• Adapt the mesh by changing the following values in the blockMeshDicthex (0 1 5 4 12 13 17 16) (46 10 1) simpleGrading (1 1 1)

hex (2 3 7 6 14 15 19 18) (40 10 1) simpleGrading (1 1 1)

hex (4 5 9 8 16 17 21 20) (46 76 1) simpleGrading (1 2 1)

hex (5 6 10 9 17 18 22 21) (4 76 1) simpleGrading (1 2 1)

hex (6 7 11 10 18 19 23 22) (40 76 1) simpleGrading (1 2 1)

• Generate the mesh running blockMesh

• Copy 0/alpha1.org to alpha1 and excute setFields, to set the non-uniform,initial conditions for the phase fraction

• To run the simulation using parallel calculation: Decompose the domain by typ-

ing decomposePar in the case+folder

Page 14: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 14

Assignment1

Martin Gramlich

CASE8 - C): DAMBREAKFINE

• Run the simulation by typing mpirun -np 4 interFoam -parallel >& log &in the case-folder

• Reconstruct the seperated results by typing reconstructPar in the case-folder

• Start post-processing by typing paraFoam in the case-folder

Page 15: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 15

Assignment1

Martin Gramlich

CASE9 - A): PITZDAILY

ITERATION: 50 ITERATION: 1000

Page 16: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 16

Assignment1

Martin Gramlich

CASE9 - B): PITZDAILY

• Copy the folder pitzDaily from $FOAM_TUTORIALS/incompressible/simpleFoam/to $FOAM_RUN/

• Generate the mesh running blockMesh

• Start the simulation by typing simpleFoam >& log & in the case-folder

• Start post-processing by typing paraFoam in the case-folder

Page 17: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 17

Assignment1

Martin Gramlich

FUNCTIONOBJECT1- A): MASSFLOW

• The massFlow-functionObject calculates the flux through a patch selected by the

user

• It works in OpenFOAM-1.6ext, and should also work in OpenFOAM-1.5dev

• To use the massFlow-functionObject, add the following lines to the controlDict-file in the system-folder

• function{massFlow{type patchMassFlow;functionObjectLibs ("libsimpleFunctionObjects.so");verbose true;patches (inlet outlet);factor 1;}};

Page 18: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 18

Assignment1

Martin Gramlich

FUNCTIONOBJECT1 - B): MASSFLOW

• In the code-lines, the following settings can be applied:

"type" defines the type of massFlow that should be calculated

"functionObjectLibs" loads the necessary library for the functionObject"verbose" defines, how the results should be written out

"patches" defines the patches, where the massFlow should be calculated"factor" defines the factor, the result should be multiplied with

• Before the massFlow-functionObject can be applied, the library ”libsimpleFunc-

tionObjects.so” must be available in the libraries-folder of OpenFOAM

• If that file is not installed yet, create the folder $WM_PROJECT_USER_DIR/libraries/and checkout the simpleFunctionObjects-libraries by typing the following line in

that folder svn checkout https://openfoam-extend.svn.sourceforge.net/ \svnroot/openfoam-extend/trunk/Breeder_1.6/libraries/ \simpleFunctionObjects

• For the OpenFOAM-Version 1.5dev change "/Breeder_1.6/" to "/Breeder_1.5/"

Page 19: Assignment1 - Thermohani/kurser/OS_CFD_2011/assignment1/...Assignment1 Martin Gramlich FUNCTIONOBJECT1-A): MASSFLOW • The massFlow-functionObject calculates the flux through a patch

Hakan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 19

Assignment1

Martin Gramlich

FUNCTIONOBJECT1 - C): MASSFLOW

• After checking out the simpleFunctionObjects, go into that folder and type wmake libsoto create the simpleFunctionObjects-libraries

• The file ”libsimpleFuntionObjects.so” should be now available in the libraries-

folder of the OpenFOAM-installation

• Once the necessary library-file is available, the solver can be started by typing

simpleFoam >& log & in the case-folder

• The solver will then create a directory patchMassFlows_massFlow/0/ in thecase directory

• In this directory the massflow-field will be stored in the file massFlow

• The data-field can be viewed by opening the with an text-editor, i.e. the vi editor