Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran mesh 2d

  1. Apr 28, 2010 #1
    What I need is a 2d mesh,user specified.I have find some solutions on net but still have problems compiling.Anyone knows wheret o find more?
  2. jcsd
  3. Apr 28, 2010 #2


    User Avatar
    Science Advisor

    What do you mean 2D mesh?
  4. Apr 28, 2010 #3
    I mean 2dimensions grid,where I can set the parameters.
  5. Apr 29, 2010 #4


    User Avatar
    Science Advisor

    You mean 2D means 2 dimensions!?!? In all honesty, you're vagueness is epic.
    Code (Text):

    integer :: ni,nj,i,j
    real,dimension(:,:),allocatable :: x,y
    real :: dx,dy,xc,yc

    !--Set parameters
    ni = 10  !--number of points in the x-direction
    nj = 10  !--number of points in the y-direction
    dx = 0.1 !--grid spacing in the x-direction
    dy = 0.1 !--grid spacing in the y-direction
    allocate( x(ni,nj),y(ni,nj) )

    xc = 0.0
    yc = 0.0
    DO i=1,ni
      DO j=1,nj
        x(i,j) = xc
        y(i,j) = yc
        xc = xc + dx
      END DO
      yc = yc + dy
      xc = 0.0
    END DO

    That's my idea of a simple orthogonal 2D mesh.
  6. Apr 29, 2010 #5
    Thanks for the answer.
    Oh,yes I am deliberately vague.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook