|
[Sponsors] |
[swak4Foam] Cartesian to polar using FunkySetFields >>> Division by zero |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Philipp Gruschka
Join Date: Jun 2014
Posts: 5
Rep Power: 12 ![]() |
Hello everybody!
First of all, I'm pretty new to OpenFOAM! Currently I'm trying to transform cartesian coordinates to cylindrical coordinates by using funkySetFields. My problem is that the calculation of the circumferential coordinate (phi) requires the calculation of arctan(y/x). For the areas where phi is calculated by arctan(y/x), the case x=0 is clearly excluded, which I also wanted to implement by 1.) using an exclusion in the expression line, e.g. expression "pos().x > 0 ? arctan(y/x) : (elseif-cond.)" 2.) using the condition option, e.g. expression "arctan(y/x)" condition "pos().x > 0" Both results in division by zero exceptions, like the expression is applied to the field before the condition is evaluated. Also I'm not quite sure whether funkySetFields understands arcus-functions. Hope somebody can help me! Thanks in advance, Philipp |
|
![]() |
![]() |
![]() |
![]() |
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 52 ![]() ![]() |
Quote:
The workaround would be to make sure that the division by 0 never happens. Like this for instance: "pos().x>0 ? arctan(y/(pos().x>0 ? x : 1e-10)): (other expression)" or "pos().x>0 ? arctan(y/max(x,1e-10)) : othr-expr"
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Philipp Gruschka
Join Date: Jun 2014
Posts: 5
Rep Power: 12 ![]() |
That works fine, thank you!
Two other quesions: 1.) Is there a way to create a pseudo-unsteady calculation of the field with funkySetFields? Starting from a simple 0/ folder, I'd like to use time and/or deltaT in my dictionary, so that I can compute three or four further timesteps without really calculating it with OpenFOAM. Therefore funkySetFields should be able to automatically create new time folders. 2.) How can I declarate and use variables and constants in FSF? I read something about #include and allowFunctionObjects, but since I'm not really familiar with the OpenFOAM structures I don't really know how to do it... Again, thank you very much in advance!!! |
|
![]() |
![]() |
![]() |
![]() |
#4 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 52 ![]() ![]() |
Quote:
FSF only works if time-folders are there. So at least you'd have to create the folders for FSF (OF) to recognize them. Then you can insert a field as usual What you CAN do to emulate that behaviour is use replayTransientBC: add expressionField-functionObjects that create the fields you want in system/controlDict and apply the utility Variables are only possible in FSF if used in dictionary mode (if the expression is specified in a dictionary and not in the command line).
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
![]() |
![]() |
![]() |
Tags |
funkysetfields, swak4foam |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] how to use funkySetFields function in muliregion case | bryant_k | OpenFOAM Community Contributions | 15 | October 15, 2021 03:50 |
On body-fitted cartesian mesh generation | sbaffini | Main CFD Forum | 0 | October 21, 2016 11:32 |
polar and cartesian coordinates. | Afaraj | FLUENT | 0 | November 21, 2015 12:07 |
Shear stress distribution from cartesian to polar coordinates | Dawood Al-Mosuli | FLUENT | 0 | January 6, 2015 19:11 |
Difficulty In Setting Boundary Conditions | Moinul Haque | CFX | 4 | November 25, 2014 18:30 |