|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
anandbiradar
Joined: 18 Feb 2013 Posts: 4 Location: Tempe, Arizona, USA
|
Posted: Thu Mar 07, 2013 2:51 am Post subject: Error 94, Unit has neither been OPENed nor preconne |
|
|
Hi all can you please guide me on following I am using in CFD course
I am getting error stating
Error 94, Unit has neither been OPENed nor preconnected
[code:1:75549b04e0]
!!!!!!!******* MAE 561 Homework 3 *******!!!!!!!!!
!!!!!!!******* Fortran95 Code for Problem 2 *******!!!!!!!!!
!!!!!!!******* ANANDRAO BIRADAR, 1206263652 *******!!!!!!!!!
program problem_2_FTCS_BTCS_explicit_method
implicit none
real*8, dimension (0:40,0:540) :: u, a, b, c
real*8, dimension (0:40) :: y
real*8, dimension (39,0:540) :: d
real*8, dimension (3) :: p
real*8 :: h, v, den, z, q
integer :: i, k, j, m
den = 800.0d0 !!!!! Density = d
z = 0.002 !!!!! z = delta(t)
h = 0.001 !!!!! grid spacing
!!!! Applying initial condition !!!!
y(0) = 0 !! boudary conditions for y
y(40)= 0.04
do i = 1,39
y(i) = y(i-1)+h
end do
open (10, file = 'Values of y.txt')
write (10,1) y
1 format(1f40.8)
close (10)
do i = 1,40
u(i,0) = 0
end do
v = 0.000217 !!!! v = kinematic viscosity
do i = 0,540
u(0,i) = 40.0d0 !!!! As lower plate start moving with u = 40 m/s
u(40,i)= 0 !!!! Upper plate is stationary
end do
!!!!!!!!!!!!!!!!!*************** Using FTCS Method with given conditions ****************!!!!!!!!!!!!!!!!
do j = 1,3
p(1) = 0.0d0 !!!!! p = dp/dx
p(2) = 20000.0d0
p(3) = -30000.0d0
do k = 0,539
do i = 1,39
u(i,k+1)= u(i,k)+((v*z)/h**2)*(u(i+1,k)-2.0d0*u(i,k)+u(i-1,k))-((z/den)*p(j)) !!!!!!!! The FTCS Formula
end do
!!!!!!!!! Saving the results in different files !!!!!!
if (j == 1) then !!!!!!! for dp/dx = 0
if ( k == 0 ) then
print*, 'At t = 0.00'
open (20, file = 'Values of u at dp-dx = 0.txt')
do i = 0,40
write (20,2) u(i,k)
end do
2 format(1f40.20)
else if ( k == 89 ) then
print*, 'At t = 0.18'
do i = 0,40
write (20,2) u(i,k)
end do
else if ( k == 179 ) then
print*, 'At t = 0.36'
do i = 0,40
write (20,2) u(i,k)
end do
else if ( k == 269 ) then
print*, 'At t = 0.54'
do i = 0,40
write (20,2) u(i,k)
end do
else if ( k == 359 ) then
print*, 'At t = 0.72'
do i = 0,40
write (20,2) u(i,k)
end do
else if ( k == 449 ) then
print*, 'At t = 0.9'
do i = 0,40
write (20,2) u(i,k)
end do
else if ( k == 539 ) then
print*, 'At t = 1.08'
do i = 0,40
write (20,2) u(i,k)
end do
close(20)
end if
else if (j == 2) then !!!!!!! for dp/dx = 2.0*10^4
if ( k == 0 ) then
print*, 'At t = 0.00'
open (30, file = 'Values of u at dp-dx = 20000.txt')
do i = 0,40
write (30,2) u(i,k)
end do
else if ( k == 89 ) then
print*, 'At t = 0.18'
do i = 0,40
write (30,2) u(i,k)
end do
else if ( k == 179 ) then
print*, 'At t = 0.36 _________________ Anandrao Biradar
MS Mechanical Engineering,
Arizona State University |
|
Back to top |
|
|
anandbiradar
Joined: 18 Feb 2013 Posts: 4 Location: Tempe, Arizona, USA
|
Posted: Thu Mar 07, 2013 2:53 am Post subject: |
|
|
Anyhelp in improvent of more compact form would be appreciated _________________ Anandrao Biradar
MS Mechanical Engineering,
Arizona State University |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Thu Mar 07, 2013 8:56 am Post subject: |
|
|
It looks like you have an OPEN statement within a condition and a WRITE statement that is not conditional. So if the condition is not satisfied then the WRITE occurs without an OPEN. |
|
Back to top |
|
|
anandbiradar
Joined: 18 Feb 2013 Posts: 4 Location: Tempe, Arizona, USA
|
Posted: Thu Mar 07, 2013 10:46 am Post subject: |
|
|
Hi Paul
thanks a ton, It works, I was stuck in this points for long time.
As I am beginner I couldn't notice it. Can you recommended some book for FORTRAN learning, reference for beginners ?
Thanks _________________ Anandrao Biradar
MS Mechanical Engineering,
Arizona State University |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Tue Mar 26, 2013 1:36 am Post subject: |
|
|
The following is a more compact form for some of your code: Code: | if ( k == 0 .or. mod(k,90)==89 ) then
write (*,1) k*0.002
if ( k == 0 ) open (20, file = 'Values_of_u_at_dp-dx=0.txt')
do i = 0,40
write (20,2) u(i,k)
end do
if ( k == 539 ) close(20)
1 format (' At t = ',f0.2)
2 format (f40.20)
end if
|
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|