Version: SMASH-1.6
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 256 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

smash::DensityOnLattice::DensityOnLattice ( )
inline

Default constructor.

Definition at line 259 of file density.h.

260  : jmu_pos_(FourVector()),
261  jmu_neg_(FourVector()),
262  djmu_dx_({FourVector(), FourVector(), FourVector(), FourVector()}) {}
std::array< FourVector, 4 > djmu_dx_
Definition: density.h:381
FourVector jmu_neg_
Four-current density of the negatively charged particle.
Definition: density.h:379
FourVector jmu_pos_
Four-current density of the positively charged particle.
Definition: density.h:377

Member Function Documentation

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

276  {
277  const FourVector PartFourVelocity = FourVector(1.0, part.velocity());
278  if (FactorTimesSf > 0.0) {
279  jmu_pos_ += PartFourVelocity * FactorTimesSf;
280  } else {
281  jmu_neg_ += PartFourVelocity * FactorTimesSf;
282  }
283  }
FourVector jmu_neg_
Four-current density of the negatively charged particle.
Definition: density.h:379
FourVector jmu_pos_
Four-current density of the positively charged particle.
Definition: density.h:377

Here is the call graph for this function:

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

298  {
299  const FourVector PartFourVelocity = FourVector(1.0, part.velocity());
300  for (int k = 1; k <= 3; k++) {
301  djmu_dx_[k] += factor * PartFourVelocity * sf_grad[k - 1];
302  djmu_dx_[0] -=
303  factor * PartFourVelocity * sf_grad[k - 1] * part.velocity()[k - 1];
304  }
305  }
std::array< FourVector, 4 > djmu_dx_
Definition: density.h:381

Here is the call graph for this function:

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

324  {
325  return (jmu_pos_.abs() - jmu_neg_.abs()) * norm_factor;
326  }
FourVector jmu_neg_
Four-current density of the negatively charged particle.
Definition: density.h:379
double abs() const
calculate the lorentz invariant absolute value
Definition: fourvector.h:441
FourVector jmu_pos_
Four-current density of the positively charged particle.
Definition: density.h:377

Here is the caller graph for this function:

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

334  {
335  ThreeVector j_rot = ThreeVector();
336  j_rot.set_x1(djmu_dx_[2].x3() - djmu_dx_[3].x2());
337  j_rot.set_x2(djmu_dx_[3].x1() - djmu_dx_[1].x3());
338  j_rot.set_x3(djmu_dx_[1].x2() - djmu_dx_[2].x1());
339  j_rot *= norm_factor;
340  return j_rot;
341  }
std::array< FourVector, 4 > djmu_dx_
Definition: density.h:381

Here is the call graph for this function:

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

349  {
350  ThreeVector rho_grad = ThreeVector();
351  for (int i = 1; i < 4; i++) {
352  rho_grad[i - 1] = djmu_dx_[i].x0() * norm_factor;
353  }
354  return rho_grad;
355  }
std::array< FourVector, 4 > djmu_dx_
Definition: density.h:381
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 363 of file density.h.

363  {
364  return djmu_dx_[0].threevec() * norm_factor;
365  }
std::array< FourVector, 4 > djmu_dx_
Definition: density.h:381
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 373 of file density.h.

373 { return jmu_pos_ + jmu_neg_; }
FourVector jmu_neg_
Four-current density of the negatively charged particle.
Definition: density.h:379
FourVector jmu_pos_
Four-current density of the positively charged particle.
Definition: density.h:377

Member Data Documentation

FourVector smash::DensityOnLattice::jmu_pos_
private

Four-current density of the positively charged particle.

Definition at line 377 of file density.h.

FourVector smash::DensityOnLattice::jmu_neg_
private

Four-current density of the negatively charged particle.

Definition at line 379 of file density.h.

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

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

Definition at line 381 of file density.h.


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