|
[Sponsors] |
Running the same simulation for many different initial conditions |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 14, 2014, 18:12 |
Running the same simulation for many different initial conditions
|
#1 |
New Member
Join Date: Aug 2014
Posts: 8
Rep Power: 0 |
Hello all,
I am just learning how to use OF and would like a little guidance on how to proceed. Essentially what I want to do is calculate the mass flow rate through a pipe system (one inlet, one outlet) for many different pressures at the inlet. The flow is incompressible, and laminar, and I only care about the steady state. I would like to do this for the exact same system but possibly hundreds of different pressure values at the inlet. My thoughts on how to do this have been to write a script that will go into the 0/p file and change the pressure at the inlet, then re-solve, write the mass flow rate to a file and repeat for a different pressure. Another thought was to have some sort of time-dependent boundary pressure condition that would increase the pressure at the inlet every 5 seconds (or something) and write the mass flow rate every 4.9 seconds. Ideally it would be nice to be able to specify the inlet pressure at the command line; something like simpleFoam -inletP 5 would run the simulation with a pressure of 5 at the inlet, but I have not seen anything like this in my searches. Its very possible I am missing some obvious tool, it seems like many people would want to do this sort of thing. I am essentially gathering the data to create a flow rate vs. pressure plot. Thanks a bunch! |
|
August 14, 2014, 19:02 |
|
#2 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
Casesam,
Welcome to the forum. Now this is one of those cases where less is more in terms of your effort on simulations. If you have no optimization that you are doing, then parameter space exploration isn't too difficult with shell scripting is finished and you can go on your way. I would just make is complicated enough to do the job but don't overdo it. Now if you were actually interested in parameter space exploration and some optimization (or just a desire to learn another tool) then you can use DAKOTA (dakota.sandia.gov). There is actually a nice set of introductory tutorials to get you started with OpenFOAM + DAKOTA located http://www.dicat.unige.it/guerrero/dakotaof.html And the first one is a parameter space exploration of a case. Unless you want this to be a project where you play around and create your own version of simpleFoam that does what you suggested, then I would try DAKOTA. Good luck and again welcome to the forum! Last edited by chegdan; August 15, 2014 at 16:39. Reason: simplification |
|
August 24, 2014, 09:22 |
|
#3 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
Have a look at http://openfoamwiki.net/index.php/Contrib/PyFoam and http://openfoamwiki.net/index.php/Contrib/swak4Foam
It provides python classes to modify OpenFOAM cases by scripts. |
|
August 24, 2014, 20:04 |
tip on how to change boundary values for a run
|
#4 |
New Member
Jim Conger
Join Date: Jan 2014
Location: California, USA
Posts: 21
Rep Power: 12 |
It took me a while to realize that I could use the same initialization files every time, and change values in the files via macro substitution. The text below is for a situation where the 2D velocity vector was being changed for each run, but you can do the same type of macro substitution for any input value.
--------------- A convenient way to run parameter studies is to put your variables into a separate file and then include them at run time. For example, in the initialization file for velocity (U) you can add the line: #include "velocityValues" Within the velocity initialization file (U) you can reference variables such as $XvelMPS: type fixedValue; value uniform ($XvelMPS, $YvelMPS 0); You then put your parameters for the case in the file "velocityValues" such as (omitting the usual OpenFOAM header) XvelMPS 10.517 YvelMPS 7.3914 #inputMode merge Your parameters are substituted into the U file at run time, so the U file does not need to be edited between cases. Just change the values in the velocityValues file between cases. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
buoyantSimpleFoam and watertank | Tobi | OpenFOAM Running, Solving & CFD | 100 | December 18, 2022 09:15 |
problem with Min/max rho | tH3f0rC3 | OpenFOAM | 8 | July 31, 2019 10:48 |
a problem with convergence in buoyantSimpleFoam | skuznet | OpenFOAM Running, Solving & CFD | 6 | November 15, 2017 13:12 |
SLTS+rhoPisoFoam: what is rDeltaT??? | nileshjrane | OpenFOAM Running, Solving & CFD | 4 | February 25, 2013 05:13 |
Negative value of k causing simulation to stop | velan | OpenFOAM Running, Solving & CFD | 1 | October 17, 2008 06:36 |