lecture6 - Diffusion problem homework 4 IMPLICIT NONE...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Diffusion problem, homework 4 IMPLICIT NONE INTEGER, PARAMETER :: Prec14=SELECTED_REAL_KIND(14) INTEGER :: j,nt,ntmax INTEGER, PARAMETER :: jmax=200 REAL(KIND=Prec14), DIMENSION(jmax) :: a,b,c,chi REAL(KIND=Prec14), DIMENSION(jmax) :: u REAL(KIND=Prec14), PARAMETER :: L=12.0d0,sigma=1.0d0, tau=L**2 REAL(KIND=Prec14), PARAMETER :: x1=L/2.0d0,x2=3.0d0*L/4.0d0 REAL(KIND=Prec14), PARAMETER :: dx=L/jmax REAL(KIND=Prec14), PARAMETER :: dt=0.5d0 REAL(KIND=Prec14), PARAMETER :: alpha=dt/(2.0d0*dx**2) REAL(KIND=Prec14) :: x,s2pi,pi pi=4.0d0*datan(1.0d0) s2pi=dsqrt(2.0d0*pi) ntmax=tau/dt u(j)=(1.0d0/(sigma*s2pi))*(dexp(-(x-x1)**2/(2.0d0*sigma**2))- dexp(-(x-x2)**2/(2.0d0*sigma**2))) Tridag… solves the linear equations… does all the hard work! call tridag(a,b,c,u,chi,jmax) SUBROUTINE TRIDAG(A,B,C,R,U,N) a,b,c,psi are the inputs, chi is what is returned by tridag after solving equations jmax is the length of the input arrays From numerical recipes, but modified for Tridag… solves the linear equations…...
View Full Document

{[ snackBarMessage ]}

Page1 / 9

lecture6 - Diffusion problem homework 4 IMPLICIT NONE...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online