Version: SMASH-3.1
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 315 of file density.h.

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

319  : jmu_pos_(FourVector()),
320  jmu_neg_(FourVector()),
321  djmu_dxnu_({FourVector(), FourVector(), FourVector(), FourVector()}),
322  drho_dxnu_(FourVector()) {}
std::array< FourVector, 4 > djmu_dxnu_
Four-gradient of the four-current density, .
Definition: density.h:521
FourVector drho_dxnu_
Four-gradient of the rest frame density, .
Definition: density.h:523
FourVector jmu_pos_
Four-current density of the positively charged particle.
Definition: density.h:517
FourVector jmu_neg_
Four-current density of the negatively charged particle.
Definition: density.h:519

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

336  {
337  const FourVector part_four_velocity = FourVector(1.0, part.velocity());
338  if (FactorTimesSf > 0.0) {
339  jmu_pos_ += part_four_velocity * FactorTimesSf;
340  } else {
341  jmu_neg_ += part_four_velocity * FactorTimesSf;
342  }
343  }

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

358  {
359  const FourVector PartFourVelocity = FourVector(1.0, part.velocity());
360  for (int k = 1; k <= 3; k++) {
361  djmu_dxnu_[k] += factor * PartFourVelocity * sf_grad[k - 1];
362  djmu_dxnu_[0] -=
363  factor * PartFourVelocity * sf_grad[k - 1] * part.velocity()[k - 1];
364  }
365  }

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

384  {
385  return (jmu_pos_.abs() - jmu_neg_.abs()) * norm_factor;
386  }
double abs() const
calculate the lorentz invariant absolute value
Definition: fourvector.h:464

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

394  {
395  ThreeVector curl_vec_j = ThreeVector();
396  curl_vec_j.set_x1(djmu_dxnu_[2].x3() - djmu_dxnu_[3].x2());
397  curl_vec_j.set_x2(djmu_dxnu_[3].x1() - djmu_dxnu_[1].x3());
398  curl_vec_j.set_x3(djmu_dxnu_[1].x2() - djmu_dxnu_[2].x1());
399  curl_vec_j *= norm_factor;
400  return curl_vec_j;
401  }

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

410  {
411  ThreeVector j0_grad = ThreeVector();
412  for (int i = 1; i < 4; i++) {
413  j0_grad[i - 1] = djmu_dxnu_[i].x0() * norm_factor;
414  }
415  return j0_grad;
416  }

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

424  {
425  return djmu_dxnu_[0].threevec() * norm_factor;
426  }

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

434 { return jmu_pos_ + jmu_neg_; }

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

440  {
441  jmu_pos_ += additional_jmu_B;
442  }

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

448  {
449  jmu_neg_ += additional_jmu_B;
450  }

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

458 { 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 465 of file density.h.

465 { 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 472 of file density.h.

472  {
473  const ThreeVector grad_rho = drho_dxnu_.threevec();
474  const ThreeVector vecj = jmu_net().threevec();
475  const ThreeVector Drho_cross_vecj = grad_rho.cross_product(vecj);
476 
477  return Drho_cross_vecj;
478  }
FourVector jmu_net() const
Definition: density.h:434
ThreeVector threevec() const
Definition: fourvector.h:329
ThreeVector cross_product(const ThreeVector &b) const
Definition: threevector.h:246

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

483  {
484  djmu_dxnu_[0] = FourVector(0.0, 0.0, 0.0, 0.0);
485  }

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

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

496  {
497  drho_dxnu_ = computed_drho_dxnu;
498  }

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

508  {
509  djmu_dxnu_[0] = djmu_dt;
510  djmu_dxnu_[1] = djmu_dx;
511  djmu_dxnu_[2] = djmu_dy;
512  djmu_dxnu_[3] = djmu_dz;
513  }

Member Data Documentation

◆ jmu_pos_

FourVector smash::DensityOnLattice::jmu_pos_
private

Four-current density of the positively charged particle.

Definition at line 517 of file density.h.

◆ jmu_neg_

FourVector smash::DensityOnLattice::jmu_neg_
private

Four-current density of the negatively charged particle.

Definition at line 519 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 521 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 523 of file density.h.


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