111 template<jit::complex_scalar T,
bool SAFE_MATH=true>
129 virtual void run(
const size_t time_index)=0;
134 concept model = std::is_base_of<method<typename A::base, A::safe_math>, A>::value;
145 template<jit::complex_scalar T,
bool SAFE_MATH=true>
211 const std::string &filename=
"",
212 const size_t index=0) :
213 kamp(kamp), w(w), kx(kx), ky(ky), kz(kz), x(x), y(y), z(z), t(t),
214 work(index), index(index), file(filename), dataset(file), sync([]{}) {
215 auto kvec = kx*eq->get_esup1(x, y, z)
216 + ky*eq->get_esup2(x, y, z)
217 + kz*eq->get_esup3(x, y, z);
218 auto klen = kvec->length();
220 auto kamp_vec = kamp*kvec/klen;
236 work.
add_item(inputs, {}, setters, NULL,
237 "root_find_init_kernel", inputs.back()->size());
263 work.
add_item(inputs, {}, setters, NULL,
264 "final_kamp", inputs.back()->size());
298 void run(
const size_t time_index) {
299 dataset.
read(file, time_index);
313 sync = std::thread([
this] (
const size_t i) ->
void {
314 dataset.
write(file, i);
328 template<jit::complex_scalar T,
bool SAFE_MATH=true>
392 const std::string &filename=
"",
393 const size_t index=0) :
394 kamp(kamp), w(w), kx(kx), ky(ky), kz(kz), x(x), y(y), z(z), t(t),
395 work(index), index(index), file(filename), dataset(file), sync([]{}) {
396 auto k_vec = kx*eq->get_esup1(x, y, z)
397 + ky*eq->get_esup2(x, y, z)
398 + kz*eq->get_esup3(x, y, z);
399 auto k_unit = k_vec->unit();
405 SAFE_MATH> ().D(w, k_vec,
408 auto kamp1 = k_vec->length()
409 - Dw/k_unit->dot(Dc->df(kx)*eq->get_esup1(x, y, z) +
410 Dc->df(ky)*eq->get_esup2(x, y, z) +
411 Dc->df(kz)*eq->get_esup3(x, y, z));
431 "weak_damping_kimg_kernel", inputs.back()->size());
465 void run(
const size_t time_index) {
466 dataset.
read(file, time_index);
480 sync = std::thread([
this] (
const size_t i) ->
void {
481 dataset.
write(file, i);
Base class for absorption models.
Definition absorption.hpp:112
static constexpr bool safe_math
Retrieve template parameter of safe math.
Definition absorption.hpp:117
T base
Type def to retrieve the backend base type.
Definition absorption.hpp:115
virtual void run(const size_t time_index)=0
Run the workflow.
virtual void compile()=0
Compile the work items.
Class interface for the root finder.
Definition absorption.hpp:146
root_finder(graph::shared_leaf< T, SAFE_MATH > kamp, graph::shared_leaf< T, SAFE_MATH > w, graph::shared_leaf< T, SAFE_MATH > kx, graph::shared_leaf< T, SAFE_MATH > ky, graph::shared_leaf< T, SAFE_MATH > kz, 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, const std::string &filename="", const size_t index=0)
Constructor for root finding.
Definition absorption.hpp:201
void run(const size_t time_index)
Run the workflow.
Definition absorption.hpp:298
void compile()
Compile the work items.
Definition absorption.hpp:277
~root_finder()
Destructor.
Definition absorption.hpp:270
Class interface weak damping approximation.
Definition absorption.hpp:329
void run(const size_t time_index)
Run the workflow.
Definition absorption.hpp:465
~weak_damping()
Destructor.
Definition absorption.hpp:437
void compile()
Compile the work items.
Definition absorption.hpp:444
weak_damping(graph::shared_leaf< T, SAFE_MATH > kamp, graph::shared_leaf< T, SAFE_MATH > w, graph::shared_leaf< T, SAFE_MATH > kx, graph::shared_leaf< T, SAFE_MATH > ky, graph::shared_leaf< T, SAFE_MATH > kz, 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, const std::string &filename="", const size_t index=0)
Constructor for weak damping.
Definition absorption.hpp:382
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
Hot Plasma Expansion Dispersion function.
Definition dispersion.hpp:1209
Hot Plasma Dispersion function.
Definition dispersion.hpp:1100
Class interface to build dispersion relation functions.
Definition dispersion.hpp:289
Class representing a netcdf dataset.
Definition output.hpp:166
void read(const result_file &result, const size_t index)
Read step.
Definition output.hpp:412
void reference_variable(const result_file &result, const std::string &name, graph::shared_variable< T, SAFE_MATH > &&node)
Load reference.
Definition output.hpp:285
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
Class representing a workflow manager.
Definition workflow.hpp:215
void run()
Run work items.
Definition workflow.hpp:359
void wait()
Wait for GPU queue to finish.
Definition workflow.hpp:368
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:271
void copy_to_device(graph::shared_leaf< T, SAFE_MATH > &node, T *destination)
Copy buffer contents to the device.
Definition workflow.hpp:378
jit::context< T, SAFE_MATH > & get_context()
Get the jit context.
Definition workflow.hpp:422
void compile()
Compile the workflow items.
Definition workflow.hpp:336
Solver method concept.
Definition absorption.hpp:134
Base class for a dispersion relation.
Namespace for power absorption models.
Definition absorption.hpp:101
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::vector< shared_variable< T, SAFE_MATH > > input_nodes
Convenience type alias for a vector of inputs.
Definition node.hpp:1711
shared_variable< T, SAFE_MATH > variable_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a variable node.
Definition node.hpp:1727
std::shared_ptr< leaf_node< T, SAFE_MATH > > shared_leaf
Convenience type alias for shared leaf nodes.
Definition node.hpp:676
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:1715
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.
Implements output files in a netcdf format.