|
[Sponsors] |
February 25, 2020, 06:59 |
Position dependent field function
|
#1 |
New Member
Victor Nieto
Join Date: Feb 2020
Posts: 3
Rep Power: 6 |
Greetings forum,
I am somewhat new to this field of CFD and I wanted to consult with some experts to see if I can get some help. I am running a simulation of a porous wall for a casting process (at the moment just the air escaping from the cavity through the beforementioned porous wall). I am using the Porous media model. I ran my first simulation with a constant viscous and inertial porous resistance, and the results where according to expected. Now I am trying to run a simulation with a wall with three regions with different permeability, in order to do that I am considering a field function that changes with the geometry of the wall section. The wall thickness is t=10 mm (0.01 m) and I am considering three regions: the outer region is from 0 to 0.003, 0.003 to 0.009 and 0.009 to 0.01 m (the values correspond to the viscous resistance at each region). ($${Position}[0]<= 0.003)?1e2 : ( ($${Position}[0]> 0.003 && $${Position}[0]<=0.009)? 1e4: ( ($${Position}[0]> 0.009)?1e5: My problem is that the syntax does not seem to work, are there any recommendations or mistakes in my code? Thank you very much for your comments or suggestions Best regards VN |
|
February 25, 2020, 10:23 |
|
#2 |
Senior Member
Matt
Join Date: Aug 2014
Posts: 947
Rep Power: 18 |
To be clear, you want porous resistance coefficients to vary with position?
For the problem you have described, it is probably easier to just split your porous region into 3 separate bodies based on the datums you defined and then assign constants to each region separately. However, this is an interesting question and I am curious how one might go about doing this so I will play around and see if I can figure it out. Hopefully, someone else has already tried something similar and can offer better advice. |
|
February 25, 2020, 10:31 |
|
#3 | |
New Member
Victor Nieto
Join Date: Feb 2020
Posts: 3
Rep Power: 6 |
Quote:
Greetings, Yes my idea is to vary the porous resistance coefficients with position, just now I tried sepeartion the porours regions into different regions and as you suggested it worked. However I am also still curious if my initial approach will work, Thank you for your suggestion. Best regards Victor Nieto |
||
February 25, 2020, 14:07 |
|
#4 |
Senior Member
Matt
Join Date: Aug 2014
Posts: 947
Rep Power: 18 |
Ok, this is actually very easy. It looks like you just have some syntax errors. Specifically, unclosed parentheses and an extra ternary statement that you don't need nor do you close properly. Try this, it should work...
($$Position[0] <= 0.003) ? 100 : ($$Position[0] > 0.003 && $$Position[0] <= 0.009) ? 10000 : 100000 Edit: I have attached an image that might help you see how the statement is constructed. Apologies if you are colorblind. Last edited by fluid23; February 25, 2020 at 14:22. Reason: Added Image |
|
February 26, 2020, 08:06 |
|
#5 |
Senior Member
Sebastian Engel
Join Date: Jun 2011
Location: Germany
Posts: 567
Rep Power: 21 |
Hi Victor,
after you have understood Matt's answer, you might become aware, that the $$Position[0] > 0.003 in the elseif part becomes redundant, because all points which are not smaller than 0.003 ($$Position[0] <= 0.003) must be larger. Though i am sure Matt left this out, so it is easier for you to retrace your initial misunderstanding. So your initial logic construct can be reduced to: ($$Position[0] <= 0.003) ? 100 : ($$Position[0] <= 0.009) ? 10000 : 100000 If your wall domain is relatively small to the rest of the domain (in terms of number of elements in that direction), you might reverse the logical relation, to get a (very) marginal improvement on simulation speed. If most of your domain is above 0.009, then right now, the sim needs to check two if statements. Only for the presumably small wall region, the simulations checks one statement only. I'd write it like this: ($$Position[0] > 0.009) ? 100000 : ($$Position[0] > 0.003 ) ? 10000 : 100 In the majority, one statement check returns the 100000. Only for the wall zone, a second if statement needs to be checked. |
|
February 26, 2020, 08:43 |
|
#6 | |
New Member
Victor Nieto
Join Date: Feb 2020
Posts: 3
Rep Power: 6 |
Thank you, I ran the simulation and everything went smoothly. I realized the mistakes on the syntax and now I understand why it wasn´t working
best regards VN Quote:
|
||
Tags |
field functions, porous media, syntax error |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
whats the cause of error? | immortality | OpenFOAM Running, Solving & CFD | 13 | March 24, 2021 08:15 |
[mesh manipulation] refineMesh Error | mohsen.boojari | OpenFOAM Meshing & Mesh Conversion | 3 | March 1, 2018 23:07 |
''unknown radialModelType type Gidaspow'' PROBLEM WITH THE BED TUTORIAL | AndoniBM | OpenFOAM Running, Solving & CFD | 2 | March 25, 2015 19:44 |
NEED HELP for position field function!! | EnronZhang | STAR-CCM+ | 6 | October 26, 2012 17:30 |
Problem with compile the setParabolicInlet | ivanyao | OpenFOAM Running, Solving & CFD | 6 | September 5, 2008 21:50 |