Version: SMASH-2.2
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 \(j^\mu\) and \(\partial_\nu j^\mu \) in one loop over particles and then calculate the Eckart density, the gradient of the density, the curl, the time derivative of the current, and derivatives of the rest frame density accordingly. Splitting into positive and negative parts of \(j^\mu\) 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(), setting jmu_pos and jmu_neg. Calculate derivatives using either add_particle_for_derivatives() (in case of Gaussian derivatives) or calculating finite difference derivatives; this sets djmu_dxnu. If needed, calculate rest frame density derivatives, setting drho_dxnu.
  2. Get the net current via jmu_net().
  3. Get the net rest frame density via rho().
  4. Get the derivatives of the net current via djmu_dxnu()
  5. Get the derivatives of the net rest frame baryon density via drho_dxnu()
  6. Get \(\vec{\nabla} j^0\) via grad_j0()
  7. Get \(\vec{\nabla} \times \vec{j}\) via curl_vecj()
  8. Get \(\partial_t \vec{j}\) via dvecj_dt()
  9. Get \((\vec{\nabla} \rho) \times \vec{j}\) via grad_rho_cross_vecj()

Definition at line 309 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 rho (const double norm_factor=1.0)
 Compute the net Eckart density on the local lattice. More...
 
ThreeVector curl_vecj (const double norm_factor=1.0)
 Compute curl of the current on the local lattice. More...
 
ThreeVector grad_j0 (const double norm_factor=1.0)
 Compute gradient of the the zeroth component of the four-current j^mu (that is of the computational frame density) on the local lattice. More...
 
ThreeVector dvecj_dt (const double norm_factor=1.0)
 Compute time derivative of the current density on the local lattice. More...
 
FourVector jmu_net () const
 
void add_to_jmu_pos (FourVector additional_jmu_B)
 Add to the positive density current. More...
 
void add_to_jmu_neg (FourVector additional_jmu_B)
 Add to the negative density current. More...
 
FourVector drho_dxnu () const
 Return the FourGradient of the rest frame density \(\partial_{\nu}\rho\). More...
 
std::array< FourVector, 4 > djmu_dxnu () const
 Return the FourGradient of the net baryon current \(\partial_{\nu} j^\mu\). More...
 
ThreeVector grad_rho_cross_vecj () const
 Compute the cross product of \(\vec{\nabla}\rho\) and \(j^\mu\). More...
 
void overwrite_djmu_dt_to_zero ()
 Overwrite the time derivative of the current to zero. More...
 
void overwrite_drho_dt_to_zero ()
 Overwrite the time derivative of the rest frame density to zero. More...
 
void overwrite_drho_dxnu (FourVector computed_drho_dxnu)
 Overwrite the rest frame density derivatives to provided values. More...
 
void overwrite_djmu_dxnu (FourVector djmu_dt, FourVector djmu_dx, FourVector djmu_dy, FourVector djmu_dz)
 Overwrite all density current derivatives to provided values. More...
 

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_dxnu_
 Four-gradient of the four-current density, \(\partial_\nu j^\mu \). More...
 
FourVector drho_dxnu_
 Four-gradient of the rest frame density, \(\partial_\nu \rho \). More...
 

Constructor & Destructor Documentation

◆ DensityOnLattice()

smash::DensityOnLattice::DensityOnLattice ( )
inline

Default constructor.

Definition at line 312 of file density.h.

313  : jmu_pos_(FourVector()),
314  jmu_neg_(FourVector()),
315  djmu_dxnu_({FourVector(), FourVector(), FourVector(), FourVector()}),
316  drho_dxnu_(FourVector()) {}
std::array< FourVector, 4 > djmu_dxnu_
Four-gradient of the four-current density, .
Definition: density.h:514
FourVector drho_dxnu_
Four-gradient of the rest frame density, .
Definition: density.h:516
FourVector jmu_pos_
Four-current density of the positively charged particle.
Definition: density.h:510
FourVector jmu_neg_
Four-current density of the negatively charged particle.
Definition: density.h:512

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

330  {
331  const FourVector part_four_velocity = FourVector(1.0, part.velocity());
332  if (FactorTimesSf > 0.0) {
333  jmu_pos_ += part_four_velocity * FactorTimesSf;
334  } else {
335  jmu_neg_ += part_four_velocity * FactorTimesSf;
336  }
337  }
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_dxnu_ 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 351 of file density.h.

352  {
353  const FourVector PartFourVelocity = FourVector(1.0, part.velocity());
354  for (int k = 1; k <= 3; k++) {
355  djmu_dxnu_[k] += factor * PartFourVelocity * sf_grad[k - 1];
356  djmu_dxnu_[0] -=
357  factor * PartFourVelocity * sf_grad[k - 1] * part.velocity()[k - 1];
358  }
359  }
Here is the call graph for this function:

◆ rho()

double smash::DensityOnLattice::rho ( 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 \(\rho\) [fm \(^{-3}\)]

Definition at line 378 of file density.h.

378  {
379  return (jmu_pos_.abs() - jmu_neg_.abs()) * norm_factor;
380  }
double abs() const
calculate the lorentz invariant absolute value
Definition: fourvector.h:459
Here is the call graph for this function:
Here is the caller graph for this function:

◆ curl_vecj()

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

Compute curl of the current on the local lattice.

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

Definition at line 388 of file density.h.

388  {
389  ThreeVector curl_vec_j = ThreeVector();
390  curl_vec_j.set_x1(djmu_dxnu_[2].x3() - djmu_dxnu_[3].x2());
391  curl_vec_j.set_x2(djmu_dxnu_[3].x1() - djmu_dxnu_[1].x3());
392  curl_vec_j.set_x3(djmu_dxnu_[1].x2() - djmu_dxnu_[2].x1());
393  curl_vec_j *= norm_factor;
394  return curl_vec_j;
395  }
Here is the call graph for this function:

◆ grad_j0()

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

Compute gradient of the the zeroth component of the four-current j^mu (that is of the computational frame density) on the local lattice.

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

Definition at line 404 of file density.h.

404  {
405  ThreeVector j0_grad = ThreeVector();
406  for (int i = 1; i < 4; i++) {
407  j0_grad[i - 1] = djmu_dxnu_[i].x0() * norm_factor;
408  }
409  return j0_grad;
410  }

◆ dvecj_dt()

ThreeVector smash::DensityOnLattice::dvecj_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 418 of file density.h.

418  {
419  return djmu_dxnu_[0].threevec() * norm_factor;
420  }

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

428 { return jmu_pos_ + jmu_neg_; }
Here is the caller graph for this function:

◆ add_to_jmu_pos()

void smash::DensityOnLattice::add_to_jmu_pos ( FourVector  additional_jmu_B)
inline

Add to the positive density current.

Parameters
[in]additional_jmu_BValue of positive density current to be added

Definition at line 434 of file density.h.

434  {
435  jmu_pos_ += additional_jmu_B;
436  }

◆ add_to_jmu_neg()

void smash::DensityOnLattice::add_to_jmu_neg ( FourVector  additional_jmu_B)
inline

Add to the negative density current.

Parameters
[in]additional_jmu_BValue of negative density current to be added

Definition at line 442 of file density.h.

442  {
443  jmu_neg_ += additional_jmu_B;
444  }

◆ drho_dxnu()

FourVector smash::DensityOnLattice::drho_dxnu ( ) const
inline

Return the FourGradient of the rest frame density \(\partial_{\nu}\rho\).

Returns
the FourGradient of the rest frame density \(\partial_{\nu}\rho\)

Definition at line 452 of file density.h.

452 { return drho_dxnu_; }

◆ djmu_dxnu()

std::array<FourVector, 4> smash::DensityOnLattice::djmu_dxnu ( ) const
inline

Return the FourGradient of the net baryon current \(\partial_{\nu} j^\mu\).

Returns
the array of FourGradients of \(\partial_{\nu} j^\mu\)

Definition at line 459 of file density.h.

459 { return djmu_dxnu_; }

◆ grad_rho_cross_vecj()

ThreeVector smash::DensityOnLattice::grad_rho_cross_vecj ( ) const
inline

Compute the cross product of \(\vec{\nabla}\rho\) and \(j^\mu\).

Returns
the cross product of \(\vec{\nabla} \rho\) and \(\vec{j}\)

Definition at line 465 of file density.h.

465  {
466  const ThreeVector grad_rho = drho_dxnu_.threevec();
467  const ThreeVector vecj = jmu_net().threevec();
468  const ThreeVector Drho_cross_vecj = grad_rho.cross_product(vecj);
469 
470  return Drho_cross_vecj;
471  }
FourVector jmu_net() const
Definition: density.h:428
ThreeVector threevec() const
Definition: fourvector.h:324
ThreeVector cross_product(const ThreeVector &b) const
Definition: threevector.h:239
Here is the call graph for this function:

◆ overwrite_djmu_dt_to_zero()

void smash::DensityOnLattice::overwrite_djmu_dt_to_zero ( )
inline

Overwrite the time derivative of the current to zero.

Definition at line 476 of file density.h.

476  {
477  djmu_dxnu_[0] = FourVector(0.0, 0.0, 0.0, 0.0);
478  }

◆ overwrite_drho_dt_to_zero()

void smash::DensityOnLattice::overwrite_drho_dt_to_zero ( )
inline

Overwrite the time derivative of the rest frame density to zero.

Definition at line 483 of file density.h.

483 { drho_dxnu_[0] = 0.0; }

◆ overwrite_drho_dxnu()

void smash::DensityOnLattice::overwrite_drho_dxnu ( FourVector  computed_drho_dxnu)
inline

Overwrite the rest frame density derivatives to provided values.

Parameters
[in]computed_drho_dxnua FourGradient of the rest frame density rho

Definition at line 489 of file density.h.

489  {
490  drho_dxnu_ = computed_drho_dxnu;
491  }

◆ overwrite_djmu_dxnu()

void smash::DensityOnLattice::overwrite_djmu_dxnu ( FourVector  djmu_dt,
FourVector  djmu_dx,
FourVector  djmu_dy,
FourVector  djmu_dz 
)
inline

Overwrite all density current derivatives to provided values.

Parameters
[in]djmu_dttime derivative of the current FourVector jmu
[in]djmu_dxx derivative of the current FourVector jmu
[in]djmu_dyy derivative of the current FourVector jmu
[in]djmu_dzz derivative of the current FourVector jmu

Definition at line 500 of file density.h.

501  {
502  djmu_dxnu_[0] = djmu_dt;
503  djmu_dxnu_[1] = djmu_dx;
504  djmu_dxnu_[2] = djmu_dy;
505  djmu_dxnu_[3] = djmu_dz;
506  }

Member Data Documentation

◆ jmu_pos_

FourVector smash::DensityOnLattice::jmu_pos_
private

Four-current density of the positively charged particle.

Definition at line 510 of file density.h.

◆ jmu_neg_

FourVector smash::DensityOnLattice::jmu_neg_
private

Four-current density of the negatively charged particle.

Definition at line 512 of file density.h.

◆ djmu_dxnu_

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

Four-gradient of the four-current density, \(\partial_\nu j^\mu \).

Definition at line 514 of file density.h.

◆ drho_dxnu_

FourVector smash::DensityOnLattice::drho_dxnu_
private

Four-gradient of the rest frame density, \(\partial_\nu \rho \).

Definition at line 516 of file density.h.


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