File: ElectronHeatFlux.h

package info (click to toggle)
lammps 20220106.git7586adbb6a%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 348,064 kB
  • sloc: cpp: 831,421; python: 24,896; xml: 14,949; f90: 10,845; ansic: 7,967; sh: 4,226; perl: 4,064; fortran: 2,424; makefile: 1,501; objc: 238; lisp: 163; csh: 16; awk: 14; tcl: 6
file content (178 lines) | stat: -rw-r--r-- 6,907 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#ifndef ELECTRON_HEAT_FLUX_H
#define ELECTRON_HEAT_FLUX_H

#include <map>
#include <string>
#include "ATC_TypeDefs.h"
#include "ElectronFlux.h"
#include "ElectronHeatCapacity.h"

namespace ATC {

  /**
   *  @class  ElectronHeatFlux
   *  @brief  Base class for the electron heat flux
   */

  class ElectronHeatFlux
  {
    public:
      ElectronHeatFlux(/*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
      virtual ~ElectronHeatFlux() {};
      /** computes heat flux */
      virtual void electron_heat_flux(const FIELD_MATS &fields,
                                      const GRAD_FIELD_MATS & /* gradFields */,
                                            DENS_MAT_VEC &flux)
      {

        FIELD_MATS::const_iterator etField = fields.find(ELECTRON_TEMPERATURE);
        const DENS_MAT & Te = etField->second;
        zeroWorkspace_.reset(Te.nRows(),Te.nCols());
        flux[0] = zeroWorkspace_;
        flux[1] = zeroWorkspace_;
        flux[2] = zeroWorkspace_;
      };
      void electron_heat_convection(const FIELD_MATS &fields,
                                          DENS_MAT_VEC & flux)
      {
        FIELD_MATS::const_iterator etField = fields.find(ELECTRON_TEMPERATURE);
        FIELD_MATS::const_iterator evField = fields.find(ELECTRON_VELOCITY);
        const DENS_MAT & Te = etField->second;
        const DENS_MAT & v = evField->second;
        electronHeatCapacity_->electron_heat_capacity(fields,cpTeWorkspace_);
        cpTeWorkspace_ *= Te;
        const CLON_VEC vx(v,CLONE_COL,0);
        const CLON_VEC vy(v,CLONE_COL,1);
        const CLON_VEC vz(v,CLONE_COL,2);
        flux[0] = vx;
        flux[1] = vy;
        flux[2] = vz;
        // scale by thermal energy
        flux[0] *= cpTeWorkspace_;
        flux[1] *= cpTeWorkspace_;
        flux[2] *= cpTeWorkspace_;
      };
  protected:
      ElectronHeatCapacity * electronHeatCapacity_;
      DENS_MAT zeroWorkspace_;
      DENS_MAT cpTeWorkspace_; // hopefully avoid resizing
  };
  //-----------------------------------------------------------------------

  /**
   *  @class  ElectronHeatFluxLinear
   *  @brief  Class for an electron heat flux proportional to the temperature gradient with constant conductivity
   */

  class ElectronHeatFluxLinear : public ElectronHeatFlux
  {
    public:
    ElectronHeatFluxLinear(std::fstream &matfile,std::map<std::string,double> & parameters,
                           /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
      virtual ~ElectronHeatFluxLinear() {};
      virtual void electron_heat_flux(const FIELD_MATS & /* fields */,
                                      const GRAD_FIELD_MATS &gradFields,
                                            DENS_MAT_VEC &flux)
      {
        GRAD_FIELD_MATS::const_iterator dEtField = gradFields.find(ELECTRON_TEMPERATURE);
         // flux = -ke dTe/dx
         const DENS_MAT_VEC & dT = dEtField->second;
         flux[0] = -conductivity_ * dT[0];
         flux[1] = -conductivity_ * dT[1];
         flux[2] = -conductivity_ * dT[2];
      };
    protected:
      double conductivity_;
  };
  //-----------------------------------------------------------------------

  /**
   *  @class  ElectronHeatFluxPowerLaw
   *  @brief  Class for an electron heat flux proportional to the temperature gradient but with a conductivity proportional to the ratio of the electron and phonon temperatures
   */

  class ElectronHeatFluxPowerLaw : public ElectronHeatFlux
  {
    public:
    ElectronHeatFluxPowerLaw(std::fstream &matfile,std::map<std::string,double> &parameters,
                             /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
      virtual ~ElectronHeatFluxPowerLaw() {};
      virtual void electron_heat_flux(const FIELD_MATS &fields,
                                      const GRAD_FIELD_MATS &gradFields,
                                            DENS_MAT_VEC &flux)
      {
        FIELD_MATS::const_iterator etField = fields.find(ELECTRON_TEMPERATURE);
        FIELD_MATS::const_iterator tField  = fields.find(TEMPERATURE);
        GRAD_FIELD_MATS::const_iterator dEtField = gradFields.find(ELECTRON_TEMPERATURE);
        const DENS_MAT_VEC & dT = dEtField->second;
        const DENS_MAT & T = tField->second;
        const DENS_MAT & Te = etField->second;

        // flux = -ke * ( Te / T ) dT;
        flux[0] = dT[0];
        flux[1] = dT[1];
        flux[2] = dT[2];
        electronConductivity_ = (-conductivity_* Te) / T;
        flux[0] *= electronConductivity_;
        flux[1] *= electronConductivity_;
        flux[2] *= electronConductivity_;
      };
    protected:
      double conductivity_;
      DENS_MAT electronConductivity_; // hopefully avoid resizing
  };
  //-----------------------------------------------------------------------

  /**
   *  @class  ElectronHeatFluxThermopower
   *  @brief  Class for an electron heat flux proportional to the temperature gradient but with a condu
ctivity proportional to the ratio of the electron and phonon temperatures with the thermopower from the electric current included
   */

  class ElectronHeatFluxThermopower : public ElectronHeatFlux
  {
    public:
      ElectronHeatFluxThermopower(std::fstream &matfile,
                                  std::map<std::string,double> & parameters,
                                  /*const*/ ElectronFlux * electronFlux = nullptr,
                                  /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
      virtual ~ElectronHeatFluxThermopower() {};
      virtual void electron_heat_flux(const FIELD_MATS &fields,
                                      const GRAD_FIELD_MATS &gradFields,
                                            DENS_MAT_VEC &flux)
      {
        FIELD_MATS::const_iterator etField = fields.find(ELECTRON_TEMPERATURE);
        FIELD_MATS::const_iterator tField  = fields.find(TEMPERATURE);
        GRAD_FIELD_MATS::const_iterator dEtField = gradFields.find(ELECTRON_TEMPERATURE);
        const DENS_MAT_VEC & dT = dEtField->second;
        const DENS_MAT & T = tField->second;
        const DENS_MAT & Te = etField->second;

        // flux = -ke * ( Te / T ) dT + pi J_e;
        flux[0] = dT[0];
        flux[1] = dT[1];
        flux[2] = dT[2];
        elecCondWorkspace_ = (-conductivity_* Te) / T;
        flux[0] *= elecCondWorkspace_;
        flux[1] *= elecCondWorkspace_;
        flux[2] *= elecCondWorkspace_;

        electronFlux_->electron_flux(fields, gradFields, tmp_);
        tmp_[0] *=  Te;
        tmp_[1] *=  Te;
        tmp_[2] *=  Te;
        flux[0] += seebeckCoef_*tmp_[0];
        flux[1] += seebeckCoef_*tmp_[1];
        flux[2] += seebeckCoef_*tmp_[2];
      };
    protected:
      double conductivity_,seebeckCoef_;
      ElectronFlux * electronFlux_;
      DENS_MAT elecCondWorkspace_; // hopefully avoid resizing
      DENS_MAT_VEC tmp_;
  };
}

#endif