|
[Sponsors] |
[snappyHexMesh] dynamic mesh: rotating body with increasing/decreasing distance to fixed body |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Member
Mona
Join Date: Mar 2016
Location: Berlin
Posts: 49
Rep Power: 10 ![]() |
Dear meshing experts,
I am a little clueless on how to solve this meshing problem and would appreciate any suggestions on how to deal with it: I am simulating a floating body with interDyMFoam (OF 3.0.1), moving in pitch motion in a 2-phase-flow. I managed to get the moving mesh working without the fixed body shown in the attached sketch, by using the sixDoFRigidBodyMotion solver. But now I want to add that fixed body which is sometimes fairly close to the pitching body and sometimes not, as I am simulating a free decay test. If I keep the outerDistance (specified in sixDoFRigidBodyMotionCoeffs) the same as before (about 0.5 m) the simulation crashes almost immediately, because the layer cells of the fixed body lie in that radius and get highly distorted. If I reduce the outerDistance to a size just below the size of the gap between the two bodies (0.05m) the simulation also crashes quite soon because the cells on top of the body (considering anti-clockwise movement) get compressed too much. I considered using sliding interfaces, but I think it won't work because the circular path of the body is intersecting with the fixed body. Is there a way I can get this to work using cell layer addition/removal or by having overlapping meshes? I don't have any experience with that and would be thankful for any advice! Cheers, Mona |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Member
Mona
Join Date: Mar 2016
Location: Berlin
Posts: 49
Rep Power: 10 ![]() |
Hi everyone,
I am not sure if this is leading somewhere, but I decided to start working with cyclicAMI. I left out the solid not moving body for now and started building a new mesh with blockMesh (sorry the numbering might be quite confusing) and defined two AMI patches on the cylindrical edge that is supposed to move later, orientating on the mixerVesselAMI2D tutorial. The blockMesh result (ami1.png) looks fine to me. The problems arise when i try to snap in the geometry with snappyHexMesh. At first I specified the locationInMesh somewhere outside the cylindrical part and the inner part just disappears (ami2.png). If I specifiy the locationInMesh inside the cylindrical part I get this error message: Code:
--> FOAM FATAL ERROR: Supplied field size is not equal to target patch size source patch = 0 target patch = 0 supplied field = 400 From function AMIInterpolation::interpolateToSource(const UList<Type>&, const CombineOp&, List<Type>&, const UList<Type>&) const in file /home/thesis/wilhelm/OpenFOAM/OpenFOAM-3.0.1/src/meshTools/lnInclude/AMIInterpolation.C at line 1256. Also if anyone has ideas how to deal with the second body, I would really appreciate it! Thanks for your time ![]() defintions.m4: Code:
// General m4 macros changecom(//)changequote([,]) define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; printf ($1)')]) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // User-parameters convertToMeters 1; //coordinates define(R, 0.65) define(a, 0.4596194078) //x and z coordinate of corner point on circle define(b, 0.4) define(x1,-9.83) //beginning of tank define(x2, calc(-a)) define(x3, calc(a)) define(x4, 6.47) //end of tank define(y1, 0) define(y2, 0.01) define(z1, -0.95) bottom of tank define(z2, calc(-a)) define(z3, calc(a)) define(z4, 0.95) //grading define(u1, 500) // u-cells in upstream define(u2, 100) // u-cells in box define(u3, 300) // u-cells in downstream define(v1, 1) // v-cells in box define(w1, 30) // w-cells low define(w2, 100) // w-cells box define(w3, 30) // w-cells upper define(c, 30) //circles define(ug1, 1) // u-cells grading in upstream define(ug2, 1) // u-cells grading in box define(ug3, 1) // u-cells grading in downstream define(vg1, 1) // v-cells grading in box define(wg1, 1) // w-cells grading low define(wg2, 1) // w-cells grading box define(wg3, 1) // w-cells grading upper // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Code:
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.3 | | \\ / A nd | Web: http://www.openfoam.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; root ""; case ""; instance ""; local ""; class dictionary; object blockMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // include(definitions.m4) // General m4 macros // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // User-parameters convertToMeters 1; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // vertices ( ( x1 y1 z1) //0 ( x2 y1 z1) //1 ( x3 y1 z1) //2 ( x4 y1 z1) //3 ( x1 y1 z2) //4 ( x2 y1 z2) //5 ( x3 y1 z2) //6 ( x4 y1 z2) //7 ( x1 y1 z3) //8 ( x2 y1 z3) //9 ( x3 y1 z3) //10 ( x4 y1 z3) //11 ( x1 y1 z4) //12 ( x2 y1 z4) //13 ( x3 y1 z4) //14 ( x4 y1 z4) //15 ( x1 y2 z1) //16 ( x2 y2 z1) //17 ( x3 y2 z1) //18 ( x4 y2 z1) //19 ( x1 y2 z2) //20 ( x2 y2 z2) //21 ( x3 y2 z2) //22 ( x4 y2 z2) //23 ( x1 y2 z3) //24 ( x2 y2 z3) //25 ( x3 y2 z3) //26 ( x4 y2 z3) //27 ( x1 y2 z4) //28 ( x2 y2 z4) //29 ( x3 y2 z4) //30 ( x4 y2 z4) //31 ( calc(b) 0 calc(-b)) //32 ( calc(b) 0 calc(b)) //33 (calc(-b) 0 calc(b)) //34 (calc(-b) 0 calc(-b)) //35 ( calc(b) y2 calc(-b)) //36 ( calc(b) y2 calc(b)) //37 (calc(-b) y2 calc(b)) //38 (calc(-b) y2 calc(-b)) //39 ( x2 y1 z2) //5-40 ( x3 y1 z2) //6-41 ( x2 y1 z3) //9-42 ( x3 y1 z3) //10-43 ( x2 y2 z2) //21-44 ( x3 y2 z2) //22-45 ( x2 y2 z3) //25-46 ( x3 y2 z3) //26-47 ); blocks ( //inner blocks hex ( 1 5 21 17 0 4 20 16) (w1 v1 u1) simpleGrading (ug1 vg1 wg1) //0 hex ( 2 6 22 18 1 5 21 17) (w1 v1 u2) simpleGrading (ug2 vg1 wg1) //1 hex ( 3 7 23 19 2 6 22 18) (w1 v1 u3) simpleGrading (ug3 vg1 wg1) //2 hex ( 5 9 25 21 4 8 24 20) (w2 v1 u1) simpleGrading (ug1 vg1 wg2) //3 hex (32 33 37 36 35 34 38 39) (w2 v1 u2) simpleGrading (ug2 vg1 wg2) //4 hex ( 7 11 27 23 6 10 26 22) (w2 v1 u3) simpleGrading (ug3 vg1 wg2) //5 hex ( 9 13 29 25 8 12 28 24) (w3 v1 u1) simpleGrading (ug1 vg1 wg3) //6 hex (10 14 30 26 9 13 29 25) (w3 v1 u2) simpleGrading (ug2 vg1 wg3) //7 hex (11 15 31 27 10 14 30 26) (w3 v1 u3) simpleGrading (ug3 vg1 wg3) //8 hex (41 32 36 45 40 35 39 44) (c v1 u2) simpleGrading (1 1 1) //9 (0.8 1 1) hex (41 43 47 45 32 33 37 36) (w2 v1 c) simpleGrading (1 1 1) //10 (1 1 0.8) hex (33 43 47 37 34 42 46 38) (c v1 u2) simpleGrading (1 1 1) //11 (1.25 1 1) hex (35 34 38 39 40 42 46 44) (w2 v1 c) simpleGrading (1 1 1) //12 (1 1 1.25) ); edges ( arc 5 6 (0 0 calc(-R)) arc 21 22 (0 y2 calc(-R)) arc 6 10 (calc(R) 0 0) arc 22 26 (calc(R) y2 0) arc 10 9 (0 0 calc(R)) arc 26 25 (0 y2 calc(R)) arc 9 5 (calc(-R) 0 0) arc 25 21 (calc(-R) y2 0) ); boundary ( inlet { type patch; faces ( ( 0 4 20 16) ( 4 8 24 20) ( 8 12 28 24) ); } outlet { type patch; faces ( ( 3 7 23 19) ( 7 11 27 23) (11 15 31 27) ); } atmosphere { type patch; faces ( (13 29 28 12) (14 30 29 13) (15 31 30 14) ); } middle { type symmetryPlane; faces ( ( 1 5 4 0) ( 2 6 5 1) ( 3 7 6 2) ( 5 9 8 4) ( 7 11 10 6) ( 9 13 12 8) (10 14 13 9) (11 15 14 10) (41 43 33 32) (33 43 42 34) (35 34 42 40) (41 32 35 40) (32 33 34 35) ); } maxY { type symmetryPlane; faces ( (17 21 20 16) (18 22 21 17) (19 23 22 18) (21 25 24 20) (23 27 26 22) (25 29 28 24) (26 30 29 25) (27 31 30 26) (45 47 37 36) (37 47 46 38) (39 38 46 44) (45 36 39 44) (36 37 38 39) ); } bottom { type wall; faces ( ( 1 17 16 0) ( 2 18 17 1) ( 3 19 18 2) ); } AMI1 { type cyclicAMI; neighbourPatch AMI2; transform noOrdering; faces ( (6 10 26 22) (10 26 25 9) (5 9 25 21) (6 22 21 5) ); } AMI2 { type cyclicAMI; neighbourPatch AMI1; transform noOrdering; faces ( (41 43 47 45) (43 47 46 42) (40 42 46 44) (41 45 44 40) ); } ); mergePatchPairs ( ); // ************************************************************************* // Code:
/*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.0 | | \\ / A nd | Web: http://www.openfoam.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object snappyHexMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // convertToMeters 1; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Which of the steps to run castellatedMesh true; snap true; addLayers true; geometry { new_absorber-r.stl { type triSurfaceMesh; name floatingObject; patchInfo { type wall; } } }; // Settings for the castellatedMesh generation. castellatedMeshControls { // Refinement parameters // ~~~~~~~~~~~~~~~~~~~~~ // While refining maximum number of cells per processor. This is basically // the number of cells that fit on a processor. If you choose this too small // it will do just more refinement iterations to obtain a similar mesh. maxLocalCells 40000000; // Overall cell limit (approximately). Refinement will stop immediately // upon reaching this number so a refinement level might not complete. // Note that this is the number of cells before removing the part which // is not 'visible' from the keepPoint. The final number of cells might // actually be a lot less. maxGlobalCells 1500000; // The surface refinement loop might spend lots of iterations refining just a // few cells. This setting will cause refinement to stop if <= minimumRefine // are selected for refinement. Note: it will at least do one iteration // (unless the number of cells to refine is 0) minRefinementCells 100; // Allow a certain level of imbalance during refining // (since balancing is quite expensive) // Expressed as fraction of perfect balance (= overall number of cells / // nProcs). 0=balance always. maxLoadUnbalance 2; // Number of buffer layers between different levels. // 1 means normal 2:1 refinement restriction, larger means slower // refinement. nCellsBetweenLevels 1; // Explicit feature edge refinement // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Specifies a level for any cell intersected by its edges. // This is a featureEdgeMesh, read from constant/triSurface for now. features ( ); // Surface based refinement // ~~~~~~~~~~~~~~~~~~~~~~~~ // Specifies two levels for every surface. The first is the minimum level, // every cell intersecting a surface gets refined up to the minimum level. // The second level is the maximum level. Cells that 'see' multiple // intersections where the intersections make an // angle > resolveFeatureAngle get refined up to the maximum level. refinementSurfaces { floatingObject { level (1 1); } } // Resolve sharp angles resolveFeatureAngle 50; // Region-wise refinement // ~~~~~~~~~~~~~~~~~~~~~~ // Specifies refinement level for cells in relation to a surface. One of // three modes // - distance. 'levels' specifies per distance to the surface the // wanted refinement level. The distances need to be specified in // descending order. // - inside. 'levels' is only one entry and only the level is used. All // cells inside the surface get refined up to the level. The surface // needs to be closed for this to be possible. // - outside. Same but cells outside. refinementRegions { } // Mesh selection // ~~~~~~~~~~~~~~ // After refinement patches get added for all refinementSurfaces and // all cells intersecting the surfaces get put into these patches. The // section reachable from the locationInMesh is kept. // NOTE: This point should never be on a face, always inside a cell, even // after refinement. locationInMesh (-7 0.001 -0.5); // Whether any faceZones (as specified in the refinementSurfaces) // are only on the boundary of corresponding cellZones or also allow // free-standing zone faces. Not used if there are no faceZones. allowFreeStandingZoneFaces true; } // Settings for the snapping. snapControls { //- Number of patch smoothing iterations before finding correspondence // to surface nSmoothPatch 10;//10 //- Relative distance for points to be attracted by surface feature point // or edge. True distance is this factor times local // maximum edge length. tolerance 4.0; //- Number of mesh displacement relaxation iterations. nSolveIter 10; //10; //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 7; //- Highly experimental and wip: number of feature edge snapping // iterations. Leave out altogether to disable. nFeatureSnapIter 20; } // Settings for the layer addition. addLayersControls { relativeSizes false; // Per final patch (so not geometry!) the layer information layers { floatingObject { nSurfaceLayers 1; } } // Expansion factor for layer mesh expansionRatio 1.25; //- Wanted thickness of final added cell layer. If multiple layers // is the // thickness of the layer furthest away from the wall. // Relative to undistorted size of cell outside layer. finalLayerThickness 0.001; //0.0053; //- Minimum thickness of cell layer. If for any reason layer // cannot be above minThickness do not add layer. // Relative to undistorted size of cell outside layer. minThickness 0.000003; //- If points get not extruded do nGrow layers of connected faces that are // also not grown. This helps convergence of the layer addition process // close to features. nGrow 1; // Advanced settings //- When not to extrude surface. 0 is flat surface, 90 is when two faces // make straight angle. featureAngle 60;// was 45 //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 15; //15; // Number of smoothing iterations of surface normals nSmoothSurfaceNormals 5; //20; // Number of smoothing iterations of interior mesh movement direction nSmoothNormals 15; //20; // Smooth layer thickness over surface patches nSmoothThickness 15; //20; // Stop layer growth on highly warped cells maxFaceThicknessRatio 0.5; // Reduce layer growth where ratio thickness to medial // distance is large maxThicknessToMedialRatio 1;//0.9; // Angle used to pick up medial axis points minMedianAxisAngle 180; // Create buffer region for new layer terminations nBufferCellsNoExtrude 0; // Overall max number of layer addition iterations nLayerIter 20; //20; // Max number of iterations after which relaxed meshQuality controls // get used. Up to nRelaxIter it uses the settings in meshQualityControls, // after nRelaxIter it uses the values in meshQualityControls::relaxed. nRelaxedIter 10; //20; } // Generic mesh quality settings. At any undoable phase these determine // where to undo. meshQualityControls { //- Maximum non-orthogonality allowed. Set to 180 to disable. maxNonOrtho 65; //90; //- Max skewness allowed. Set to <0 to disable. maxBoundarySkewness 20; maxInternalSkewness 4; //- Max concaveness allowed. Is angle (in degrees) below which concavity // is allowed. 0 is straight face, <0 would be convex face. // Set to 180 to disable. maxConcave 180; //90; //- Minimum projected area v.s. actual area. Set to -1 to disable. minFlatness 0.2; //0.5; //- Minimum pyramid volume. Is absolute volume of cell pyramid. // Set to very negative number (e.g. -1E30) to disable. minVol 1e-20; //- Minimum quality of the tet formed by the face-centre // and variable base point minimum decomposition triangles and // the cell centre. This has to be a positive number for tracking // to work. Set to very negative number (e.g. -1E30) to // disable. // <0 = inside out tet, // 0 = flat tet // 1 = regular tet minTetQuality -1000; // 1e-9; //- Minimum face area. Set to <0 to disable. minArea -1; //- Minimum face twist. Set to <-1 to disable. dot product of face normal //- and face centre triangles normal minTwist 0.001; //0.025; //- minimum normalised cell determinant //- 1 = hex, <= 0 = folded or flattened illegal cell minDeterminant 0.001; //- minFaceWeight (0 -> 0.5) minFaceWeight 0.02; //- minVolRatio (0 -> 1) minVolRatio 0.001; //must be >0 for Fluent compatibility minTriangleTwist -1; //- if >0 : preserve single cells with all points on the surface if the // resulting volume after snapping (by approximation) is larger than // minVolCollapseRatio times old volume (i.e. not collapsed to flat cell). // If <0 : delete always. //minVolCollapseRatio 0.1; //0.5; // Advanced //- Number of error distribution iterations nSmoothScale 4; //- amount to scale back displacement at error points errorReduction 0.75; // Optional : some meshing phases allow usage of relaxed rules. // See e.g. addLayersControls::nRelaxedIter. relaxed { //- Maximum non-orthogonality allowed. Set to 180 to disable. maxNonOrtho 180; } } // Advanced // Flags for optional output // 0 : only write final meshes // 1 : write intermediate meshes // 2 : write volScalarField with cellLevel for postprocessing // 4 : write current intersections as .obj files debug 0; // Merge tolerance. Is fraction of overall bounding box of initial mesh. // Note: the write tolerance needs to be higher than this. mergeTolerance 1E-6; // ************************************************************************* // |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Member
Mona
Join Date: Mar 2016
Location: Berlin
Posts: 49
Rep Power: 10 ![]() |
Ok, I managed to built the mesh I think.
The trick was to have two cases, one with the inner cylinder mesh and one with the outer main mesh. I snapped in the geometry to the inner cylinder mesh and then used mergeMeshes to integrate the cylinder in the main mesh. Then I used createPatch to built the AMI patches. Now I would like to figure out how to move the inner cylinder according to the dynamics of the body and not by applying a rotation frequency. Any ideas? |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Member
Mona
Join Date: Mar 2016
Location: Berlin
Posts: 49
Rep Power: 10 ![]() |
Ok, so probably AMI is still not the way to go.
I found this in Hrvoje Jasaks Paper DYNAMIC MESH HANDLING IN OPENFOAM APPLIED TO FLUID-STRUCTURE INTERACTION SIMULATIONS: For cases of overturning bodies, simple mesh motion will not suffice: substantial rotation would destroy the mesh. To deal with this, a floatingBody class optionally supports a two-part mesh, where the internal part is attached to the floating body and moves in unison with it. The external part of the mesh captures translational motion only; between the two, a sliding or GGI interface similar to the one in mixers is used to accommodate relative rotation between components. An example of this kind is shown in Figure 7, right. An interesting side-effect of this mesh setup is that the mesh close to the body remains undisturbed and near-wall mesh layers are protected from deformation. When lookingfor that floatingBody class I only found the sourcefiles and I don't have any C++ knowledge yet ![]() Does anyone have experience with this? Do you think it could work for my case? |
|
![]() |
![]() |
![]() |
Tags |
dynamic mesh, pitch, sixdofrigidbodymotion |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Star CCM Overset Mesh Error (Rotating Turbine) | thezack | Siemens | 7 | October 12, 2016 11:14 |
Writing a dynamic mesh motion result to fixed mesh | albcem | OpenFOAM Running, Solving & CFD | 0 | December 23, 2015 02:24 |
[snappyHexMesh] Layers:problem with curvature | giulio.topazio | OpenFOAM Meshing & Mesh Conversion | 10 | August 22, 2012 09:03 |
Dynamic mesh for deformable body | gascortado | OpenFOAM | 5 | January 14, 2011 13:19 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 11:55 |