subroutine flatten (flat) C C Flaten looks for signs of strong shocks and sets the variable flat C between 0.0 (smooth flow) and 1.0 (strong shock). C Simplified method of C&W: eqn. A.1 and A.2. C include 'global.h' include 'sweep.h' C real flat(maxsweep), steep(maxsweep) real omega1, omega2, epsilon, delp1, delp2, shock real temp1, temp2 integer n C C-------------------------------------------------------------------------- C C Parameters as suggested in C&W C omega1 = 0.75 omega2 = 5.0 epsilon = 0.33 C C Look for presence of a shock using pressure gradient and sign of C velocity jump: shock = 1 if there is a shock in the zone, else shock = 0 C Compute steepness parameter based on steepness of pressure jump IF C there is a shock. C do 20 n = nmin, nmax delp1 = p(n+1) - p(n-1) delp2 = p(n+2) - p(n-2) if(abs(delp2) .lt. small) delp2 = small shock = abs(delp1)/min(p(n+1),p(n-1))-epsilon shock = max(0.0,shock) if(shock .gt. 0.0) shock = 1.0 if(u(n-1).lt.u(n+1)) shock = 0.0 temp1 = ( delp1 / delp2 - omega1 ) * omega2 steep(n) = shock * max( 0., temp1 ) 20 continue C C Set phony boundary conditions for the steepness parameter C steep(nmin-1) = steep(nmin) steep(nmax+1) = steep(nmax) C C Set flatening coefficient based on the steepness in nieghboring zones C do 30 n = nmin, nmax temp2 = max( steep(n-1), steep(n), steep(n+1) ) flat(n) = max( 0.0, min( 0.5, temp2 ) ) 30 continue C return end