!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
program compress2d
!
! Description:
!
! Use of the original upstream volume grid compression capability still
! provided here is now deprecated except perhaps for minimal compression.
! Recommended is the most-recently added simplest-possible splitting option.
! (The concern is over the possible effect of the compression on the nicety
! of the original hyperbolic volume gridding.)
!
! A retrofitted output (a plottable measure of skewness of the radial lines
! of the input single-block grid) may suggest adjusting the forebody portion
! of the underlying generatrix. See further details below.
!
! The original description of the deprecated compression follows:
!
! 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
! otherwise 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 (maybe constant) and outermost
! spacings, or by preserving the relative spacings. However, no such
! radial redistribution is provided if the simple splitting option that is
! now recommended is selected. (Hypgen controls should be enough.)
!
! Input Grid Format (from Gridgen/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, and z = 0 everywhere.
!
! 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 (and 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. Spreading shoulder
! clustering well forward along a conical flank, possibly with more points,
! can reduce the indicated skewing. The function file output here,
! skewness.f[u], provides a graphical means of seeing whether a modified
! generatrix has reduced the 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 bow shock is so crucial to good surface heating predictions.
!
! In view of the realization that compressing the upstream part of the
! volume grid may do more harm than good, a simple option is now provided
! (for BC purposes) to split the single block at an indicated i index
! without any redistribution options. Hypgen itself can produce the
! desired radial point count and wall spacing.
!
! 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.
! 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.
! 05/22/26 " " Introduced a simplest possible splitting option
! at an indicated i index, with no radial redistri-
! bution (now the recommended choice as long as the
! Hypgen controls are appropriate).
!
! Author: David Saunders, ERC, Inc. at NASA Ames Research Center, CA
! Later with AMA, Inc. at NASA ARC.
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!