|
[Sponsors] |
December 9, 2019, 02:19 |
funkysetfields
|
#1 |
Member
Sam
Join Date: May 2019
Posts: 64
Rep Power: 7 |
Could someone explain the difference between how funkysetfields operates and setfields work.
I need to use funkysetfields due to its adaptability however it is causing issues running the simulation at the beginning. Such as --> FOAM FATAL IO ERROR: wrong token type - expected Scalar, found on line 0 the word 'nan' file: /home/joseph/OpenFOAM/joseph-2.4.0/run/CFD-PC-master/CFD-PC/interThermalPhaseFoam/tutorials/VapourGrowthWithoutLayer/system/data.solverPerformance.p_rgh at line 0. From function operator>>(Istream&, Scalar&) in file lnInclude/Scalar.C at line 93. However this is not the case for setFieldsDict. My simulation is for a growing bubble. My funkysetfieldsdict is alpha1.org { field alpha1; expression "0"; condition "pow(pos().x-0,2) + pow(pos().y-0,2) < pow((0.1E-3),2)"; keepPatches true; } BubbleTemp { field T; expression "373.15"; condition "pow(pos().x-0,2) + pow(pos().y-0,2) < pow((0.1E-3),2)"; keepPatches true; } Whereas the simulation works for setFieldsDict with this configuration defaultFieldValues ( volScalarFieldValue alpha.water 1 ); regions ( sphereToCell { centre (0.0025 0.0025 0.001); radius 0.0005; fieldValues ( volScalarFieldValue alpha.water 0 ); } ); Please let me know if anyone has any ideas. Thanks |
|
December 9, 2019, 03:17 |
|
#2 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66 |
1) Follow the right format for the funkySetFieldsDict. There should be a list of dictionaries named expression (unless it has changed for v2.4, I honestly can't recall).
2) funkySetFields (and setFields) are their own utility. You run them by running setFields and funkySetFields standalone before running the solver (e.g. interThermalPhaseFoam). What does it mean run them during the simulation...? You don't do that. Does the error occur when running setFields, funkySetFields, or interThermalPhaseFoam? |
|
December 9, 2019, 03:28 |
|
#3 |
Member
Sam
Join Date: May 2019
Posts: 64
Rep Power: 7 |
Thank you for the response
I have put the configuration of funkysetfields in a funkysetfieldsdict file in the normal expressions format when using the simulation (this was just a shortcut). When I look at the simulation at the beginning, the setup is as I require. I know that setfields and funkysetfields are different and you only initialise with one. My query was that using funkysetfields for a bubble causes my simulation to immediately crash with the previously stated error notification. However, when I use a similar configuration for a bubble using setfields it operates fine with the same boundary conditions. My question is do you know why this is the case because I need to use funkysetfields for more complex simulations. This occurrence does not change even when I change boundary conditions. The error occurs when running interThermalPhasechangeFoam |
|
December 9, 2019, 03:41 |
|
#4 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66 |
So what you're saying is... funkySetFields ran without errors?
You have an IO error. You solver is reading a dictionary, expecting a scalar (numbers) and instead it finds nan words. Check the fields that were modified by funkySetFields (alpha1 and T). Probably, there are a bunch of nan's where some wonky extrpolation happened, or (more likely) it may be on the boundaryFields have been screwed up. If so, you need to fix your boundary fields by editing them, running setFields, or running funkySetBoundary. |
|
December 9, 2019, 04:05 |
|
#5 |
Member
Sam
Join Date: May 2019
Posts: 64
Rep Power: 7 |
Yeah it does, the issue is when the solver begins.
Time = 0 Using funkySetFieldsDict Part: alpha1.org Modifying field alpha1 of type volScalarField Putting "0" into field alpha1 at t = "0" if condition "pow(pos().x-0,2) + pow(pos().y-0,2) < pow((0.1E-3),2)" is true Keeping patches unaltered Setting 7866 of 640000 cells Writing to "alpha1" Part: BubbleTemp Modifying field T of type volScalarField Putting "373.15" into field T at t = "0" if condition "pow(pos().x-0,2) + pow(pos().y-0,2) < pow((0.1E-3),2)" is true Keeping patches unaltered Setting 7866 of 640000 cells Writing to "T" End Sorry I am still quite new to OF so how do I effectively do that. If there was errors in the boundaries wouldn't that mean that setfields would have the same issues Thanks for your help. |
|
December 9, 2019, 05:02 |
|
#6 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66 |
That's very odd (to me) that setFields is being called within the time loop. But I'm also not familiar with this specific solver interThermalPhaseFoam.
Are you initializing your fields every time you run your simulation? Again, open up the variables... inspect them... before running your solver and after running your solver (now that it's already broken). When you call setFields and/or funkySetFields and it messes up your fields (and put's nan's everywhere), the corrupted ones will be saved. This means... If you don't re-initialize them, they'll stay corrupted. So you can do the right thing a million times and keep getting errors. If you are re-initializing your fields, then inspect them before and after the setFields and funkySetFields are called. Are there nan's? I noticed that the "Keeping patches unaltered" is appearing which means the patches are being ignored properly by funkySetFields. So if you find NAN's in the boundaryFields, then you screwed up something already. If you find NAN's in the volumeScalarField, then there's another issue. In case it hasn't been clear up to now... There are NAN's in your fields and that's why openfoam is complaining. Find your nan's!!!!!!!!!!!!!! Do not reply unless you've found them. Go into your 0 dir, open the alpha1 dict (with your favorite text editor) and open the T dict. Find the nan's. funkySetFields is part a swak utility. It's a completely different utility than setFields and you shouldn't even think for a single momemt that their behavior is any close to being similar. The fact that funkySetFields bears the name SetFields is not important. If it helps, you think rename funkySetFields to scriptWrittenbyHeathens. |
|
January 3, 2020, 15:29 |
|
#7 |
Member
FaRa
Join Date: Jul 2019
Posts: 33
Rep Power: 7 |
You can try this. I am not sure if this works.
Code:
expressions ( defaultAlpha1 { field alpha1; expression "1"; keepPatches true; } defaultTemp { field T; expression "373.15"; keepPatches true; } bubbleAlpha1 { field alpha1; expression "0"; condition "pow(pos().x-0,2) + pow(pos().y-0,2) < pow((0.1E-3),2)"; keepPatches true; } bubbleTemp { field T; expression "373.15"; condition "pow(pos().x-0,2) + pow(pos().y-0,2) < pow((0.1E-3),2)"; keepPatches true; } ); |
|
Tags |
funkysetfield, funkysetfields, swak4foam |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] groovyBC and funkySetFields married and got a kid named swak4Foam | gschaider | OpenFOAM Community Contributions | 169 | August 10, 2023 10:01 |
[swak4Foam] how to use funkySetFields function in muliregion case | bryant_k | OpenFOAM Community Contributions | 15 | October 15, 2021 03:50 |
[swak4Foam] funkySetFields and funkySetBoundaryFields | zxj160 | OpenFOAM Community Contributions | 19 | February 14, 2018 20:07 |
[swak4Foam] Ellipsoid Particles using funkySetFields | beatsy | OpenFOAM Community Contributions | 0 | March 24, 2017 13:31 |
[swak4Foam] funkySetFields: problem with processor boundary | nmikhailov | OpenFOAM Community Contributions | 4 | May 26, 2015 10:48 |