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

Mesh generation fortran 90

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By anon_o
  • 1 Post By selig5576

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 18, 2017, 14:49
Question Mesh generation fortran 90
  #1
Disabled
 
Join Date: Apr 2017
Posts: 8
Rep Power: 9
anon_o is on a distinguished road
Dear friends,
How can I generate mesh for the attached photo? Any sample code? Any reference?
Thanks,
Armin
Attached Images
File Type: jpg IMG_20170418_225950.jpg (58.1 KB, 125 views)
ssh123 likes this.
anon_o is offline   Reply With Quote

Old   April 18, 2017, 19:13
Default References
  #2
Senior Member
 
Selig
Join Date: Jul 2016
Posts: 213
Rep Power: 11
selig5576 is on a distinguished road
In the picture you have given, the person who wrote the problem set gave references. A paper thats a bit more theoretical is: https://arxiv.org/pdf/math/0607388.pdf
anon_o likes this.
selig5576 is offline   Reply With Quote

Old   April 25, 2017, 02:00
Default
  #3
Disabled
 
Join Date: Apr 2017
Posts: 8
Rep Power: 9
anon_o is on a distinguished road
wrote the code. is it correct for this problem?

program Adaptive_mesh
implicit none
integer ::n,i,j,iter
real::deltax,deltay,deltat,c,tol,xx,yy,a,ap,error
real,allocatable::W(:,,u(:,,x(:,,y(:,,xn(: ,,yn(:,
write(*,*),' Enter partition n=... '
read(*,*)n
allocate (x(n+1,n+1),y(n+1,n+1),W(n+1,n+1),u(n+1,n+1),xn(n+ 1,n+1),yn(n+1,n+1))
write(*,*),' Enter time step <0.01 '
read(*,*)deltat

open(1,file='MESH.plt')
open(2,file='ADAPTIVE MESH RESULT.plt')

write(1,*)'VARIABLES= ,"X","Y"'
write(1,*)'ZONE I=',n+1,'J=',n+1,'F=POINT'

write(2,*)'VARIABLES= ,"X","Y"'
write(2,*)'ZONE I=',n+1,'J=',n+1,'F=POINT'
!constant variable
tol=0.00001
c=100.
iter=1
deltax=0.01
deltay=0.01
!mesh grid
xx=0.0
yy=0.0
do i=1,n+1
do j=1,n+1
y(i,j)=yy
x(i,j)=xx
xx=xx+deltax
write(1,*) x(i,j),y(i,j)
end do
xx=0.0
yy=yy+deltay
end do

1001 error=0.0
deltax=1.
deltay=1.
!field of velocity
do i=1,n+1
do j=1,n+1
u(i,j)=c*(exp(-(c**2)*(x(i,j)**2+y(i,j)**2)))
end do
end do
! w(i,j)
a=0.0
do i=1,n+1
do j=1,n+1
w(i,j)=0.0
end do
end do
do i=2,n
do j=2,n
w(i,j)=sqrt(1.+(((u(i+1,j)-u(i-1,j))/(2.*deltax))**2.+((u(i,j+1)-u(i,j-1))/(2.*deltay))**2.))
ap=w(i,j)
if(a<ap)then
a=ap
end if
end do
end do
!x(i,j) and y(i,j) NEW
do i=1,n+1
do j=1,n+1
xn(i,j)=x(i,j)
yn(i,j)=y(i,j)
end do
end do

do 100 i=2,n
do 101 j=2,n
x(i,j)=x(i,j)+(deltat/(2.*deltax**2.))*((w(i+1,j)+w(i,j))*(x(i+1,j)-x(i,j))-(w(i-1,j)+w(i,j))*(x(i,j)-x(i-1,j))&
&+(w(i,j+1)+w(i,j))*(x(i,j+1)-x(i,j))-(w(i,j-1)+w(i,j))*(x(i,j)-x(i,j-1)))&
&-a*deltat*((xn(i+1,j)+xn(i-1,j)+xn(i,j+1)+xn(i,j-1)-4.*xn(i,j))/(deltax**2))&
&+a*deltat*((x(i+1,j)+x(i-1,j)+x(i,j+1)+x(i,j-1)-4.*x(i,j))/(deltax**2))

y(i,j)=y(i,j)+(deltat/(2.*deltay**2.))*((w(i+1,j)+w(i,j))*(y(i+1,j)-y(i,j))-(w(i-1,j)+w(i,j))*(y(i,j)-y(i-1,j))&
&+(w(i,j+1)+w(i,j))*(y(i,j+1)-y(i,j))-(w(i,j-1)+w(i,j))*(y(i,j)-y(i,j-1)))&
&-a*deltat*((yn(i+1,j)+yn(i-1,j)+yn(i,j+1)+yn(i,j-1)-4.*yn(i,j))/(deltay**2))&
&+a*deltat*((y(i+1,j)+y(i-1,j)+y(i,j+1)+y(i,j-1)-4.*y(i,j))/(deltay**2))
error=error+abs(x(i,j)-xn(i,j))
101 continue
100 continue

if(error<tol)then
goto 1000
else
write(*,*) iter,error,a
iter=iter+1
goto 1001
end if
1000 do i=1,n+1
do j=1,n+1
write(2,*) x(i,j),y(i,j)
end do
end do
end program

Sent from my P024 using CFD Online Forum mobile app
anon_o is offline   Reply With Quote

Old   April 25, 2017, 02:01
Default
  #4
Disabled
 
Join Date: Apr 2017
Posts: 8
Rep Power: 9
anon_o is on a distinguished road
Quote:
Originally Posted by selig5576 View Post
In the picture you have given, the person who wrote the problem set gave references. A paper thats a bit more theoretical is: https://arxiv.org/pdf/math/0607388.pdf
wrote the code. is it correct for this problem?

program Adaptive_mesh
implicit none
integer ::n,i,j,iter
real::deltax,deltay,deltat,c,tol,xx,yy,a,ap,error
real,allocatable::W(:,,u(:,,x(:,,y(:,,xn(: ,,yn(:,
write(*,*),' Enter partition n=... '
read(*,*)n
allocate (x(n+1,n+1),y(n+1,n+1),W(n+1,n+1),u(n+1,n+1),xn(n+ 1,n+1),yn(n+1,n+1))
write(*,*),' Enter time step <0.01 '
read(*,*)deltat

open(1,file='MESH.plt')
open(2,file='ADAPTIVE MESH RESULT.plt')

write(1,*)'VARIABLES= ,"X","Y"'
write(1,*)'ZONE I=',n+1,'J=',n+1,'F=POINT'

write(2,*)'VARIABLES= ,"X","Y"'
write(2,*)'ZONE I=',n+1,'J=',n+1,'F=POINT'
!constant variable
tol=0.00001
c=100.
iter=1
deltax=0.01
deltay=0.01
!mesh grid
xx=0.0
yy=0.0
do i=1,n+1
do j=1,n+1
y(i,j)=yy
x(i,j)=xx
xx=xx+deltax
write(1,*) x(i,j),y(i,j)
end do
xx=0.0
yy=yy+deltay
end do

1001 error=0.0
deltax=1.
deltay=1.
!field of velocity
do i=1,n+1
do j=1,n+1
u(i,j)=c*(exp(-(c**2)*(x(i,j)**2+y(i,j)**2)))
end do
end do
! w(i,j)
a=0.0
do i=1,n+1
do j=1,n+1
w(i,j)=0.0
end do
end do
do i=2,n
do j=2,n
w(i,j)=sqrt(1.+(((u(i+1,j)-u(i-1,j))/(2.*deltax))**2.+((u(i,j+1)-u(i,j-1))/(2.*deltay))**2.))
ap=w(i,j)
if(a<ap)then
a=ap
end if
end do
end do
!x(i,j) and y(i,j) NEW
do i=1,n+1
do j=1,n+1
xn(i,j)=x(i,j)
yn(i,j)=y(i,j)
end do
end do

do 100 i=2,n
do 101 j=2,n
x(i,j)=x(i,j)+(deltat/(2.*deltax**2.))*((w(i+1,j)+w(i,j))*(x(i+1,j)-x(i,j))-(w(i-1,j)+w(i,j))*(x(i,j)-x(i-1,j))&
&+(w(i,j+1)+w(i,j))*(x(i,j+1)-x(i,j))-(w(i,j-1)+w(i,j))*(x(i,j)-x(i,j-1)))&
&-a*deltat*((xn(i+1,j)+xn(i-1,j)+xn(i,j+1)+xn(i,j-1)-4.*xn(i,j))/(deltax**2))&
&+a*deltat*((x(i+1,j)+x(i-1,j)+x(i,j+1)+x(i,j-1)-4.*x(i,j))/(deltax**2))

y(i,j)=y(i,j)+(deltat/(2.*deltay**2.))*((w(i+1,j)+w(i,j))*(y(i+1,j)-y(i,j))-(w(i-1,j)+w(i,j))*(y(i,j)-y(i-1,j))&
&+(w(i,j+1)+w(i,j))*(y(i,j+1)-y(i,j))-(w(i,j-1)+w(i,j))*(y(i,j)-y(i,j-1)))&
&-a*deltat*((yn(i+1,j)+yn(i-1,j)+yn(i,j+1)+yn(i,j-1)-4.*yn(i,j))/(deltay**2))&
&+a*deltat*((y(i+1,j)+y(i-1,j)+y(i,j+1)+y(i,j-1)-4.*y(i,j))/(deltay**2))
error=error+abs(x(i,j)-xn(i,j))
101 continue
100 continue

if(error<tol)then
goto 1000
else
write(*,*) iter,error,a
iter=iter+1
goto 1001
end if
1000 do i=1,n+1
do j=1,n+1
write(2,*) x(i,j),y(i,j)
end do
end do
end program

Sent from my P024 using CFD Online Forum mobile app
anon_o is offline   Reply With Quote

Reply

Tags
fortran 90, grid, mesh


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] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
unstructured mesh generation with strictly constrained boundary in simple space goujl Mesh Generation & Pre-Processing 0 January 29, 2015 10:44
ISAAC code mesh generation morteza08 Main CFD Forum 0 June 15, 2012 09:26
Convergence moving mesh lr103476 OpenFOAM Running, Solving & CFD 30 November 19, 2007 14:09
Latest new in mesh generation Robert Schneiders Main CFD Forum 0 February 16, 2000 07:12


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