LCOV - code coverage report
Current view: top level - include/crpropa/advectionField - TimeDependentAdvectionField.h (source / functions) Coverage Total Hit
Test: coverage.info.cleaned Lines: 100.0 % 2 2
Test Date: 2026-06-18 09:49:19 Functions: - 0 0

            Line data    Source code
       1              : #ifndef CRPROPA_TIMEDEPENDENTADVECTIONFIELD_H
       2              : #define CRPROPA_TIMEDEPENDENTADVECTIONFIELD_H
       3              : 
       4              : #include "crpropa/advectionField/AdvectionField.h"
       5              : 
       6              : #include <string>
       7              : #include <iostream>
       8              : #include <cmath>
       9              : #include <cstdlib>
      10              : #include <sstream>
      11              : 
      12              : #include "crpropa/Vector3.h"
      13              : #include "crpropa/Referenced.h"
      14              : #include "crpropa/Units.h"
      15              : 
      16              : namespace crpropa {
      17              : 
      18              : /**
      19              :  @class OneDimensionalTimeDependentShock
      20              :  @brief Advection field in x-direction with shock at x = x0 that propagates with a constant speed vsh = v_up - v_down
      21              :                 and width x_sh approximated by a tanh() with variable compression ratio r_comp = v_up/v_down.
      22              :         Pre- and postshock speeds as well as shock speed must be specified. 
      23              :         The shock position at t=0 can be specified, as well as the time t0 the shock starts to propagate.
      24              :  */
      25            1 : class OneDimensionalTimeDependentShock: public AdvectionField {
      26              :         double v_sh; // shock speed assuming xsh = vsh * t + xsh_0
      27              :         double v1; // speed behind the shock in lab frame
      28              :         double v0; // undisturbed speed in lab frame
      29              :         double l_sh; // shock width
      30              :     double x_sh0; // shock position at t = 0
      31              :         double t_sh0; // time the shock starts to propagate, before: vsh=0
      32              : public:/** Constructor
      33              :         @param v_sh; // shock speed
      34              :     @param v1; // speed behind the shock in lab frame
      35              :     @param v0; // undisturbed speed in lab frame
      36              :         @param l_sh; // shock width
      37              : */
      38              :         OneDimensionalTimeDependentShock(double v_sh, double v1, double v0, double l_sh);
      39              : 
      40              :         Vector3d getField(const Vector3d &position, const double &time=0) const;
      41              :         double getDivergence(const Vector3d &position, const double &time=0) const;
      42              : 
      43              :         void setShockSpeed(double v_sh);
      44              :         void setSpeeds(double v1, double v0);
      45              :         void setShockWidth(double l_sh);
      46              :         void setShockPosition(double x_sh0);
      47              :         void setShockTime(double t_sh0);
      48              : 
      49              :     double getVshock() const;
      50              :     double getV1() const;
      51              :     double getV0() const;
      52              :     double getShockWidth() const;
      53              :     double getShockPosition(double time) const;
      54              :     double getShockTime() const;
      55              : };
      56              : 
      57              : /**
      58              :  @class SedovTaylorBlastWave
      59              :  @brief Spherical advection field with shock at R(t), velocity vsh(t) and width l_sh approximated by tanh() 
      60              :                 Wind solution is given by Kahn 1975, see also Drury 1983 for acceleration at the expanding shock
      61              :  */
      62            1 : class SedovTaylorBlastWave: public AdvectionField {
      63              :         double E0;          // energy of the explosion
      64              :         double rho0;    // initial density
      65              :         double l_sh;    // shock width
      66              : public:/** Constructor
      67              :         @param E0 // energy of the explosion
      68              :         @param rho0     // initial density
      69              :         
      70              : */
      71              :         SedovTaylorBlastWave(double E0, double rho0, double l_sh);
      72              :         Vector3d getField(const Vector3d &position, const double &time=0) const;
      73              :         double getDivergence(const Vector3d &position, const double &time=0) const;
      74              : 
      75              :         void setShockWidth(double l_sh);
      76              :         void setEnergy(double E0);
      77              :         void setDensity(double rho0);
      78              : 
      79              :         double getShockRadius(double time) const;
      80              :     double getShockSpeed(double time) const;
      81              :     double getShockWidth() const;
      82              :     double getEnergy() const;
      83              :     double getDensity() const;
      84              : };
      85              : 
      86              : } // namespace crpropa
      87              : 
      88              : #endif // CRPROPA_TIMEDEPENDENTADVECTIONFIELD_H
        

Generated by: LCOV version 2.0-1