<HTML>
<CENTER><A HREF = "https://sparta.github.io">SPARTA WWW Site</A> - <A HREF = "Manual.html">SPARTA Documentation</A> - <A HREF = "Section_commands.html#comm">SPARTA Commands</A> 
</CENTER>






<HR>

<H3>compute isurf/grid command 
</H3>
<P><B>Syntax:</B>
</P>
<PRE>compute ID isurf/grid group-ID mix-ID value1 value2 ... 
</PRE>
<UL><LI>ID is documented in <A HREF = "compute.html">compute</A> command 

<LI>isurf/grid = style name of this compute command 

<LI>group-ID = group ID for which grid cells to perform calculation on 

<LI>mix-ID = mixture ID for particles to perform calculation on 

<LI>one or more values can be appended 

<LI>value = <I>n</I> or <I>nwt</I> or <I>mflux</I> or <I>fx</I> or <I>fy</I> or <I>fz</I> or <I>press</I> or <I>px</I> or <I>py</I> or <I>pz</I> or <I>shx</I> or <I>shy</I> or <I>shz</I> or <I>ke</I> 

<PRE>  n = count of particles hitting surface elements in a grid cell
  nwt = weighted count of particles hitting surface elements in a grid cell
  mflux = flux of mass on surface elements in a grid cell
  fx,fy,fz = components of force on surface elements in a grid cell
  press = magnitude of normal pressure on surface elements in a grid cell
  px,py,pz = components of normal pressure on surface elements in a grid cell
  shx,shy,shz = components of shear stress on surface elements in a grid cell
  ke = flux of particle kinetic energy on surface elements in a grid cell
  erot = flux of particle rotational energy on surface elements in a grid cell
  evib = flux of particle vibrational energy on surface elements in a grid cell
  etot = flux of particle total energy on surface elements in a grid cell 
</PRE>

</UL>
<P><B>Examples:</B>
</P>
<PRE>compute 1 isurf/grid all all n press eng
compute mine isurf/grid sphere species press shx shy shz 
</PRE>
<P>These commands will dump time averages for each species and each
grid cell to a dump file every 1000 steps:
</P>
<PRE>compute 1 isurfgrid all species n press shx shy shz
fix 1 ave/grid all 10 100 1000 c_1[*]
dump 1 grid all 1000 tmp.grid id f_1[*] 
</PRE>
<P>These commands will time-average the force surface elements in each
grid cell, then sum them across grid cells to compute drag (fx) and
lift (fy) on the set of implicit surfs:
</P>
<PRE>compute 1 isurf/grid all all fx fy
fix 1 ave/grid all 10 100 1000 c_1[*]
compute 2 reduce sum f_1[1] f_1[2]
stats 1000
stats_style step cpu np c_2[1] c_2[2] 
</PRE>
<P><B>Description:</B>
</P>
<P>Define a computation that calculates one or more values for each grid
cell in a grid cell group, based on the particles that collide with
the implicit surfaces in that grid cell.  The values are summed for
each group of species in the specified mixture.  See the
<A HREF = "mixture.html">mixture</A> command for how a set of species can be
partitioned into groups.  Only grid cells in the grid group specified
by <I>group-ID</I> are included in the calculations.  See the <A HREF = "group.html">group
grid</A> command for info on how grid cells can be assigned to
grid groups.
</P>
<P>Implicit surface elements are triangles for 3d simulations and line
segments for 2d simulations.  Unlike explicit surface elements, each
triangle or line segment is wholly contained within a single grid
cell.  See the <A HREF = "read_isurf.html">read_isurf</A> command for details.
</P>
<P>This command can only be used for simulations with implicit surface
elements.  See the similar <A HREF = "compute_surf.html">compute surf</A> command
for use with simulations with explicit surface elements.
</P>
<P>Note that when a particle collides with a surface element, it can
bounce off (possibly as a different species), be captured by the
surface (vanish), or a 2nd particle can also be emitted.  The formulas
below account for all the possible outcomes.  For example, the kinetic
energy flux <I>ke</I> onto a suface element for a single collision includes
a positive contribution from the incoming particle and negative
contributions from 0, 1, or 2 outgoing particles.  The exception is
the <I>n</I> and <I>nwt</I> values which simply tally counts of particles
colliding with the surface element.
</P>
<P>Also note that all values for a collision are tallied based on the
species group of the incident particle.  Quantities associated with
outgoing particles are part of the same tally, even if they are in
different species groups.
</P>
<P>The results of this compute can be used by different commands in
different ways.  The values for a single timestep can be output by the
<A HREF = "dump.html">dump grid</A> command.
</P>
<P>The values over many sampling timesteps can be averaged by the <A HREF = "fix_ave_grid.html">fix
ave/grid</A> command.  It does its averaging as if the
particles striking the surface elements within the grid cell at each
sampling timestep were combined together into one large set to compute
the formulas below.  The answer is then divided by the number of
sampling timesteps if it is not otherwise normalized by the number of
particles.  Note that in general this is a different normalization
than taking the values produced by the formulas below for a single
timestep, summing them over the sampling timesteps, and then dividing
by the number of sampling steps.  However for the current values
listed below, the two normalization methods are the same.
</P>
<P>NOTE: If particle weighting is enabled via the <A HREF = "global.html">global
weight</A> command, then all of the values below are scaled
by the weight assigned to the grid cell in which the particle
collision with the surface element occurs.  The only exception is the
the <I>n</I> value, which is NOT scaled by the weight; it is a simple count
of particle collisions with surface elements in the grid cell.
</P>
<HR>

<P>The meaning of all the value keywords and the formulas for calculating
these quantities is exactly the same as described by the <A HREF = "compute_surf.html">compute
surf</A> command.
</P>
<P>The only difference is that the quantities are calculated on a per
grid cell basis, summing over all the surface elements in that grid
cell.
</P>
<HR>

<P><B>Output info:</B>
</P>
<P>This compute calculates a per-grid array, with the number of columns
equal to the number of values times the number of groups.  The
ordering of columns is first by values, then by groups.  I.e. if the
<I>n</I> and <I>u</I> values were specified as keywords, then the first two
columns would be <I>n</I> and <I>u</I> for the first group, the 3rd and 4th
columns would be <I>n</I> and <I>u</I> for the second group, etc.
</P>
<P>Grid cells not in the specified <I>group-ID</I> will output zeroes for all
their values.
</P>
<P>The array can be accessed by any command that uses per-grid values
from a compute as input.  See <A HREF = "Section_howto.html#howto_4">Section 6.4</A>
for an overview of SPARTA output options.
</P>
<P>The per-grid array values will be in the <A HREF = "units.html">units</A>
appropriate to the individual values as described above. <I>N</I> is
unitless.  <I>Press</I>, <I>px</I>, <I>py</I>, <I>pz</I>, <I>shx</I>, <I>shy</I>, <I>shz</I> are in in
pressure units.  <I>Ke</I>, <I>erot</I>, <I>evib</I>, and <I>etot</I> are in
energy/area-time units for 3d simulations and energy/length-time units
for 2d simulations.
</P>
<HR>

<P><B>Restrictions:</B> none
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "fix_ave_grid.html">fix ave/grid</A>, <A HREF = "dump.html">dump grid</A>, <A HREF = "compute_surf.html">compute
surf</A>
</P>
<P><B>Default:</B> none
</P>
</HTML>
