!************************************************************
!CÁLCULO DO COEFICIENTE DE ARRASTO DE PRESSÃO
!************************************************************
    
!COEFICIENTE DE ARRASTO DAS EMPENAS

SUBROUTINE Cdpressaoe (M, Tc, S, Cbc, N, e, Sref, Cdpe, Sa)

REAL*8 q, M, Cdstag, Cpel1, Cpel, Tc, S, Cpet, Cbc, Cpe, Cdpe, e, N, Sref, Sa

q = 1d0+M**2d0/4d0+M**4d0/40d0
Cdstag = 0.85d0*q
Cpel1 = Cdstag
!Cpel1 = (1d0-M**2d0)**(-0.417d0)-1
!Cpel = Cpel1*(dcos(datan((Tc/2d0)/S)))**2d0
Cpel = Cpel1*(dcos(Sa))**2d0
Cpet = Cbc
!Cpet = Cbc*(0.5d0)
Cpe = Cpel+Cpet
!Cpe = Cpel
Cdpe = Cpe*N*e*S/Sref
write(*,*) cpel, cpet

END SUBROUTINE Cdpressaoe

!COEFICIENTE DE ARRASTO DO NARIZ
    
SUBROUTINE Cdpressaon (M, Na, Dna, Lna, Cdpn)

INTEGER Na

REAL*8 M, Dna, Lna, Cdpn, o

SELECT CASE (Na)

!Nariz cônico
CASE(3)
    o = datan((Dna/2d0)/Lna)      !Ângulo da junta do nariz
    Cdpn = 0.8d0*(dsin(o))**2d0   !Coeficiente de arrasto experimental para números de Machi pequenos

!Outros formatos
CASE DEFAULT
    Cdpn = 0d0

END SELECT

write(*,*) Cdpn
END SUBROUTINE Cdpressaon