!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
program compress2d
!
! Description:
!
! Use of this utility is now deprecated except perhaps for minimal
! compression and now for its retrofitted option to output a plottable
! measure of skewness of the radial grid lines. (The concern is over the
! possible effect of the compression on the nicety of the original hyper-
! bolic volume gridding.) See more on this option below. The following is
! the original description.
!
! This specialized program adjusts the single-block hyperbolic 2D volume
! grid associated with a generatrix from CAPSULE_GRID by compressing its
! forward portion to improve initial flow calculations. It prompts for a
! handful of controls. A heuristic new forward boundary is established as
! a 2-space local parametric cubic spline (x and y vs. arc length) and the
! input radial grid lines are intersected with it then redistributed. The
! untouched radial lines are also redistributed to ensure smooth blending
! of the radial spacings.
!
! The number of points in the radial direction for the output grid can
! be changed along with the wall spacings (some constant) and outermost
! spacings.
!
! Input Grid Format (from Gridgeni/Hypgen-based script, with z = 0 everywhere;
! may be unformatted; single block):
!
! 285 101 1
! 0.00000000000e+00 8.96179650000e-06 3.59308720000e-05 8.08756720000e-05
! 1.43791190000e-04 2.24670450000e-04 3.23504450000e-04 4.40282210000e-04
! : : : :
!
! The input grid is assumed to have i along the surface and j in the radial
! direction.
!
! Option to Derive a 3D Volume Grid From the Compressed 2D Grid:
!
! "Umbrella" (faceted and open at the back) full-body surface grids have
! been found difficult to grow hyperbolic volume grids from in Gridgen.
! Therefore, an option is provided to read a spoked form of the faceted
! surface grid and morph the plane 2D hyperbolic grid to each azimuthal
! station of the spoked surface.
!
! The expected surfaces are spoked_surface_fore.g and spoked_surface_aft.g
! from CAPSULE_GRID. The option is invoked automatically if the first of
! these is found in the working directory, but a prompt allows skipping this
! volume gridding if the 2D compression controls still need to be checked
! graphically, if the surface is axisymmetric, or if there is no aft body.
!
! Output Function File Containing a Measure of Radial Grid Line Skewness:
!
! Experience shows that the DPLR alignment process can produce indentations
! in the outer boundary (and corresponding surface heat flux irregularities)
! if the radial grid lines, which are normal very close to the surface by
! construction in the hyperbolic growth off the surface, deviate too much
! from orthogonality further out from the [fore]body. This is because the
! skewed radial lines are longer than they would be if they weren't skewed,
! so their arc lengths (an arc length changes for the same reason) become
! shortened by the smoothing process more than they would be otherwise.
! The surface point distribution in the [forebody] generatrix is the only
! way to affect such skewing--through trial and error. The function file
! output here, skewness.f[u], provides a graphical means of seeing whether
! a modified generatrix has reduced any skewing or not.
!
! The measure output at each grid point (i,j) is the angle in degrees
! between the surface normal at (i,1) and the cell side defined by points
! (i,j) and (i,j+1). At j = nj, the nj - 1 result is copied. This is
! expected to be meaningful for forebodies only, where grid alignment
! with the bowshock is so crucial to good surface heating predictions.
!
! History:
!
! 01/23/12 D.A.Saunders Initial implementation, for fore+aft body cases.
! 01/24/12 " " Split the output grid into 2 blocks so that one
! can have free stream inflow BC at jmax and the
! other can have supersonic outflow BC. Splitting
! is at an odd index at or aft of ymax by default,
! but allow an override.
! 03/16/12 " " Compressing forebody or forebody-like sting cases
! where the blending aft of the body is exactly at
! the aft end of the outer boundary needs control
! over the slope of the revised boundary there, and
! it doesn't need the splitting into two blocks.
! 08/28/12 " " For non-axisymmetric "umbrella"-type (faceted)
! geometries, use WARPQ3D morphing to produce a
! (compressed) 3D volume grid as well as the 2D one
! corresponding to the underlying generatrix.
! 08/29/12 " " Dinesh noted that the forebody diameter is a
! more natural reference length than body length
! (~6 diameters from the nose for the downstream
! boundary that the hyperbolic gridding should reach
! and multiple of the diameter for the desired up-
! stream boundary, depending on Mach and Alpha).
! 09/04/12 " " I forgot about WARPQ3D2, which has fewer arguments
! because work-space is allocated locally.
! 09/05/12 " " A prompt now allows suppression of the output 3D
! volume grid, either because the surface is axi-
! symmetric, or no aft body is present, or the 2D
! compression controls still need to be iterated on.
! 09/07/12 " " A SIAD (inflatable) case with a sharp vertex in
! the forebody generatrix prompted an option to
! redistribute the radial lines with the same
! relative spacing as in the uncompressed input
! 2D volume grid. Lines that have been compressed
! conflict with the assumptions of ADJUSTN, but an
! initial shuffle works around this as best we can.
! 09/13/12 " " The same relative spacing isn't much help for
! sharp vertices unless compression is limited.
! Preserving the existing wall spacing proves even
! worse, but it's now an option. Rounding sharp
! corners is preferable if they're not critical.
! 11/13/14 " " The test for forebody or not needed a tolerance.
! 04/19/16 " " The test for forebody or not was using x when it
! should use y!
! 04/14/21 " " Went to add same-relative-spacing option, but it
! was already there. Fixed one typo.
! 01/24/24 " " Added output of a volume file containing a measure
! of the skewness of the radial grid lines.
! 01/26/24 " " Arranged to skip the compression step, but always
! write skewness.f or skewness.fu depending on the
! input grid formatting..
!
! Author: David Saunders, ERC, Inc. at NASA Ames Research Center, CA
! Later with AMA, Inc. at NASA ARC.
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!