122 template<dispersion::function DISPERSION_FUNCTION>
127 DISPERSION_FUNCTION::safe_math>
w;
130 DISPERSION_FUNCTION::safe_math>
kx;
133 DISPERSION_FUNCTION::safe_math>
ky;
136 DISPERSION_FUNCTION::safe_math>
kz;
139 DISPERSION_FUNCTION::safe_math>
x;
142 DISPERSION_FUNCTION::safe_math>
y;
145 DISPERSION_FUNCTION::safe_math>
z;
148 DISPERSION_FUNCTION::safe_math>
t;
181 DISPERSION_FUNCTION::safe_math>
work;
211 DISPERSION_FUNCTION::safe_math>
w,
213 DISPERSION_FUNCTION::safe_math>
kx,
215 DISPERSION_FUNCTION::safe_math>
ky,
217 DISPERSION_FUNCTION::safe_math>
kz,
219 DISPERSION_FUNCTION::safe_math>
x,
221 DISPERSION_FUNCTION::safe_math>
y,
223 DISPERSION_FUNCTION::safe_math>
z,
225 DISPERSION_FUNCTION::safe_math>
t,
227 DISPERSION_FUNCTION::safe_math> &eq,
228 const std::string &filename=
"",
229 const size_t num_rays=0,
230 const size_t index=0) :
231 D(
w,
kx,
ky,
kz,
x,
y,
z,
t, eq),
w(
w),
253 DISPERSION_FUNCTION::safe_math>
255 DISPERSION_FUNCTION::safe_math>
x,
256 const typename DISPERSION_FUNCTION::base tolerance = 1.0E-30,
257 const size_t max_iterations = 1000) final {
259 DISPERSION_FUNCTION::safe_math> inputs {
271 tolerance, max_iterations);
282 DISPERSION_FUNCTION::safe_math>
init() final {
284 DISPERSION_FUNCTION::safe_math> inputs {
305 DISPERSION_FUNCTION::safe_math> inputs = {
317 DISPERSION_FUNCTION::safe_math> outputs = {
322 DISPERSION_FUNCTION::safe_math> setters = {
333 "solver_kernel", inputs.back()->size());
419 sync = std::thread([
this] {
428 D.print_dispersion();
478 std::cout << std::endl;
486 std::cout << std::endl;
494 std::cout << std::endl;
502 std::cout << std::endl;
510 std::cout << std::endl;
518 std::cout << std::endl;
526 std::cout << std::endl;
531 typedef typename DISPERSION_FUNCTION::base
base;
533 static constexpr bool safe_math = DISPERSION_FUNCTION::safe_math;
538 concept method = std::is_base_of<solver_interface<typename S::dispersion_function>, S>::value;
548 template<dispersion::function DISPERSION_FUNCTION>
553 DISPERSION_FUNCTION::safe_math>
kx1;
556 DISPERSION_FUNCTION::safe_math>
ky1;
559 DISPERSION_FUNCTION::safe_math>
kz1;
562 DISPERSION_FUNCTION::safe_math>
x1;
565 DISPERSION_FUNCTION::safe_math>
y1;
568 DISPERSION_FUNCTION::safe_math>
z1;
572 DISPERSION_FUNCTION::safe_math>
kx2;
575 DISPERSION_FUNCTION::safe_math>
ky2;
578 DISPERSION_FUNCTION::safe_math>
kz2;
581 DISPERSION_FUNCTION::safe_math>
x2;
584 DISPERSION_FUNCTION::safe_math>
y2;
587 DISPERSION_FUNCTION::safe_math>
z2;
608 DISPERSION_FUNCTION::safe_math>
w,
610 DISPERSION_FUNCTION::safe_math>
kx,
612 DISPERSION_FUNCTION::safe_math>
ky,
614 DISPERSION_FUNCTION::safe_math>
kz,
616 DISPERSION_FUNCTION::safe_math>
x,
618 DISPERSION_FUNCTION::safe_math>
y,
620 DISPERSION_FUNCTION::safe_math>
z,
622 DISPERSION_FUNCTION::safe_math>
t,
624 DISPERSION_FUNCTION::safe_math> dt,
626 DISPERSION_FUNCTION::safe_math> &eq,
627 const std::string &filename=
"",
628 const size_t num_rays=0,
629 const size_t index=0) :
631 filename, num_rays,
index) {
632 this->kx1 = dt*this->
D.get_dkxdt();
633 this->ky1 = dt*this->
D.get_dkydt();
634 this->kz1 = dt*this->
D.get_dkzdt();
635 this->x1 = dt*this->
D.get_dxdt();
636 this->y1 = dt*this->
D.get_dydt();
637 this->z1 = dt*this->
D.get_dzdt();
659 this->
x_next = this->
x + (this->x1 + this->
x2 )/2.0;
660 this->
y_next = this->
y + (this->y1 + this->
y2 )/2.0;
661 this->
z_next = this->
z + (this->z1 + this->
z2 )/2.0;
674 template<dispersion::function DISPERSION_FUNCTION>
679 DISPERSION_FUNCTION::safe_math>
kx1;
682 DISPERSION_FUNCTION::safe_math>
ky1;
685 DISPERSION_FUNCTION::safe_math>
kz1;
688 DISPERSION_FUNCTION::safe_math>
x1;
691 DISPERSION_FUNCTION::safe_math>
y1;
694 DISPERSION_FUNCTION::safe_math>
z1;
698 DISPERSION_FUNCTION::safe_math>
kx2;
701 DISPERSION_FUNCTION::safe_math>
ky2;
704 DISPERSION_FUNCTION::safe_math>
kz2;
707 DISPERSION_FUNCTION::safe_math>
x2;
710 DISPERSION_FUNCTION::safe_math>
y2;
713 DISPERSION_FUNCTION::safe_math>
z2;
717 DISPERSION_FUNCTION::safe_math>
kx3;
720 DISPERSION_FUNCTION::safe_math>
ky3;
723 DISPERSION_FUNCTION::safe_math>
kz3;
726 DISPERSION_FUNCTION::safe_math>
x3;
729 DISPERSION_FUNCTION::safe_math>
y3;
732 DISPERSION_FUNCTION::safe_math>
z3;
736 DISPERSION_FUNCTION::safe_math>
kx4;
739 DISPERSION_FUNCTION::safe_math>
ky4;
742 DISPERSION_FUNCTION::safe_math>
kz4;
745 DISPERSION_FUNCTION::safe_math>
x4;
748 DISPERSION_FUNCTION::safe_math>
y4;
751 DISPERSION_FUNCTION::safe_math>
z4;
755 DISPERSION_FUNCTION::safe_math>
t_sub;
776 DISPERSION_FUNCTION::safe_math>
w,
778 DISPERSION_FUNCTION::safe_math>
kx,
780 DISPERSION_FUNCTION::safe_math>
ky,
782 DISPERSION_FUNCTION::safe_math>
kz,
784 DISPERSION_FUNCTION::safe_math>
x,
786 DISPERSION_FUNCTION::safe_math>
y,
788 DISPERSION_FUNCTION::safe_math>
z,
790 DISPERSION_FUNCTION::safe_math>
t,
792 DISPERSION_FUNCTION::safe_math> dt,
794 DISPERSION_FUNCTION::safe_math> &eq,
795 const std::string &filename=
"",
796 const size_t num_rays=0,
797 const size_t index=0) :
799 filename, num_rays,
index) {
800 this->kx1 = dt*this->
D.get_dkxdt();
801 this->ky1 = dt*this->
D.get_dkydt();
802 this->kz1 = dt*this->
D.get_dkzdt();
803 this->x1 = dt*this->
D.get_dxdt();
804 this->y1 = dt*this->
D.get_dydt();
805 this->z1 = dt*this->
D.get_dzdt();
807 this->t_sub = this->
t + dt/2.0;
862 this->
kx_next = this->
kx + (this->kx1 + 2.0*(this->kx2 + this->
kx3) + this->kx4)/6.0;
863 this->
ky_next = this->
ky + (this->ky1 + 2.0*(this->ky2 + this->
ky3) + this->ky4)/6.0;
864 this->
kz_next = this->
kz + (this->kz1 + 2.0*(this->kz2 + this->
kz3) + this->kz4)/6.0;
865 this->
x_next = this->
x + (this->x1 + 2.0*(this->x2 + this->
x3 ) + this->x4 )/6.0;
866 this->
y_next = this->
y + (this->y1 + 2.0*(this->y2 + this->
y3 ) + this->y4 )/6.0;
867 this->
z_next = this->
z + (this->z1 + 2.0*(this->z2 + this->
z3 ) + this->z4 )/6.0;
879 template<dispersion::function DISPERSION_FUNCTION>
907 DISPERSION_FUNCTION::safe_math>
w,
909 DISPERSION_FUNCTION::safe_math>
kx,
911 DISPERSION_FUNCTION::safe_math>
ky,
913 DISPERSION_FUNCTION::safe_math>
kz,
915 DISPERSION_FUNCTION::safe_math>
x,
917 DISPERSION_FUNCTION::safe_math>
y,
919 DISPERSION_FUNCTION::safe_math>
z,
921 DISPERSION_FUNCTION::safe_math>
t,
923 DISPERSION_FUNCTION::safe_math> dt,
925 DISPERSION_FUNCTION::safe_math> &eq,
926 const std::string &filename=
"",
927 const size_t num_rays=0,
928 const size_t index=0) :
929 rk4<DISPERSION_FUNCTION> (
w,
kx,
ky,
kz,
x,
y,
z,
t, dt, eq,
930 filename, num_rays,
index),
947 auto lambda =
graph::variable(var->size(),
static_cast<typename DISPERSION_FUNCTION::base
> (1.0),
"\\lambda");
948 auto loss =
graph::one<
typename DISPERSION_FUNCTION::base,
949 DISPERSION_FUNCTION::safe_math> ()/
dt_var + lambda*
D.get_d()*
D.get_d();
952 DISPERSION_FUNCTION::safe_math> inputs = {
966 DISPERSION_FUNCTION::safe_math> (this->
work, {
968 }, inputs, {}, loss, NULL);
983 DISPERSION_FUNCTION::safe_math> outputs = {
988 DISPERSION_FUNCTION::safe_math> setters = {
998 this->work.add_item(inputs, outputs, setters, {}, NULL,
999 "solver_kernel", inputs.back()->size());
1000 this->work.compile();
1012 template<dispersion::function DISPERSION_FUNCTION>
1017 DISPERSION_FUNCTION::safe_math>
x1;
1020 DISPERSION_FUNCTION::safe_math>
y1;
1023 DISPERSION_FUNCTION::safe_math>
z1;
1044 DISPERSION_FUNCTION::safe_math>
w,
1046 DISPERSION_FUNCTION::safe_math>
kx,
1048 DISPERSION_FUNCTION::safe_math>
ky,
1050 DISPERSION_FUNCTION::safe_math>
kz,
1052 DISPERSION_FUNCTION::safe_math>
x,
1054 DISPERSION_FUNCTION::safe_math>
y,
1056 DISPERSION_FUNCTION::safe_math>
z,
1058 DISPERSION_FUNCTION::safe_math>
t,
1060 DISPERSION_FUNCTION::safe_math> dt,
1062 DISPERSION_FUNCTION::safe_math> &eq,
1063 const std::string &filename=
"",
1064 const size_t num_rays=0,
1065 const size_t index=0) :
1067 filename, num_rays,
index) {
1072 assert(zero->is_match(this->D.get_dkxdt()->df(
kx)) &&
1073 zero->is_match(this->D.get_dkxdt()->df(
ky)) &&
1074 zero->is_match(this->D.get_dkxdt()->df(
kz)) &&
1075 zero->is_match(this->D.get_dkydt()->df(
kx)) &&
1076 zero->is_match(this->D.get_dkydt()->df(
ky)) &&
1077 zero->is_match(this->D.get_dkydt()->df(
kz)) &&
1078 zero->is_match(this->D.get_dkzdt()->df(
kx)) &&
1079 zero->is_match(this->D.get_dkzdt()->df(
ky)) &&
1080 zero->is_match(this->D.get_dkzdt()->df(
kz)) &&
1081 zero->is_match(this->D.get_dxdt()->df(
x)) &&
1082 zero->is_match(this->D.get_dxdt()->df(
y)) &&
1083 zero->is_match(this->D.get_dxdt()->df(
z)) &&
1084 zero->is_match(this->D.get_dydt()->df(
x)) &&
1085 zero->is_match(this->D.get_dydt()->df(
y)) &&
1086 zero->is_match(this->D.get_dydt()->df(
z)) &&
1087 zero->is_match(this->D.get_dzdt()->df(
x)) &&
1088 zero->is_match(this->D.get_dzdt()->df(
y)) &&
1089 zero->is_match(this->D.get_dzdt()->df(
z)) &&
1090 "Hamiltonian is not separable.");
1094 this->x1 = this->
x + dt*this->
D.get_dxdt()/2.0;
1095 this->y1 = this->
y + dt*this->
D.get_dydt()/2.0;
1096 this->z1 = this->
z + dt*this->
D.get_dzdt()/2.0;
Class interface to build dispersion relation functions.
Definition dispersion.hpp:1320
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dydt()
Provide right hand side for y update.
Definition dispersion.hpp:1529
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dkydt()
Provide right hand side for z update.
Definition dispersion.hpp:1562
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dkxdt()
Provide right hand side for z update.
Definition dispersion.hpp:1551
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dkzdt()
Provide right hand side for z update.
Definition dispersion.hpp:1573
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 > get_dzdt()
Provide right hand side for z update.
Definition dispersion.hpp:1540
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_residual()
Get the dispersion residual.
Definition dispersion.hpp:1485
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dxdt()
Provide right hand side for x update.
Definition dispersion.hpp:1518
Class representing a netcdf dataset.
Definition output.hpp:166
void create_variable(const result_file &result, const std::string &name, graph::shared_leaf< T, SAFE_MATH > &node, jit::context< T, SAFE_MATH > &context)
Create a variable.
Definition output.hpp:260
void write(const result_file &result)
Write step.
Definition output.hpp:353
Class representing a netcdf based output file.
Definition output.hpp:32
void end_define_mode() const
End define mode.
Definition output.hpp:94
Adaptive Fourth Order Runge Kutta class.
Definition solver.hpp:880
dispersion::dispersion_interface< DISPERSION_FUNCTION > D
Dispersion residual.
Definition solver.hpp:883
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > dt_var
Time step variable.
Definition solver.hpp:886
adaptive_rk4(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, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > dt, equilibrium::shared< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > &eq, const std::string &filename="", const size_t num_rays=0, const size_t index=0)
Construct a new second order runge kutta solver.
Definition solver.hpp:906
virtual void compile() final
Compile the solver function.
Definition solver.hpp:945
Second Order Runge Kutta class.
Definition solver.hpp:549
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky2
ky2 subexpression.
Definition solver.hpp:575
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y2
y2 subexpression.
Definition solver.hpp:584
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx2
kx2 subexpression.
Definition solver.hpp:572
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx1
kx1 subexpression.
Definition solver.hpp:553
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y1
y1 subexpression.
Definition solver.hpp:565
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x1
x1 subexpression.
Definition solver.hpp:562
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz2
kz2 subexpression.
Definition solver.hpp:578
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z1
z1 subexpression.
Definition solver.hpp:568
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z2
z2 subexpression.
Definition solver.hpp:587
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky1
ky1 subexpression.
Definition solver.hpp:556
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz1
kz1 subexpression.
Definition solver.hpp:559
rk2(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, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > dt, equilibrium::shared< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > &eq, const std::string &filename="", const size_t num_rays=0, const size_t index=0)
Construct a new second order runge kutta solver.
Definition solver.hpp:607
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x2
x2 subexpression.
Definition solver.hpp:581
Fourth Order Runge Kutta class.
Definition solver.hpp:675
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky1
ky1 subexpression.
Definition solver.hpp:682
rk4(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, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > dt, equilibrium::shared< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > &eq, const std::string &filename="", const size_t num_rays=0, const size_t index=0)
Construct a new second order runge kutta solver.
Definition solver.hpp:775
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x2
x2 subexpression.
Definition solver.hpp:707
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx1
kx1 subexpression.
Definition solver.hpp:679
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z2
z2 subexpression.
Definition solver.hpp:713
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky4
ky4 subexpression.
Definition solver.hpp:739
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz1
kz1 subexpression.
Definition solver.hpp:685
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y4
y4 subexpression.
Definition solver.hpp:748
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky2
ky2 subexpression.
Definition solver.hpp:701
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz4
kz4 subexpression.
Definition solver.hpp:742
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx2
kx2 subexpression.
Definition solver.hpp:698
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y3
y3 subexpression.
Definition solver.hpp:729
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z1
z1 subexpression.
Definition solver.hpp:694
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y2
y2 subexpression.
Definition solver.hpp:710
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky3
ky3 subexpression.
Definition solver.hpp:720
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz3
kz3 subexpression.
Definition solver.hpp:723
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x4
x4 subexpression.
Definition solver.hpp:745
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz2
kz2 subexpression.
Definition solver.hpp:704
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z4
z4 subexpression.
Definition solver.hpp:751
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx4
kx4 subexpression.
Definition solver.hpp:736
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x3
x3 subexpression.
Definition solver.hpp:726
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y1
y1 subexpression.
Definition solver.hpp:691
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z3
z3 subexpression.
Definition solver.hpp:732
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x1
x1 subexpression.
Definition solver.hpp:688
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > t_sub
t subexpression.
Definition solver.hpp:755
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx3
kx3 subexpression.
Definition solver.hpp:717
Class interface the solver.
Definition solver.hpp:123
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky
ky variable.
Definition solver.hpp:133
virtual graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > init() final
Method to initialize the rays.
Definition solver.hpp:282
void print_kz_next()
Print out the latex expression for the kz_next.
Definition solver.hpp:524
DISPERSION_FUNCTION::base base
Type def to retrieve the backend base type.
Definition solver.hpp:531
void print_z_next()
Print out the latex expression for the z_next.
Definition solver.hpp:500
output::data_set< typename DISPERSION_FUNCTION::base > dataset
Output dataset.
Definition solver.hpp:188
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz
kz variable.
Definition solver.hpp:136
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > t_next
Next t value.
Definition solver.hpp:173
void print_ky_next()
Print out the latex expression for the ky_next.
Definition solver.hpp:516
void print_y_next()
Print out the latex expression for the y_next.
Definition solver.hpp:492
void sync_device()
Synchronize results from host to gpu.
Definition solver.hpp:352
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > residual
Residual.
Definition solver.hpp:177
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz_next
Next kz value.
Definition solver.hpp:161
void print_residual()
Print out the latex expression for the residual.
Definition solver.hpp:476
void print_dkzdt()
Print out the latex expression for the dkzdt.
Definition solver.hpp:448
DISPERSION_FUNCTION::base check_residual(const size_t index)
Check the residual.
Definition solver.hpp:390
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x_next
Next x value.
Definition solver.hpp:164
DISPERSION_FUNCTION dispersion_function
Type def to retrieve the dispersion function.
Definition solver.hpp:529
dispersion::dispersion_interface< DISPERSION_FUNCTION > D
Dispersion function interface.
Definition solver.hpp:151
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx
kx variable.
Definition solver.hpp:130
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z
z variable.
Definition solver.hpp:145
void print_dkxdt()
Print out the latex expression for the dkxdt.
Definition solver.hpp:434
virtual graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > init(graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x, const typename DISPERSION_FUNCTION::base tolerance=1.0E-30, const size_t max_iterations=1000) final
Method to initialize the rays.
Definition solver.hpp:254
virtual void compile()
Compile the solver function.
Definition solver.hpp:303
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > w
w variable.
Definition solver.hpp:127
void print_x_next()
Print out the latex expression for the x_next.
Definition solver.hpp:484
void print_dxdt()
Print out the latex expression for the dxdt.
Definition solver.hpp:455
void print_kx_next()
Print out the latex expression for the kx_next.
Definition solver.hpp:508
std::thread sync
Async thread to write data files.
Definition solver.hpp:191
void step()
Method to step the rays.
Definition solver.hpp:380
const size_t index
Concurrent index.
Definition solver.hpp:183
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > t
t variable.
Definition solver.hpp:148
void print_dydt()
Print out the latex expression for the dydt.
Definition solver.hpp:462
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx_next
Next kx value.
Definition solver.hpp:155
void print_dzdt()
Print out the latex expression for the dzdt.
Definition solver.hpp:469
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z_next
Next z value.
Definition solver.hpp:170
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y
y variable.
Definition solver.hpp:142
workflow::manager< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > work
Workflow manager.
Definition solver.hpp:181
void write_step()
Write result step.
Definition solver.hpp:416
void sync_host()
Synchronize results from gpu to host.
Definition solver.hpp:366
void print_dkydt()
Print out the latex expression for the dkydt.
Definition solver.hpp:441
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y_next
Next y value.
Definition solver.hpp:167
void print(const size_t index)
Print out the results.
Definition solver.hpp:399
void print_dispersion()
Print out the latex expression for the dispersion relation.
Definition solver.hpp:427
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x
x variable.
Definition solver.hpp:139
solver_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, const std::string &filename="", const size_t num_rays=0, const size_t index=0)
Construct a new solver_interface with initial conditions.
Definition solver.hpp:210
output::result_file file
Output file.
Definition solver.hpp:186
static constexpr bool safe_math
Retrieve template parameter of safe math.
Definition solver.hpp:533
~solver_interface()
Destructor.
Definition solver.hpp:239
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky_next
Next ky value.
Definition solver.hpp:158
Predictor corrector that trys to minimize the dispersion residual.
Definition solver.hpp:1013
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y1
Half step y.
Definition solver.hpp:1020
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x1
Half step x.
Definition solver.hpp:1017
split_simplextic(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, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > dt, equilibrium::shared< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > &eq, const std::string &filename="", const size_t num_rays=0, const size_t index=0)
Construct a split simplextic integrator.
Definition solver.hpp:1043
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z1
Half step z.
Definition solver.hpp:1023
Class representing a workflow manager.
Definition workflow.hpp:400
void add_item(graph::input_nodes< T, SAFE_MATH > in, graph::output_nodes< T, SAFE_MATH > out, graph::map_nodes< T, SAFE_MATH > maps, graph::input_nodes< T, SAFE_MATH > atomics, graph::shared_random_state< T, SAFE_MATH > state, const std::string name, const size_t size)
Add a workflow item.
Definition workflow.hpp:459
void wait()
Wait for GPU queue to finish.
Definition workflow.hpp:668
void copy_to_host(graph::shared_leaf< T, SAFE_MATH > &node, T *destination)
Copy contexts of buffer to host.
Definition workflow.hpp:689
void run()
Run work items.
Definition workflow.hpp:649
void print(const size_t index, const graph::output_nodes< T, SAFE_MATH > &nodes)
Print results.
Definition workflow.hpp:700
void copy_to_device(graph::shared_leaf< T, SAFE_MATH > &node, T *destination)
Copy buffer contents to the device.
Definition workflow.hpp:678
jit::context< T, SAFE_MATH > & get_context()
Get the jit context.
Definition workflow.hpp:722
void compile()
Compile the workflow items.
Definition workflow.hpp:629
T check_value(const size_t index, const graph::shared_leaf< T, SAFE_MATH > &node)
Check the value.
Definition workflow.hpp:712
Solver method concept.
Definition solver.hpp:538
Base class for a dispersion relation.
subroutine assert(test, message)
Assert check.
Definition f_binding_test.f90:38
std::shared_ptr< generic< T, SAFE_MATH > > shared
Convenience type alias for shared equilibria.
Definition equilibrium.hpp:470
Name space for graph nodes.
Definition arithmetic.hpp:13
constexpr shared_leaf< T, SAFE_MATH > zero()
Forward declare for zero.
Definition node.hpp:1154
constexpr shared_leaf< T, SAFE_MATH > one()
Forward declare for one.
Definition node.hpp:1167
std::vector< shared_variable< T, SAFE_MATH > > input_nodes
Convenience type alias for a vector of inputs.
Definition node.hpp:2149
shared_variable< T, SAFE_MATH > variable_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a variable node.
Definition node.hpp:2169
shared_leaf< T, SAFE_MATH > variable(const size_t s, const std::string &symbol)
Construct a variable.
Definition node.hpp:2093
std::shared_ptr< leaf_node< T, SAFE_MATH > > shared_leaf
Convenience type alias for shared leaf nodes.
Definition node.hpp:691
std::vector< std::pair< shared_leaf< T, SAFE_MATH >, shared_variable< T, SAFE_MATH > > > map_nodes
Convenience type alias for mapping end codes back to inputs.
Definition node.hpp:2153
std::vector< shared_leaf< T, SAFE_MATH > > output_nodes
Convenience type alias for a vector of output nodes.
Definition node.hpp:706
shared_leaf< T, SAFE_MATH > pseudo_variable(shared_leaf< T, SAFE_MATH > x)
Define pseudo variable convenience function.
Definition node.hpp:2314
Name space for solvers.
Definition newton.hpp:13
void newton(workflow::manager< T, SAFE_MATH > &work, graph::output_nodes< T, SAFE_MATH > vars, graph::input_nodes< T, SAFE_MATH > inputs, graph::input_nodes< T, SAFE_MATH > atomics, 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:35
Implements output files in a netcdf format.