|August 14, 2014, 17:12||
Running the same simulation for many different initial conditions
Join Date: Aug 2014
Posts: 3Rep Power: 3
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, 18:02||
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 550Rep Power: 18
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
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 15:39. Reason: simplification
|August 24, 2014, 08:22||
Join Date: Sep 2010
Posts: 300Rep Power: 10
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, 19:04||
tip on how to change boundary values for a run
Join Date: Jan 2014
Location: California, USA
Posts: 18Rep Power: 3
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:
Within the velocity initialization file (U) you can reference variables such as $XvelMPS:
value uniform ($XvelMPS, $YvelMPS 0);
You then put your parameters for the case in the file "velocityValues" such as (omitting the usual OpenFOAM header)
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.
|Thread||Thread Starter||Forum||Replies||Last Post|
|buoyantSimpleFoam and watertank||Tobi||OpenFOAM Running, Solving & CFD||48||December 26, 2014 09:49|
|a problem with convergence in buoyantSimpleFoam||skuznet||OpenFOAM Running, Solving & CFD||5||February 19, 2014 05:30|
|SLTS+rhoPisoFoam: what is rDeltaT???||nileshjrane||OpenFOAM Running, Solving & CFD||4||February 25, 2013 05:13|
|problem with Min/max rho||tH3f0rC3||OpenFOAM||7||February 23, 2013 06:37|
|Negative value of k causing simulation to stop||velan||OpenFOAM Running, Solving & CFD||1||October 17, 2008 05:36|