Commit 771410e5 authored by sergio's avatar sergio Committed by Andrew Heather
Browse files

ENH: Adding tutorial for overset and multi motion solvers

parent d96ad1cd
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
##. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
(cd background && ./Allclean)
(cd floatingBody && ./Allclean)
#------------------------------------------------------------------------------
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
./Allrun.pre
(cd background && runApplication $(getApplication))
#------------------------------------------------------------------------------
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
# mesh floating body
(cd floatingBody && ./Allrun.pre)
# Add background mesh
(cd background && ./Allrun.pre)
#------------------------------------------------------------------------------
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
oversetPatch
{
type overset;
}
overset
{
patchType overset;
type zeroGradient;
}
stationaryWalls
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
sidePatch
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
atmosphere
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
floatingObject
{
type movingWallVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object alpha.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
oversetPatch
{
type overset;
}
sides
{
type overset;
}
stationaryWalls
{
type variableHeightFlowRate;
lowerBound 0;
upperBound 1;
value uniform 0;
}
atmosphere
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
floatingObject
{
// type variableHeightFlowRate;
// lowerBound 0;
// upperBound 1;
// value uniform 0;
type zeroGradient;
}
sidePatch
{
type variableHeightFlowRate;
lowerBound 0;
upperBound 1;
value uniform 0;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 0.1;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
stationaryWalls
{
type inletOutlet;
inletValue uniform 0.1;
value uniform 0.1;
}
"(atmosphere|sidePatch)"
{
type inletOutlet;
inletValue uniform 0.1;
value uniform 0.1;
}
floatingObject
{
type epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0.1;
}
overset
{
type overset;
}
oversetPatch
{
type overset;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0.01;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
stationaryWalls
{
type inletOutlet;
inletValue uniform 0.01;
value uniform 0.01;
}
"(atmosphere|sidePatch)"
{
type inletOutlet;
inletValue uniform 0.01;
value uniform 0.01;
}
floatingObject
{
type kqRWallFunction;
value uniform 0.01;
}
overset
{
type overset;
}
oversetPatch
{
type overset;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
stationaryWalls
{
type calculated;
value uniform 0;
}
"(atmosphere|sidePatch)"
{
type calculated;
value uniform 0;
}
floatingObject
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
overset
{
patchType overset;
type zeroGradient;
}
oversetPatch
{
type overset;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
oversetPatch
{
type overset;
}
"(stationaryWalls|sidePatch)"
{
type fixedFluxPressure;
}
atmosphere
{
type totalPressure;
p0 uniform 0;
U U;
phi phi;
rho rho;
psi none;
gamma 1;
value uniform 0;
}
floatingObject
{
type fixedFluxPressure;
}
overset
{
patchType overset;
type overset;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class pointVectorField;
object pointDisplacement;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 0 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
stationaryWalls
{
type calculated;
value uniform (0 0 0);
}
"(atmosphere|sidePatch)"
{
type calculated;
value uniform (0 0 0);
}
floatingObject
{
type calculated;
value uniform (0 0 0);
}
oversetPatch
{
patchType overset;
type zeroGradient;
}
sides
{
patchType overset;
type zeroGradient;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object zoneID;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
"(stationaryWalls|sidePatch)"
{
type zeroGradient;
}
atmosphere
{
type zeroGradient;
}
floatingObject
{
type zeroGradient;
}
oversetPatch
{
patchType overset;
type zeroGradient;
}
sides
{
patchType overset;
type zeroGradient;
}
}
// ************************************************************************* //
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
cleanCase0
#------------------------------------------------------------------------------
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
# Create background mesh
runApplication blockMesh
# Add the cylinder mesh
runApplication mergeMeshes . ../floatingBody -overwrite
# Select cellSets for the different zones
runApplication topoSet
restore0Dir
# Use cellSets to write zoneID
runApplication setFields
#------------------------------------------------------------------------------
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1812 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh dynamicOversetFvMesh;
solvers
{
VF
{
motionSolverLibs ("libfvMotionSolvers.so" );
motionSolver solidBody;
solidBodyMotionFunction drivenLinearMotion;
cellSet c0;
CofGvelocity CofG;
normal (0 0 1);
}
cube
{
motionSolverLibs ("libsixDoFRigidBodyMotion.so");
motionSolver sixDoFRigidBodyMotion;
cellSet c1;
patches (floatingObject);
innerDistance 1000.0;
outerDistance 1001.0;
centreOfMass (0.5 0.5 0.4);
CofGvelocity CofG;
// Cuboid dimensions
Lx 0.24;
Ly 0.24;
Lz 0.4;
// Density of the solid
rhoSolid 500;
// Cuboid mass
mass #calc "$rhoSolid*$Lx*$Ly*$Lz";
// Cuboid moment of inertia about the centre of mass
momentOfInertia #codeStream
{
codeInclude
#{
#include "diagTensor.H"
#};
code
#{
scalar sqrLx = sqr($Lx);
scalar sqrLy = sqr($Ly);
scalar sqrLz = sqr($Lz);
os <<
$mass
*diagTensor(sqrLy + sqrLz, sqrLx + sqrLz, sqrLx + sqrLy)/12.0;
#};
};
report on;
accelerationRelaxation 0.6;
accelerationDamping 1;
solver
{
type Newmark;
}
constraints