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

Grid by Fortran

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 2, 2013, 07:39
Default Grid by Fortran
  #1
Member
 
le hoang anh
Join Date: Oct 2012
Posts: 96
Rep Power: 4
lehoanganh07 is on a distinguished road
Hi,
I am a beginner in the coding. I will use fortran for my course. I'm trying to make the grid for my model, but when i ran, it had error.
Could you help me to fix it!!
Thank you

program nozzle_mesh
implicit none
real,allocatable,dimension(:,::x,y
integer::i,j,num_xi,num_eta
real::d_xi,d_eta,xi,eta,le,wi,L1,L2,eta0
!eta0 is the hight of base
!L1 is the lenght of base
!L2 is the lenght of combustion chamber
!eta,xi is coordinate in computer plane, eta vetical axial, xi holizon axial
!d_xi; d_eta is distance between 2 node
!i,j is the node
!num_xi;num_eta is number of node
!beta_x;beta_y is the compressible coefficience of cluster grid
!xi0 is the position where cluster compressed in x direction
!xii;etaj distance to origin
real,parameter::e=2.71828
real::beta_x=5.0,beta_y=1.2,anpha,A,xi0,xii,etaj,c ,eta0,x0
open(1,"Nozlle.dat")
read*,le,hg,L1
read*,num_xi,num_eta
xi=hg
eta=le
call number(xi,num_xi,L1)
call number(eta,num_eta,eta0)
d_xi=xi/(num_xi-1)
d_eta=eta/(num_eta-1)
xi0=L1
allocate(x(num_xi,num_eta),y(num_xi,num_eta))
do j=1,num_xi
do i=1,num_eta
xii=d_xi*(j-1)
x0=log((1.0+(exp(beta_x)-1.0)*xi0)/(1.0+(exp(-beta_x)-1.0)*xi0))&
& /log(e)/2.0/beta_x
A=sinh(beta_x*x0)
x(i,j)=xi0*(sinh((xii-x0)*beta_x)+A)/A
if(xii<=L1 .and. i<=eta0/d_eta)y(i,j)=eta0
else if (xii<=L1 .and. i>eta0/d_eta) then
etaj=d_eta*(i-1)
c=log((beta_y+1)/(beta_y-1))
if (xii<=L1) anpha=0
if (xii>L1) anpha=0.5
y(i,j)=((beta_y+1)-(beta_y-1)*exp(-c*(etaj-1-anpha)/(1-anpha))) &
& /((2*anpha+1)*(1+exp(-c*(etaj-1-anpha))/(1-anpha)))
write(1,*),x(i,j),y(i,j)
end if
end do
write(1,*),x(i,j),y(i,j)
print*,x(i,j),y(i,j)
end do
end

//************************************************** *****************//
subroutine number(L,number,L1)
real,intent(inout)::L,number,L1
real::delta
integer::num1,num2
delta=L/(number-1)
num1=L1/delta
delta=L1/num1
num2=L2/delta
L2=num2*delta
L=L1+L2
number=num1+num2
return (L),(number),(L1)
end
Attached Images
File Type: jpg 1385855_659641574054657_1942636461_n.jpg (31.3 KB, 32 views)
lehoanganh07 is offline   Reply With Quote

Old   October 30, 2013, 14:49
Default
  #2
Senior Member
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 387
Rep Power: 6
cdegroot is on a distinguished road
With code looking like that it's no wonder you can't find the error. Please indent your code so it is human-readable. What kind of error do you get?
cdegroot is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need help in setting up grid for cylinder thethirdfarial Main CFD Forum 2 November 28, 2011 05:57
Grid around a cylinder for beginners in C or fortran vikingcarioca Main CFD Forum 1 April 28, 2009 09:23
Obtain Geometry Data from a Grid File in CFX 10.0 ARJUN CFX 2 August 17, 2006 07:20
some question about moving grid and fortran shure CD-adapco 4 April 18, 2005 22:12
Numerical methods for discontinuous grid interfaces? Hansong Hang Main CFD Forum 12 September 16, 1998 22:26


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