Version: SMASH-1.5
smash::DensityOnLattice Class Reference

#include <density.h>

A class for time-efficient (time-memory trade-off) calculation of density on the lattice.

It holds six FourVectors - positive and negative summands of 4-current, and the time and spatial derivatives of the compound current. These Four-vectors are additive by particles. It is efficient to calculate additive jmu and \( \partial_\nu jmu \) in one loop over particles and then calculate the Eckart density, the gradient of the density, the curl and the time derivative of the current accordingly. Splitting into positive and negative parts of jmu is necessary to avoid problems with the definition of Eckart rest frame.

Intended usage of the class:

  1. Add particles from some list using add_particle(...). and add_particle_for_derivatives(...) The former sets jmu_pos and jmu_neg, the next sets djmu_dx.
  2. Get jmus and density whenever necessary via density(), jmu_pos(), jmu_neg()
  3. Get \(\nabla \cdot \rho\) via grad_rho()
  4. Get \(\nabla \times \vec j\) via rot_j()
  5. Get \(\partial_t \vec j\) via dj_dt()

Definition at line 242 of file density.h.

Collaboration diagram for smash::DensityOnLattice:
[legend]

Public Member Functions

 DensityOnLattice ()
 Default constructor. More...
 
void add_particle (const ParticleData &part, double FactorTimesSf)
 Adds particle to 4-current: \(j^{\mu} += p^{\mu}/p^0 \cdot factor \). More...
 
void add_particle_for_derivatives (const ParticleData &part, double factor, ThreeVector sf_grad)
 Adds particle to the time and spatial derivatives of the 4-current. More...
 
double density (const double norm_factor=1.0)
 Compute the net Eckart density on the local lattice. More...
 
ThreeVector rot_j (const double norm_factor=1.0)
 Compute curl of the current on the local lattice. More...
 
ThreeVector grad_rho (const double norm_factor=1.0)
 Compute gradient of the density on the local lattice. More...
 
ThreeVector dj_dt (const double norm_factor=1.0)
 Compute time derivative of the current density on the local lattice. More...
 
FourVector jmu_net () const
 

Private Attributes

FourVector jmu_pos_
 Four-current density of the positively charged particle. More...
 
FourVector jmu_neg_
 Four-current density of the negatively charged particle. More...
 
std::array< FourVector, 4 > djmu_dx_
 \(\partial_\nu j^\mu \) More...
 

Constructor & Destructor Documentation

◆ DensityOnLattice()

smash::DensityOnLattice::DensityOnLattice ( )
inline

Default constructor.

Definition at line 245 of file density.h.

246  : jmu_pos_(FourVector()),
247  jmu_neg_(FourVector()),
248  djmu_dx_({FourVector(), FourVector(), FourVector(), FourVector()}) {}
std::array< FourVector, 4 > djmu_dx_
Definition: density.h:367
FourVector jmu_neg_
Four-current density of the negatively charged particle.
Definition: density.h:365
FourVector jmu_pos_
Four-current density of the positively charged particle.
Definition: density.h:363

Member Function Documentation

◆ add_particle()

void smash::DensityOnLattice::add_particle ( const ParticleData part,
double  FactorTimesSf 
)
inline

Adds particle to 4-current: \(j^{\mu} += p^{\mu}/p^0 \cdot factor \).

Two private class members jmu_pos_ and jmu_neg_ indicating the 4-current of the positively and negatively charged particles are updated by this function.

Parameters
[in]partParticle would be added to the current density on the lattice.
[in]FactorTimesSfparticle contribution to given density type (e.g. anti-proton contributes with factor -1 to baryon density, proton - with factor 1) times the smearing factor.

Definition at line 262 of file density.h.

262  {
263  const FourVector PartFourVelocity = FourVector(1.0, part.velocity());
264  if (FactorTimesSf > 0.0) {
265  jmu_pos_ += PartFourVelocity * FactorTimesSf;
266  } else {
267  jmu_neg_ += PartFourVelocity * FactorTimesSf;
268  }
269  }
FourVector jmu_neg_
Four-current density of the negatively charged particle.
Definition: density.h:365
FourVector jmu_pos_
Four-current density of the positively charged particle.
Definition: density.h:363
Here is the call graph for this function:

◆ add_particle_for_derivatives()

void smash::DensityOnLattice::add_particle_for_derivatives ( const ParticleData part,
double  factor,
ThreeVector  sf_grad 
)
inline

Adds particle to the time and spatial derivatives of the 4-current.

An array of four private 4-vectors djmu_dx_ indicating the derivatives of the compound current are updated by this function.

Parameters
[in]partParticle would be added to the current density on the lattice.
[in]factorparticle contribution to given density type (e.g. anti-proton contributes with factor -1 to baryon density, proton - with factor 1).
[in]sf_gradSmearing factor of the gradients

Definition at line 283 of file density.h.

284  {
285  const FourVector PartFourVelocity = FourVector(1.0, part.velocity());
286  for (int k = 1; k <= 3; k++) {
287  djmu_dx_[k] += factor * PartFourVelocity * sf_grad[k - 1];
288  djmu_dx_[0] -=
289  factor * PartFourVelocity * sf_grad[k - 1] * part.velocity()[k - 1];
290  }
291  }
std::array< FourVector, 4 > djmu_dx_
Definition: density.h:367
Here is the call graph for this function:

◆ density()

double smash::DensityOnLattice::density ( const double  norm_factor = 1.0)
inline

Compute the net Eckart density on the local lattice.

Note that the net Eckart density is calculated by taking the difference between the Eckart density of the positively charged particles and that of the negatively charged particles, which are, in general, defined in different frames. So the net Eckart density is not the net density in the Eckart local rest frame. However, this is the only way we can think of to be applied to the case where the density current is space-like. And fortunately, the net eckart densities are only used for calculating the potentials which are valid only in the low-energy collisions where the amount of the negatively charged particles are negligible. May be in the future, the net Eckart density can be calculated in a smarter way.

Parameters
[in]norm_factorNormalization factor
Returns
Net Eckart density on the local lattice [fm \(^{-3}\)]

Definition at line 310 of file density.h.

310  {
311  return (jmu_pos_.abs() - jmu_neg_.abs()) * norm_factor;
312  }
FourVector jmu_neg_
Four-current density of the negatively charged particle.
Definition: density.h:365
FourVector jmu_pos_
Four-current density of the positively charged particle.
Definition: density.h:363
double abs() const
calculate the lorentz invariant absolute value
Definition: fourvector.h:441
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rot_j()

ThreeVector smash::DensityOnLattice::rot_j ( const double  norm_factor = 1.0)
inline

Compute curl of the current on the local lattice.

Parameters
[in]norm_factorNormalization factor
Returns
\(\nabla\times\j\) [fm \(^{-4}\)]

Definition at line 320 of file density.h.

320  {
321  ThreeVector j_rot = ThreeVector();
322  j_rot.set_x1(djmu_dx_[2].x3() - djmu_dx_[3].x2());
323  j_rot.set_x2(djmu_dx_[3].x1() - djmu_dx_[1].x3());
324  j_rot.set_x3(djmu_dx_[1].x2() - djmu_dx_[2].x1());
325  j_rot *= norm_factor;
326  return j_rot;
327  }
std::array< FourVector, 4 > djmu_dx_
Definition: density.h:367
Here is the call graph for this function:

◆ grad_rho()

ThreeVector smash::DensityOnLattice::grad_rho ( const double  norm_factor = 1.0)
inline

Compute gradient of the density on the local lattice.

Parameters
[in]norm_factorNormalization factor
Returns
\(\nabla\rho\) [fm \(^{-4}\)]

Definition at line 335 of file density.h.

335  {
336  ThreeVector rho_grad = ThreeVector();
337  for (int i = 1; i < 4; i++) {
338  rho_grad[i - 1] = djmu_dx_[i].x0() * norm_factor;
339  }
340  return rho_grad;
341  }
std::array< FourVector, 4 > djmu_dx_
Definition: density.h:367

◆ dj_dt()

ThreeVector smash::DensityOnLattice::dj_dt ( const double  norm_factor = 1.0)
inline

Compute time derivative of the current density on the local lattice.

Parameters
[in]norm_factorNormalization factor
Returns
\(\partial_t \vec j\) [fm \(^{-4}\)]

Definition at line 349 of file density.h.

349  {
350  return djmu_dx_[0].threevec() * norm_factor;
351  }
std::array< FourVector, 4 > djmu_dx_
Definition: density.h:367

◆ jmu_net()

FourVector smash::DensityOnLattice::jmu_net ( ) const
inline
Returns
Net current density

There is a "+" operator in between, because the negative symbol of the charge has already be included in FactorTimesSF.

Definition at line 359 of file density.h.

359 { return jmu_pos_ + jmu_neg_; }
FourVector jmu_neg_
Four-current density of the negatively charged particle.
Definition: density.h:365
FourVector jmu_pos_
Four-current density of the positively charged particle.
Definition: density.h:363

Member Data Documentation

◆ jmu_pos_

FourVector smash::DensityOnLattice::jmu_pos_
private

Four-current density of the positively charged particle.

Definition at line 363 of file density.h.

◆ jmu_neg_

FourVector smash::DensityOnLattice::jmu_neg_
private

Four-current density of the negatively charged particle.

Definition at line 365 of file density.h.

◆ djmu_dx_

std::array<FourVector, 4> smash::DensityOnLattice::djmu_dx_
private

\(\partial_\nu j^\mu \)

Definition at line 367 of file density.h.


The documentation for this class was generated from the following file: