CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Help with running many cases of OF to generate training data for machine learning

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 12, 2019, 01:34
Default Help with running many cases of OF to generate training data for machine learning
  #1
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 400
Rep Power: 19
quarkz is on a distinguished road
Hi,

I need to generate many cases of OF to generate training data for machine learning. I need to vary the input conditions such as p, U and T. Is there anyway I can do this more or less automatically?

For e.g. U from 20 to 100 in intervals of 5, p ...., T ...

I found that there's an addon call PyFoam which seems to be able to do what I want, but it seems to work for OF v2x. Does anyone know if it works for newer OF versions?

Thanks!
quarkz is offline   Reply With Quote

Old   September 12, 2019, 07:35
Default
  #2
Senior Member
 
Carlo_P
Join Date: May 2019
Location: Italy
Posts: 176
Rep Power: 7
Carlo_P is on a distinguished road
Hey,
you can use two way.
The first way is to use pyFoamCleanBoundiary file patch value to change the value in the file. (I'm not sure about the name, check the correct spelling)
For example, if you want to Inlet velocity to 0.001, you have to write pyFoamCleanBoundiary 0/U Inlet 0.001


Another way is to store somewhere a file with partcilolar key word, instead of number.
Such as, in the U file,


value velocity ;


and then run a bash or python or C file with a for cicle that copy the file in you folder and change the keyword velocity with your desidered value.


Example in shell

for i velocity1 velocity2 velocity3

do
cp directory/U directory/0/U
sed "../velocity/velocit1" 0/U

done


very raw description..
If you have more questions, feel free to ask.
Cheers,
Carlo
Carlo_P is offline   Reply With Quote

Old   September 12, 2019, 07:39
Default
  #3
Senior Member
 
Carlo_P
Join Date: May 2019
Location: Italy
Posts: 176
Rep Power: 7
Carlo_P is on a distinguished road
pyFoamClearBoundaryValue.py


pyFoamClearBoundaryValue.py -help
Usage
=====
pyFoamClearBoundaryValue.py [options] <fieldfile> <patchnames>

Takes a field-file and makes the whole internal field uniform. Either taking
the value from a patch or using a user-specified value
Carlo_P is offline   Reply With Quote

Old   September 12, 2019, 07:40
Default
  #4
Senior Member
 
Carlo_P
Join Date: May 2019
Location: Italy
Posts: 176
Rep Power: 7
Carlo_P is on a distinguished road
sed -i "s/massValue/$i/g" 0/U


the correct way to run sed in bash
Carlo_P is offline   Reply With Quote

Old   September 12, 2019, 08:01
Default
  #5
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 400
Rep Power: 19
quarkz is on a distinguished road
Hi Carlo_P, thanks for the info! I'll give it a try.
quarkz 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
OpenFOAM Training Jan-Jul 2017, Virtual, London, Houston, Berlin CFDFoundation OpenFOAM Announcements from Other Sources 0 January 4, 2017 06:15
OpenFOAM Training Jan-Apr 2017, Virtual, London, Houston, Berlin cfd.direct OpenFOAM Announcements from Other Sources 0 September 21, 2016 11:50
OpenFOAM Training, London, Chicago, Munich, Houston 2016-2017 cfd.direct OpenFOAM Announcements from Other Sources 0 September 14, 2016 03:19
OpenFOAM Training Pilot Sessions June 2015 cfd.direct OpenFOAM Announcements from Other Sources 0 April 8, 2015 17:26


All times are GMT -4. The time now is 16:36.