.\" -*- text -*- .\" ppm98_flux, d_ppm98_flux: ntegrates the ppm piecewise parabolae .\" over a given fraction of a zone. .\" .\" Paul R. Woodward and B. Kevin Edgar .\" University of Minn, Minneapolis .\" paul@lcse.umn.edu bke@pobox.com .\" .\" $Header: xf.1[2.6] May 1998 bke@pobox.com $ .\" .TH PPM98_FLUX 1 "May 1998" .SH NAME .B ppm98_flux, d_ppm98_flux \- integrates PPM piecewise parabolae, with respect to the coordinate mm, which may be either a zone volume [spatial] coordinate or a zone mass coordinate. The coordinate system is assume to be normalized in such a way that mm is 0. at the left-hand side of the zone and is dmm at the right. a amount DMML is advected across the left-hand interface, c with negative DMML corresponding to advection to the left. c F is the zone fraction advected, and F1 is the complement (1 - F) c output of this routine consists of DAL, the integral of A with c respect to m over the advected chunk. again, DAL is negative c when advection is to the left. .SH SYNOPSIS .DS subroutine ppm98flux( AL, A, AR, DAL, DMML, F, F1, N ) .br integer*4 n .br real*4 A(n), AL(n), AR(n), DAL(n), DMML(n), F(n), F1(n) .sp .SH SYNOPSIS .DS subroutine d_ppm98flux( AL, A, AR, DAL, DMML, F, F1, N ) .br ) .br integer*4 n .br real*8 A(n), AL(n), AR(n), DAL(n), DMML(n), F(n), F1(n) .sp .sp .SH ARGUMENTS .IP "\fBAL\fP [out]" 10 array of interpolated left interface point values of the variable. .IP "\fBA\fP [in]" 10 array of zone averages .IP "\fBAR\fP [out]" 10 array of interpolated right interface point values of the variable. .IP "\fBDAL\fP [out]" 10 array of containing the integral of A over the volume DMML .IP "\fBDMML\fP [out]" 10 array volumes (or weighting factors) over which to integrate .IP "\fBF\fP [in]" 10 The volume fractions, that is, .br F(I) = DMML(I)/DMM(I) if DMML(I) <= 0 .br F(I) = DMML(I)/DMM(I-1) if DMML(I) > 0 .IP "\fBF1\fP [out]" 10 The compliment of F: 1.0 - F. .IP "\fBN\fP [in]" 10 the array dimension, or number of elements to process .sp .SH DESCRIPTION .PP This routine integrates PPM piecewise parabolae with respect to the coordinate mm, which may be either a zone volume [spatial] coordinate or a zone mass coordinate. The coordinate system is assumed to be normalized in such a way that mm is 0. at the left-hand side of the zone and is dmm(i) at the right. If the volume DMML is positive, and the PPM piecewise parabola in zone (I-1) is integrated leftward from the right edge of zone (i-1) over the volume DMML. If the volume DMML is negative, the PPM piecewise parabola in zone (i) is integrated over the volume DMML from the left edge of zone (i). .PP IWhen used in advection, this means that an amount DMML is advected across the left-hand interface, with negative DMML corresponding to advection to the left. F is the zone fraction advected, and F1 is the complement (1 - F) output of this routine consists of DAL, the integral of A with respect to m over the advected chunk. again, DAL is negative when advection is to the left. .PP .SH USAGE EXAMPLES .sp Example: .nf .LP .br integer*4 N .br real*4 XL(N+1), XLNEW(N+1) real*4 AL(-2:N+3), AAVG(-2:N+3), AR(-2:N+3), DA(-2:N+3) real*4 RHOL(-2:N+3), AHOAVG(-2:N+3), RHOR(-2:N+3), DRHO(-2:N+3) REAL*4 DX(N), DM(I), DXNEW(I), DMNEW(I) .LP C C Given PPM interpolation of a density: c RHOL(I), RHOAVG(I), RHOR(I), AND DRHO(I) c and PPM interpolation os another quantity A: c AL(I), AAVG(I), AR(I), AR(I) c which have been interpolated on a grid defined by the lefthand c zone interface locations XL(I), find the new zone averages on c a grid defined vy the lefthand zone interface locations XLNEW(I). c c Assume XL(I-1) < XLNEW(I) < XL(I+1). C c Left the densities be volume weighted, and the quantity A be c mass weighted. c c If one thinks in terms of fluxes, the we have from conservation of c mass: c c RHONEW(I)*DXNEW(I) = RHOAVG(I)*DX(I) + DMASSL(I) - DMASSL(I+1) c c where DMASSL is the abount of mass advect across the boundary at XL(I) c positive DMASSL(I) indicated advection from zone (I-1) to zone (I) c negative DMASSL(I) indicated advection from zone (I) to zone (I-1) c c Similarly for A, we have (with mass weighting): c c ANEW(I)*DMNEW(I) = AAVG(I)*DM(I) + DMAL(I) - DMAL(I+1) c c where DMNEW(I) = RHONEW(I)*DXNEW(I), and DM(I) = RHOAVG(I)*DX(I) C c First, compute some necessary quantities: DO I=1,N c old and new grid volumes: DX(I) = XL(I+1) - xl(I) DXNEW(I) = XLNEW(I+1) - xlNEW(I) c masses: DM(I) = RHO(I) * DX(I) PAV(I) = P(I) ENDDO c DO I=2,N c advected volumes at left edge: DVOLL(I) = XLNEW(I) - XL(I) c advected volumes fractions: IF( DVOLL(I) .LE. 0.0 ) THEN F(I) = - DVOLL(I) / DX(I-1) ELSE F(I) = DVOLL(I) / DX(I) ENDIF F1(I) = 1.0 - F(I) ENDDO c Find advected masses: CALL PPM98_FLUX( RHOL(2), RHOAVG(2), RHOR(2), DRHO(2), DMASSL(2), DVOLL(I), F(20, F1(2), N-1) C DO I=2,N-1 DMNEW(I) = DM(I) + DMASSL(I) - DMASSL(I+1) RHONEW(I) = DMNEW(I)/DXNEW(I) ENDDO DO I=2,N c advected maqss fractions: IF( DMASSL(I) .LE. 0.0 ) THEN F(I) = - DMASSL(I) / DM(I-1) ELSE F(I) = DMASSL(I) / DM(I) ENDIF F1(I) = 1.0 - F(I) ENDDO c Find the mass weighted fluxes of A: CALL PPM98_FLUX( AL(2), AAVG(2), AR(2), DA(2), DMAL(2), DMASSL(I), F(2), F1(2), N-1) C c Update A: c DO I=2,N-1 ANEW(I) = (A(I) * DM(I) + SMAL(I) - SMAL(I+1))/DMNEW(I) ENDDO c c Note, that to allow for both positive and negative advection, the new zone c averages can be defined only on the range [2,N-1]. c .fi .br .sp .SH HINTS .PP .IP "\(bu" Note, that to allow for both positive and negative advection, the new zone averages can be defined only on the range [2,N-1]. is the Eulerian sound speed. .PP .SH BUGS .PP .\" .IP "\(bu" Surely there are many bugs. .SH "SEE ALSO" .PP ppm98interp0_mono, d_ppm98interp0_interface, ppm98interp_discont_comp .SH AUTHORS .PP \fBPaul R. Woodward\fP paul@lcse.umn.edu .br \fBB. Kevin Edgar\fP bke@pobox.com .br Department of Astronomy .br University of Minnesota .br Minneapolis, MN 55455 USA .br