Graph Framework
Loading...
Searching...
No Matches
dispersion.hpp
Go to the documentation of this file.
1//------------------------------------------------------------------------------
6//------------------------------------------------------------------------------
7//------------------------------------------------------------------------------
218//------------------------------------------------------------------------------
219
220#ifndef dispersion_h
221#define dispersion_h
222
223#include "newton.hpp"
224#include "equilibrium.hpp"
225
227namespace dispersion {
228//******************************************************************************
229// Z Function interface.
230//******************************************************************************
231//------------------------------------------------------------------------------
236//------------------------------------------------------------------------------
237 template<jit::float_scalar T, bool SAFE_MATH=false>
239 public:
240//------------------------------------------------------------------------------
245//------------------------------------------------------------------------------
248
250 typedef T base;
252 static constexpr bool safe_math = SAFE_MATH;
253 };
254
255//------------------------------------------------------------------------------
260//------------------------------------------------------------------------------
261 template<jit::complex_scalar T, bool SAFE_MATH=false>
262 class z_power_series final : public z_function<T, SAFE_MATH> {
263 public:
264//------------------------------------------------------------------------------
269//------------------------------------------------------------------------------
272 auto zeta2 = zeta*zeta;
273 auto zeta4 = zeta2*zeta2;
274 auto zeta6 = zeta4*zeta2;
275 return graph::i<T>*std::sqrt(M_PI)/graph::exp(zeta2) -
276 2.0*(1.0 - 2.0/3.0*zeta2
277 + 4.0/15.0*zeta4
278 - 8.0/105.0*zeta6)*zeta;
279 }
280 };
281
282//------------------------------------------------------------------------------
287//------------------------------------------------------------------------------
288 template<jit::complex_scalar T, bool SAFE_MATH=false>
289 class z_erfi final : public z_function<T, SAFE_MATH> {
290 public:
291//------------------------------------------------------------------------------
296//------------------------------------------------------------------------------
299 return -std::sqrt(M_PI)*graph::exp(-zeta*zeta)*(graph::erfi(zeta) -
301 }
302 };
303
305 template<class Z>
306 concept z_func = std::is_base_of<z_function<typename Z::base, Z::safe_math>, Z>::value;
307
308//******************************************************************************
309// Common physics expressions.
310//******************************************************************************
311//------------------------------------------------------------------------------
323//------------------------------------------------------------------------------
324 template<jit::float_scalar T, bool SAFE_MATH=false>
325 static constexpr graph::shared_leaf<T, SAFE_MATH>
326 build_plasma_frequency(graph::shared_leaf<T, SAFE_MATH> n,
327 const T q,
328 const T m,
329 const T c,
330 const T epsilon0) {
331 return n*q*q/(epsilon0*m*c*c);
332 }
333
334//------------------------------------------------------------------------------
345//------------------------------------------------------------------------------
346 template<jit::float_scalar T, bool SAFE_MATH=false>
347 static constexpr graph::shared_leaf<T, SAFE_MATH>
348 build_cyclotron_frequency(const T q,
350 const T m,
351 const T c) {
352 return q*b/(m*c);
353 }
354
355//******************************************************************************
356// Dispersion function.
357//******************************************************************************
358//------------------------------------------------------------------------------
363//------------------------------------------------------------------------------
364 template<jit::float_scalar T, bool SAFE_MATH=false>
366 public:
367//------------------------------------------------------------------------------
377//------------------------------------------------------------------------------
386
388 typedef T base;
390 static constexpr bool safe_math = SAFE_MATH;
391 };
392
393//------------------------------------------------------------------------------
398//------------------------------------------------------------------------------
399 template<jit::float_scalar T, bool SAFE_MATH=false>
400 class stiff final : public dispersion_function<T, SAFE_MATH> {
401 public:
402//------------------------------------------------------------------------------
431//------------------------------------------------------------------------------
442 };
443
444//------------------------------------------------------------------------------
449//------------------------------------------------------------------------------
450 template<jit::float_scalar T, bool SAFE_MATH=false>
451 class simple final : public dispersion_function<T, SAFE_MATH> {
452 public:
453//------------------------------------------------------------------------------
465//------------------------------------------------------------------------------
474 const T c = 1.0;
475
476 auto npar2 = k_vec->get_z()*k_vec->get_z()*c*c/(w*w);
477 auto nperp2 = (k_vec->get_x()*k_vec->get_x() +
478 k_vec->get_y()*k_vec->get_y())*c*c/(w*w);
479 return npar2 + nperp2 - c;
480 }
481 };
482
483//------------------------------------------------------------------------------
488//------------------------------------------------------------------------------
489 template<jit::float_scalar T, bool SAFE_MATH=false>
490 class physics : public dispersion_function<T, SAFE_MATH> {
491 protected:
492// Define some common constants.
494 const T epsilon0 = 8.8541878138E-12;
496 const T mu0 = M_PI*4.0E-7;
498 const T q = 1.602176634E-19;
500 const T me = 9.1093837015E-31;
502 const T c = static_cast<T> (1.0)/std::sqrt(epsilon0*mu0);
503 };
504
505//------------------------------------------------------------------------------
510//------------------------------------------------------------------------------
511 template<jit::float_scalar T, bool SAFE_MATH=false>
512 class bohm_gross final : public physics<T, SAFE_MATH> {
513 public:
514//------------------------------------------------------------------------------
528//------------------------------------------------------------------------------
537
538// Equilibrium quantities.
539 auto ne = eq->get_electron_density(x, y, z);
540 auto wpe2 = build_plasma_frequency(ne, physics<T, SAFE_MATH>::q,
544 auto te = eq->get_electron_temperature(x, y, z);
545// 2*1.602176634E-19 to convert eV to J.
546
547 auto vterm2 = static_cast<T> (2.0)*physics<T, SAFE_MATH>::q*te
551
552// Wave numbers should be parallel to B if there is a magnetic field. Otherwise
553// B should be zero.
554 auto b_vec = eq->get_magnetic_field(x, y, z);
556 if (b_vec->length()->is_match(graph::zero<T, SAFE_MATH> ())) {
557 kpara2 = k_vec->dot(k_vec);
558 } else {
559 auto b_hat = b_vec->unit();
560 auto kpara = b_hat->dot(k_vec);
561 kpara2 = kpara*kpara;
562 }
563
564 return wpe2 + 3.0/2.0*kpara2*vterm2 - w*w;
565 }
566 };
567
568//------------------------------------------------------------------------------
573//------------------------------------------------------------------------------
574 template<jit::float_scalar T, bool SAFE_MATH=false>
575 class light_wave final : public physics<T, SAFE_MATH> {
576 public:
577//------------------------------------------------------------------------------
591//------------------------------------------------------------------------------
600
601// Equilibrium quantities.
602 auto ne = eq->get_electron_density(x, y, z);
603 auto wpe2 = build_plasma_frequency(ne,
608
609// Wave numbers should be parallel to B if there is a magnetic field. Otherwise
610// B should be zero.
611 assert(eq->get_magnetic_field(x, y, z)->length()->is_match(graph::zero<T, SAFE_MATH> ()) &&
612 "Expected equilibrium with no magnetic field.");
613
614 auto k2 = k_vec->dot(k_vec);
615
616 return wpe2 + k2 - w*w;
617 }
618 };
619
620//------------------------------------------------------------------------------
625//------------------------------------------------------------------------------
626 template<jit::float_scalar T, bool SAFE_MATH=false>
627 class acoustic_wave final : public physics<T, SAFE_MATH> {
628 public:
629//------------------------------------------------------------------------------
643//------------------------------------------------------------------------------
652
653// Equilibrium quantities.
654 const T mi = eq->get_ion_mass(0);
655 auto te = eq->get_electron_temperature(x, y, z);
656 auto ti = eq->get_ion_temperature(0, x, y, z);
657 const T gamma = 3.0;
658 auto vs2 = (physics<T, SAFE_MATH>::q*te + gamma*physics<T, SAFE_MATH>::q*ti)
660
661// Wave numbers should be parallel to B if there is a magnetic field. Otherwise
662// B should be zero.
663 auto b_vec = eq->get_magnetic_field(x, y, z);
665 if (b_vec->length()->is_match(graph::zero<T, SAFE_MATH> ())) {
666 kpara2 = k_vec->dot(k_vec);
667 } else {
668 auto b_hat = b_vec->unit();
669 auto kpara = b_hat->dot(k_vec);
670 kpara2 = kpara*kpara;
671 }
672
673 return kpara2*vs2 - w*w;
674 }
675 };
676
677//------------------------------------------------------------------------------
682//------------------------------------------------------------------------------
683 template<jit::float_scalar T, bool SAFE_MATH=false>
684 class gaussian_well final : public dispersion_function<T, SAFE_MATH> {
685 public:
686//------------------------------------------------------------------------------
698//------------------------------------------------------------------------------
707 const T c = 1.0;
708 auto well = c - 0.5*exp(-(x*x + y*y)/0.1);
709 auto npar2 = k_vec->get_z()*k_vec->get_z()*c*c/(w*w);
710 auto nperp2 = (k_vec->get_x()*k_vec->get_x() +
711 k_vec->get_y()*k_vec->get_y())*c*c/(w*w);
712 return npar2 + nperp2 - well;
713 }
714 };
715
716//------------------------------------------------------------------------------
721//------------------------------------------------------------------------------
722 template<jit::float_scalar T, bool SAFE_MATH=false>
723 class ion_cyclotron final : public physics<T, SAFE_MATH> {
724 public:
725//------------------------------------------------------------------------------
741//------------------------------------------------------------------------------
750// Equilibrium quantities.
751 const T mi = eq->get_ion_mass(0);
752
753 auto te = eq->get_electron_temperature(x, y, z);
754 auto ti = eq->get_ion_temperature(0, x, y, z);
755 const T gamma = 3.0;
756 auto vs2 = (physics<T, SAFE_MATH>::q*te +
760
761 auto b_vec = eq->get_magnetic_field(x, y, z);
762 auto wce = build_cyclotron_frequency(-physics<T, SAFE_MATH>::q,
763 b_vec->length(),
766
767// Wave numbers.
768 auto b_hat = b_vec->unit();
769 auto kperp = b_hat->cross(k_vec)->length();
770 auto kperp2 = kperp*kperp;
771
772 auto w2 = w*w;
773
774 return wce - kperp2*vs2 - w*w;
775 }
776 };
777
778//------------------------------------------------------------------------------
783//------------------------------------------------------------------------------
784 template<jit::float_scalar T, bool SAFE_MATH=false>
785 class ordinary_wave final : public physics<T, SAFE_MATH> {
786 public:
787//------------------------------------------------------------------------------
801//------------------------------------------------------------------------------
810// Equilibrium quantities.
811 auto ne = eq->get_electron_density(x, y, z);
812 auto wpe2 = build_plasma_frequency(ne,
817
818// Wave numbers.
819 auto n = k_vec/w;
820 auto b_vec = eq->get_magnetic_field(x, y, z);
821 auto b_hat = b_vec->unit();
822 auto nperp = b_hat->cross(n);
823 auto nperp2 = nperp->dot(nperp);
824
825 auto w2 = w*w;
826
827 return 1.0 - wpe2/w2 - nperp2;
828 }
829 };
830
831//------------------------------------------------------------------------------
836//------------------------------------------------------------------------------
837 template<jit::float_scalar T, bool SAFE_MATH=false>
838 class extra_ordinary_wave final : public physics<T, SAFE_MATH> {
839 public:
840//------------------------------------------------------------------------------
859//------------------------------------------------------------------------------
868// Equilibrium quantities.
869 auto ne = eq->get_electron_density(x, y, z);
870 auto wpe2 = build_plasma_frequency(ne,
875
876 auto b_vec = eq->get_magnetic_field(x, y, z);
877 auto b_len = b_vec->length();
878 auto wec = build_cyclotron_frequency(-physics<T, SAFE_MATH>::q,
879 b_len,
882
883// Wave numbers.
884 auto n = k_vec/w;
885 auto b_hat = b_vec->unit();
886 auto nperp = b_hat->cross(n);
887 auto nperp2 = nperp->dot(nperp);
888
889 auto wh = wpe2 + wec*wec;
890
891 auto w2 = w*w;
892
893 return 1.0 - wpe2/(w2)*(w2 - wpe2)/(w2 - wh) - nperp2;
894 }
895 };
896
897//------------------------------------------------------------------------------
902//------------------------------------------------------------------------------
903 template<jit::float_scalar T, bool SAFE_MATH=false>
904 class cold_plasma : public physics<T, SAFE_MATH> {
905 public:
906//------------------------------------------------------------------------------
940//------------------------------------------------------------------------------
949// Dielectric terms.
950// Frequencies
951 auto ne = eq->get_electron_density(x, y, z);
952 auto wpe2 = build_plasma_frequency(ne,
957 auto b_vec = eq->get_magnetic_field(x, y, z);
958 auto b_len = b_vec->length();
959 auto ec = build_cyclotron_frequency(-physics<T, SAFE_MATH>::q,
960 b_len,
963
964 auto w2 = w*w;
965 auto denome = 1.0 - ec*ec/w2;
966 auto e11 = 1.0 - (wpe2/w2)/denome;
967 auto e12 = ((ec/w)*(wpe2/w2))/denome;
968 auto e33 = wpe2;
969
970 for (size_t i = 0, ie = eq->get_num_ion_species(); i < ie; i++) {
971 const T mi = eq->get_ion_mass(i);
972 const T charge = static_cast<T> (eq->get_ion_charge(i))
974
975 auto ni = eq->get_ion_density(i, x, y, z);
976 auto wpi2 = build_plasma_frequency(ni, charge, mi,
979 auto ic = build_cyclotron_frequency(charge, b_len, mi,
981
982 auto denomi = 1.0 - ic*ic/w2;
983 e11 = e11 - (wpi2/w2)/denomi;
984 e12 = e12 + ((ic/w)*(wpi2/w2))/denomi;
985 e33 = e33 + wpi2;
986 }
987
988 e12 = -1.0*e12;
989 e33 = 1.0 - e33/w2;
990
991// Wave numbers.
992 auto n = k_vec/w;
993 auto b_hat = b_vec->unit();
994
995 auto npara = b_hat->dot(n);
996 auto npara2 = npara*npara;
997 auto nperp = b_hat->cross(n)->length();
998 auto nperp2 = nperp*nperp;
999
1000// Determinate matrix elements
1001 auto m11 = e11 - npara2;
1002 auto m12 = e12;
1003 auto m13 = npara*nperp;
1004 auto m22 = e11 - npara2 - nperp2;
1005 auto m33 = e33 - nperp2;
1006
1007 return (m11*m22 - m12*m12)*m33 - m22*(m13*m13);
1008 }
1009 };
1010
1011//------------------------------------------------------------------------------
1016//------------------------------------------------------------------------------
1017 template<jit::float_scalar T, bool SAFE_MATH=false>
1018 class cold_plasma_expansion : public physics<T, SAFE_MATH> {
1019 public:
1020//------------------------------------------------------------------------------
1041//------------------------------------------------------------------------------
1050// Setup plasma parameters.
1051 auto b_vec = eq->get_magnetic_field(x, y, z);
1052 auto b_len = b_vec->length();
1053 auto b_hat = b_vec/b_len;
1054 auto ne = eq->get_electron_density(x, y, z);
1055 auto te = eq->get_electron_temperature(x, y, z);
1056
1057 auto ve = graph::sqrt(static_cast<T> (2.0)*physics<T, SAFE_MATH>::q*te /
1060
1061// Setup characteristic frequencies.
1062 auto ec = build_cyclotron_frequency(physics<T, SAFE_MATH>::q,
1063 b_len,
1066 auto wpe2 = build_plasma_frequency(ne, physics<T, SAFE_MATH>::q,
1070
1071// Dispersion quantities.
1072 auto P = wpe2/(w*w);
1073 auto q = P/(2.0*(1.0 + ec/w));
1074
1075 auto n = k_vec/w;
1076 auto n2 = n->dot(n);
1077 auto npara = n->dot(b_hat);
1078 auto npara2 = npara*npara;
1079 auto nperp = b_hat->cross(n);
1080 auto nperp2 = nperp->dot(nperp);
1081 auto n2nperp2 = n2*nperp2;
1082
1083 auto q_func = 1.0 - 2.0*q;
1084 auto n_func = n2 + npara2;
1085 auto p_func = 1.0 - P;
1086
1087 auto gamma1 = (1.0 - q)*n2nperp2
1088 + p_func*(n2*npara2 - (1.0 - q)*n_func)
1089 + q_func*(p_func - nperp2);
1090 auto gamma0 = nperp2*(n2 - 2.0*q_func) + p_func*(2.0*q_func - n_func);
1091
1092 return -P/2.0*(1.0 + ec/w)*gamma0 + (1.0 - ec*ec/(w*w))*gamma1;
1093 }
1094 };
1095
1096//------------------------------------------------------------------------------
1098//------------------------------------------------------------------------------
1099 template<jit::complex_scalar T, z_func Z, bool SAFE_MATH=false>
1100 class hot_plasma final : public physics<T, SAFE_MATH> {
1101 private:
1103 Z z;
1104
1105 public:
1106//------------------------------------------------------------------------------
1139//------------------------------------------------------------------------------
1148// Setup plasma parameters.
1149 auto b_vec = eq->get_magnetic_field(x, y, z);
1150 auto b_len = b_vec->length();
1151 auto b_hat = b_vec/b_len;
1152 auto ne = eq->get_electron_density(x, y, z);
1153 auto te = eq->get_electron_temperature(x, y, z);
1154
1155 auto ve = graph::sqrt(static_cast<T> (2.0)*physics<T, SAFE_MATH>::q*te /
1158
1159// Setup characteristic frequencies.
1160 auto ec = build_cyclotron_frequency(physics<T, SAFE_MATH>::q,
1161 b_len,
1164 auto wpe2 = build_plasma_frequency(ne, physics<T, SAFE_MATH>::q,
1168
1169// Dispersion quantities.
1170 auto P = wpe2/(w*w);
1171 auto q = P/(2.0*(1.0 + ec/w));
1172
1173 auto n = k_vec/w;
1174 auto n2 = n->dot(n);
1175 auto npara = n->dot(b_hat);
1176 auto npara2 = npara*npara;
1177 auto nperp = b_hat->cross(n);
1178 auto nperp2 = nperp->dot(nperp);
1179
1180 auto zeta = (1.0 - ec/w)/(npara*ve);
1181 auto Z_func = this->z.Z(zeta);
1182 auto zeta_func = 1.0 + zeta*Z_func;
1183 auto F = ve*zeta*w/(2.0*npara*ec);
1184 auto isigma = P*Z_func/(2.0*npara*ve);
1185
1186 auto q_func = 1.0 - 2.0*q;
1187 auto n_func = n2 + npara2;
1188 auto p_func = 1.0 - P;
1189
1190 auto gamma5 = n2*npara2 - (1.0 - q)*n_func + q_func;
1191 auto gamma2 = (n2 - q_func)
1192 + P*w/(4.0*ec*npara2)*(n_func - 2.0*q_func);
1193 auto gamma1 = nperp2*((1.0 - q)*n2 - q_func)
1194 + p_func*(n2*npara2 - (1.0 - q)*n_func + q_func);
1195 auto gamma0 = nperp2*(n2 - 2.0*q_func) + p_func*(2.0*q_func - n_func);
1196
1197 return isigma*gamma0 + gamma1 + nperp2*P*w/ec*zeta_func*(gamma2 + gamma5*F);
1198 }
1199 };
1200
1201//------------------------------------------------------------------------------
1207//------------------------------------------------------------------------------
1208 template<jit::float_scalar T, class Z, bool SAFE_MATH=false>
1209 class hot_plasma_expansion final : public physics<T, SAFE_MATH> {
1210 private:
1212 Z z;
1213
1214 public:
1215//------------------------------------------------------------------------------
1246//------------------------------------------------------------------------------
1255// Setup plasma parameters.
1256 auto b_vec = eq->get_magnetic_field(x, y, z);
1257 auto b_hat = b_vec->unit();
1258 auto b_len = b_vec->length();
1259 auto ne = eq->get_electron_density(x, y, z);
1260 auto te = eq->get_electron_temperature(x, y, z);
1261
1262 auto ve = graph::sqrt(static_cast<T> (2.0)*physics<T, SAFE_MATH>::q*te /
1264
1265// Setup characteristic frequencies.
1266 auto ec = build_cyclotron_frequency(physics<T, SAFE_MATH>::q, b_len,
1269 auto wpe2 = build_plasma_frequency(ne, physics<T, SAFE_MATH>::q,
1273
1274// Dispersion quantities.
1275 auto P = wpe2/(w*w);
1276 auto q = P/(2.0*(1.0 + ec/w));
1277
1278 auto n = k_vec/w;
1279 auto n2 = n->dot(n);
1280 auto npara = b_hat->dot(n);
1281 auto npara2 = npara*npara;
1282 auto nperp = b_hat->cross(n);
1283 auto nperp2 = nperp->dot(nperp);
1284
1285 auto vtnorm = ve/physics<T, SAFE_MATH>::c;
1286
1287 auto zeta = (1.0 - ec/w)/(npara*vtnorm);
1288 auto Z_func = this->z.Z(zeta);
1289
1290 auto q_func = 1.0 - 2.0*q;
1291 auto n_func = n2 + npara2;
1292 auto n2nperp2 = n2*nperp2;
1293 auto p_func = 1.0 - P;
1294
1295 auto gamma5 = P*(n2*npara2 - (1.0 - q)*n_func + q_func);
1296 auto gamma2 = P*w/ec*nperp2*(n2 - q_func)
1297 + P*P*w*w/(4.0*ec*ec)*(n_func - 2.0*q_func)*nperp2/npara2;
1298 auto gamma1 = (1.0 - q)*n2nperp2
1299 + p_func*(n2*npara2 - (1.0 - q)*n_func)
1300 + q_func*(p_func - nperp2);
1301
1302 return -(1.0 + ec/w)*npara*vtnorm *
1303 (gamma1 + gamma2 + nperp2/(2.0*npara)*(w*w/(ec*ec))*vtnorm*zeta*gamma5)*(1.0/Z_func + zeta);
1304 }
1305 };
1306
1307//******************************************************************************
1308// Dispersion interface.
1309//******************************************************************************
1311 template<class D>
1312 concept function = std::is_base_of<dispersion_function<typename D::base, D::safe_math>, D>::value;
1313
1314//------------------------------------------------------------------------------
1318//------------------------------------------------------------------------------
1319 template<function DISPERSION_FUNCTION>
1321 protected:
1323 graph::shared_vector<typename DISPERSION_FUNCTION::base,
1324 DISPERSION_FUNCTION::safe_math> k_vec;
1326 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1327 DISPERSION_FUNCTION::safe_math> D;
1328
1330 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1331 DISPERSION_FUNCTION::safe_math> dxdt;
1333 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1334 DISPERSION_FUNCTION::safe_math> dydt;
1336 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1337 DISPERSION_FUNCTION::safe_math> dzdt;
1339 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1340 DISPERSION_FUNCTION::safe_math> dkxdt;
1342 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1343 DISPERSION_FUNCTION::safe_math> dkydt;
1345 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1346 DISPERSION_FUNCTION::safe_math> dkzdt;
1348 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1349 DISPERSION_FUNCTION::safe_math> dsdt;
1350
1351 public:
1352//------------------------------------------------------------------------------
1368//------------------------------------------------------------------------------
1369 dispersion_interface(graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1370 DISPERSION_FUNCTION::safe_math> w,
1371 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1372 DISPERSION_FUNCTION::safe_math> kx,
1373 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1374 DISPERSION_FUNCTION::safe_math> ky,
1375 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1376 DISPERSION_FUNCTION::safe_math> kz,
1377 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1378 DISPERSION_FUNCTION::safe_math> x,
1379 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1380 DISPERSION_FUNCTION::safe_math> y,
1381 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1382 DISPERSION_FUNCTION::safe_math> z,
1383 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1384 DISPERSION_FUNCTION::safe_math> t,
1385 equilibrium::shared<typename DISPERSION_FUNCTION::base,
1386 DISPERSION_FUNCTION::safe_math> &eq) :
1387 k_vec(kx*eq->get_esup1(x, y, z) +
1388 ky*eq->get_esup2(x, y, z) +
1389 kz*eq->get_esup3(x, y, z)),
1390 D(DISPERSION_FUNCTION().D(w, k_vec, x, y, z, t, eq)) {
1391// Add correction term to deal with k_vec being a function of the coordinates.
1392 auto dkdx = k_vec->df(x);
1393 auto dkdy = k_vec->df(y);
1394 auto dkdz = k_vec->df(z);
1395
1396 auto dDdk_vec = graph::vector<typename DISPERSION_FUNCTION::base,
1397 DISPERSION_FUNCTION::safe_math> (
1398 this->D->df(k_vec->get_x()),
1399 this->D->df(k_vec->get_y()),
1400 this->D->df(k_vec->get_z())
1401 );
1402
1403 auto dDdw = this->D->df(w);
1404 auto dDdkx = this->D->df(kx);
1405 auto dDdky = this->D->df(ky);
1406 auto dDdkz = this->D->df(kz);
1407 auto dDdx = this->D->df(x);
1408 auto dDdy = this->D->df(y);
1409 auto dDdz = this->D->df(z);
1410
1411 if (graph::pseudo_variable_cast(x).get()) {
1412 dkdx = dkdx->remove_pseudo();
1413 dkdy = dkdy->remove_pseudo();
1414 dkdz = dkdz->remove_pseudo();
1415 dDdk_vec = dDdk_vec->remove_pseudo();
1416
1417 dDdw = dDdw->remove_pseudo();
1418 dDdkx = dDdkx->remove_pseudo();
1419 dDdky = dDdky->remove_pseudo();
1420 dDdkz = dDdkz->remove_pseudo();
1421 dDdx = dDdx->remove_pseudo();
1422 dDdy = dDdy->remove_pseudo();
1423 dDdz = dDdz->remove_pseudo();
1424 }
1425
1426 dxdt = -dDdkx/dDdw;
1427 dydt = -dDdky/dDdw;
1428 dzdt = -dDdkz/dDdw;
1429 dkxdt = (dDdx - dDdk_vec->dot(dkdx))/dDdw;
1430 dkydt = (dDdy - dDdk_vec->dot(dkdy))/dDdw;
1431 dkzdt = (dDdz - dDdk_vec->dot(dkdz))/dDdw;
1432
1433 dsdt = graph::vector(dxdt, dydt, dzdt)->length();
1434 }
1435
1436//------------------------------------------------------------------------------
1449//------------------------------------------------------------------------------
1450 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1451 DISPERSION_FUNCTION::safe_math>
1452 solve(graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1453 DISPERSION_FUNCTION::safe_math> x,
1454 graph::input_nodes<typename DISPERSION_FUNCTION::base,
1455 DISPERSION_FUNCTION::safe_math> inputs,
1456 const size_t index=0,
1457 const typename DISPERSION_FUNCTION::base tolerance = 1.0E-30,
1458 const size_t max_iterations = 1000) {
1459 auto x_var = graph::variable_cast(x);
1460
1461 workflow::manager<typename DISPERSION_FUNCTION::base,
1462 DISPERSION_FUNCTION::safe_math> work(index);
1463
1464 solver::newton(work, {x}, inputs, this->D,
1465 graph::shared_random_state<typename DISPERSION_FUNCTION::base,
1466 DISPERSION_FUNCTION::safe_math> (),
1467 tolerance, max_iterations);
1468
1469 work.compile();
1470 work.run();
1471
1472 work.copy_to_host(x, x_var->data());
1473
1474 return this->D*this->D;
1475 }
1476
1477//------------------------------------------------------------------------------
1481//------------------------------------------------------------------------------
1482 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1483 DISPERSION_FUNCTION::safe_math>
1485 return this->D*this->D;
1486 }
1487
1488//------------------------------------------------------------------------------
1492//------------------------------------------------------------------------------
1493 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1494 DISPERSION_FUNCTION::safe_math>
1496 return this->D;
1497 }
1498
1499//------------------------------------------------------------------------------
1503//------------------------------------------------------------------------------
1504 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1505 DISPERSION_FUNCTION::safe_math>
1507 return this->dsdt;
1508 }
1509
1510//------------------------------------------------------------------------------
1514//------------------------------------------------------------------------------
1515 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1516 DISPERSION_FUNCTION::safe_math>
1518 return this->dxdt;
1519 }
1520
1521//------------------------------------------------------------------------------
1525//------------------------------------------------------------------------------
1526 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1527 DISPERSION_FUNCTION::safe_math>
1529 return this->dydt;
1530 }
1531
1532//------------------------------------------------------------------------------
1536//------------------------------------------------------------------------------
1537 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1538 DISPERSION_FUNCTION::safe_math>
1540 return this->dzdt;
1541 }
1542
1543//------------------------------------------------------------------------------
1547//------------------------------------------------------------------------------
1548 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1549 DISPERSION_FUNCTION::safe_math>
1551 return this->dkxdt;
1552 }
1553
1554//------------------------------------------------------------------------------
1558//------------------------------------------------------------------------------
1559 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1560 DISPERSION_FUNCTION::safe_math>
1562 return this->dkydt;
1563 }
1564
1565//------------------------------------------------------------------------------
1569//------------------------------------------------------------------------------
1570 graph::shared_leaf<typename DISPERSION_FUNCTION::base,
1571 DISPERSION_FUNCTION::safe_math>
1573 return this->dkzdt;
1574 }
1575
1576//------------------------------------------------------------------------------
1578//------------------------------------------------------------------------------
1580 D->to_latex();
1581 std::cout << std::endl;
1582 }
1583
1584//------------------------------------------------------------------------------
1586//------------------------------------------------------------------------------
1588 get_dkxdt()->to_latex();
1589 std::cout << std::endl;
1590 }
1591
1592//------------------------------------------------------------------------------
1594//------------------------------------------------------------------------------
1596 get_dkydt()->to_latex();
1597 std::cout << std::endl;
1598 }
1599
1600//------------------------------------------------------------------------------
1602//------------------------------------------------------------------------------
1604 get_dkzdt()->to_latex();
1605 std::cout << std::endl;
1606 }
1607
1608//------------------------------------------------------------------------------
1610//------------------------------------------------------------------------------
1611 void print_dxdt() {
1612 get_dxdt()->to_latex();
1613 std::cout << std::endl;
1614 }
1615
1616//------------------------------------------------------------------------------
1618//------------------------------------------------------------------------------
1619 void print_dydt() {
1620 get_dydt()->to_latex();
1621 std::cout << std::endl;
1622 }
1623
1624//------------------------------------------------------------------------------
1626//------------------------------------------------------------------------------
1627 void print_dzdt() {
1628 get_dzdt()->to_latex();
1629 std::cout << std::endl;
1630 }
1631 };
1632}
1633
1634#endif /* dispersion_h */
Ion wave dispersion function.
Definition dispersion.hpp:627
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)
Ion acoustic wave function.
Definition dispersion.hpp:645
Bohm-Gross dispersion function.
Definition dispersion.hpp:512
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)
Bohm-Gross function.
Definition dispersion.hpp:530
Cold Plasma expansion dispersion function.
Definition dispersion.hpp:1018
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)
Cold Plasma expansion Dispersion function.
Definition dispersion.hpp:1043
Cold Plasma Dispersion function.
Definition dispersion.hpp:904
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)
Cold Plasma Dispersion function.
Definition dispersion.hpp:942
Interface for dispersion functions.
Definition dispersion.hpp:365
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)=0
Interface for a dispersion function.
T base
Type def to retrieve the backend base type.
Definition dispersion.hpp:388
static constexpr bool safe_math
Retrieve template parameter of safe math.
Definition dispersion.hpp:390
Class interface to build dispersion relation functions.
Definition dispersion.hpp:1320
graph::shared_vector< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > k_vec
Wave number.
Definition dispersion.hpp:1324
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dydt()
Provide right hand side for y update.
Definition dispersion.hpp:1528
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dkydt()
Provide right hand side for z update.
Definition dispersion.hpp:1561
void print_dxdt()
Print out the latex expression for the dxdt.
Definition dispersion.hpp:1611
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > dkxdt
Derivative with respect to kx.
Definition dispersion.hpp:1340
dispersion_interface(graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > w, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > t, equilibrium::shared< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > &eq)
Construct a new dispersion_interface.
Definition dispersion.hpp:1369
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > dxdt
Derivative with respect to kx.
Definition dispersion.hpp:1331
void print_dkxdt()
Print out the latex expression for the dkxdt.
Definition dispersion.hpp:1587
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > dydt
Derivative with respect to ky.
Definition dispersion.hpp:1334
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dkxdt()
Provide right hand side for z update.
Definition dispersion.hpp:1550
void print_dispersion()
Print out the latex expression for the dispersion relation.
Definition dispersion.hpp:1579
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > dkydt
Derivative with respect to ky.
Definition dispersion.hpp:1343
void print_dkydt()
Print out the latex expression for the dkydt.
Definition dispersion.hpp:1595
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > D
Dispersion function.
Definition dispersion.hpp:1327
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > dzdt
Derivative with respect to kz.
Definition dispersion.hpp:1337
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dkzdt()
Provide right hand side for z update.
Definition dispersion.hpp:1572
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dsdt()
Provide right hand side for s update.
Definition dispersion.hpp:1506
void print_dkzdt()
Print out the latex expression for the dkzdt.
Definition dispersion.hpp:1603
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > solve(graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x, graph::input_nodes< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > inputs, const size_t index=0, const typename DISPERSION_FUNCTION::base tolerance=1.0E-30, const size_t max_iterations=1000)
Solve the dispersion relation for x.
Definition dispersion.hpp:1452
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > dkzdt
Derivative with respect to kz.
Definition dispersion.hpp:1346
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > dsdt
Derivative with respect to omega.
Definition dispersion.hpp:1349
void print_dydt()
Print out the latex expression for the dydt.
Definition dispersion.hpp:1619
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_d()
Get the dispersion function.
Definition dispersion.hpp:1495
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dzdt()
Provide right hand side for z update.
Definition dispersion.hpp:1539
void print_dzdt()
Print out the latex expression for the dzdt.
Definition dispersion.hpp:1627
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_residual()
Get the dispersion residual.
Definition dispersion.hpp:1484
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dxdt()
Provide right hand side for x update.
Definition dispersion.hpp:1517
Extra ordinary wave dispersion function.
Definition dispersion.hpp:838
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)
Dispersion relation for the X-Mode.
Definition dispersion.hpp:861
Gaussian Well dispersion function.
Definition dispersion.hpp:684
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)
Dispersion relation with a non uniform well.
Definition dispersion.hpp:700
Hot Plasma Expansion Dispersion function.
Definition dispersion.hpp:1209
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)
Hot plasma expansion dispersion function.
Definition dispersion.hpp:1248
Hot Plasma Dispersion function.
Definition dispersion.hpp:1100
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)
Hot Plasma Dispersion function.
Definition dispersion.hpp:1141
Electrostatic ion cyclotron wave dispersion function.
Definition dispersion.hpp:723
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)
Dispersion relation for the O mode.
Definition dispersion.hpp:743
Light Wave dispersion function.
Definition dispersion.hpp:575
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)
Light-wave function.
Definition dispersion.hpp:593
Ordinary wave dispersion function.
Definition dispersion.hpp:785
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)
Dispersion relation for the O mode.
Definition dispersion.hpp:803
Physics.
Definition dispersion.hpp:490
const T q
Fundamental charge.
Definition dispersion.hpp:498
const T me
Electron mass.
Definition dispersion.hpp:500
const T c
Speed of light.
Definition dispersion.hpp:502
const T mu0
Vacuum permeability.
Definition dispersion.hpp:496
const T epsilon0
Vacuum permittivity.
Definition dispersion.hpp:494
Simple dispersion function.
Definition dispersion.hpp:451
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)
Simple dispersion function.
Definition dispersion.hpp:467
Stiff dispersion function.
Definition dispersion.hpp:400
virtual graph::shared_leaf< T, SAFE_MATH > D(graph::shared_leaf< T, SAFE_MATH > w, graph::shared_vector< T, SAFE_MATH > k_vec, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, graph::shared_leaf< T, SAFE_MATH > z, graph::shared_leaf< T, SAFE_MATH > t, equilibrium::shared< T, SAFE_MATH > &eq)
Stiff function.
Definition dispersion.hpp:433
Class interface to build dispersion relation functions.
Definition dispersion.hpp:289
virtual graph::shared_leaf< T, SAFE_MATH > Z(graph::shared_leaf< T, SAFE_MATH > zeta)
Method to build the Z function.
Definition dispersion.hpp:298
Class interface to build dispersion relation functions.
Definition dispersion.hpp:238
static constexpr bool safe_math
Retrieve template parameter of safe math.
Definition dispersion.hpp:252
T base
Type def to retrieve the backend base type.
Definition dispersion.hpp:250
virtual graph::shared_leaf< T, SAFE_MATH > Z(graph::shared_leaf< T, SAFE_MATH > zeta)=0
Method to build the Z function.
Class interface to build dispersion relation functions.
Definition dispersion.hpp:262
virtual graph::shared_leaf< T, SAFE_MATH > Z(graph::shared_leaf< T, SAFE_MATH > zeta)
Method to build the Z function.
Definition dispersion.hpp:271
Class representing a workflow manager.
Definition workflow.hpp:215
Dispersion concept.
Definition dispersion.hpp:1312
Dispersion concept.
Definition dispersion.hpp:306
Class signature to implement plasma equilibrium.
subroutine assert(test, message)
Assert check.
Definition f_binding_test.f90:38
Name space for dispersion functions.
Definition dispersion.hpp:227
std::shared_ptr< generic< T, SAFE_MATH > > shared
Convenience type alias for shared equilibria.
Definition equilibrium.hpp:470
constexpr shared_leaf< T, SAFE_MATH > zero()
Forward declare for zero.
Definition node.hpp:986
std::shared_ptr< vector_quantity< T, SAFE_MATH > > shared_vector
Convenience type for shared vector quantities.
Definition vector.hpp:142
shared_vector< T, SAFE_MATH > vector(shared_leaf< T, SAFE_MATH > x, shared_leaf< T, SAFE_MATH > y, shared_leaf< T, SAFE_MATH > z)
Build a shared vector quantity.
Definition vector.hpp:156
shared_leaf< T, SAFE_MATH > exp(shared_leaf< T, SAFE_MATH > x)
Define exp convenience function.
Definition math.hpp:544
std::shared_ptr< random_state_node< T, SAFE_MATH > > shared_random_state
Convenience type alias for shared sqrt nodes.
Definition random.hpp:263
std::vector< shared_variable< T, SAFE_MATH > > input_nodes
Convenience type alias for a vector of inputs.
Definition node.hpp:1711
shared_leaf< T, SAFE_MATH > erfi(shared_leaf< T, SAFE_MATH > x)
Define erfi convenience function.
Definition math.hpp:1620
shared_variable< T, SAFE_MATH > variable_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a variable node.
Definition node.hpp:1727
shared_leaf< T, SAFE_MATH > sqrt(shared_leaf< T, SAFE_MATH > x)
Define sqrt convenience function.
Definition math.hpp:279
std::shared_ptr< leaf_node< T, SAFE_MATH > > shared_leaf
Convenience type alias for shared leaf nodes.
Definition node.hpp:676
shared_pseudo_variable< T, SAFE_MATH > pseudo_variable_cast(shared_leaf< T, SAFE_MATH > &x)
Cast to a pseudo variable node.
Definition node.hpp:1890
void newton(workflow::manager< T, SAFE_MATH > &work, graph::output_nodes< T, SAFE_MATH > vars, graph::input_nodes< T, SAFE_MATH > inputs, graph::shared_leaf< T, SAFE_MATH > func, graph::shared_random_state< T, SAFE_MATH > state, const T tolerance=1.0E-30, const size_t max_iterations=1000, const T step=1.0)
Determine the value of vars to minimize the loss function.
Definition newton.hpp:34
Sets up the kernel for a newtons method.