Fortran Finding 2D Mesh Solutions for User-Specified Needs

  • Thread starter Thread starter Milentije
  • Start date Start date
  • Tags Tags
    2d Mesh
AI Thread Summary
The discussion centers on the creation of a user-specified 2D mesh, specifically a grid in two dimensions where parameters can be set. The original poster expresses difficulty in compiling existing solutions found online. Clarification is sought regarding what constitutes a 2D mesh, leading to a brief exchange about the definition of dimensions. A sample code snippet is provided, demonstrating how to define a simple orthogonal 2D mesh using Fortran, including the allocation of arrays for grid points and setting grid spacing. The code outlines the initialization of parameters, the allocation of arrays for x and y coordinates, and the nested loops used to populate the mesh. The conversation concludes with the poster affirming the simplicity of their approach to creating the mesh.
Milentije
Messages
47
Reaction score
0
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?
 
Technology news on Phys.org
What do you mean 2D mesh?
 
I mean 2dimensions grid,where I can set the parameters.
 
You mean 2D means 2 dimensions?? In all honesty, you're vagueness is epic.
Code:
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

deallocate(x,y)

That's my idea of a simple orthogonal 2D mesh.
 
  • Like
Likes mariem.makh
Thanks for the answer.
Oh,yes I am deliberately vague.
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top