CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Open Source Meshers: Gmsh, Netgen, CGNS, ... (http://www.cfd-online.com/Forums/openfoam-meshing-open/)
-   -   How to define these patches (http://www.cfd-online.com/Forums/openfoam-meshing-open/61873-how-define-these-patches.html)

zhoubinwx September 9, 2008 05:48

Dear all, First thank you f
 
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

aunola September 9, 2008 08:50

Have a look at the BNS syntax
 
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.

zhoubinwx September 11, 2008 03:20

Dear Martin, As you said, i
 
Dear Martin,

As you said, it works now with the function "Sprintf()". Thank you.

Best regards,

Bin

zhoubinwx September 12, 2008 07:45

Dear Martin and other friends,
 
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

aunola September 12, 2008 09:11

You are again using a syntax n
 
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.

aunola September 12, 2008 09:17

Ok, I see you have another pos
 
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

zhoubinwx September 15, 2008 08:52

Hi Martin, This problem is
 
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


All times are GMT -4. The time now is 07:24.