CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Running the same simulation for many different initial conditions

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 14, 2014, 17:12
Default Running the same simulation for many different initial conditions
  #1
New Member
 
Join Date: Aug 2014
Posts: 8
Rep Power: 0
casesam is on a distinguished road
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!
casesam is offline   Reply With Quote

Old   August 14, 2014, 18:02
Default
  #2
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
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 15:39. Reason: simplification
chegdan is offline   Reply With Quote

Old   August 24, 2014, 08:22
Default
  #3
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
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.
jherb is offline   Reply With Quote

Old   August 24, 2014, 19:04
Default 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
james.conger is on a distinguished road
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.
james.conger is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
buoyantSimpleFoam and watertank Tobi OpenFOAM Running, Solving & CFD 100 December 18, 2022 08:15
problem with Min/max rho tH3f0rC3 OpenFOAM 8 July 31, 2019 09:48
a problem with convergence in buoyantSimpleFoam skuznet OpenFOAM Running, Solving & CFD 6 November 15, 2017 12:12
SLTS+rhoPisoFoam: what is rDeltaT??? nileshjrane OpenFOAM Running, Solving & CFD 4 February 25, 2013 04:13
Negative value of k causing simulation to stop velan OpenFOAM Running, Solving & CFD 1 October 17, 2008 05:36


All times are GMT -4. The time now is 19:45.