|
[Sponsors] |
April 24, 2020, 20:46 |
Different results using python vs shell
|
#1 |
Senior Member
Josh McCraney
Join Date: Jun 2018
Posts: 220
Rep Power: 8 |
Hi FOAMers!
Liquid is sucked of a tank, where the velocity at this outlet (suction point) is controlled by a python script. The script changes the entire 4th line below to a different number Code:
outlet { type fixedValue; value uniform (0 -2.6254593e-03 0); } THIS IS THE WEIRD PART: after running through bash, when I re-run through python, the volumetric flow rate is perfect. WHAT'S EVEN WEIRDER is after it works fine, if I copy the entire work file and run it again, the same error occurs. Anyone have any experience with this? Very confusing for me. |
|
April 25, 2020, 12:52 |
|
#2 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12 |
have you checked how many decimals were dumped by python and bash separately. should be some syntax error.
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
April 25, 2020, 12:56 |
|
#3 | |
Senior Member
Josh McCraney
Join Date: Jun 2018
Posts: 220
Rep Power: 8 |
Quote:
But is this the reason? I copy exactly what the python script writes and I get good results. The odd thing is, after I run it through bash, when I rerun through Python it works fine, and it still pastes over whatever I hardcoded (though it's the same). |
||
April 26, 2020, 21:11 |
|
#4 |
Senior Member
Josh McCraney
Join Date: Jun 2018
Posts: 220
Rep Power: 8 |
UPDATE: the solution was given here. To summarize, disc operations, like reading and writing, can take a very long time compared to the operation of the program, and they run independently of the thread of your program. The solution here is to invoke Popen.wait.
Thanks for the interest! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error Interpolating Results onto New Mesh | nammeh | CFX | 1 | March 26, 2019 12:08 |
How to get Python Shell into ParaView 3.8.1? | blaise | OpenFOAM Installation | 3 | July 24, 2012 04:58 |
shell conduction | ezabille | FLUENT | 2 | December 15, 2010 17:42 |
ParaView 33 Python Shell error and fix | mschoenberg | OpenFOAM Bugs | 1 | August 21, 2008 04:43 |
[OpenFOAM] ParaView 33 Python Shell error | mschoenberg | ParaView | 2 | August 20, 2008 10:42 |