CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Wiki > Example code for solving Smith-Hutton test - Fortran 90

Example code for solving Smith-Hutton test - Fortran 90

From CFD-Wiki

(Difference between revisions)
Jump to: navigation, search
(Main.f90)
(Main.f90)
Line 93: Line 93:
END
END
 +
 +
-----------------------------------------------------------------------
 +
 +
== Bound.f90 ==
 +
 +
 +
Subroutine Bound_condition
 +
 +
include 'icomm_1.f90' 
 +
 +
!  F(NXmaxP,2:NYmaxP,5) = F(NXmaxP-1,2:NYmaxP,5)
 +
 +
!  F(1,2:NYmaxP,5) = F(2,2:NYmaxP,5)
 +
 +
!  F(2:NXmaxP,NYmaxP,5) = F(2:NXmaxP,NYmaxP-1,5)
 +
 +
!  F(2:NXmaxP,1    ,5) = F(2:NXmaxP, 2      ,5)
 +
 +
open(54, file='ioutlet_prof.txt')
 +
 +
DO 5 I=1,NXmaxP
 +
 
 +
If ( Xp(i,1)>0.) then 
 +
 +
  F(i,1,5) = F(i,2,5)
 +
 +
write(54,*) Xp(i,1),F(i,1,5)
 +
end if
 +
 +
  5 continue 
 +
 +
close(54)
 +
 +
 +
Return
 +
 +
End

Revision as of 01:31, 19 September 2005

Main.f90

Program Main

include 'icomm_1.f90'

Dimension F_out(nx,ny)

Character Filename*10

Call Ini

Call Grid_rectangular

Call input_all

Call Geom

Call Init_all

   Call Control_gem

Do 100 Niter=1,100

write(*,*) '------------------------',Niter,'------------------------'

Call Coef_1(5)

	Call Check_koeff	
!  Alfa = 0.95     
!  Call Under_Relaxation(Alfa,5)
   Call TDMA_1(5)
 

Call Bound_condition

  Call Convergence_Criteria(5)

100 continue


!----------------------------------------------------------------

NImax = NXmaxp

NJmax = NYmaxp

F_out = F(:,:,1)

! 1234567890

Filename ='1_U_s.txt'

! Call Out_array(F_out,NImax,NJmax,Filename)

!-------------------------------------------------------------------

!----------------------------------------------------------------

NImax = NXmaxp

NJmax = NYmaxp

F_out = F(:,:,2)

! 1234567890 Filename ='1_V_s.txt'

! Call Out_array(F_out,NImax,NJmax,Filename)

!-------------------------------------------------------------------

NImax = NXmaxp

NJmax = NYmaxp

F_out = F(:,:,5)

! 1234567890

Filename ='1_T_s.txt'

! Call Out_array(F_out,NImax,NJmax,Filename)

!-------------------------------------------------------------------

	Call output_all

WRITE(*,*) 'PRIVET'

STOP

END


Bound.f90

Subroutine Bound_condition

include 'icomm_1.f90'

! F(NXmaxP,2:NYmaxP,5) = F(NXmaxP-1,2:NYmaxP,5)

! F(1,2:NYmaxP,5) = F(2,2:NYmaxP,5)

! F(2:NXmaxP,NYmaxP,5) = F(2:NXmaxP,NYmaxP-1,5)

! F(2:NXmaxP,1 ,5) = F(2:NXmaxP, 2 ,5)

open(54, file='ioutlet_prof.txt')

DO 5 I=1,NXmaxP

	If ( Xp(i,1)>0.) then  
			
			  F(i,1,5) = F(i,2,5)

				write(54,*) Xp(i,1),F(i,1,5)
	end if
 5 continue  

close(54)


Return

End

My wiki