Version: SMASH-2.0
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 258 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 261 of file density.h.

262  : jmu_pos_(FourVector()),
263  jmu_neg_(FourVector()),
264  djmu_dx_({FourVector(), FourVector(), FourVector(), FourVector()}) {}

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 278 of file density.h.

278  {
279  const FourVector PartFourVelocity = FourVector(1.0, part.velocity());
280  if (FactorTimesSf > 0.0) {
281  jmu_pos_ += PartFourVelocity * FactorTimesSf;
282  } else {
283  jmu_neg_ += PartFourVelocity * FactorTimesSf;
284  }
285  }
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 299 of file density.h.

300  {
301  const FourVector PartFourVelocity = FourVector(1.0, part.velocity());
302  for (int k = 1; k <= 3; k++) {
303  djmu_dx_[k] += factor * PartFourVelocity * sf_grad[k - 1];
304  djmu_dx_[0] -=
305  factor * PartFourVelocity * sf_grad[k - 1] * part.velocity()[k - 1];
306  }
307  }
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 326 of file density.h.

326  {
327  return (jmu_pos_.abs() - jmu_neg_.abs()) * norm_factor;
328  }
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 336 of file density.h.

336  {
337  ThreeVector j_rot = ThreeVector();
338  j_rot.set_x1(djmu_dx_[2].x3() - djmu_dx_[3].x2());
339  j_rot.set_x2(djmu_dx_[3].x1() - djmu_dx_[1].x3());
340  j_rot.set_x3(djmu_dx_[1].x2() - djmu_dx_[2].x1());
341  j_rot *= norm_factor;
342  return j_rot;
343  }
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 351 of file density.h.

351  {
352  ThreeVector rho_grad = ThreeVector();
353  for (int i = 1; i < 4; i++) {
354  rho_grad[i - 1] = djmu_dx_[i].x0() * norm_factor;
355  }
356  return rho_grad;
357  }

◆ 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 365 of file density.h.

365  {
366  return djmu_dx_[0].threevec() * norm_factor;
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 375 of file density.h.

375 { return jmu_pos_ + jmu_neg_; }

Member Data Documentation

◆ jmu_pos_

FourVector smash::DensityOnLattice::jmu_pos_
private

Four-current density of the positively charged particle.

Definition at line 379 of file density.h.

◆ jmu_neg_

FourVector smash::DensityOnLattice::jmu_neg_
private

Four-current density of the negatively charged particle.

Definition at line 381 of file density.h.

◆ djmu_dx_

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

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

Definition at line 383 of file density.h.


The documentation for this class was generated from the following file:
smash::DensityOnLattice::djmu_dx_
std::array< FourVector, 4 > djmu_dx_
Definition: density.h:383
smash::DensityOnLattice::jmu_neg_
FourVector jmu_neg_
Four-current density of the negatively charged particle.
Definition: density.h:381
smash::DensityOnLattice::jmu_pos_
FourVector jmu_pos_
Four-current density of the positively charged particle.
Definition: density.h:379
smash::FourVector::abs
double abs() const
calculate the lorentz invariant absolute value
Definition: fourvector.h:454