CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Gmsh] Editing .geo file to be used with DAKOTA! (https://www.cfd-online.com/Forums/openfoam-meshing/188693-editing-geo-file-used-dakota.html)

CFD-Lover June 4, 2017 23:14

Editing .geo file to be used with DAKOTA!
 
Hi,

I am following some examples on how to couple DAKOTA with OpenFoam. The examples were created by Wolf-Dynamics. I have noticed that most of the examples deal with SnappyHEX mesh only. However, I have come to a mesh that is created with gmsh. The mesh has one design variable that I wish to be changed through the optimization process. For instance,
Code:

D = 5; // Diameter
h = 0.1*D; //
Theta = 4;//

All, I want it to know is a way to tell gmsh or .geo to change the variable Theta to {x1}, so it can then match the design variables in the dakota.in file and create a new mesh. I am hoping to find easy way similar to that when openscas used to manipulate the stl files.

Thanks in advance for you kind help.

Regards,

CFD-Lover June 5, 2017 01:33

Ok.

I put the geo file in the templatedir and named it geo.template putting theta={x1}. In the simulator_script file, I used;

Code:

dprepro $1 geo.template geo.in
I have noticed that the x1 has changed to the corresponding value in the Dakota input file. However, the dprepro manipulated some other points in the new geo file, causing an issue when I wanted to re-mesh it with the new value due to having points in the following format;

Code:

Point(1) = {-7.5*D, 10*D, 0, 0};
Point(2) = {12.5*D, 10*D, 0, 0};

I want to tell dprepro tool to avoid manipulating these points that have the curly brackets. Is there any way to do that?
Best,

CFD-Lover June 5, 2017 02:05

Alright, the problem is solved by simply changing the dprepro file to the following :D;

Code:

# default delimiters are curly braces { }
my $ld = "\{";
my $rd = "\}";

to

Code:

# default delimiters are curly braces { }
my $ld = "\{{";
my $rd = "\}}";

I hope someone else find it helpful.

Best,

edwinrajeev April 29, 2020 01:32

Regarding the .geo file and the dprepo
 
Hi I came across this post and this is the only one of the kind. Could you possibly upload the case setup directory if you still probably have it?

I was facing issues doing this and for some reason the .geo file is not being modified.

Thanks in advance

edwinrajeev April 29, 2020 11:23

Solved it
 
wrote a python code to modify the gmsh file. and dprepo modified the the variable within the python code.


All times are GMT -4. The time now is 01:33.