Track vortices using Swak4FOAM
Hi all,
I am simulating the propagation in space and time of some vortices. I would like to be able to trace the center of these vortices into my field and then be able to compute the circulation on a closed surface around this center. So, first step I need to trace the center of my vortex. It looks like defining some functions in the controlDict and using the libsimpleSwakFunctionObjects could be an option but I am not sure how to do it. To start easy I was planning to find the center of my vortex by looking for the maximum vorticity in my field. I wrote those lines in my dictionary: Code:
functions Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
Quote:
Anyway. What might help you is minPosition/maxPosition (this is currently only available in the development-version of swak. You'll have to get that via Mercurial): they take an expression and return the position where that expression has its minimum/maximum (you'll have to guess from the names which does which) |
Dear Bernhard,
Thank you for your reply. Indeed it looks like minPosition and maxPosition could be a good starting point. I went to the wiki in order to see how to download the development version. I got it and apparently managed to install in on my openfoam version 2.1. I looked at the examples and did not find one including the min or max Position function. Could you tell me if something like this should work: Code:
vorticityMax { Or do you have an example? |
I got it working. At least I can track one vortex center with this code:
Code:
functions |
Quote:
Quote:
Quote:
|
Quote:
I am not sure how to handle that. I would need to say something like "track the maximum vorticity only where vorticity.z is positive/negative" but I'm not sure if there is a way to do it. Quote:
|
Dear Bernhard,
do you think it is possible to create a subset of my mesh based on the vorticity value or on a coordinate for instance and then look for a maximum only in that subset? |
Quote:
vortPos1=maxPosition(vorticity) maskField=(mag(pos()-vortPos1)<rCut) ? 0 : 1 vortPos2=maxPosition( maskField ? vorticity : -1000) maskField=(mag(pos()-vortPos2)<rCut) ? 0 : maskField vortPos3= .... Of course the criteria for masking could be something more advanced (the problem here is that rCut being to small might give you "vortex centers" that are in the other vortex and being too large might "hide" another vortex center) Alternative would be "dynamic" cellSets based on an expression, but that feature is not yet implemented (partly because I'm not sure whether the parts of the OF-code where this could be interesting can "cope" with cellSets that change their size) |
Ok I see, not straight forward but brilliant! :)
I manage to get something which looks interesting with the following lines: Code:
mask I tried the following to create such a sphere : Code:
distField Then I am wondering what type is expected at this place? Any idea? |
Quote:
Quote:
a) putting vortPos2 in an expression field b) using a global variable (see slide 35ff in http://openfoamwiki.net/images/d/da/...Leoben2011.pdf). Something like (untested) Code:
Code:
globalScopes ( vortexLoc ); |
Thanks again for your help Bernhard!
I managed to get it working, and to track my two vortices. Here is an example of what I was trying to do: http://i.imgur.com/oRo3n.gif |
Quote:
BTW: looking at the picture it occurred to me that by searching for the minimum and the maximum of "vorticity*pos().x" the "masking" could have been avoided |
Honestly I have never user the wikki so I have no idea how to include this :)
However, it is not urgent, it's an ongoing work so I cannot share everything right now. The contract ends on july and I should have other interesting (hopefully) thing to show afterwards and place it on the wikki. Regarding the other possibility to track the vortices, I think it is less general. And although it might work in this specific case, I have other cases with wind comming from the left or where one vortex might turn around the other and I think your last proposal would not work anymore. Thanks again for your help. |
Quote:
It's quite easy. Really Quote:
But I guess there is no general solution that will always work |
All times are GMT -4. The time now is 22:03. |