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 tolarance = 1.0E-30,
257 const size_t max_iterations = 1000) final {
259 DISPERSION_FUNCTION::safe_math> inputs {
271 tolarance, 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 = {
334 DISPERSION_FUNCTION::safe_math> (),
335 "solver_kernel", inputs.back()->size());
421 sync = std::thread([
this] {
430 D.print_dispersion();
480 std::cout << std::endl;
488 std::cout << std::endl;
496 std::cout << std::endl;
504 std::cout << std::endl;
512 std::cout << std::endl;
520 std::cout << std::endl;
528 std::cout << std::endl;
533 typedef typename DISPERSION_FUNCTION::base
base;
535 static constexpr bool safe_math = DISPERSION_FUNCTION::safe_math;
540 concept method = std::is_base_of<solver_interface<typename S::dispersion_function>, S>::value;
550 template<dispersion::function DISPERSION_FUNCTION>
555 DISPERSION_FUNCTION::safe_math>
kx1;
558 DISPERSION_FUNCTION::safe_math>
ky1;
561 DISPERSION_FUNCTION::safe_math>
kz1;
564 DISPERSION_FUNCTION::safe_math>
x1;
567 DISPERSION_FUNCTION::safe_math>
y1;
570 DISPERSION_FUNCTION::safe_math>
z1;
574 DISPERSION_FUNCTION::safe_math>
kx2;
577 DISPERSION_FUNCTION::safe_math>
ky2;
580 DISPERSION_FUNCTION::safe_math>
kz2;
583 DISPERSION_FUNCTION::safe_math>
x2;
586 DISPERSION_FUNCTION::safe_math>
y2;
589 DISPERSION_FUNCTION::safe_math>
z2;
610 DISPERSION_FUNCTION::safe_math>
w,
612 DISPERSION_FUNCTION::safe_math>
kx,
614 DISPERSION_FUNCTION::safe_math>
ky,
616 DISPERSION_FUNCTION::safe_math>
kz,
618 DISPERSION_FUNCTION::safe_math>
x,
620 DISPERSION_FUNCTION::safe_math>
y,
622 DISPERSION_FUNCTION::safe_math>
z,
624 DISPERSION_FUNCTION::safe_math>
t,
626 DISPERSION_FUNCTION::safe_math> dt,
628 DISPERSION_FUNCTION::safe_math> &eq,
629 const std::string &filename=
"",
630 const size_t num_rays=0,
631 const size_t index=0) :
633 filename, num_rays,
index) {
634 this->kx1 = dt*this->
D.get_dkxdt();
635 this->ky1 = dt*this->
D.get_dkydt();
636 this->kz1 = dt*this->
D.get_dkzdt();
637 this->x1 = dt*this->
D.get_dxdt();
638 this->y1 = dt*this->
D.get_dydt();
639 this->z1 = dt*this->
D.get_dzdt();
661 this->
x_next = this->
x + (this->x1 + this->
x2 )/2.0;
662 this->
y_next = this->
y + (this->y1 + this->
y2 )/2.0;
663 this->
z_next = this->
z + (this->z1 + this->
z2 )/2.0;
676 template<dispersion::function DISPERSION_FUNCTION>
681 DISPERSION_FUNCTION::safe_math>
kx1;
684 DISPERSION_FUNCTION::safe_math>
ky1;
687 DISPERSION_FUNCTION::safe_math>
kz1;
690 DISPERSION_FUNCTION::safe_math>
x1;
693 DISPERSION_FUNCTION::safe_math>
y1;
696 DISPERSION_FUNCTION::safe_math>
z1;
700 DISPERSION_FUNCTION::safe_math>
kx2;
703 DISPERSION_FUNCTION::safe_math>
ky2;
706 DISPERSION_FUNCTION::safe_math>
kz2;
709 DISPERSION_FUNCTION::safe_math>
x2;
712 DISPERSION_FUNCTION::safe_math>
y2;
715 DISPERSION_FUNCTION::safe_math>
z2;
719 DISPERSION_FUNCTION::safe_math>
kx3;
722 DISPERSION_FUNCTION::safe_math>
ky3;
725 DISPERSION_FUNCTION::safe_math>
kz3;
728 DISPERSION_FUNCTION::safe_math>
x3;
731 DISPERSION_FUNCTION::safe_math>
y3;
734 DISPERSION_FUNCTION::safe_math>
z3;
738 DISPERSION_FUNCTION::safe_math>
kx4;
741 DISPERSION_FUNCTION::safe_math>
ky4;
744 DISPERSION_FUNCTION::safe_math>
kz4;
747 DISPERSION_FUNCTION::safe_math>
x4;
750 DISPERSION_FUNCTION::safe_math>
y4;
753 DISPERSION_FUNCTION::safe_math>
z4;
757 DISPERSION_FUNCTION::safe_math>
t_sub;
778 DISPERSION_FUNCTION::safe_math>
w,
780 DISPERSION_FUNCTION::safe_math>
kx,
782 DISPERSION_FUNCTION::safe_math>
ky,
784 DISPERSION_FUNCTION::safe_math>
kz,
786 DISPERSION_FUNCTION::safe_math>
x,
788 DISPERSION_FUNCTION::safe_math>
y,
790 DISPERSION_FUNCTION::safe_math>
z,
792 DISPERSION_FUNCTION::safe_math>
t,
794 DISPERSION_FUNCTION::safe_math> dt,
796 DISPERSION_FUNCTION::safe_math> &eq,
797 const std::string &filename=
"",
798 const size_t num_rays=0,
799 const size_t index=0) :
801 filename, num_rays,
index) {
802 this->kx1 = dt*this->
D.get_dkxdt();
803 this->ky1 = dt*this->
D.get_dkydt();
804 this->kz1 = dt*this->
D.get_dkzdt();
805 this->x1 = dt*this->
D.get_dxdt();
806 this->y1 = dt*this->
D.get_dydt();
807 this->z1 = dt*this->
D.get_dzdt();
809 this->t_sub = this->
t + dt/2.0;
864 this->
kx_next = this->
kx + (this->kx1 + 2.0*(this->kx2 + this->
kx3) + this->kx4)/6.0;
865 this->
ky_next = this->
ky + (this->ky1 + 2.0*(this->ky2 + this->
ky3) + this->ky4)/6.0;
866 this->
kz_next = this->
kz + (this->kz1 + 2.0*(this->kz2 + this->
kz3) + this->kz4)/6.0;
867 this->
x_next = this->
x + (this->x1 + 2.0*(this->x2 + this->
x3 ) + this->x4 )/6.0;
868 this->
y_next = this->
y + (this->y1 + 2.0*(this->y2 + this->
y3 ) + this->y4 )/6.0;
869 this->
z_next = this->
z + (this->z1 + 2.0*(this->z2 + this->
z3 ) + this->z4 )/6.0;
881 template<dispersion::function DISPERSION_FUNCTION>
909 DISPERSION_FUNCTION::safe_math>
w,
911 DISPERSION_FUNCTION::safe_math>
kx,
913 DISPERSION_FUNCTION::safe_math>
ky,
915 DISPERSION_FUNCTION::safe_math>
kz,
917 DISPERSION_FUNCTION::safe_math>
x,
919 DISPERSION_FUNCTION::safe_math>
y,
921 DISPERSION_FUNCTION::safe_math>
z,
923 DISPERSION_FUNCTION::safe_math>
t,
925 DISPERSION_FUNCTION::safe_math> dt,
927 DISPERSION_FUNCTION::safe_math> &eq,
928 const std::string &filename=
"",
929 const size_t num_rays=0,
930 const size_t index=0) :
931 rk4<DISPERSION_FUNCTION> (
w,
kx,
ky,
kz,
x,
y,
z,
t, dt, eq,
932 filename, num_rays,
index),
949 auto lambda =
graph::variable(var->size(),
static_cast<typename DISPERSION_FUNCTION::base
> (1.0),
"\\lambda");
950 auto loss =
graph::one<
typename DISPERSION_FUNCTION::base,
951 DISPERSION_FUNCTION::safe_math> ()/
dt_var + lambda*
D.get_d()*
D.get_d();
954 DISPERSION_FUNCTION::safe_math> inputs = {
970 DISPERSION_FUNCTION::safe_math> ());
985 DISPERSION_FUNCTION::safe_math> outputs = {
990 DISPERSION_FUNCTION::safe_math> setters = {
1002 DISPERSION_FUNCTION::safe_math> (),
1003 "solver_kernel", inputs.back()->size());
1016 template<dispersion::function DISPERSION_FUNCTION>
1021 DISPERSION_FUNCTION::safe_math>
x1;
1024 DISPERSION_FUNCTION::safe_math>
y1;
1027 DISPERSION_FUNCTION::safe_math>
z1;
1048 DISPERSION_FUNCTION::safe_math>
w,
1050 DISPERSION_FUNCTION::safe_math>
kx,
1052 DISPERSION_FUNCTION::safe_math>
ky,
1054 DISPERSION_FUNCTION::safe_math>
kz,
1056 DISPERSION_FUNCTION::safe_math>
x,
1058 DISPERSION_FUNCTION::safe_math>
y,
1060 DISPERSION_FUNCTION::safe_math>
z,
1062 DISPERSION_FUNCTION::safe_math>
t,
1064 DISPERSION_FUNCTION::safe_math> dt,
1066 DISPERSION_FUNCTION::safe_math> &eq,
1067 const std::string &filename=
"",
1068 const size_t num_rays=0,
1069 const size_t index=0) :
1071 filename, num_rays,
index) {
1076 assert(zero->is_match(this->D.get_dkxdt()->df(
kx)) &&
1077 zero->is_match(this->D.get_dkxdt()->df(
ky)) &&
1078 zero->is_match(this->D.get_dkxdt()->df(
kz)) &&
1079 zero->is_match(this->D.get_dkydt()->df(
kx)) &&
1080 zero->is_match(this->D.get_dkydt()->df(
ky)) &&
1081 zero->is_match(this->D.get_dkydt()->df(
kz)) &&
1082 zero->is_match(this->D.get_dkzdt()->df(
kx)) &&
1083 zero->is_match(this->D.get_dkzdt()->df(
ky)) &&
1084 zero->is_match(this->D.get_dkzdt()->df(
kz)) &&
1085 zero->is_match(this->D.get_dxdt()->df(
x)) &&
1086 zero->is_match(this->D.get_dxdt()->df(
y)) &&
1087 zero->is_match(this->D.get_dxdt()->df(
z)) &&
1088 zero->is_match(this->D.get_dydt()->df(
x)) &&
1089 zero->is_match(this->D.get_dydt()->df(
y)) &&
1090 zero->is_match(this->D.get_dydt()->df(
z)) &&
1091 zero->is_match(this->D.get_dzdt()->df(
x)) &&
1092 zero->is_match(this->D.get_dzdt()->df(
y)) &&
1093 zero->is_match(this->D.get_dzdt()->df(
z)) &&
1094 "Hamiltonian is not separable.");
1098 this->x1 = this->
x + dt*this->
D.get_dxdt()/2.0;
1099 this->y1 = this->
y + dt*this->
D.get_dydt()/2.0;
1100 this->z1 = this->
z + dt*this->
D.get_dzdt()/2.0;
Class interface to build dispersion relation functions.
Definition dispersion.hpp:1327
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dydt()
Provide right hand side for y update.
Definition dispersion.hpp:1508
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dkydt()
Provide right hand side for z update.
Definition dispersion.hpp:1541
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_residule()
Get the disperison residule.
Definition dispersion.hpp:1464
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dkxdt()
Provide right hand side for z update.
Definition dispersion.hpp:1530
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dkzdt()
Provide right hand side for z update.
Definition dispersion.hpp:1552
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 tolarance=1.0E-30, const size_t max_iterations=1000)
Solve the dispersion relation for x.
Definition dispersion.hpp:1432
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dzdt()
Provide right hand side for z update.
Definition dispersion.hpp:1519
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > get_dxdt()
Provide right hand side for x update.
Definition dispersion.hpp:1497
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:882
dispersion::dispersion_interface< DISPERSION_FUNCTION > D
Dispersion residule.
Definition solver.hpp:885
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > dt_var
Time step variable.
Definition solver.hpp:888
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:908
virtual void compile() final
Compile the solver function.
Definition solver.hpp:947
Second Order Runge Kutta class.
Definition solver.hpp:551
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky2
ky2 subexpression.
Definition solver.hpp:577
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y2
y2 subexpression.
Definition solver.hpp:586
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx2
kx2 subexpression.
Definition solver.hpp:574
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx1
kx1 subexpression.
Definition solver.hpp:555
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y1
y1 subexpression.
Definition solver.hpp:567
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x1
x1 subexpression.
Definition solver.hpp:564
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz2
kz2 subexpression.
Definition solver.hpp:580
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z1
z1 subexpression.
Definition solver.hpp:570
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z2
z2 subexpression.
Definition solver.hpp:589
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky1
ky1 subexpression.
Definition solver.hpp:558
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz1
kz1 subexpression.
Definition solver.hpp:561
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:609
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x2
x2 subexpression.
Definition solver.hpp:583
Fourth Order Runge Kutta class.
Definition solver.hpp:677
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky1
ky1 subexpression.
Definition solver.hpp:684
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:777
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x2
x2 subexpression.
Definition solver.hpp:709
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx1
kx1 subexpression.
Definition solver.hpp:681
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z2
z2 subexpression.
Definition solver.hpp:715
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky4
ky4 subexpression.
Definition solver.hpp:741
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz1
kz1 subexpression.
Definition solver.hpp:687
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y4
y4 subexpression.
Definition solver.hpp:750
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky2
ky2 subexpression.
Definition solver.hpp:703
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz4
kz4 subexpression.
Definition solver.hpp:744
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx2
kx2 subexpression.
Definition solver.hpp:700
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y3
y3 subexpression.
Definition solver.hpp:731
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z1
z1 subexpression.
Definition solver.hpp:696
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y2
y2 subexpression.
Definition solver.hpp:712
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky3
ky3 subexpression.
Definition solver.hpp:722
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz3
kz3 subexpression.
Definition solver.hpp:725
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x4
x4 subexpression.
Definition solver.hpp:747
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz2
kz2 subexpression.
Definition solver.hpp:706
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z4
z4 subexpression.
Definition solver.hpp:753
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx4
kx4 subexpression.
Definition solver.hpp:738
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x3
x3 subexpression.
Definition solver.hpp:728
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y1
y1 subexpression.
Definition solver.hpp:693
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z3
z3 subexpression.
Definition solver.hpp:734
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x1
x1 subexpression.
Definition solver.hpp:690
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > t_sub
t subexpression.
Definition solver.hpp:757
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx3
kx3 subexpression.
Definition solver.hpp:719
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 initalize the rays.
Definition solver.hpp:282
void print_kz_next()
Print out the latex expression for the kz_next.
Definition solver.hpp:526
DISPERSION_FUNCTION::base base
Type def to retrieve the backend base type.
Definition solver.hpp:533
void print_z_next()
Print out the latex expression for the z_next.
Definition solver.hpp:502
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:518
void print_y_next()
Print out the latex expression for the y_next.
Definition solver.hpp:494
void sync_device()
Syncronize results from host to gpu.
Definition solver.hpp:354
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz_next
Next kz value.
Definition solver.hpp:161
void print_dkzdt()
Print out the latex expression for the dkzdt.
Definition solver.hpp:450
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x_next
Next x value.
Definition solver.hpp:164
DISPERSION_FUNCTION::base check_residule(const size_t index)
Check the residule.
Definition solver.hpp:392
DISPERSION_FUNCTION dispersion_function
Type def to retrieve the dispersion function.
Definition solver.hpp:531
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:436
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:486
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 tolarance=1.0E-30, const size_t max_iterations=1000) final
Method to initalize the rays.
Definition solver.hpp:254
void print_dxdt()
Print out the latex expression for the dxdt.
Definition solver.hpp:457
void print_kx_next()
Print out the latex expression for the kx_next.
Definition solver.hpp:510
std::thread sync
Async thread to write data files.
Definition solver.hpp:191
void step()
Method to step the rays.
Definition solver.hpp:382
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:464
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:471
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
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > residule
Residule.
Definition solver.hpp:177
void write_step()
Write result step.
Definition solver.hpp:418
void sync_host()
Syncronize results from gpu to host.
Definition solver.hpp:368
void print_residule()
Print out the latex expression for the residule.
Definition solver.hpp:478
void print_dkydt()
Print out the latex expression for the dkydt.
Definition solver.hpp:443
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:401
void print_dispersion()
Print out the latex expression for the dispersion relation.
Definition solver.hpp:429
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 inital 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:535
~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 disperison residule.
Definition solver.hpp:1017
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y1
Half step y.
Definition solver.hpp:1024
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x1
Half step x.
Definition solver.hpp:1021
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:1047
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z1
Half step z.
Definition solver.hpp:1027
Class representing a workflow manager.
Definition workflow.hpp:171
void run()
Run work items.
Definition workflow.hpp:285
void wait()
Wait for GPU queue to finish.
Definition workflow.hpp:294
void copy_to_host(graph::shared_leaf< T, SAFE_MATH > &node, T *destination)
Copy contexts of buffer to host.
Definition workflow.hpp:315
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::shared_random_state< T, SAFE_MATH > state, const std::string name, const size_t size)
Add a workflow item.
Definition workflow.hpp:221
void print(const size_t index, const graph::output_nodes< T, SAFE_MATH > &nodes)
Print results.
Definition workflow.hpp:326
void copy_to_device(graph::shared_leaf< T, SAFE_MATH > &node, T *destination)
Copy buffer contents to the device.
Definition workflow.hpp:304
jit::context< T, SAFE_MATH > & get_context()
Get the jit context.
Definition workflow.hpp:348
void compile()
Compile the workflow items.
Definition workflow.hpp:262
T check_value(const size_t index, const graph::shared_leaf< T, SAFE_MATH > &node)
Check the value.
Definition workflow.hpp:338
Solver method concept.
Definition solver.hpp:540
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:472
Name space for graph nodes.
Definition arithmetic.hpp:13
constexpr shared_leaf< T, SAFE_MATH > zero()
Forward declare for zero.
Definition node.hpp:994
constexpr shared_leaf< T, SAFE_MATH > one()
Forward declare for one.
Definition node.hpp:1007
std::shared_ptr< random_state_node< T, SAFE_MATH > > shared_random_state
Convenience type alias for shared sqrt nodes.
Definition random.hpp:272
std::vector< shared_variable< T, SAFE_MATH > > input_nodes
Convenience type alias for a vector of inputs.
Definition node.hpp:1730
shared_variable< T, SAFE_MATH > variable_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a variable node.
Definition node.hpp:1746
shared_leaf< T, SAFE_MATH > variable(const size_t s, const std::string &symbol)
Construct a variable.
Definition node.hpp:1674
std::shared_ptr< leaf_node< T, SAFE_MATH > > shared_leaf
Convenience type alias for shared leaf nodes.
Definition node.hpp:673
std::vector< std::pair< shared_leaf< T, SAFE_MATH >, shared_variable< T, SAFE_MATH > > > map_nodes
Convenience type alias for maping end codes back to inputs.
Definition node.hpp:1734
std::vector< shared_leaf< T, SAFE_MATH > > output_nodes
Convenience type alias for a vector of output nodes.
Definition node.hpp:688
shared_leaf< T, SAFE_MATH > pseudo_variable(shared_leaf< T, SAFE_MATH > x)
Define pseudo variable convience function.
Definition node.hpp:1902
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::shared_leaf< T, SAFE_MATH > func, graph::shared_random_state< T, SAFE_MATH > state, const T tolarance=1.0E-30, const size_t max_iterations=1000, const T step=1.0)
Determine the value of vars to minimze the loss function.
Definition newton.hpp:34
Impliments output files in a netcdf format.