|
[Sponsors] |
OF 1.6 extend. GGI - rotation around two axis - C++ newbie needs help |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Member
Andreas Wendy
Join Date: Aug 2012
Posts: 73
Rep Power: 13 ![]() |
Hi everybody,
i have a problem and i hope you can help me. i am planing to simulate an gyro-copter including the auto rotation. i was able to implement some rigid body movement into the mixerggi library and can simulate a rotation around one fixed axis. but i also want to simulate the flapping hinge. for that i need to make a rotation around a second axis. i know what i have to implement but i dont know how. the plan is the following: reading out he forces using forces library <- works recalculate an ne rpm for rotation <- works rotate the rotor around z-axis <- works change the rotation axis for flapping hinge <- does not work (see below) rotate rotor for flapping hinge <- should work change rotation axis back to z-axis and start to next time step. here to the problem with the rotation for the flapping hinge: when the rotor is rotating around the z-axis the coordinate system for the flapping hinge will change by each time step. so i have to compute this axis manually. i think i can do this. but i can not store these data in the variable of the mixerGgi script. the variables (classes) are: csPtr_().axis() csPtr_().origin() i am able to change the origin but not the axis. has anyone an idea to solve this problem? here is the declaration: //- Return coordinate system const coordinateSystem& cs() const { return csPtr_(); } how can i change it? why can i change the origin but not the axis? both have the same declaration or? i added the c-file and header. Best wishes Andreas |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,898
Rep Power: 36 ![]() ![]() |
Hi Andreas,
You can only change the origin, as this is the only variable (besides the name), which has an edit-option in the coordinateSystem-class. You can find the details here: Code:
<some path>/src/OpenFOAM/coordinateSystems/coordinateSystem.H Another option is that if you have defined the axis in a dictionary, then you can change that particular input in the dictionary every time the axis is updated. This way you do not need to change the mixer*** classes. Kind regards, Niels |
|
![]() |
![]() |
![]() |
![]() |
#3 | |
Member
Andreas Wendy
Join Date: Aug 2012
Posts: 73
Rep Power: 13 ![]() |
Quote:
thanks for the info so far. the second option means, that i have to change the entries in the dynamicMeshDict after every iteration an reload it afterwards right? This includes the selecting of the cells or? Would be a lot calculation time wich is needed... but the fastest programming method. i will give it a try. the first option looks lets say more professional i will try this afterwards best wishes Andy |
||
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,898
Rep Power: 36 ![]() ![]() |
Hi Andreas,
I just had a quick look at the code again, and it occurred to me that the coordinateSystem is only created in the constructor, which means that my comment on changing the input in the dictionary has become redundant. Thus: Only solutions are to change the mixer class as already discussed OR make a new coordinate system class. This class should, whenever the runTime.timeIndex() differs from a local variable, read the axis of rotation from somewhere and update the rotation matrix. Kind regards, Niels |
|
![]() |
![]() |
![]() |
![]() |
#5 | ||
Member
Andreas Wendy
Join Date: Aug 2012
Posts: 73
Rep Power: 13 ![]() |
Quote:
Quote:
best wishes Andy |
|||
![]() |
![]() |
![]() |
![]() |
#6 | ||
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,898
Rep Power: 36 ![]() ![]() |
Quote:
Quote:
Kind regards Niels |
|||
![]() |
![]() |
![]() |
![]() |
#7 | |
Member
Andreas Wendy
Join Date: Aug 2012
Posts: 73
Rep Power: 13 ![]() |
Quote:
so i have to "delete" the cobnstruction of the cooardinate system by moving it a later position and modify it a little bit - or maybe more^^ thanks! |
||
![]() |
![]() |
![]() |
![]() |
#8 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,898
Rep Power: 36 ![]() ![]() |
Yes, that is exactly what I would try
![]() / Niels |
|
![]() |
![]() |
![]() |
![]() |
#9 | ||||
Member
Andreas Wendy
Join Date: Aug 2012
Posts: 73
Rep Power: 13 ![]() |
hi niels,
somehow i am not able to compile the mixxer class. i tried the following: 1. copy the constructur for reading in the dynmaicmesh dict and modified like this: Quote:
Quote:
when i try to compile i get this error: Quote:
Quote:
best wishes Andy |
|||||
![]() |
![]() |
![]() |
![]() |
#10 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,898
Rep Power: 36 ![]() ![]() |
Good morning,
Yes, your simple updateCS(io) method has some constructor-behaviour to it, because all the stuff, which is defined after ":" and before the scope "{" is part of the constructor. I do not believe 1. That you are allowed to do that in a simple class method - have never tried. 2. When you are updating the coordinate system, you do not need to set all the other class-variables againl; which is what is happening after ":" Have you declared void in both H and C files? Furthermore, you are using the "new" memory allocation for your coordinate sytem. If you do not clean up after yourself, you will come to a point, where you run out of memory, since you continue to allocate more and more memory. Kind regards Niels |
|
![]() |
![]() |
![]() |
![]() |
#11 | |
Member
Andreas Wendy
Join Date: Aug 2012
Posts: 73
Rep Power: 13 ![]() |
Quote:
by setting the variables again do you ment the readscalar part? aren't they overwritten by the data inside the dynamicmeshdict? what other option do i have instead of ::New? ::Update or what would the right expression? cause i do not want the constructor behaviour i have to move the part after ":" into this range: { ....... } i added the .c and .h file for further "investigations" i am very sorry for being so helpless but i never worked with c++ before.... best wishes Andy |
||
![]() |
![]() |
![]() |
![]() |
#12 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,898
Rep Power: 36 ![]() ![]() |
Hi Andy,
It is a bit difficult to give advice based on your code, since you have made a lot of modifications, though, here are my immediate recommendations, which will give you a first go on a working code: 1. Remove entirely the updateCS method. This will not work. 2. In each of the methods (in the C-file), where you use the coordinateSystem, you construct your own local coordinate system, say csLocal (see <somePath>/OpenFoam/src/OpenFOAM/coordinateSystems/coordinateSystem.H to find your preferred way of constructing the coordinate system). Use this local coordinate system instead of cs() and csPtr_. This approach is a bit cumbersome and might not be terribly effective, but it is the first step toward a working code. 3. Please note that until you actually clean up the code, you still need to construct csPtr_ in the constructor of mixerGgiFvMesh. I know csPtr_ becomes redundant, but just take one single step at the time. Hope this helps, Niels P.S. Here is a link to a quite big book on C++ programming. Otherwise, I can recommend using Google, even though I understand that it is hard to find answers, if you are unsure of which questions to pose. http://www-cs-faculty.stanford.edu/~...6BX-Reader.pdf |
|
![]() |
![]() |
![]() |
![]() |
#13 | |
Member
Andreas Wendy
Join Date: Aug 2012
Posts: 73
Rep Power: 13 ![]() |
Quote:
1) done 2) i am going to have a look at that. so i recalculate my vector for the origin, direction and axis use them as input and calculate/update the local CS right? That sounds good and is exactly what i was locking for ![]() 3) i will have a fixed axis which coordinate system will never change. so i can stay at this pointer to the coordinate system in the mesh dict and only have to update my second local cs right? Thanks so far Andy |
||
![]() |
![]() |
![]() |
![]() |
#14 | |
Member
Andreas Wendy
Join Date: Aug 2012
Posts: 73
Rep Power: 13 ![]() |
Hi,
the definition of an new axis coordinate system worked pretty well ![]() now i try the following: 1. step (for initialization only) get the cell index of clossest cell/node to given coordinates. for example 0, 1,0 2. after each iteration get new coordinates of this cell after rotation. and so on... i was trying this one: (http://www.cfd-online.com/Forums/ope...ordinates.html) Quote:
i am still sea5rching for a way to get the coordinates for a given cell id. best wishes andy |
||
![]() |
![]() |
![]() |
![]() |
#15 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,898
Rep Power: 36 ![]() ![]() |
Hi Andreas,
Back in the office again ![]() The discussion about the cellID, where are you heading with that? I am unsure what you want to obtain by that. Furthermore, using GGI, you need to have matching surfaces between the stagnant and moving part, correct? In that case, are you rotating a sphere about its centre, or how will you system work, when change the axis of rotation? Kind regards, Niels |
|
![]() |
![]() |
![]() |
![]() |
#16 | |
Member
Andreas Wendy
Join Date: Aug 2012
Posts: 73
Rep Power: 13 ![]() |
Quote:
yes you are right. by using the ggi the surfaces between the moving and static part have to mach. that is why i am using o sphere in a reactangle surrounding. now i have implemented a automatically update on a reference cell coordinates whch lies on the axis of rotation. furthermore i am trying to clean the code. that was pretty dirty^^ wish you a nice weekend Andy |
||
![]() |
![]() |
![]() |
![]() |
#17 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,898
Rep Power: 36 ![]() ![]() |
And the same to you. Please upload a video, when you wing is rotating freely
![]() |
|
![]() |
![]() |
![]() |
![]() |
#18 |
Member
Andreas Wendy
Join Date: Aug 2012
Posts: 73
Rep Power: 13 ![]() |
and the next problem has occured....
maybe you got an idea: http://www.cfd-online.com/Forums/ope...ng-forces.html best wishes andy |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Create a GeometricField of a given type on given patch? | philippose | OpenFOAM Programming & Development | 4 | August 12, 2013 12:41 |
OF 1.6 extend. GGI - rotation around two axis - C++ newbie needs help | A.Wendy | OpenFOAM Running, Solving & CFD | 1 | February 4, 2013 08:05 |
Frozen Rotor 1:1 Mesh Connection | pharley | CFX | 5 | January 31, 2013 16:15 |
parallel computing with GGI (OF 1.6 extend) | A.Wendy | OpenFOAM Running, Solving & CFD | 1 | November 18, 2012 17:27 |
Axis of rotation for centrifugal compressor | Mattia | FLUENT | 4 | October 22, 2007 11:05 |