"SPARTA WWW Site"_sws - "SPARTA Documentation"_sd - "SPARTA Commands"_sc :c :link(sws,http://sparta.sandia.gov) :link(sd,Manual.html) :link(sc,Section_commands.html#comm) :line compute grid command :h3 compute grid/kk command :h3 [Syntax:] compute ID grid group-ID mix-ID value1 value2 ... :pre ID is documented in "compute"_compute.html command :ulb,l grid = style name of this compute command :l group-ID = group ID for which grid cells to perform calculation on :l mix-ID = mixture ID to perform calculation on :l one or more values can be appended :l value = {n} or {nrho} or {nfrac} or {mass} or {massrho} or {massfrac} or {u} or {v} or {w} or {usq} or {vsq} or {wsq} of {ke} or {temp} or {erot} or {trot} or {evib} or {tvib} or {pxrho} or {pyrho} or {pzrho} or {kerho} :l {n} = particle count {nrho} = number density {nfrac} = number fraction {mass} = mass {massrho} = mass density {massfrac} = mass fraction {u} = x component of velocity {v} = y component of velocity {w} = z component of velocity {usq} = x component of velocity squared {vsq} = y component of velocity squared {wsq} = z component of velocity squared {ke} = kinetic energy {temp} = temperature {erot} = rotational energy {trot} = rotational temperature {evib} = vibrational energy {tvib} = vibrational temperature (classical definition) {pxrho} = x component of momentum density {pyrho} = y component of momentum density {pzrho} = z component of momentum density {kerho} = kinetic energy density :pre :ule [Examples:] compute 1 grid all species n u v w usq vsq wsq compute 1 grid subset air n u v w :pre These commands will dump time averages for each species and each grid cell to a dump file every 1000 steps: compute 1 grid all species n u v w usq vsq wsq fix 1 ave/grid 10 100 1000 c_1\[*\] dump 1 grid all 1000 tmp.grid id f_1\[*\] :pre [Description:] Define a computation that calculates one or more values for each grid cell in a grid cell group, based on the particles in the cell. The values are tallied separately for each group of species in the specified mixture, as described in the Ouput section below. See the "mixture"_mixture.html command for how a set of species can be partitioned into groups. Only grid cells in the grid group specified by {group-ID} are included in the calculations. See the "group grid"_group.html command for info on how grid cells can be assigned to grid groups. 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 "dump grid"_dump.html command. The values over many sampling timesteps can be averaged by the "fix ave/grid"_fix_ave_grid.html command. It does its averaging as if the particles in the cell at each sampling timestep were combined together into one large set of particles to compute the formulas below. Note that for most of the values, this is a different form of averaging than taking the values produced by the formulas below for a single timestep, summing those values over the sampling timesteps, and then dividing by the number of sampling steps. :line :line The {n} value counts the number of particles in each group. When accumulated over multiple sampling steps, this value is normalized by the number of sampling steps. The {nrho} value computes the number density for the grid cell volume due to particles in each group: Nrho = fnum/volume * N :pre N is the number of particles (same as the {n} keyword), fnum is the real/simulated particle ratio set by the "global fnum"_global.html command, and volume is the flow volume of the grid cell. When accumulated over multiple sampling steps, this value is normalized by the number of sampling steps. Note that if particle weighting is enabled via the "global weight"_global.html command, then the volume used in the formula is divided by the weight assigned to the grid cell. The {nfrac} value computes the number fraction of particles in each group: Nfrac = Ngroup / Ntotal Ngroup is the count of particles in the group and Ntotal is the total number of particles in all groups in the mixture. Note that this total is not (necessarily) all particles in the cell. :line The {mass} value computes the average mass of particles in each group: Mass = Sum_i (mass_i) / N :pre where Sum_i is a sum over particles in the group. The {massrho} value computes the mass density for the grid cell volume due to particles in each group: Massrho = fnum/volume * Sum_i (mass_i) :pre where Sum_i is a sum over particles in the group, fnum is the real/simulated particle ratio set by the "global fnum"_global.html command, and volume is the flow volume of the grid cell. When accumulated over multiple sampling steps, this value is normalized by the number of sampling steps. Note that if particle weighting is enabled via the "global weight"_global.html command, then the volume used in the formula is divided by the weight assigned to the grid cell. The {massfrac} value computes the mass fraction of particles in each group: Massfrac = Sum_i (mass_i) / Masstotal :pre where Sum_i is a sum over particles in the group and Masstotal is the total mass of particles in all groups in the mixture. Note that this total is not (necessarily) the mass of all particles in the cell. :line The {u}, {v}, {w} values compute the components of the mass-weighted average velocity of particles in each group: U = Sum_i (mass_i Vx_i) / Sum_i (mass_i) V = Sum_i (mass_i Vy_i) / Sum_i (mass_i) W = Sum_i (mass_i Vz_i) / Sum_i (mass_i) :pre This is the same as the center-of-mass velocity of particles in each group. The {usq}, {vsq}, {wsq} values compute the average mass-weighted squared components of the velocity of particles in each group: Usq = Sum_i (mass_i Vx_i Vx_i) / Sum_i (mass_i) Vsq = Sum_i (mass_i Vy_i Vy_i) / Sum_i (mass_i) Wsq = Sum_i (mass_i Vz_i Vz_i) / Sum_i (mass_i) :pre :line The {ke} value computes the average kinetic energy of particles in each group: Vsq = Vx*Vx + Vy*Vy + Vz*Vz KE = Sum_i (1/2 mass_i Vsq_i) / N :pre Note that this is different than the group's contribution to the average kinetic energy of entire grid cells. That can be calculated by multiplying the {ke} quantity by the {n} quantity. The {temp} value first computes the average kinetic energy of particles in each group, as for the {ke} value. This is then converted to a temperature {T} by the following formula where {kB} is the Boltzmann factor: Vsq = Vx*Vx + Vy*Vy + Vz*Vz KE = Sum_i (1/2 mass_i Vsq_i) / N T = KE / (3/2 kB) :pre Note that this definition of temperature does not subtract out a net streaming velocity for particles in the grid cell, so it is not a thermal temperature when the particles have a non-zero streaming velocity. See the "compute thermal/grid"_compute_thermal_grid.html command to calculate thermal temperatures after subtracting out streaming components of velocity. :line The {erot} value computes the average rotational energy of particles in each group: Erot = Sum_i (erot_i) / N :pre Note that this is different than the group's contribution to the average rotational energy of entire grid cells. That can be calculated by multiplying the {erot} quantity by the {n} quantity. The {trot} value computes a rotational temperature by the following formula where {kB} is the Boltzmann factor: Trot = (2/kB) Sum_i (erot_i) / Sum_i (dof_i) :pre Dof_i is the number of rotational degrees of freedom for particle i. :line The {evib} value computes the average vibrational energy of particles in each group: Evib = Sum_i (evib_i) / N :pre Note that this is different than the group's contribution to the average vibrational energy of entire grid cells. That can be calculated by multiplying the {evib} quantity by the {n} quantity. The {tvib} value computes a classical definition of vibrational temperature, valid for continous distributions of vibrational energy, by the following formula where {kB} is the Boltzmann factor: Tvib = (2/kB) Sum_i (evib_i) / Sum_i (dof_i) :pre Dof_i is the number of vibrational degrees of freedom for particle i. :line The {pxrho}, {pyrho}, {pzrho} values compute components of momentum density for the grid cell volume due to particles in each group: Pxrho = fnum/volume * Sum_i (mass_i * Vx_i) Pyrho = fnum/volume * Sum_i (mass_i * Vy_i) Pzrho = fnum/volume * Sum_i (mass_i * Vz_i) :pre where Sum_i is a sum over particles in the group, fnum is the real/simulated particle ratio set by the "global fnum"_global.html command, and volume is the flow volume of the grid cell. When accumulated over multiple sampling steps, this value is normalized by the number of sampling steps. Note that if particle weighting is enabled via the "global weight"_global.html command, then the volume used in the formula is divided by the weight assigned to the grid cell. The {kerho} value computes the kinetic energy density for the grid cell volume due to particles in each group: Vsq = Vx*Vx + Vy*Vy + Vz*Vz KErho = fnum/volume * Sum_i (mass_i * Vsq_i) :pre where Sum_i is a sum over particles in the group, fnum is the real/simulated particle ratio set by the "global fnum"_global.html command, and volume is the flow volume of the grid cell. When accumulated over multiple sampling steps, this value is normalized by the number of sampling steps. Note that if particle weighting is enabled via the "global weight"_global.html command, then the volume used in the formula is divided by the weight assigned to the grid cell. :line :line [Output info:] 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 {n} and {u} values were specified as keywords, then the first two columns would be {n} and {u} for the first group, the 3rd and 4th columns would be {n} and {u} for the second group, etc. This compute performs calculations for all flavors of child grid cells in the simulation, which includes unsplit, cut, split, and sub cells. See "Section 6.8"_Section_howto.html#howto_8 of the manual gives details of how SPARTA defines child, unsplit, split, and sub cells. Note that cells inside closed surfaces contain no particles. These could be unsplit or cut cells (if they have zero flow volume). Both of these kinds of cells will compute a zero result for all their values. Likewise, split cells store no particles and will produce a zero result. This is because their sub-cells actually contain the particles that are geometrically inside the split cell. Grid cells not in the specified {group-ID} will output zeroes for all their values. The array can be accessed by any command that uses per-grid values from a compute as input. See "Section 6.4"_Section_howto.html#howto_4 for an overview of SPARTA output options. The per-grid array values will be in the "units"_units.html appropriate to the individual values as described above. {N} is unitless. {Nrho} is in 1/distance^3 units for 3d simulations and 1/distance^2 units for 2d simulations. {Mass} is in mass units. {Massrho} is in is in mass/distance^3 units for 3d simulations and mass/distance^2 units for 2d simulations. {U}, {v}, and {w} are in velocity units. {Usq}, {vsq}, and {wsq} are in velocity squared units. {Ke}, {erot}, and {evib} are in energy units. {Temp} and {trot} and {tvib} are in temperature units. {Pxrho}, {pyrho}, {pzrho} are in momentum/distance^3 units for 3d simulations and momentum/distance^2 units for 2d simulations, where momentum is in units of mass*velocity. {Kerho} is in units of energy/distance^3 units for 3d simulations and energy/distance^2 units for 2d simulations. :line Styles with a {kk} suffix are functionally the same as the corresponding style without the suffix. They have been optimized to run faster, depending on your available hardware, as discussed in the "Accelerating SPARTA"_Section_accelerate.html section of the manual. The accelerated styles take the same arguments and should produce the same results, except for different random number, round-off and precision issues. These accelerated styles are part of the KOKKOS package. They are only enabled if SPARTA was built with that package. See the "Making SPARTA"_Section_start.html#start_3 section for more info. You can specify the accelerated styles explicitly in your input script by including their suffix, or you can use the "-suffix command-line switch"_Section_start.html#start_6 when you invoke SPARTA, or you can use the "suffix"_suffix.html command in your input script. See the "Accelerating SPARTA"_Section_accelerate.html section of the manual for more instructions on how to use the accelerated styles effectively. :line [Restrictions:] none [Related commands:] "fix ave/grid"_fix_ave_grid.html, "dump grid"_dump.html, "compute thermal/grid"_compute_thermal_grid.html [Default:] none