|
[Sponsors] |
September 9, 2008, 05:48 |
How to define these patches
|
#1 |
Senior Member
|
Dear all,
First thank you for your attention. I want to name the circle patches as "circle1","circle2",.... I write the following code: ----------------------- For t In {1:101} char add= (char) t; Physical Surface(StrCat("circle",add)) = {e1[8+4*t]:e1[11+4*t]} ; EndFor ----------------------- When it is loaded, I get: problem 1. add: unknown variable, problem 2. I visualize the patch, and I could only get one patch named "circleadd", NOT "circle1". If some of you have this experience, would you please give me any suggestions? Thank you very much. Bin |
|
September 9, 2008, 08:50 |
Have a look at the BNS syntax
|
#2 |
Member
Martin Aunskjaer
Join Date: Mar 2009
Location: Denmark
Posts: 53
Rep Power: 17 |
Have a look at the BNS syntax of character expressions in Gmsh in section 2.1.2. It does not support a declaration like your 2nd line.
One suggestion is to simply replace what your are trying to do (convert t to a char and concatenate it with the string "circle") with the Sprintf() function. Have a look at the tutorial t8.geo in section 7.8 of the manual for an example of how this is done. |
|
September 11, 2008, 03:20 |
Dear Martin,
As you said, i
|
#3 |
Senior Member
|
Dear Martin,
As you said, it works now with the function "Sprintf()". Thank you. Best regards, Bin |
|
September 12, 2008, 07:45 |
Dear Martin and other friends,
|
#4 |
Senior Member
|
Dear Martin and other friends,
When I want to define the boundary condition for my circles in the file 0/U, for an example, I tried many ways, but failed: // for (int t=1;t<=101;t++) // { // Sprintf("circle%g", t) // "circle".merge(1:101); // "circle".push_back(1) // circle.merge(1) "circle".append(1) { type slip; } // } I write here, just to see if some one knows how to define those patches: circle1, circle2, ... Not by hand. Otherwise it is a lot of work. Thank you for your attention. Bin |
|
September 12, 2008, 09:11 |
You are again using a syntax n
|
#5 |
Member
Martin Aunskjaer
Join Date: Mar 2009
Location: Denmark
Posts: 53
Rep Power: 17 |
You are again using a syntax not recognized by Gmsh. For instance, the C++ string push_back() function for appending characters to a string is unknown to the Gmsh parser.
To name your circle patches it should be possible to get through it using the Sprintf() function provided by Gmsh, though I haven't tried. |
|
September 12, 2008, 09:17 |
Ok, I see you have another pos
|
#6 |
Member
Martin Aunskjaer
Join Date: Mar 2009
Location: Denmark
Posts: 53
Rep Power: 17 |
Ok, I see you have another post about the same problem and have received some hlp there:
http://www.cfd-online.com/OpenFOAM_D...es/1/8536.html |
|
September 15, 2008, 08:52 |
Hi Martin,
This problem is
|
#7 |
Senior Member
|
Hi Martin,
This problem is solved in the file 0/U and 0/p as the suggestions in the link. I am implementing my boundary for those circles now, and I am sure to finish them soon. Thank you. Bin |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hydrogen storage by metal hydride | longbk | FLUENT | 12 | August 1, 2023 20:13 |
HELP----Surface Reaction UDF | Ashi | Fluent UDF and Scheme Programming | 1 | May 19, 2020 21:13 |
[mesh manipulation] Problem with using createPatchDict to define cyclic boundaries | kaszt | OpenFOAM Meshing & Mesh Conversion | 0 | April 1, 2016 21:18 |
UDF error for Heat Generation | mame | Fluent UDF and Scheme Programming | 4 | March 3, 2016 04:22 |
How to define patches after gmshToFoam ? | seb_j | OpenFOAM | 8 | July 13, 2011 09:25 |