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

Parameter Study

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By clapointe

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 10, 2019, 06:52
Default Parameter Study
  #1
New Member
 
Join Date: Jul 2019
Posts: 3
Rep Power: 7
psapercace is on a distinguished road
Hi,
I'm new to Openfoam and wondering how to change parameters automatically after a successful run. I have a pipe with constant inlet velocity which is simulated with SimpleFoam (in laminar mode). I want to increase the Reynolds number (by changing the inlet velocity or the kinematic viscosity) after each successful run with the solver and then rerun the solver and I want to find an automatic way to do that. This is easily done in COMSOL using a parametric sweep, but I'm wondering how it can be done in Openfoam.
psapercace is offline   Reply With Quote

Old   July 10, 2019, 16:16
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
This can be done easily using a bash script. There are many ways to accomplish this, but one possible way in pesudo code :

Code:
for i in ...
cp baseCase case_$i
cd case_$i
sed 0/U (0 $i 0)
Allrun
cd ..
Where you have a (clean) case, call it baseCase, that gets copied some number of times. You then enter the new case directory, use sed to edit a file (in this case 0/U), and then the case can be run using an Allrun script like those used in foam tutorials. So looking into for loops and sed should put you on the right path.

Caelan
Lennart.H likes this.
clapointe is offline   Reply With Quote

Old   July 17, 2019, 12:17
Default
  #3
New Member
 
Join Date: Jul 2019
Posts: 3
Rep Power: 7
psapercace is on a distinguished road
Quote:
Originally Posted by clapointe View Post
This can be done easily using a bash script. There are many ways to accomplish this, but one possible way in pesudo code :

Code:
for i in ...
cp baseCase case_$i
cd case_$i
sed 0/U (0 $i 0)
Allrun
cd ..
Where you have a (clean) case, call it baseCase, that gets copied some number of times. You then enter the new case directory, use sed to edit a file (in this case 0/U), and then the case can be run using an Allrun script like those used in foam tutorials. So looking into for loops and sed should put you on the right path.

Caelan
It worked perfectly. Thanks.
psapercace is offline   Reply With Quote

Old   November 13, 2023, 07:18
Default Use caseFoam/PyFoam
  #4
New Member
 
David von Rüden
Join Date: Oct 2019
Location: Germany
Posts: 6
Rep Power: 7
openFo is on a distinguished road
Hi,
To add to this for future searchers. I would recommend using a tool like PyFoam or better caseFoam (https://github.com/DLR-RY/caseFoam). The latter is designed to do parameter studies. I can highly recommend it.
openFo is offline   Reply With Quote

Reply


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
[Workbench] odd problem of updating parameter study mesh funkvps ANSYS Meshing & Geometry 0 August 17, 2017 12:51
Results from parameter study -mAx- FloEFD, FloWorks & FloTHERM 4 March 4, 2015 05:18
Parametric study and time dependent parameter monitoring Crustulu FLUENT 1 April 12, 2013 06:54
Average of Expressions in Transient Run for Parameter Study BigPapi34 CFX 1 August 7, 2012 06:34
Force can not converge colopolo CFX 13 October 4, 2011 23:03


All times are GMT -4. The time now is 12:05.