- **OpenFOAM Running, Solving & CFD**
(*https://www.cfd-online.com/Forums/openfoam-solving/*)

- - **Problems with 3 degrees of rotation**
(*https://www.cfd-online.com/Forums/openfoam-solving/58006-problems-3-degrees-rotation.html*)

Anyone any ideas how to solve Anyone any ideas how to solve this basic problem?
Frank |

Hi everybody,
Concerning thHi everybody,
Concerning the movement of a patch in the code, is there a way to specify directly the point locations instead of using the velocity motionU like this: fixedValueTetPolyPatchVectorField& motionUBodyPatch = refCast<fixedvaluetetpolypatchvectorfield> ( motionU.boundaryField()[bodyPatchID_] ); motionUBodyPatch == ( rot )/time().deltaT().value(); In other words, I like to read boundary point locations from a file and then replace the oldPoints on the boundary with these newPoints. Any ideas how to achieve this, any examples? Regards, Frank |

Sorry, can't say I have. Very Sorry, can't say I have. Very interesting topic though, what kind of modelling did you have in mind for the bubbles?
Regards Eric |

Sorry!
The last message is Sorry!
The last message is obsolete and ended up the wrong thread //Eric |

bPoints from file
pointVectbPoints from file
pointVectorField newPoints(mesh.points()) newPoints.boundaryField()[movingPatchID]=bPoints; You need to move the rest of the mesh accordingly forAll(newPoints, pointI) { Given body rigid motion calculate the rotation refering to center of motion. } mesh.movePoints(newPoints) /Eric |

Not like that: if you do newPoNot like that: if you do newPoints[i].x(), OpenFOAM will make a copy of the x-component and return a scalarField.
First make a vectorField out of the stuff from the file and then do the "=". Hrv |

Mmm, Hrvoje, I still don't getMmm, Hrvoje, I still don't get it to work. Ignoring the reading from file (this will replace the initialPoints...) stuff I have the following:
================================================ pointField initialPoints = mesh.boundaryMesh()[patchI].localPoints(); for (runTime++; !runTime.end(); runTime++) { pointField newPoints = mesh.boundaryMesh()[patchI].localPoints(); forAll(newPoints, i) { newPoints[i] = initialPoints[i]*runTime.time().value() //just some function of time and the initial points; } mesh.movePoints(newPoints); runTime.write(); } return 0; } ================================================ Still I get this error: --> FOAM FATAL ERROR : Cannot move points: size of given point list smaller than the number of active points When I use mesh.update(), this error dissapears (why?) but no motion occurs (why?). So I am able to calculate the boundary points the way I want, but not to update / move the boundary points accordingly. Regards, Frank BTW, I have to use the newPoints.x() component when I add some sin() or cos() function. Why is that? |

When moving the mesh with moveWhen moving the mesh with movePoints() you need to supply new locations for ALL points in the mesh, not just the boundary. If you just move the boundarypoints you'll need an algorithm or solver to calculate the motion of the rest of the mesh. Your error results from your initialization of newPoints
>> pointField newPoints = mesh.boundaryMesh()[patchI].localPoints(); This will only copy the boundary points to newPoints and you need all mesh.points(), see post above for proper initialization. The amount of movement in the mesh depends on the boundary motion amplitude. If you're looking for rigid body motion things should be trivial if you define a referens point (e.g. (0 0 0)) and calculate a rotation translation for each point in the mesh relative that referens. If you read a prescribed boundary point motion from a file I think you only need to calculate rotation/translation for 3 points on your boundary to specify the entire body motion, right? If you have a prescribed motion of the boundary that is not rigid you'll need a mesh motion solver of some sort. Hope you find this helpful Regards, Eric |

Thanks Eric, I already had somThanks Eric, I already had some similar ideas on this, but you made it much clearer to me.
You're idea of moving all internal mesh points according to the rotational boundary motion is not going to work in 3D where the moving body has a 'complex' shape and the outer boundary is just a rectangular box where all boundary points are fixed. I think that it is better to calculate the motionU boundary condition (which is easy since the boundary motion is known) and then use the tetDecompositionMotionSolver to move all internal mesh points. Some library (like movingBodyFvMesh) has to be created then. This last method is slightly more difficult and I thought that it should be possible to move the boundary and the mesh accordingly in a custom solver. Am i right? Regards, Frank |

In that case try...
IncremeIn that case try...
Incremental motion of your patch points in 'boundaryPatchPointsDispl' // Grab motionU from registry tetPointVectorField& motionU = const_cast<tetpointvectorfield&> ( mesh.objectRegistry::lookupObject<tetpointvectorfi eld> ( "motionU" ) ); // Get a tetPolyPatch for the points on your moving boundary fixedValueTetPolyPatchVectorField& motionUPatch = refCast<fixedvaluetetpolypatchvectorfield> ( motionU.boundaryField()[movingBoundaryPatchID] ); // Fix an interpolator for your motionU boundary tetPolyPatchInterpolation tetPointPatchInterpolator ( refCast<const>(motionUPatch.patch()) ); //Use the interpolator to put the point velocities on your motionU patch motionUPatch == tetPointPatchInterpolator.pointToPointInterpolate ( boundaryPatchPointsDispl/runTime.deltaT().value() ); // Do the mesh motion using the tetDecom solver defined in th dynamicMeshDict in constant mesh.update(); Regards, Eric |

Thanks, I solved the problem aThanks, I solved the problem a couple of days ago. As always it turned out to be a very straightforward solution. I forgot to put some matrix inverse somewhere in my code.
So I can now start simulating a 3d flapping wing with prescribed translations (3Dofs) and rotations (3Dofs). Regards, Frank |

Excellent,
If possible, I wExcellent,
If possible, I would like to try your code on some two-phase FSI cases that I'm playing around with. Regards, Eric |

Mmm, are you sure that you neeMmm, are you sure that you need this, its quite simple. I only move the boundary points according to some rotation matrices with prescribed motion angles which are a function of time. So no FSI involved.
If you are still interested, drop me a mail. Regards, Frank |

Hi Frank!
Beeing enthusiast aHi Frank!
Beeing enthusiast about your work on flapping wings, I started to have a look to dynamic meshes. At first, I used movingCone totorial inside icoDyMFoam as base example, and now I can make cube slide onto a surface, and all the mesh is readapted in a very nice way, both with 1.3 and with 1.4 version. Now, I would like to impose a general transformation to the cube (let's say, rotating, scaling, etc...) I don't know where to start from! I had a look to moveMesh tools, and it's very short and elegant, but a bit obscure to me. Then, I moved to dynamicBodyFvMesh, that you yoused for your flapping wings. I looked a bit inside it, and it seems to look for some entries in the dynamicMeshDict that I can't find inside any example... I changed my constant/dynamicMeshDict to: solverLib "libdynamicFvMesh.so"; dynamicFvMesh dynamicBodyFvMesh; ... But the line "dynamicFvMesh" is ignored. If I remove ite, "moveMesh" works without problems, and it still translate my cube. Where am I wrong? How can I use dynamicBodyFvMesh as my movement routine? |

Hi Francesco!
Very nice thaHi Francesco!
Very nice that you find my work interesting! Indeed, I used dynamicBodyFvMesh to define the translational and rotational motion. In the standard dynamicBodyFvMesh you can only specify 1 freedom of translation and 1 freedom of rotation. I modified this lib, such that I am able to define a 6 DOF motion. (Remark: I did not implement a coupling between the forces and motion.) So, you'll have to start with dynamicBodyFvMesh, where you can define your desired rotation, translation or scaling etc.....Very nice!! Furthermore, in order to use this lib, you'll have to specify the following in dynamicMeshDict: dynamicFvMeshLib "libtetDecompositionMotionSolver.so"; dynamicFvMesh dynamicBodyFvMesh; dynamicBodyFvMeshCoeffs { bodyPatchName body_wall; translationDirection (-1 0 0); translationAmplitude 0; TranslationFrequency 0.25; initialRotationOrigin (0 0 0); rotationAxis (1 0 0); rotationAmplitude 0.523; //30 degrees in radians rotationFrequency 0.25; } If you get this working, try moving a subset within another subset, I would be interesting :-) Enjoy!!! Regards, Frank |

Hi Frank!
Thanks for the veryHi Frank!
Thanks for the very quick reply. I still have the same behaviuor... This is my dynamicMeshDict input file: FoamFile { version 2.0; format ascii; root ""; case ""; instance ""; local ""; class dictionary; object motionProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solverLib "libdynamicFvMesh.so"; twoDMotion no; solver laplaceTetDecomposition; diffusion quadratic patchEnhanced; frozenDiffusion off; distancePatches ( cube ); dynamicFvMeshLib "libtetDecompositionMotionSolver.so"; dynamicFvMesh dynamicBodyFvMesh; dynamicBodyFvMeshCoeffs { bodyPatchName cube; translationDirection (1 0 0); translationAmplitude 0; translationFrequency 1; initialRotationOrigin (3.5 2.5 0); rotationAxis (0 0 1.); rotationAmplitude 0.3; rotationFrequency 1; } // ************************************************** *********************** // The problem is that moveMesh complains only for missing "solver", "solverLib", twoDMotion, diffusion, frozenDiffusion and distancePatches lines. It completely ignores everything else... And it's not using dynamicBodyFvMesh yet. I guess I have to use something that activate the "dynamicFvMeshLib" option inside this dictionary... |

Hi,
I don't use:
solverLiHi,
I don't use: solverLib "libdynamicFvMesh.so" If you specify a nonexisting dynamicFvMesh, instead of dynamicBodyFvMesh, it should give the available options, including the dynamicBodyFvMesh. If not, you should recompile the dynamicFvMesh lib. Frank |

Thanks Frank!
My mistake was Thanks Frank!
My mistake was using "moveMesh" instead of "moveDynamicMesh". I can rotate the cube, at last, and I know what I have to modify in order to add mya own motion laws. I'll play a bit with this, and I'll let you know if I'll be able to move a subset within another one. Ciao Francesco |

Here I am again...
After someHere I am again...
After some test on more complicated cases with version 1.3 dev, I would like to test my rotating and translating cube with version 1.4. Basicly, I would like to port "dynamicBodyFvMesh" to OF 1.4, but I'm having a lot of troubles, because of tetdecompositionMotionSolver doesn't exist anymore, as the algorithm is changed. Frank, you could recompile your modified version of "dynamicBodyFvMesh" with 1.4, am I right? How? Francesco |

If it halps at all, I have porIf it halps at all, I have ported the dynamicBodyFvMesh and all other stuff mentioned in Zgabre already - all it needs is some time to make sure I didn't put any new bugs in...
Hrv |

All times are GMT -4. The time now is 03:24. |