# surface

Each user defined application requires three grid_surface_compute routines
which all need to be placed in the comp_amr_error.f file:

- grid_asurface_comp
- grid_bsurface_comp
- grid_csurface_comp

These routines enable surface extraction capability.
They can be empty if surface extraction is not needed.
Three separate surfaces
are possible: a, b, and c. Each surface is a sphere. The highest resolution mesh
containing the surface ( or part thereof ) is passed to each of these three routines. The user
develops the interpolation necessary to extract the surface from the local 3-D Cartesian
mesh and places that code in these three routines.

2-D grid functions for storing the extracted surfaces are defined in
setup using the
keywords ** asurface**, ** bsurface**, ** csurface**
for each of the three surfaces available. See the example below.
Output of these surfaces is controlled by parameters:
** asf_out_[field_name]** ==> output for spherical surface 'a'. 0 is off, 1 outputs the spatial integral of the 2-D surface, 2 outputs the spatial integral and the full 2-D surface.
** bsf_out_[field_name]** ==> output for spherical surface 'b'. 0 is off, 1 outputs the spatial integral of the 2-D surface, 2 outputs the spatial integral and the full 2-D surface.
** csf_out_[field_name]** ==> output for spherical surface 'c'. 0 is off, 1 outputs the spatial integral of the 2-D surface, 2 outputs the spatial integral and the full 2-D surface.

Parameters specific for each surface are specified as follows:
** asf_rconst** ==> radius of spherical surface 'a'
** bsf_rconst** ==> radius of spherical surface 'b'
** csf_rconst** ==> radius of spherical surface 'c'
** asf_ntheta** ==> number of theta points for spherical surface 'a'.
** bsf_ntheta** ==> number of theta points for spherical surface 'b'.
** csf_ntheta** ==> number of theta points for spherical surface 'c'
** asf_nphi** ==> number of phi points for spherical surface 'a'
** bsf_nphi** ==> number of phi points for spherical surface 'b'
** csf_nphi** ==> number of phi points for spherical surface 'c'

Note that ** theta varies from 0 to 2*Pi** and ** phi varies from 0 to Pi**.
Consequently, you should usually have twice as many points in the ntheta direction than in the nphi direction.

The frequency of surface extraction is controlled by parameters:
** asf_period** ==> period of surface extraction for spherical surface 'a'
** bsf_period** ==> period of surface extraction for spherical surface 'b'
** csf_period** ==> period of surface extraction for spherical surface 'c'

### Notes

- The surface extraction occurs in parallel and the resulting 2-D surface is communicated
to the root process ( for analysis or output ).
- Output of the 2-D surface is serial. The rest of
**HAD** I/O is parallel.
- Only the root process has the entire 2-D surface once extraction is complete.
- Note that the number of theta and phi zones must be
**odd**, not even.

### See Also

setup,
List of required routines,
nx0,ny0,nz0

Index of all manual pages
### Examples

See **had/src/hyperCurvedWave/comp_amr_error.f** for a full example.

**For defining 2-D grid function of surface:**
in *setup*:

asurface

{

q, g

}

bsurface

{

qq, gg

}

csurface

{

qqq, ggg

}

In this example, six 2-D grid functions are allocated: q and g of size
** asf_ntheta x asf_nphi**, qq and gg of size ** bsf_ntheta x bsf_nphi**,
and qqq and ggg of size ** csf_ntheta x csf_nphi**.