CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Creating circular shape through programming

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 9, 2012, 14:20
Default Creating circular shape through programming
  #1
New Member
 
Lokesh Agarwal
Join Date: Feb 2012
Posts: 6
Rep Power: 14
lokeshagarwal.vitian is on a distinguished road
Hello Everyone,

I want to create a circle with help of programming for computation.
I tried by equation of circle but i am not able to compute with the entire circle.

Can i get guidance on how to create circle and then compute around it

Thank you
lokeshagarwal.vitian is offline   Reply With Quote

Old   June 10, 2012, 03:18
Default
  #2
Senior Member
 
ztdep's Avatar
 
p ding
Join Date: Mar 2009
Posts: 427
Rep Power: 19
ztdep is on a distinguished road
Send a message via Yahoo to ztdep Send a message via Skype™ to ztdep
I can not catch what is the problem?
could you please detail it.
create a circle for what? grid generation?
ztdep is offline   Reply With Quote

Old   June 11, 2012, 12:47
Default
  #3
New Member
 
Lokesh Agarwal
Join Date: Feb 2012
Posts: 6
Rep Power: 14
lokeshagarwal.vitian is on a distinguished road
Yes, for grid generation and then computing in that points
lokeshagarwal.vitian is offline   Reply With Quote

Old   June 11, 2012, 19:52
Default
  #4
Senior Member
 
ztdep's Avatar
 
p ding
Join Date: Mar 2009
Posts: 427
Rep Power: 19
ztdep is on a distinguished road
Send a message via Yahoo to ztdep Send a message via Skype™ to ztdep
try gmesh
http://geuz.org/gmsh/
ztdep is offline   Reply With Quote

Old   June 13, 2012, 13:50
Default
  #5
New Member
 
Lokesh Agarwal
Join Date: Feb 2012
Posts: 6
Rep Power: 14
lokeshagarwal.vitian is on a distinguished road
Thank you sir,
But gmesh is the software, i wanted to write my own C code to generate circle and then compute
lokeshagarwal.vitian is offline   Reply With Quote

Old   June 13, 2012, 18:54
Default
  #6
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20
cfdnewbie is on a distinguished road
I guess you need to state your problem more clearly before we can try to help!
cfdnewbie is offline   Reply With Quote

Old   June 13, 2012, 19:29
Default
  #7
Senior Member
 
ztdep's Avatar
 
p ding
Join Date: Mar 2009
Posts: 427
Rep Power: 19
ztdep is on a distinguished road
Send a message via Yahoo to ztdep Send a message via Skype™ to ztdep
Quote:
Originally Posted by lokeshagarwal.vitian View Post
Thank you sir,
But gmesh is the software, i wanted to write my own C code to generate circle and then compute
OK, then, you can choose the polar coordinate system. http://en.wikipedia.org/wiki/Polar_coordinate_system
if you try to generate the unstructured grid, try find some free procedure on this page
http://people.sc.fsu.edu/~jburkardt/...c/cpp_src.html
hope this help you
ztdep is offline   Reply With Quote

Old   June 15, 2012, 13:07
Default
  #8
New Member
 
Lokesh Agarwal
Join Date: Feb 2012
Posts: 6
Rep Power: 14
lokeshagarwal.vitian is on a distinguished road
Quote:
Originally Posted by cfdnewbie View Post
I guess you need to state your problem more clearly before we can try to help!
Sir, I am trying to make my own C code to examine the flow over a cylinder and for the same i need to create a circle and then compute around it i.e, solve momentum and continuity equation.
lokeshagarwal.vitian is offline   Reply With Quote

Old   June 15, 2012, 15:18
Default
  #9
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20
cfdnewbie is on a distinguished road
So is your problem related to the meshing of the geometry, or to the solution of the associated PDEs?
cfdnewbie is offline   Reply With Quote

Old   June 15, 2012, 23:45
Default
  #10
Senior Member
 
Martin Hegedus
Join Date: Feb 2011
Posts: 500
Rep Power: 19
Martin Hegedus is on a distinguished road
?

Is the answer as simple as this:
x = r*cos(theta)
y = r*sin(theta)

It seems that way.
Martin Hegedus is offline   Reply With Quote

Old   June 16, 2012, 06:46
Default
  #11
New Member
 
Lokesh Agarwal
Join Date: Feb 2012
Posts: 6
Rep Power: 14
lokeshagarwal.vitian is on a distinguished road
Quote:
Originally Posted by cfdnewbie View Post
So is your problem related to the meshing of the geometry, or to the solution of the associated PDEs?
Sir,I am facing problem with the geometry itself. If i am able to make geometry then i can think of computing in that.
lokeshagarwal.vitian is offline   Reply With Quote

Old   June 16, 2012, 07:30
Default
  #12
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20
cfdnewbie is on a distinguished road
Quote:
Originally Posted by Martin Hegedus View Post
?

Is the answer as simple as this:
x = r*cos(theta)
y = r*sin(theta)

It seems that way.
It seems to me as well....however, if that's truly the question, the guy has a very long and stony way to go before he can solve the NS equations....



Quote:
Sir,I am facing problem with the geometry itself. If i am able to make geometry then i can think of computing in that.
Yes, but what exactly is your problem? It can't be how to describe/draw a circle in a programming language.... can it??? If that's the case, then writing a code to solve the NS equations is way too ambitious for you.....

So please restate your problem and show us the steps you have taken to solve it, then we might help. just restating "I have a problem" won't enable us to help you!
cfdnewbie is offline   Reply With Quote

Old   June 16, 2012, 07:31
Default
  #13
Senior Member
 
Ford Prefect's Avatar
 
Join Date: Mar 2009
Posts: 157
Rep Power: 17
Ford Prefect is on a distinguished road
Quote:
Originally Posted by lokeshagarwal.vitian View Post
Sir, I am trying to make my own C code to examine the flow over a cylinder and for the same i need to create a circle and then compute around it i.e, solve momentum and continuity equation.
Do you accept a staircase shape of the circle? Then it is really really easy to create. I have a simple code that reads images that can be created in any drawing tool such as Paint or Gimp, using ImageMagick. Creating any object then becomes trivial and needs no change of your code.

If staircase shapes are not allowed then you could use grid transformation or unstructured grid.
__________________
"Trying is the first step to failure." - Homer Simpson
Ford Prefect is offline   Reply With Quote

Old   June 16, 2012, 10:06
Default
  #14
New Member
 
Lokesh Agarwal
Join Date: Feb 2012
Posts: 6
Rep Power: 14
lokeshagarwal.vitian is on a distinguished road
Quote:
Originally Posted by cfdnewbie View Post
It seems to me as well....however, if that's truly the question, the guy has a very long and stony way to go before he can solve the NS equations....





Yes, but what exactly is your problem? It can't be how to describe/draw a circle in a programming language.... can it??? If that's the case, then writing a code to solve the NS equations is way too ambitious for you.....

So please restate your problem and show us the steps you have taken to solve it, then we might help. just restating "I have a problem" won't enable us to help you!
Sir,
I want to create a 2D rectangular unstructured grid with a circle of diameter 0.2 times the smallest side of the rectangle.

The circle is on the center of the rectangular grid

The grid is finer near the circle and coarse away from it.

So, i want to create this grid in x, y coordinate using "for" and other iterative loops in c programming (also using arrays)

After generating grid i will use these grid points to solve NS equations.
lokeshagarwal.vitian is offline   Reply With Quote

Old   June 16, 2012, 10:37
Default
  #15
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20
cfdnewbie is on a distinguished road
Well, how do you want to create the grid? There are many ways to do it. You can use an elliptic solver, triangulate by Delauny.... what type of grid? structured hexas? triads?

I would recommend you do some reading up on grid generation and identify what requirements you have before starting with this...
cfdnewbie is offline   Reply With Quote

Reply

Tags
circle, programming


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
[Commercial meshers] Fluent3DMeshToFoam simvun OpenFOAM Meshing & Mesh Conversion 50 January 19, 2020 16:33
benchmark: flow over a circular cylinder goodegg Main CFD Forum 12 January 22, 2013 12:47
Problem in running ICEM grid in Openfoam Tarak OpenFOAM 6 September 9, 2011 18:51
+ shape circular pipe - meshing possible? Selina Tracy Main CFD Forum 2 January 16, 2003 14:31
CREATING A VERTICAL CIRCULAR PIPE sanjib das sharma CFX 15 August 2, 2001 07:11


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