CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Special Topics > Mesh Generation & Pre-Processing

Cylinder mesh in Fortran

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 22, 2022, 21:07
Smile Cylinder mesh in Fortran
  #1
Member
 
Niyas
Join Date: Apr 2013
Posts: 44
Rep Power: 13
niyas is on a distinguished road
Hello everyone,
I am trying to create a simple cylinder mesh using Fortran (see the attached figure) and I think I did.
I want to make sure the cylindrical mesh I produced is correct and that is why I am here.
Please check and let me know if there are any changes.

Here is the code:

Code:
program cylinder_Grid
      parameter (mmx=601,nmx=21,omx=601)
      common/contr0/m,n,next,o
      common/coord /x(mmx,nmx,omx),y(mmx,nmx,omx),z(mmx,nmx,omx)

      m = 151; o = 11; n = 101
      dxy = 1.d0; rad = 1.d0

      dx = 3.d0/dble(m-1)
      dy = 0.2d0/dble(o-1)
      dz = 1.3d0/dble(n-1)      

      do k=1,n
      do j=1,o
      do i=1,m 
            ang      = 0.4*(i-1)
            x(i,j,k) = dx*dble(rad*cos(ang)) 
            y(i,j,k) = dy*dble(rad*sin(ang)) 
            z(i,j,k) = dz*dble(k-1)        
      enddo
      enddo
      enddo 
      
      print*,'z_end=',z(1,1,n)
      
      open(2,file='cylinder.grd',status='unknown')
      write(2,*) 'variables = x y z'
      write(2,*) 'zone t="", i=',m,'  j=',o,'  k=',n

      do k=1,n
      do j=1,o
      do i=1,m
        write(2,*) x(i,j,k), y(i,j,k), z(i,j,k)
      enddo
      enddo
      enddo

      close(2)

      stop
      end program cylinder_Grid
__________________
Regards,
Niyas
niyas is offline   Reply With Quote

Reply

Tags
cylinder mesh, fortran 77, mesh

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
[snappyHexMesh] non uniform mesh near the stl object vava10 OpenFOAM Meshing & Mesh Conversion 0 January 31, 2021 14:41
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 06:09
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 18:57
Forces Acting on a Rotating Cylinder (Moving Mesh) dreamchaser CFX 5 April 25, 2015 06:01
CFX11 + Fortran compiler ? Mohan CFX 20 March 30, 2011 18:56


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