module coeficientes ! objetivo: calcular os coeficientes e termos fontes das equações discretizadas use variaveis implicit none contains !------------------------------------------------------------------------------- subroutine calcula_coeficientes_contornos ! contorno esquerdo aw(0) = 0.0d0 ae(0) = 0.0d0 ap(0) = 1.0d0 bp(0) = 0.0d0 ! contorno direito aw(N) = 0.0d0 ae(N) = 0.0d0 ap(N) = 1.0d0 bp(N) = 1.0d0 end subroutine calcula_coeficientes_contornos !------------------------------------------------------------------------------- subroutine calcula_fonte select case ( fonte ) case ( 0 ) bp = dexp(x) / (dexp(1.0d0) - 1.0d0) case ( 1 ) bp = 0.0d0 case ( 2 ) bp = 2.0d0 case ( 3 ) bp = 6.0d0*X case ( 4 ) bp = 12.0d0*(X**2) end select end subroutine calcula_fonte !------------------------------------------------------------------------------- subroutine calcula_coeficientes_cds call calcula_fonte call calcula_coeficientes_contornos ! nós internos do P = 1, N-1 aw(P) = 1.0d0 ae(P) = 1.0d0 ap(P) = 2.0d0 bp(P) = - bp(P) * (h**2) end do end subroutine calcula_coeficientes_cds !------------------------------------------------------------------------------- end module coeficientes