|
[Sponsors] |
Imposing an oscillating linear motion with a sudden stop through the dynamicMeshDict |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 21, 2019, 15:28 |
Imposing an oscillating linear motion with a sudden stop through the dynamicMeshDict
|
#1 |
New Member
Élio Pereira
Join Date: Dec 2017
Location: Lisbon
Posts: 5
Rep Power: 9 |
I would like to know how to impose an oscillating linear motion with a sudden stop to a body. I know how to impose an oscillating linear motion. I wrote the following lines in the dynamicMeshDict:
Code:
dynamicFvMesh dynamicMotionSolverFvMesh; motionSolver solidBody; solidBodyMotionFunction multiMotion; oscillation { solidBodyMotionFunction oscillatingLinearMotion; //Sinusoidal translation motion oscillatingLinearMotionCoeffs { amplitude (0.02 0 0); //amplitude vector of the sinusoidal translation [m] omega 21.9838; //angular frequency of the sinusoidal translation [rad/s] } } |
|
February 22, 2019, 09:28 |
|
#2 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Hi!
What if you try the timeActivatedFIleUpdate function object: https://cpp.openfoam.org/v6/timeActi...8H_source.html Just create 2 dynamicMeshDicts, and at the given time just copy the 2nd one. I'm not sure if OF reads the dynamicMeshDict if it is modified. If not, the much easier way is to run the simulation to the time when the motion should stop, manually (through a script) change the dynMesDict file, and the end time of the simulation. And continue the run. I think this is not a professional move, but simple and working. |
|
February 23, 2019, 15:57 |
|
#3 |
New Member
Élio Pereira
Join Date: Dec 2017
Location: Lisbon
Posts: 5
Rep Power: 9 |
I added this code to my controlDict file inside "functions":
Code:
fileUpdate1 //substitute a file at a given instant { type timeActivatedFileUpdate; libs ("libutilityFunctionObjects.so"); writeControl timeStep; writeInterval 1; fileToUpdate "$FOAM_CASE/constant/dynamicMeshDict"; //file to be substituted timeVsFile ( (-1 "$FOAM_CASE/constant/dynamicMeshDict.1") //substitution at t=0s (0.3 "$FOAM_CASE/constant/dynamicMeshDict.2") //substituition at t=0.3s ); } Last edited by eliocpereira; February 25, 2019 at 05:46. |
|
February 24, 2019, 21:37 |
|
#4 |
New Member
Élio Pereira
Join Date: Dec 2017
Location: Lisbon
Posts: 5
Rep Power: 9 |
I now tried to change the oscillatingLinearMotion.C and oscillatingLinearMotion.H files, so that they could do what I desired. I defined a new SBMFCoeffs variable: ts, which is the stopping instant of the oscillation. I changed the formula for the oscillation, using comparison operators:
Code:
const vector displacement = amplitude_*sin(omega_*t)*(t<ts_) + amplitude_*sin(omega_*ts_)*(t>=ts_); I discovered that the changes to the files actually didn't change anything. It felt like OpenFOAM used the old files instead of the new ones, although the old were substituted. I even tried a simple change: only putting a factor 2 multiplying the frequency in the sine function, so that I could expect a two times faster oscillation. Still, the results were the same as before, nothing changed. Why isn't OpenFOAM reading my changes?. |
|
February 25, 2019, 08:39 |
|
#5 |
New Member
Élio Pereira
Join Date: Dec 2017
Location: Lisbon
Posts: 5
Rep Power: 9 |
I eventually made OpenFOAM recognize the changes that I did to the .C and .H files, by running the related makefile after. Basically I changed directory to where the "Make" folder lives, then I logged in as root and ran the makefile. To do this, I wrote the following commands at the terminal:
Code:
cd /opt/openfoam6/src/dynamicMesh sudo bash wmake |
|
February 25, 2019, 08:52 |
|
#6 |
Senior Member
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14 |
Sorry for the late answer. So yes. That's why I told you in this case you can try to simply stop the simulation and the continua with the changed motion.
The next approach would be the new dynMesh solver, or a more better one if you use a coded one. You should NOT modify the original code. You can do it, but next time you forget that, you use this motion solver, and you will have no idea what the hack is happening. :/ In this case it is better if you create a new library for yourself. (copy paste original, rename, rewrite, you can use.) |
|
Tags |
dynamicmeshdict, motion dynamicmesh, openfoam, oscillating |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
AMI with linear translation motion | macti | OpenFOAM | 2 | June 27, 2017 12:05 |
solution diverges when linear upwind interpolation scheme is used | subash | OpenFOAM | 0 | May 29, 2010 02:23 |
IdeasUnvToFoam Bug amp Fix | benru | OpenFOAM Bugs | 42 | November 13, 2009 08:59 |
rotation and linear motion | Chroko | CFX | 5 | August 26, 2009 19:34 |
Is linear motion possible to model in CFX? | abe | CFX | 0 | January 10, 2006 01:05 |