Version: SMASH-3.4
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 \(\boldsymbol{\nabla} j^0\) via grad_j0()
  7. Get \(\boldsymbol{\nabla} \times \mathbf{j}\) via curl_vecj()
  8. Get \(\partial_t\,\mathbf{j}\) via dvecj_dt()
  9. Get \((\boldsymbol{\nabla} \rho) \times \mathbf{j}\) via grad_rho_cross_vecj()

Definition at line 304 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 \(\boldsymbol{\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 307 of file density.h.

308  : jmu_pos_(FourVector()),
309  jmu_neg_(FourVector()),
310  djmu_dxnu_({FourVector(), FourVector(), FourVector(), FourVector()}),
311  drho_dxnu_(FourVector()) {}
std::array< FourVector, 4 > djmu_dxnu_
Four-gradient of the four-current density, .
Definition: density.h:510
FourVector drho_dxnu_
Four-gradient of the rest frame density, .
Definition: density.h:512
FourVector jmu_pos_
Four-current density of the positively charged particle.
Definition: density.h:506
FourVector jmu_neg_
Four-current density of the negatively charged particle.
Definition: density.h:508

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

325  {
326  const FourVector part_four_velocity = FourVector(1.0, part.velocity());
327  if (FactorTimesSf > 0.0) {
328  jmu_pos_ += part_four_velocity * FactorTimesSf;
329  } else {
330  jmu_neg_ += part_four_velocity * FactorTimesSf;
331  }
332  }
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 346 of file density.h.

347  {
348  const FourVector PartFourVelocity = FourVector(1.0, part.velocity());
349  for (int k = 1; k <= 3; k++) {
350  djmu_dxnu_[k] += factor * PartFourVelocity * sf_grad[k - 1];
351  djmu_dxnu_[0] -=
352  factor * PartFourVelocity * sf_grad[k - 1] * part.velocity()[k - 1];
353  }
354  }
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 373 of file density.h.

373  {
374  return (jmu_pos_.abs() - jmu_neg_.abs()) * norm_factor;
375  }
double abs() const
calculate the lorentz invariant absolute value
Definition: fourvector.h:464
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
\(\boldsymbol{\nabla}\times\mathbf{j}\) [fm \(^{-4}\)]

Definition at line 383 of file density.h.

383  {
384  ThreeVector curl_vec_j = ThreeVector();
385  curl_vec_j.set_x1(djmu_dxnu_[2].x3() - djmu_dxnu_[3].x2());
386  curl_vec_j.set_x2(djmu_dxnu_[3].x1() - djmu_dxnu_[1].x3());
387  curl_vec_j.set_x3(djmu_dxnu_[1].x2() - djmu_dxnu_[2].x1());
388  curl_vec_j *= norm_factor;
389  return curl_vec_j;
390  }
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
\(\boldsymbol{\nabla} j^0\) [fm \(^{-4}\)]

Definition at line 399 of file density.h.

399  {
400  ThreeVector j0_grad = ThreeVector();
401  for (int i = 1; i < 4; i++) {
402  j0_grad[i - 1] = djmu_dxnu_[i].x0() * norm_factor;
403  }
404  return j0_grad;
405  }

◆ 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 \mathbf{j}\) [fm \(^{-4}\)]

Definition at line 413 of file density.h.

413  {
414  return djmu_dxnu_[0].threevec() * norm_factor;
415  }

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

423 { 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 429 of file density.h.

429  {
430  jmu_pos_ += additional_jmu_B;
431  }

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

437  {
438  jmu_neg_ += additional_jmu_B;
439  }

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

447 { 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 454 of file density.h.

454 { return djmu_dxnu_; }

◆ grad_rho_cross_vecj()

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

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

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

Definition at line 461 of file density.h.

461  {
462  const ThreeVector grad_rho = drho_dxnu_.threevec();
463  const ThreeVector vecj = jmu_net().threevec();
464  const ThreeVector Drho_cross_vecj = grad_rho.cross_product(vecj);
465 
466  return Drho_cross_vecj;
467  }
FourVector jmu_net() const
Definition: density.h:423
ThreeVector threevec() const
Definition: fourvector.h:329
ThreeVector cross_product(const ThreeVector &b) const
Definition: threevector.h:255
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 472 of file density.h.

472  {
473  djmu_dxnu_[0] = FourVector(0.0, 0.0, 0.0, 0.0);
474  }

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

479 { 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 485 of file density.h.

485  {
486  drho_dxnu_ = computed_drho_dxnu;
487  }

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

497  {
498  djmu_dxnu_[0] = djmu_dt;
499  djmu_dxnu_[1] = djmu_dx;
500  djmu_dxnu_[2] = djmu_dy;
501  djmu_dxnu_[3] = djmu_dz;
502  }

Member Data Documentation

◆ jmu_pos_

FourVector smash::DensityOnLattice::jmu_pos_
private

Four-current density of the positively charged particle.

Definition at line 506 of file density.h.

◆ jmu_neg_

FourVector smash::DensityOnLattice::jmu_neg_
private

Four-current density of the negatively charged particle.

Definition at line 508 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 510 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 512 of file density.h.


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