Commit 57304aea authored by Kutalmis Bercin's avatar Kutalmis Bercin Committed by Sergio Ferraris
Browse files

TUT: multiphase: replace boatAndPropeller with rigidBodyHull

parent 7d425011
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: 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"
"overset.*"
{
type overset;
value uniform 1;
}
hullWall
{
type epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0.1;
}
propellerWall
{
type epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0.1;
}
rudderWall
{
type epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0.1;
}
atmosphere
{
type inletOutlet;
inletValue uniform 0.1;
value uniform 0.1;
}
defaultFaces
{
type epsilonWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0.1;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: 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"
"overset.*"
{
type overset;
value uniform 1;
}
hullWall
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
propellerWall
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
rudderWall
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
atmosphere
{
type calculated;
value uniform 0;
}
defaultFaces
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;
}
}
// ************************************************************************* //
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
runApplication blockMesh
#runApplication -s 1 topoSet -dict system/topoSetDictRefine
#runApplication -s 1 refineMesh -overwrite -dict system/refineMeshDict
runApplication -s 1 topoSet -dict system/topoSetDictRefine
runApplication -s 1 refineMesh -overwrite -dict system/refineMeshDict.2
runApplication -s 2 topoSet -dict system/topoSetDictRefine
runApplication -s 2 refineMesh -overwrite -dict system/refineMeshDict.2
runApplication -s 7 topoSet -dict system/topoSetDictRefine.3
runApplication -s 7 refineMesh -overwrite -dict system/refineMeshDict.2
runApplication -s 8 topoSet -dict system/topoSetDictRefine.4
runApplication -s 8 refineMesh -overwrite -dict system/refineMeshDict.2
# Select cellSets
runApplication -s hull topoSet -dict system/topoSetDictHull
runApplication -s hull subsetMesh keepBox -patch hullWall -overwrite
# Select cellSets
runApplication -s propeller topoSet -dict system/topoSetDictPropeller
runApplication -s propeller subsetMesh keepBox -patch propellerWall -overwrite
# Select cellSets
runApplication -s rudder topoSet -dict system/topoSetDictRudder
runApplication -s rudder subsetMesh keepBox -patch rudderWall -overwrite
restore0Dir
# Use cellSets to write zoneID
runApplication -s 1 setFields -dict system/setFieldsDict
runApplication -s 2 setFields -dict system/setFieldsDictWaterLevel
touch boatAndPropeller.foam
#------------------------------------------------------------------------------
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
motionSolverLibs (rigidBodyMeshMotion);
dynamicFvMesh dynamicOversetFvMesh;
motionSolver rigidBodyMotion;
report on;
solver
{
type Newmark;
//gamma 0.1; // Velocity integration coefficient
//beta 0.1; // Position integration coefficient
}
accelerationRelaxation 0.4;
// prescribedRotation requires some sub-iterations to converge faster
// to desired value of omega.
nIter 3;
bodies
{
hull
{
type rigidBody;
parent root;
// To get Tensor of Inertia (symmetrical) use surfaceInertia
// here hull is empty shell
mass 0.552;
inertia (0.0033 0 0 0.01 0 0.0095);
centreOfMass (0.2857 -0.07 0); // relative to the centreOfMass
// of parent body
// (here root = global coord system)
// Transformation tensor and centre of rotation (CoR)
transform (1 0 0 0 1 0 0 0 1) (0.2857 -0.07 0);
joint
{
// These constrains are applied only to body hull,
// other bodies need to have their own set
// Constraints used for faster run
type composite;
joints
(
{
type Px; // Allow translation in X -
}
{
type Ry; // Allow rotation along Y axis
// (local - body CS)
}
);
}
patches (hullWall);
innerDistance 100; // With overset we want to avoid the mesh
// deformation so have large innerDistance
outerDistance 200;
}
propeller
{
type rigidBody;
parent hull;
centreOfMass (-0.2847 0.03 0); // Relative to parent CoM
mass 0.0288;
inertia (7.6e-6 0 0 4.2e-6 0 4.2e-6);
// transform and CoR - relative to parent CoR
transform (1 0 0 0 1 0 0 0 1) (-0.2757 0.03 0);
patches (propellerWall);
innerDistance 100;
outerDistance 200;
joint
{
type Rx;
}
}
rudder
{
type rigidBody;
parent hull;
centreOfMass (-0.3602 -0.0055 0);
mass 0.0746;
inertia (3.3e-5 0 0 4.7e-6 0 3.4e-5);
// transform and CoR - relative to parent CoR
transform (1 0 0 0 1 0 0 0 1) (-0.3487 -0.04 0);
patches (rudderWall);
innerDistance 100;
outerDistance 200;
joint
{
type Ry;
}
}
}
restraints
{
rudderRotation
{
type prescribedRotation;
body rudder;
referenceOrientation (1 0 0 0 1 0 0 0 1);
axis (0 1 0); // Axis of rotation
relax 0.5;
p 0.5;
i 0.5;
d 0.5;
omega sine; // Function1 entry
omegaCoeffs
{
frequency 4;
amplitude 0.2;
scale (0 1 0);
level (0 1 0);
}
}
propellerRotation
{
type prescribedRotation;
body propeller;
referenceOrientation (1 0 0 0 1 0 0 0 1);
axis (1 0 0);
relax 0.5;
p 0.5;
i 0.5;
d 0.5;
omega table
(
(0 (0 0 0))
(1 (16 0 0))
);
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
vertices
(
// backgroundMesh
( -0.50 -0.5 -0.7) // 0
( 1.00 -0.5 -0.7)
( 1.00 0.5 -0.7)
( -0.50 0.5 -0.7)
( -0.50 -0.5 0.7) // 4
( 1.00 -0.5 0.7)
( 1.00 0.5 0.7)
( -0.50 0.5 0.7)
// hullBox
( 0.045 -0.14 -0.15) // 8
( 0.60 -0.14 -0.15)
( 0.60 0.10 -0.15) // 10
( 0.045 0.10 -0.15)
( 0.045 -0.14 0.15) // 12
( 0.60 -0.14 0.15)
( 0.60 0.10 0.15) // 14
( 0.045 0.10 0.15)
// propeller
( -0.02 -0.08 -0.04) // 16
( 0.04 -0.08 -0.04)
( 0.04 0.00 -0.04) // 18
( -0.02 0.00 -0.04)
( -0.02 -0.08 0.04) // 20
( 0.04 -0.08 0.04)
( 0.04 0.00 0.04) // 22
( -0.02 0.00 0.04)
// rudder
( -0.10 -0.14 -0.02) // 24
( -0.04 -0.14 -0.02)
( -0.04 -0.02 -0.02) // 26
( -0.10 -0.02 -0.02)
( -0.10 -0.14 0.02) // 28
( -0.04 -0.14 0.02)
( -0.04 -0.02 0.02) // 30
( -0.10 -0.02 0.02)
);
blocks
(
// hex (0 1 2 3 4 5 6 7) background (60 40 56)
// simpleGrading (1 1 1) // coarser mesh cell size 0.025 m
hex (0 1 2 3 4 5 6 7) background (75 50 70)
simpleGrading (1 1 1) // cell size 0.02 m
hex (8 9 10 11 12 13 14 15) hullBox (32 16 16) simpleGrading (1 1 1)
hex (16 17 18 19 20 21 22 23) propeller (10 20 20) simpleGrading (1 1 1)
hex (24 25 26 27 28 29 30 31) rudder (20 22 11) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
overset1 //oversetHull
{
type overset;
faces
(
( 8 12 15 11)
(10 14 13 9)
(11 15 14 10)
( 9 13 12 8)
( 9 8 11 10)
(12 13 14 15)
);
}
overset2 //oversetPropeller
{
type overset;
faces
(
(16 20 23 19)
(18 22 21 17)
(19 23 22 18)
(17 21 20 16)
(20 21 22 23)
(19 18 17 16)
);
}
overset3 //oversetRudder
{
type overset;
faces
(
(24 28 31 27)
(26 30 29 25)
(28 29 30 31)
(25 24 27 26)
(27 31 30 26)
(24 25 29 28)
);
}
// Populated by subsetMesh
hullWall
{
type wall;
faces ();
}
propellerWall
{
type wall;
faces ();
}
rudderWall
{
type wall;
faces ();
}
atmosphere
{
type patch;
faces
(
(3 7 6 2)
// (1 5 4 0)
);
}
defaultFaces
{
type wall;
faces
();
}
);
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name bgr0; // all around bgr
type cellSet;
action new;
source zoneToCell;
zone background;
}
{
name hullBox0; // all around bgr
type cellSet;
action new;
source zoneToCell;
zone hullBox;
}
{
name propeller0; // all around bgr
type cellSet;
action new;
source zoneToCell;
zone propeller;
}
{
name rudder0; // all around bgr
type cellSet;
action new;
source zoneToCell;
zone rudder;
}
{
name box; //all cells
type cellSet;
action new;
source cellToCell;
set hullBox0;
}
{
name box; // hole in mesh
type cellSet;
action subset;
source boxToCell;
boxes
(
(0.12 -0.082 -0.1)(0.52 0.052 0.1) //hullBox
);
}
{
name box;
type cellSet;
action invert;
}
{
name keepBox; //all cells
type cellSet;
action new;
source cellToCell;
set box;
}
{
name keepBox; //all cells
type cellSet;
action add;
source cellToCell;
set propeller0;
}
{
name keepBox; //all cells
type cellSet;
action add;
source cellToCell;
set rudder0;
}
{
name keepBox; //all cells
type cellSet;
action add;
source cellToCell;
set bgr0;
}
);