simpson quadrature replaced with simpler rule for unevenly spaced intervals (computation of <rho>_{P,J} and d<rho>_{P,J)

This commit is contained in:
Lorenzo Figini 2014-06-13 09:47:20 +00:00
parent f9facdc28e
commit b6d8dd5a6f
2 changed files with 40 additions and 27 deletions

View File

@ -6167,36 +6167,30 @@ c
end do end do
end do end do
h=1.0d0/dble(nd-1) !!!!!!!!!! equi-spaced grid expected in rhotpav=0.0d0
rhotpav=0.0d0 !!!!!!!!!! simpson subroutine rhot2pav=0.0d0
drhotpav=0.0d0 !!!!!!!!!! wrong integrals until fixed rhotjav=0.0d0
rhotjav=0.0d0 !!!!!!!!!! (d)rhotpav,rhotjav,(d)rhotjava affected
rhotjava=0.0d0 rhotjava=0.0d0
rhot2java=0.0d0 rhot2java=0.0d0
fi=dpdv/h c here dpdv is still dP (not divided yet by dV)
call simpson (nd,h,fi,spds) spds=sum(dpdv(1:nd))
fi=rhotv*dpdv/h if (spds.gt.0.0d0) then
call simpson (nd,h,fi,rhotpav) rhotpav=sum(rhotv(1:nd)*dpdv(1:nd))/spds
fi=rhotv*rhotv*dpdv/h rhot2pav=sum(rhotv(1:nd)*rhotv(1:nd)*dpdv(1:nd))/spds
call simpson (nd,h,fi,rhot2pav) end if
rhotpav=rhotpav/spds
rhot2pav=rhot2pav/spds
c here ajphiv is still dI (not divided yet by dA)
if (ieccd.ne.0) then if (ieccd.ne.0) then
fi=ajphiv/h sccs=sum(ajphiv(1:nd))
call simpson (nd,h,fi,sccs) if (sccs.gt.0.0d0) then
fi=rhotv*ajphiv/h rhotjav=sum(rhotv(1:nd)*ajphiv(1:nd))/sccs
call simpson (nd,h,fi,rhotjav) end if
fi=abs(ajphiv)/h sccsa=sum(abs(ajphiv(1:nd)))
call simpson (nd,h,fi,sccsa) if (sccsa.gt.0.0d0) then
fi=rhotv*abs(ajphiv)/h rhotjava=sum(rhotv(1:nd)*abs(ajphiv(1:nd)))/sccsa
call simpson (nd,h,fi,rhotjava) rhot2java=sum(rhotv(1:nd)*rhotv(1:nd)*abs(ajphiv(1:nd)))/sccsa
fi=rhotv*rhotv*abs(ajphiv)/h end if
call simpson (nd,h,fi,rhot2java)
rhotjav=rhotjav/sccs
rhotjava=rhotjava/sccsa
rhot2java=rhot2java/sccsa
end if end if
c factor sqrt(8)=2 sqrt(2) to match with full width c factor sqrt(8)=2 sqrt(2) to match with full width

View File

@ -257,6 +257,25 @@ c
end subroutine simpson end subroutine simpson
c c
c c
c
subroutine trapezoid(n,xi,fi,s)
c subroutine for integration with the trapezoidal rule.
c fi: integrand f(x); xi: abscissa x;
c s: integral Int_{xi(1)}^{xi(n)} f(x)dx
implicit none
integer n
real*8 xi(n),fi(n)
real*8 s
integer i
c
s = 0.0d0
do i = 1, n-1
s = s+(xi(i+1)-xi(i))*(fi(i+1)-fi(i))
end do
s = 0.5d0*s
end subroutine trapezoid
c
c
c spline routines: begin c spline routines: begin
c c
c c