implement interfoam as a fluid solver in fsi package for...

49
Introduction FSI package Add interFluid Validation Conclusion Implement interFoam as a fluid solver in FSI package for the course CFD with OpenSource Software Minghao Li Marine and shipping department, Chalmers University of Technology, Gothenburg, Sweden 2016-12-05 Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 1 / 49

Upload: others

Post on 13-Oct-2019

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Implement interFoam as a fluid solver in FSI packagefor the course

CFD with OpenSource Software

Minghao Li

Marine and shipping department,Chalmers University of Technology,

Gothenburg, Sweden

2016-12-05

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 1 / 49

Page 2: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Fluid-Solid Interaction

Fluid-Solid Interaction

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 2 / 49

Page 3: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Fluid-Solid Interaction

Scope of this tutorial

General FSI package structure

Emphasize on fsiFoam solver and fluidSolidInteraction library

Implement interFoam as interFluid fluidSolver

Validation with tutorial case

Conclusion and future work

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 3 / 49

Page 4: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Download and compile

Download and compile

The FSI package is downloaded with command:

f40NR

run

wget https://openfoamwiki.net/images/d/d6/Fsi_40.tar.gz

tar -xzf Fsi_40.tar.gz

Then a folder named ”FluidSolidInteraction” will show up and thecompilation is done by

cd FluidSolidInteraction/src

./Allwclean

./Allwmake

Allwmake compiles all the solvers, utilities and fluidSolidInteraction library.

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 4 / 49

Page 5: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Download and compile

Main Structure

FluidSolidInteraction/src

contains all the source terms including fluidSolidInteraction library,solvers and utilities.

FluidSolidInteraction/run

consists of the whole tutorial cases for each solver for examplebeamInCrossFlow case for fsiFoam solver.

To view more details, one can use tree command to shown the directories.

tree -L 3 -d

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 5 / 49

Page 6: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

Existing solvers

FluidSolidInteraction/src/solvers

ampFsiFoam

fluidFoam # evoke fluid solver

fsiFoam # strong coupling fluid solid interaction solver

solidFoam # evoke solid solver

thermalSolidFoam

weakFsiFoam

The description of each solver can be found in correspond *.C file.

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 6 / 49

Page 7: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

fsiFoam directory

fsiFoam folder contains creatSolidMesh.H, fsiFoam.C and Make directorywhere files and options locates.

vi fsiFoam.C

headers

#include "fvCFD.H"

#include "dynamicFvMesh.H"

#include "fluidSolidInterface.H"

int main(int argc, char *argv[])

...

# include "createDynamicFvMesh.H"

# include "createSolidMesh.H"

fluidSolidInterface fsi(mesh, solidMesh);

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 7 / 49

Page 8: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

fsiFoam code implementation

The code is mainly implemented by recalling member functions of objectfsi and the problem solving precess code is listed below.

do

{

fsi.outerCorr()++;

fsi.updateDisplacement();

fsi.moveFluidMesh();

fsi.flow().evolve();

fsi.updateForce();

fsi.stress().evolve();

residualNorm =

fsi.updateResidual();

}

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 8 / 49

Page 9: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

fsiFoam interpretation

The procedure of solving fluid solid interaction

1 update soliddeformation

2 move deformedmesh to fluid side

3 evoke fluid solver

4 calculate pressureand viscous forces

5 evoke solid solver

6 iterate this cycleuntil convergence

information is transferredin the interface

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 9 / 49

Page 10: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

fsiFoam Make

Make/files specifies the name and location of fsiFoam solver.

vi Make/options

EXE_INC = -std=c++11 \

-I../../fluidSolidInteraction/lnInclude \

-I../../ThirdParty/eigen3 \

-I$(LIB_SRC)/finiteVolume/lnInclude \

...

EXE_LIBS = \

-lfiniteVolume \

-L$(FOAM_USER_LIBBIN) \

-lincompressibleTransportModels \

-lfluidSolidInteraction \

...

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 10 / 49

Page 11: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

fluidSolidInteraction library

fluidSolidInterface #interface information communication

fluidSolvers

consistentIcoFluidfiniteVolume #basic FV sources

fluidSolver #base class and fluidsolver selector

fvPatchFields #define patch field types

icoFluidpisoFluid #identical to pisoFoam

include

lnInclude

Make

solidSolvers

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 11 / 49

Page 12: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

fluidSolidInterface Class

This class defines all the functions for the fluid solid interface where allinformation communicates and exchanges.

fluidSolidInterface.H

Declaration#include "fluidSolver.H"

#include "solidSolver.H"

Member functions

fluidSolver& flow()

solidSolver& stress()

void initializeFields()

void updateForce()

void updateDisplacement()

void initializeFields()

scalar updateResidual()

const Switch& predictor()

label& outerCorr()

void moveFluidMesh()

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 12 / 49

Page 13: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

fluidSolidInterface Constructor 1/2

Foam::fluidSolidInterface::fluidSolidInterface

(

dynamicFvMesh& fMesh,

fvMesh& sMesh // arguments = fsi(mesh, solidMesh)

)

:

IOdictionary

(

IOobject

(

"fsiProperties", // dictionary name

fMesh.time().constant(),

fMesh,

IOobject::MUST_READ, // read properties for fsi setting

IOobject::NO_WRITE

)

),

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 13 / 49

Page 14: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

fluidSolidInterface Constructor 2/2

Initialize all the member datas through looking up ”fsiProperties”

fluidMesh_(fMesh),

flow_(fluidSolver::New(fluidMesh_)), // fluidSolver New selector

solidMesh_(sMesh),

stress_(solidSolver::New(solidMesh_)), // solidSolver New selector

couplingScheme_(lookup("couplingScheme")),

relaxationFactor_(readScalar(lookup("relaxationFactor"))),

aitkenRelaxationFactor_(relaxationFactor_),

outerCorrTolerance_(readScalar(lookup("outerCorrTolerance"))),

nOuterCorr_(readInt(lookup("nOuterCorr"))), // read fsiProperties

coupled_(lookup("coupled")),

predictor_(false),

rbfInterpolation_(false),

...

Focus on "flow_" and "stress_" then

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 14 / 49

Page 15: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

fluidSolver Class

fluidSolver folder has three files:

newFluidSolver.CDefinition of selector i.e. which fluid solver is seleted.

fluidSolver.CDefinition of constructor and functions.

fluidSolver.HVirtual base class for fluid solvers e.g. pisoFluidDeclaration of member data, constructor, selector and functions.

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 15 / 49

Page 16: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

fluidSolver selector

Foam::autoPtr<Foam::fluidSolver>Foam::fluidSolver::New(const fvMesh& mesh)

{

word fluidSolverTypeName;

{

IOdictionary fluidProperties

(

IOobject

(

"fluidProperties",

mesh.time().constant(),

mesh,

IOobject::MUST_READ,

IOobject::NO_WRITE

)

);// look up key word after "fluidSolver" in "fluidProperties"

fluidProperties.lookup("fluidSolver") >> fluidSolverTypeName;

}

}

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 16 / 49

Page 17: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

Select pisoFluid for instance

vi pisoFluid/pisoFluid.C

defineTypeNameAndDebug(pisoFluid, 0);

addToRunTimeSelectionTable(fluidSolver, pisoFluid, dictionary);

pisoFluid is defined as a key word in pisoFluid.C and this pisoFluid.C solvercan be utilized by specifying the pisoFluid key word after fluidSolversubsection under fluidProperties dictionary.

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 17 / 49

Page 18: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

fluidSolver constructor and functions

The constructor create the fluidProperties dictionary and read thecoefficient settings.

fluidSolver

(

const word& type,

const fvMesh& mesh

);

The member functions required by the sub-classes are defined in virtualfunctions and initialized to 0, for example

//- Patch pressure force (N/m2)

virtual tmp<scalarField> patchPressureForce

(

const label patchID

) const = 0;

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 18 / 49

Page 19: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

pisoFluid Class

Equivalent to pisoFoam solver with dynamic mesh.

pisoFluid.Hclass pisoFluid

:

public fluidSolver

pisoFluid is a sub-class of fluidSolver which means it inherits all theattributes from the base class. The above talked constructor andvirtual functions are of great importance.

pisoFluid.CDefinition of constructor and functions including pressure and viscousforce on patch and zone, and the essential virtual void evolve();function which is equivalent to pisoFoam.

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 19 / 49

Page 20: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

Connect pisoFluid to fsiFoam

The principle of how fsiFoam uses fsi.flow().evolve(); to evoke fluidSolvere.g. pisoFluid gets clear so far.

1 create an object fsi of fluidSolidInterface class

2 call function flow() and return member data flow_

3 flow_ is initialized by fluidSolver New selector

4 New selector choose pisoFluid by reading fluidProperties

5 pisoFluid evokes function evolve() to solve fluid

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 20 / 49

Page 21: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

pisoFluid VS pisoFoam

pisoFluid

pisoFluid.C

pisoFluid.H

pisoFoam

pisoFoam.C

createFields.H

Make

createFields.H corresponds to the constructor in pisoFluid.CpisoFoam.C corresponds to the evolve() member function in pisoFluid.C

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 21 / 49

Page 22: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

fluidSolidInteraction library

fluidSolidInterface #interface information communication

fluidSolvers

consistentIcoFluidfiniteVolume #basic FV sources

fluidSolver #base class and fluidsolver selector

fvPatchFields #define patch field types

icoFluidpisoFluid #identical to pisoFoam

include

lnInclude

Make

solidSolvers

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 22 / 49

Page 23: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Solver and library

Make/files

...

fluidSolvers/fluidSolver/fluidSolver.C

fluidSolvers/fluidSolver/newFluidSolver.C

fluidSolvers/icoFluid/icoFluid.C

fluidSolvers/pisoFluid/pisoFluid.C

fluidSolvers/consistentIcoFluid/consistentIcoFluid.C

solidSolvers/solidSolver/solidSolver.C

solidSolvers/solidSolver/newSolidSolver.C

...

LIB = $(FOAM_USER_LIBBIN)/libfluidSolidInteraction

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 23 / 49

Page 24: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

fluidSolidInteraction library

fluidSolidInterface

fluidSolvers

consistentIcoFluid # sub-class of icoFluid

finiteVolumefluidSolverfvPatchFieldsicoFluid #equivalent to icoDymFoam

pisoFluid #identical to pisoFoam

include

lnInclude

Make

solidSolvers

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 24 / 49

Page 25: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Introduce and compile

Motivation and process

What if solve for 2 incompressible, isothermal immiscible fluids ?

How to process:

1 introduce interFluid from pisoFluid

2 add interFluid into compile file

3 modify interFluid referring to interDymFoam

headers and Make directoryconstructormember functions

4 recompile interFluid

5 adjust fsiFoam

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 25 / 49

Page 26: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Introduce and compile

Introduce interFluid

Set pisoFluid as a starting point as it takes turbulence into account.

cd FluidSolidInteraction/src/fluidSolidInteraction

cd fluidSolvers

cp -r pisoFluid interFluid

cd interFluid

mv pisoFluid.C interFluid.C

mv pisoFluid.H interFluid.H

sed -i s/pisoFluid/interFluid/g interFluid.*

cd ../..

echo "fluidSolvers/interFluid/interFluid.C" >> Make/files

wmake libso

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 26 / 49

Page 27: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Introduce and compile

Introduce interFluid

Double check in a tutorial case, set ”dummy” after ”fluidSolver”subdictionary in ”fluidProperties” dictionary.

cd FluidSolidInteraction/run/fsiFoam/beamInCrossFlow

sed -i s/tcsh/sh/g *Links

cd fluid

sed -i s/consistentIcoFluid/dummy/g

\constant/fluidProperties

./Allrun

>> FATAL ERROR: prompt

valid fluidSolver types are:

4

(consistentIcoFluid

interFLuid

pisoFluid

icoFluid

)

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 27 / 49

Page 28: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Introduce and compile

Headers

Blue headers move .H while black headers move to .C

Headers

interDymFoam.C interFluid.C interFluid.H

fvCFD.H interFluid.H fluidSolver.HdynamicFvMesh.H volFields.H volFields.H

MULES.H fvm.H surfaceFields.HsubCycle.H fvc.H turbulenceModel.H

interfaceProperties.H fvMatrices.HtwoPhaseMixture.H findRefCell.HturbulenceModel.H adjustPhi.H

pimpleControl.H fluidSolidInterface.H...

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 28 / 49

Page 29: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Introduce and compile

Make/options

Compare Make/options between fluidSolidInteraction library andinterDymFoam solver

cd fluidSolidInteraction

kompare Make/options $FOAM_SOLVERS/multiphase/

\ interDyMFoam/Make/options

Add interfaceProperties lninclude path and link to its library.

-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \

-linterfaceProperties

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 29 / 49

Page 30: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Constructor and functions

Constructor

Identical to createFields.H of interDymFoam with below differences:

1 Each member data takes an underscore at name end

2 member data is declared in .H but initialized in .C

3 runTime.timeName is changed to runTime().timeName

4 no Info statement in the constructor

5 tiny symbol changes

The main fields includes U_ phi_ rho_ alpha1_ rhoPhi_ g_ etc. Makesure these fields have the same sequence of declaration and initialization.

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 30 / 49

Page 31: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Constructor and functions

Member functions

For the pressure and viscous member functions, one tiny change isrho_because it is shifted from dimensionedScalarF ield tovolScalarF ield.

//- Patch viscous force (N/m2)

tvF() =

rho_ // orig. rho_.value()

*(

mesh().boundary()[patchID].nf()

& turbulence_->devReff()().boundaryField()[patchID]

);

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 31 / 49

Page 32: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Constructor and functions

evolve() function 1/5

In principle, all the codes in interDymFoam.C including the inclusionsshould be extracted and implemented to interFluid evolve() function.

interDymFoam.C inclusions (limited version)

KEEP OMITcorrectPhi.H createFields.H

alphaEqnSubCycle.H createControlsalphaEqn.H readControls

pEqn.H setDeltaT.HUEqn.H setInitialDeltaT.H

CourantNo.H meshCourantNo.HvolContinuity.H

use command ”locate XXX.H” to find the path.

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 32 / 49

Page 33: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Constructor and functions

evolve() function 2/5

Unfold the inclusions for example alphaEqnSubCycle.H.

interDymFoam.C

twoPhaseProperties.correct();

# include "alphaEqnSubCycle.H"

# include "UEqn.H"

//*------------------shift--------------------*\\

interFluid.C

twoPhaseProperties_.correct();

label nAlphaCorr

(

readLabel(pimple.dict().lookup("nAlphaCorr"))

);

...// the rest code in this inclusion

# include "UEqn.H" // same process as above

//- Note: there could be inclusions inside inclusions.

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 33 / 49

Page 34: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Constructor and functions

evolve() function 3/5

Inconvenience caused by invalid ”pimple” object construction.

pimpleControl.H

//- Construct from mesh and the name of control sub-dictionary

pimpleControl(fvMesh& mesh, const word& dictName="PIMPLE");

interDymFoam.C

pimpleControl pimple(mesh); // mesh is an argument of constructor

interFluid.C

const fvMesh& mesh = fluidSolver::mesh(); // mesh is "const" type

pimpleControl pimple(mesh); // invalid with const mesh

No functions of pimple can be recalled e.g. pimple.dict().

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 34 / 49

Page 35: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Constructor and functions

evolve() function 4/5

Rewrite code to function identically with pimple functions.

alphaEquSubCycle.H

label nAlphaCorr

(

readLabel(pimple.dict().lookup("nAlphaCorr"))

);

//*--------------------shift-----------------------*\\

dictionary pimple = mesh.solutionDict().subDict("PIMPLE");

label nAlphaCorr

(

readLabel(pimple.lookup("nAlphaCorr"))

);

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 35 / 49

Page 36: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Constructor and functions

evolve() function 5/5

Rewrite code to function identically with pimple functions. Find theoriginal code in pimpleControl.C or pimpleControlI.H (inline).

interFluid.C evolve()

while(pimple.loop())

while (pimple_.correct())

//*------------------shift--------------------*\\

for (int oCorr = 0; oCorr < nOuterCorr; oCorr++)

for (int corr=0; corr<nCorr; corr++)

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 36 / 49

Page 37: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Constructor and functions

interFluid compilation

The compilation is done under fluidSolidInteraction library and it isrecommended to modify and compile simultaneously and read carefully thelog file.

cd fluidSolidInteraction/

wmake libso >& log

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 37 / 49

Page 38: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Constructor and functions

myfsiFoam compilation

Link interfaceProperties.so to myfsiFoam solver.

cd FluidSolidInteraction/src/solvers

cp -r fsiFoam myfsiFoam

cd myfsiFoam

mv fsiFoam.C myfsiFoam.C

sed -i s/fsiFoam/myfsiFoam/g Make/files

echo "-linterfaceProperties" >> Make/options # check by vim again and be careful with the syntax

wmake

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 38 / 49

Page 39: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Case setup

beamInCrossFlow

Before running the beamInCrossFlow case, take a look at the *Link filesand Allrun script.

f40NR

run # change to the user run directory

cd FluidSolidInteraction/run/fsiFoam/beamInCrossFlow

sed -i s/tcsh/sh/g *Links

cd fluid

./Allrun

paraFoam

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 39 / 49

Page 40: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Case setup

beamInCrossFlow

icoFluid

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 40 / 49

Page 41: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Case setup

interFluidBeamInCrossFlow

Copy from beamInCrossFlow, change to interFluid fluid model and makere-setting to 0, constant, system dictionaryies referring to interDymFoamdamBreakWithoutObstacle tutorial case.

cd FluidSolidInteraction/run/fsiFoam

cp -r beamInCrossFlow/ interFluidBeamInCrossFlow

cd fluid

sed -i s/consistentIcoFluid/interFluid/g

\ constant/fluidProperties

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 41 / 49

Page 42: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Case setup

interFluidBeamInCrossFlow - 0 directory

1 copy VolScalarField alpha1 from damBreakWithoutObstable/0 andadjust the boundary fields.

2 rename p to pd to correspond to system settings

3 treat outlet boundary as a wallpd outlet changes to zeroGradient;U outlet changes to fixValue;

4 adjust top boundary setting

pd top changes to totalPressure;U top changes to pressureInletOutletVelocity;

5 format the dimension unit in pd to SI

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 42 / 49

Page 43: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Case setup

interFluidBeamInCrossFlow - constant directory

copy transportProperties, turbulenceProperties, RASProperties,gravity g from damBreakWithoutObstable/constant

cd interFluidBeamInCrossFlow/fluid

cp $FOAM_TUTORIALS/multiphase/interDymFoam/ras/

\ damBreakWithoutObstable/constant/transportProperties

\ constant/

cp ... # the same to RASProperties and g

cp ... # the same to turbulenceProperties

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 43 / 49

Page 44: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Case setup

interFluidBeamInCrossFlow - system directory

1 copy setFieldsDict from damBreakWithoutObstable/system

2 set fvSheme referring to damBreak... case

3 set fvSolution the same way as fvSheme

4 In controDict reset deltaT and comment function

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 44 / 49

Page 45: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Case setup

interFluidBeamInCrossFlow - Allrun

Add setFields before running fsiFoam solver.

application=‘getApplication‘

...

cd fluid

runApplication setFileds // added

runApplication $application

cd fluid

sed -i s/fsiFoam/myfsiFoam/g system/controlDict

./Allrun

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 45 / 49

Page 46: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Case setup

interFluidBeamInCrossFlow

interFluid larger defomation (E=1.4e6)Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 46 / 49

Page 47: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Case setup

interFluidBeamInCrossFlow

interFluid smaller defomation (E=1.4e9)Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 47 / 49

Page 48: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Conclusion and improvement

Conclusion and future work

Conclusion

1 Upgrade OpenFOAM structures.

2 An insight of FSI problems and FSI package.

3 A good example of interFluid implementation.

Future work

1 Try const_cast command for pimple constructor.

2 Enable adjustTimeSteps in the code,

3 Fixed large deformation crash problem.

4 Test different boundary condition for both fluid and solid.

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 48 / 49

Page 49: Implement interFoam as a fluid solver in FSI package for ...hani/kurser/OS_CFD_2016/MinghaoLi/Minghao_slides.pdf · for the course CFD with OpenSource Software Minghao Li Marine and

Introduction FSI package Add interFluid Validation Conclusion

Conclusion and improvement

Question?

Thank you for your attention.

Minghao Li Implement interFoam as a fluid solver in the FSI package 2016-12-05 49 / 49