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 kx_amp = kamp*kx/klen;
221 auto ky_amp = kamp*ky/klen;
222 auto kz_amp = kamp*kz/klen;
240 "root_find_init_kernel", inputs.back()->size());
270 "final_kamp", inputs.back()->size());
304 void run(
const size_t time_index) {
305 dataset.
read(file, time_index);
319 sync = std::thread([
this] (
const size_t i) ->
void {
320 dataset.
write(file, i);
334 template<jit::complex_scalar T,
bool SAFE_MATH=true>
398 const std::string &filename=
"",
399 const size_t index=0) :
400 kamp(kamp), w(w), kx(kx), ky(ky), kz(kz), x(x), y(y), z(z), t(t),
401 work(index), index(index), file(filename), dataset(file), sync([]{}) {
402 auto k_vec = kx*eq->get_esup1(x, y, z)
403 + ky*eq->get_esup2(x, y, z)
404 + kz*eq->get_esup3(x, y, z);
405 auto k_unit = k_vec->unit();
411 SAFE_MATH> ().D(w, kx, ky, kz,
414 auto kamp1 = k_vec->length()
415 - Dw/k_unit->dot(Dc->df(kx)*eq->get_esup1(x, y, z) +
416 Dc->df(ky)*eq->get_esup2(x, y, z) +
417 Dc->df(kz)*eq->get_esup3(x, y, z));
437 "weak_damping_kimg_kernel", inputs.back()->size());
471 void run(
const size_t time_index) {
472 dataset.
read(file, time_index);
486 sync = std::thread([
this] (
const size_t i) ->
void {
487 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:304
void compile()
Compile the work items.
Definition absorption.hpp:283
~root_finder()
Destructor.
Definition absorption.hpp:276
Class interface weak damping approximation.
Definition absorption.hpp:335
void run(const size_t time_index)
Run the workflow.
Definition absorption.hpp:471
~weak_damping()
Destructor.
Definition absorption.hpp:443
void compile()
Compile the work items.
Definition absorption.hpp:450
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:388
Cold Plasma expansion dispersion function.
Definition dispersion.hpp:1008
virtual graph::shared_leaf< T, SAFE_MATH > D(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)
Cold Plasma expansion Dispersion function.
Definition dispersion.hpp:1035
Hot Plasma Expansion Dispersion function.
Definition dispersion.hpp:1211
Hot Plasma Dispersion function.
Definition dispersion.hpp:1096
Class interface to build dispersion relation functions.
Definition dispersion.hpp:219
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:171
void run()
Run work items.
Definition workflow.hpp:285
void wait()
Wait for GPU queue to finish.
Definition workflow.hpp:294
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 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
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:472
constexpr shared_leaf< T, SAFE_MATH > zero()
Forward declare for zero.
Definition node.hpp:995
std::vector< shared_variable< T, SAFE_MATH > > input_nodes
Convenience type alias for a vector of inputs.
Definition node.hpp:1731
shared_variable< T, SAFE_MATH > variable_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a variable node.
Definition node.hpp:1747
std::shared_ptr< leaf_node< T, SAFE_MATH > > shared_leaf
Convenience type alias for shared leaf nodes.
Definition node.hpp:674
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:1735
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.