Version: SMASH-3.4
fields.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2021-2022
4  * SMASH Team
5  *
6  * GNU General Public License (GPLv3 or later)
7  *
8  */
9 #ifndef SRC_INCLUDE_SMASH_FIELDS_H_
10 #define SRC_INCLUDE_SMASH_FIELDS_H_
11 
12 #include <iostream>
13 #include <typeinfo>
14 #include <utility>
15 #include <vector>
16 
17 #include "density.h"
18 #include "experimentparameters.h"
19 #include "fourvector.h"
20 #include "potentials.h"
21 #include "threevector.h"
22 
23 namespace smash {
24 
25 /**
26  * A class for calculating the fields A^mu associated with the VDF potentials.
27  * The structure of the class is heavily based on the DensityOnLattice class.
28  *
29  * It holds the values of the A^mu FourVector as well as fourgradients of its
30  * components.
31  */
33  public:
34  /// Default constructor
36  : A_mu_(FourVector()),
38 
39  /**
40  * \return The field four-vector A^mu
41  */
42  FourVector A_mu() const { return A_mu_; }
43 
44  /**
45  * \return The four-gradient of the field four-vector A^mu
46  */
47  std::array<FourVector, 4> dAmu_dxnu() const { return dAmu_dxnu_; }
48 
49  /**
50  * \return The time derivative of the 3-vector part of A^mu on the local
51  * lattice
52  */
53  ThreeVector dvecA_dt() { return dAmu_dxnu_[0].threevec(); }
54 
55  /**
56  * Compute the gradient of A^0 on the local lattice
57  *
58  * \return \f$\nabla A^0\f$
59  */
61  ThreeVector A_0_grad = ThreeVector();
62  for (int i = 1; i < 4; i++) {
63  A_0_grad[i - 1] = dAmu_dxnu_[i].x0();
64  }
65  return A_0_grad;
66  }
67 
68  /**
69  * Compute the curl of the field on the local lattice
70  *
71  * \return \f$\boldsymbol{\nabla}\times\mathbf{A}\f$
72  */
74  ThreeVector curl_vec_A = ThreeVector();
75  curl_vec_A.set_x1(dAmu_dxnu_[2].x3() - dAmu_dxnu_[3].x2());
76  curl_vec_A.set_x2(dAmu_dxnu_[3].x1() - dAmu_dxnu_[1].x3());
77  curl_vec_A.set_x3(dAmu_dxnu_[1].x2() - dAmu_dxnu_[2].x1());
78  return curl_vec_A;
79  }
80 
81  /**
82  * Overwrite the value of the field on the local lattice
83  *
84  * \param[in] new_A_mu new value of the field
85  */
86  void overwrite_A_mu(FourVector new_A_mu) { A_mu_ = new_A_mu; }
87 
88  /**
89  * Overwrite the time derivative of A^mu to zero
90  */
92  FourVector tmp0(0.0, 0.0, 0.0, 0.0);
93 
94  dAmu_dxnu_[0] = tmp0;
95  }
96 
97  /**
98  * Overwrite the four-gradient of A^mu on the local lattice, using the
99  * provided values of its components.
100  *
101  * \param[in] dAmu_dt new value of the time derivative of A^mu
102  * \param[in] dAmu_dx new value of the x-derivative of A^mu
103  * \param[in] dAmu_dy new value of the y-derivative of A^mu
104  * \param[in] dAmu_dz new value of the z-derivative of A^mu
105  */
107  FourVector dAmu_dy, FourVector dAmu_dz) {
108  dAmu_dxnu_[0] = dAmu_dt;
109  dAmu_dxnu_[1] = dAmu_dx;
110  dAmu_dxnu_[2] = dAmu_dy;
111  dAmu_dxnu_[3] = dAmu_dz;
112  }
113 
114  private:
115  /// Four-vector density of the field
117  /// Four-gradient of the four-vector density of the field
118  std::array<FourVector, 4> dAmu_dxnu_;
119 };
120 
121 /// Conveniency typedef for lattice of fields
123 
124 /**
125  * Updates the contents on the lattice of FieldsOnLattice type.
126  *
127  * \param[out] fields_lat The lattice of FieldsOnLattice type on which the
128  * content will be updated
129  * \param[in] old_fields Auxiliary lattice, filled with field values at t0,
130  * needed for calculating time derivatives
131  * \param[in] new_fields Auxiliary lattice, filled with field values at t0 + dt,
132  * needed for calculating time derivatives
133  * \param[in] fields_four_grad_lattice Auxiliary lattice for calculating the
134  * fourgradient of the fields
135  * \param[in] jmu_B_lat Lattice of baryon four-current
136  * \param[in] fields_lat_update Tells if called for update at printout or at
137  * timestep
138  * \param[in] potentials mean-field potentials used in the simulation
139  * \param[in] time_step Time step used in the simulation
140  */
141 
144  RectangularLattice<FourVector> *old_fields,
145  RectangularLattice<FourVector> *new_fields,
146  RectangularLattice<std::array<FourVector, 4>> *fields_four_grad_lattice,
147  DensityLattice *jmu_B_lat, const LatticeUpdate fields_lat_update,
148  const Potentials &potentials, const double time_step);
149 } // namespace smash
150 
151 #endif // SRC_INCLUDE_SMASH_FIELDS_H_
A class for calculating the fields A^mu associated with the VDF potentials.
Definition: fields.h:32
std::array< FourVector, 4 > dAmu_dxnu() const
Definition: fields.h:47
void overwrite_dAmu_dt_to_zero()
Overwrite the time derivative of A^mu to zero.
Definition: fields.h:91
ThreeVector dvecA_dt()
Definition: fields.h:53
FourVector A_mu_
Four-vector density of the field.
Definition: fields.h:116
FourVector A_mu() const
Definition: fields.h:42
std::array< FourVector, 4 > dAmu_dxnu_
Four-gradient of the four-vector density of the field.
Definition: fields.h:118
void overwrite_dAmu_dxnu(FourVector dAmu_dt, FourVector dAmu_dx, FourVector dAmu_dy, FourVector dAmu_dz)
Overwrite the four-gradient of A^mu on the local lattice, using the provided values of its components...
Definition: fields.h:106
ThreeVector grad_A0()
Compute the gradient of A^0 on the local lattice.
Definition: fields.h:60
void overwrite_A_mu(FourVector new_A_mu)
Overwrite the value of the field on the local lattice.
Definition: fields.h:86
FieldsOnLattice()
Default constructor.
Definition: fields.h:35
ThreeVector curl_vecA()
Compute the curl of the field on the local lattice.
Definition: fields.h:73
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
Definition: fourvector.h:33
A class that stores parameters of potentials, calculates potentials and their gradients.
Definition: potentials.h:36
A container class to hold all the arrays on the lattice and access them.
Definition: lattice.h:49
The ThreeVector class represents a physical three-vector with the components .
Definition: threevector.h:31
void set_x1(double x)
set first component
Definition: threevector.h:188
void set_x3(double z)
set third component
Definition: threevector.h:196
void set_x2(double y)
set second component
Definition: threevector.h:192
constexpr Section potentials
Section for the potentials information.
Definition: input_keys.h:228
Definition: action.h:24
void update_fields_lattice(RectangularLattice< FieldsOnLattice > *fields_lat, RectangularLattice< FourVector > *old_fields, RectangularLattice< FourVector > *new_fields, RectangularLattice< std::array< FourVector, 4 >> *fields_four_grad_lattice, DensityLattice *jmu_B_lat, const LatticeUpdate fields_lat_update, const Potentials &potentials, const double time_step)
Updates the contents on the lattice of FieldsOnLattice type.
Definition: fields.cc:14
LatticeUpdate
Enumerator option for lattice updates.
Definition: lattice.h:38
RectangularLattice< FieldsOnLattice > FieldsLattice
Conveniency typedef for lattice of fields.
Definition: fields.h:122