CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] funkysetfields

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 9, 2019, 02:19
Default funkysetfields
  #1
Member
 
Sam
Join Date: May 2019
Posts: 64
Rep Power: 7
saj216 is on a distinguished road
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
saj216 is offline   Reply With Quote

Old   December 9, 2019, 03:17
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,752
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
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?
LuckyTran is offline   Reply With Quote

Old   December 9, 2019, 03:28
Default
  #3
Member
 
Sam
Join Date: May 2019
Posts: 64
Rep Power: 7
saj216 is on a distinguished road
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
saj216 is offline   Reply With Quote

Old   December 9, 2019, 03:41
Default
  #4
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,752
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
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.
LuckyTran is offline   Reply With Quote

Old   December 9, 2019, 04:05
Default
  #5
Member
 
Sam
Join Date: May 2019
Posts: 64
Rep Power: 7
saj216 is on a distinguished road
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.
saj216 is offline   Reply With Quote

Old   December 9, 2019, 05:02
Default
  #6
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,752
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
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.
LuckyTran is offline   Reply With Quote

Old   January 3, 2020, 15:29
Default
  #7
Member
 
FaRa
Join Date: Jul 2019
Posts: 33
Rep Power: 7
Fahmida is on a distinguished road
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;
        }
		
   
);
Fahmida is offline   Reply With Quote

Reply

Tags
funkysetfield, funkysetfields, swak4foam


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 01:30.