CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Gmsh] How to define these patches

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 9, 2008, 05:48
Default How to define these patches
  #1
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
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
zhoubinwx is offline   Reply With Quote

Old   September 9, 2008, 08:50
Default Have a look at the BNS syntax
  #2
Member
 
Martin Aunskjaer
Join Date: Mar 2009
Location: Denmark
Posts: 53
Rep Power: 17
aunola is on a distinguished road
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.
aunola is offline   Reply With Quote

Old   September 11, 2008, 03:20
Default Dear Martin, As you said, i
  #3
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
Dear Martin,

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

Best regards,

Bin
zhoubinwx is offline   Reply With Quote

Old   September 12, 2008, 07:45
Default Dear Martin and other friends,
  #4
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
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
zhoubinwx is offline   Reply With Quote

Old   September 12, 2008, 09:11
Default You are again using a syntax n
  #5
Member
 
Martin Aunskjaer
Join Date: Mar 2009
Location: Denmark
Posts: 53
Rep Power: 17
aunola is on a distinguished road
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 is offline   Reply With Quote

Old   September 12, 2008, 09:17
Default Ok, I see you have another pos
  #6
Member
 
Martin Aunskjaer
Join Date: Mar 2009
Location: Denmark
Posts: 53
Rep Power: 17
aunola is on a distinguished road
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
aunola is offline   Reply With Quote

Old   September 15, 2008, 08:52
Default Hi Martin, This problem is
  #7
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
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
zhoubinwx 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
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


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