|
[Sponsors] |
How to change automatically parameters in blockMesh and run a parametric case |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 21, 2023, 12:48 |
How to change automatically parameters in blockMesh and run a parametric case
|
#1 |
New Member
Join Date: Sep 2023
Posts: 2
Rep Power: 0 |
Hello everyone!
I'd like to set an automatic parametric-iterative case changing some parameters in the blockMeshDict. Basically I have a set of geometic parameters on which the mesh depens, what I want to do is to change this parameters and run the simulation automatically. This is a conjugate heat transfer case (liquid-solid) and I want to find the best shape of some component in order the minimize the temperture of the solid. The idea is: 1-generate n sets of geometric parameters; 2-run n simulations changing the n set of parameters; 3-write a file with the results for each case. I'm pretty new to OpenFOAM, python and C++ and I don't know which one is the best approach, I know that some use pyFoam, other use DAKOTA. Can someone suggest a good approch to perform this case or maybe provide a tamplate with a similar case? Thanks ! |
|
September 21, 2023, 18:26 |
|
#2 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14 |
Sounds like a nice idea. The way I'd do it is as follows:
etc. - hopefully you get the idea. You could try run from python, but IMO bash scripts are much simpler to use. Good luck! |
|
September 22, 2023, 10:33 |
|
#3 |
Senior Member
|
||
October 4, 2023, 11:47 |
|
#4 |
New Member
Join Date: Jul 2019
Posts: 2
Rep Power: 0 |
Using .m4 file to make your parametrized blockMesh template would be helpful.
This page contains information of m4 file. https://openfoamwiki.net/index.php/H...ckMesh_with_m4 refer to this page, you can make your own .m4 file And then, modifying only 'value' of define(variable,value) in .m4 file automatically with some code(it can be based on C++, python, etc..) If you successfully editted your .m4 file, command "m4 blockMeshDict.m4 > blockMeshDict;blockMesh" will construct mesh with changed parameters. I hope it would be helpful to find your optimal solution using OpenFOAM. ps. There are some examples on .m4 file in tutorials of foam-extend. Its m4 file is also can be used not only foam-extend but also OpenFOAM, when its boundary conditions are modified properlly. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM benchmarks on various hardware | eric | Hardware | 821 | Yesterday 02:45 |
Displaying OpenFOAM Results Automatically in ParaView through a Single Command | nucerl | OpenFOAM Post-Processing | 0 | December 21, 2022 20:28 |
How to run the 3dTube case in parallel (foam-extend 3.1 with FSI from Zagreb)? | Warlord | OpenFOAM Running, Solving & CFD | 1 | January 27, 2018 15:48 |
Some questions about a multi region case run in parallel | zfaraday | OpenFOAM Running, Solving & CFD | 5 | February 23, 2017 11:25 |
[blockMesh] run BlockMesh in existing case? | xiyuqiu | OpenFOAM Meshing & Mesh Conversion | 0 | February 24, 2011 19:55 |