File: WeakEquationElectronTemperature.cpp

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 (230 lines) | stat: -rw-r--r-- 8,016 bytes parent folder | download
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
#include "WeakEquationElectronTemperature.h"
#include "Material.h"
#include <iostream>
#include <fstream>

namespace ATC {
//==============================================================
//  Class WeakEquationElectronTemperature
//==============================================================

//--------------------------------------------------------------
//  Constructor
//--------------------------------------------------------------
WeakEquationElectronTemperature::WeakEquationElectronTemperature()
  : WeakEquation(DYNAMIC_PDE,ELECTRON_TEMPERATURE,1)
{
}
//--------------------------------------------------------------
//  Destructor
//---------------------------------------------------------------------
WeakEquationElectronTemperature::~WeakEquationElectronTemperature(void)
{}

//---------------------------------------------------------------------
//   compute energy
//---------------------------------------------------------------------
void WeakEquationElectronTemperature::E_integrand(
  const FIELD_MATS &fields,
  const GRAD_FIELD_MATS & /* grad_fields */,
  const Material * material,
  DENS_MAT & energy ) const
{
  material->electron_thermal_energy(fields, energy);
}

//---------------------------------------------------------------------
//   compute heat capacities
//---------------------------------------------------------------------
void WeakEquationElectronTemperature::M_integrand(
  const FIELD_MATS &fields,
  const Material * material,
  DENS_MAT & capacity ) const
{
  material->electron_heat_capacity(fields, capacity);
}

//---------------------------------------------------------------------
//   compute heat fluxes
//---------------------------------------------------------------------
void WeakEquationElectronTemperature::B_integrand(
  const FIELD_MATS &fields,
  const GRAD_FIELD_MATS &grad_fields,
  const Material * material,
  DENS_MAT_VEC &flux) const
{
  material->electron_heat_flux(fields, grad_fields, flux);
}

//---------------------------------------------------------------------
//   compute exchange fluxes
//---------------------------------------------------------------------
bool WeakEquationElectronTemperature::N_integrand(
  const FIELD_MATS &fields,
  const GRAD_FIELD_MATS & /* grad_fields */,
  const Material * material,
  DENS_MAT &flux) const
{

  DENS_MAT exchange_flux;
  bool has = material->electron_phonon_exchange(fields, exchange_flux);
  if (has) flux = -1.*exchange_flux;
  return has;
}

//==============================================================
//  Class WeakEquationElectronJouleHeating
//==============================================================

//--------------------------------------------------------------
//  Constructor
//--------------------------------------------------------------
WeakEquationElectronTemperatureJouleHeating::WeakEquationElectronTemperatureJouleHeating()
  : WeakEquationElectronTemperature()
{
  // convert charge * voltage --> mass length^2 / time^2
  //eV2E_ = (ATC::LammpsInterface::instance()->qe2f())
  //      * (ATC::LammpsInterface::instance()->ftm2v());
  eV2E_ = ATC::LammpsInterface::instance()->qv2e();
  int nSD = 3;
  _J_.assign(nSD, DENS_MAT());
  _E_.assign(nSD, DENS_MAT());
}
//--------------------------------------------------------------
//  Destructor
//---------------------------------------------------------------------
WeakEquationElectronTemperatureJouleHeating::~WeakEquationElectronTemperatureJouleHeating(void)
{}

//---------------------------------------------------------------------
void WeakEquationElectronTemperatureJouleHeating::E_integrand(
  const FIELD_MATS &fields,
  const GRAD_FIELD_MATS &grad_fields,
  const Material * material,
  DENS_MAT &energy) const
{
  WeakEquationElectronTemperature::E_integrand(fields, grad_fields, material, energy);
}
//---------------------------------------------------------------------
void WeakEquationElectronTemperatureJouleHeating::M_integrand(
  const FIELD_MATS &fields,
  const Material * material,
  DENS_MAT &capacity) const
{
  WeakEquationElectronTemperature::M_integrand(fields, material, capacity);
}
//---------------------------------------------------------------------
void WeakEquationElectronTemperatureJouleHeating::B_integrand(
  const FIELD_MATS &fields,
  const GRAD_FIELD_MATS &grad_fields,
  const Material * material,
  DENS_MAT_VEC &flux) const
{
  WeakEquationElectronTemperature::B_integrand(fields, grad_fields, material, flux);
}

//---------------------------------------------------------------------
bool WeakEquationElectronTemperatureJouleHeating::N_integrand(
  const FIELD_MATS &fields,
  const GRAD_FIELD_MATS &grad_fields,
  const Material * material,
  DENS_MAT &flux) const
{

  // call base class to get electron_temperature terms
  WeakEquationElectronTemperature::N_integrand(fields, grad_fields, material, flux);
  // Joule heating = -I.grad Psi = J.grad Psi \approx J.E
  DENS_MAT jouleHeating;
  material->electron_flux (fields, grad_fields, _J_);
  material->electric_field(fields, grad_fields, _E_);
  jouleHeating = _J_[0].mult_by_element(_E_[0]);
  for (DENS_MAT_VEC::size_type i=1; i < _J_.size(); i++)
    jouleHeating += _J_[i].mult_by_element(_E_[i]);
  jouleHeating *= eV2E_;
  flux -= jouleHeating;
  return true;
}

//==============================================================
//  Class WeakEquationElectronConvection
//==============================================================

//--------------------------------------------------------------
//  Constructor
//--------------------------------------------------------------
WeakEquationElectronTemperatureConvection::WeakEquationElectronTemperatureConvection()
  : WeakEquationElectronTemperatureJouleHeating()
{
  int nSD = 3;
  _convectiveFlux_.assign(nSD, DENS_MAT());
}

//--------------------------------------------------------------
//  Destructor
//---------------------------------------------------------------------
WeakEquationElectronTemperatureConvection::~WeakEquationElectronTemperatureConvection(void)
{
  // do nothing
}

//---------------------------------------------------------------------
void WeakEquationElectronTemperatureConvection::B_integrand(
  const FIELD_MATS &fields,
  const GRAD_FIELD_MATS &grad_fields,
  const Material * material,
  DENS_MAT_VEC &flux) const
{
  // add diffusion term

  WeakEquationElectronTemperatureJouleHeating::B_integrand(fields, grad_fields, material, flux);
  //flux[0] = 0.;
  //flux[1] = 0.;
  //flux[2] = 0.;

  // add convection term
  DENS_MAT_VEC convectiveFlux;
  material->electron_heat_convection(fields,_convectiveFlux_);
  flux[0] += _convectiveFlux_[0];
  flux[1] += _convectiveFlux_[1];
  flux[2] += _convectiveFlux_[2];
}

//---------------------------------------------------------------------
bool WeakEquationElectronTemperatureConvection::N_integrand(
  const FIELD_MATS &fields,
  const GRAD_FIELD_MATS &grad_fields,
  const Material * material,
  DENS_MAT &flux) const
{
  // call base class to get electron_temperature terms
  WeakEquationElectronTemperatureJouleHeating::N_integrand(fields, grad_fields, material, flux);
#ifdef TEST
  // add exchange with kinetic energy
  DENS_MAT keExchange;
  DENS_MAT capacity;
  material->electron_heat_capacity(fields, capacity);
  capacity *= 2./3.; // correction in DDM equations


  //FIELD_MATS::const_iterator dField = fields.find(ELECTRON_DENSITY);
  FIELD_MATS::const_iterator tField = fields.find(ELECTRON_TEMPERATURE);
  //const DENS_MAT & density = dField->second;
  const DENS_MAT & temperature = tField->second;

  GRAD_FIELD_MATS::const_iterator velocityGradients = grad_fields.find(ELECTRON_VELOCITY);
  const DENS_MAT_VEC & dv = velocityGradients->second;
  CLON_VEC vxx(dv[0],CLONE_COL,0);
  CLON_VEC vyy(dv[1],CLONE_COL,1);
  CLON_VEC vzz(dv[2],CLONE_COL,2);

  keExchange = vxx + vyy + vzz;
  //keExchange *= density;
  keExchange *= temperature;
  keExchange *= capacity;

  flux -= keExchange;
#endif
  return true;
}

}; // end namespace