110 template<jit::complex_scalar T,
bool SAFE_MATH=true>
128 virtual void run(
const size_t time_index)=0;
133 concept model = std::is_base_of<method<typename A::base, A::safe_math>, A>::value;
144 template<jit::complex_scalar T,
bool SAFE_MATH=true>
210 const std::string &filename=
"",
211 const size_t index=0) :
212 kamp(kamp), w(w), kx(kx), ky(ky), kz(kz), x(x), y(y), z(z), t(t),
213 work(index), index(index), file(filename), dataset(file), sync([]{}) {
214 auto kvec = kx*eq->get_esup1(x, y, z)
215 + ky*eq->get_esup2(x, y, z)
216 + kz*eq->get_esup3(x, y, z);
217 auto klen = kvec->length();
219 auto kx_amp = kamp*kx/klen;
220 auto ky_amp = kamp*ky/klen;
221 auto kz_amp = kamp*kz/klen;
239 "root_find_init_kernel", inputs.back()->size());
269 "final_kamp", inputs.back()->size());
303 void run(
const size_t time_index) {
304 dataset.
read(file, time_index);
318 sync = std::thread([
this] (
const size_t i) ->
void {
319 dataset.
write(file, i);
333 template<jit::complex_scalar T,
bool SAFE_MATH=true>
397 const std::string &filename=
"",
398 const size_t index=0) :
399 kamp(kamp), w(w), kx(kx), ky(ky), kz(kz), x(x), y(y), z(z), t(t),
400 work(index), index(index), file(filename), dataset(file), sync([]{}) {
401 auto k_vec = kx*eq->get_esup1(x, y, z)
402 + ky*eq->get_esup2(x, y, z)
403 + kz*eq->get_esup3(x, y, z);
404 auto k_unit = k_vec->unit();
410 SAFE_MATH> ().D(w, kx, ky, kz,
413 auto kamp1 = k_vec->length()
414 - Dw/k_unit->dot(Dc->df(kx)*eq->get_esup1(x, y, z) +
415 Dc->df(ky)*eq->get_esup2(x, y, z) +
416 Dc->df(kz)*eq->get_esup3(x, y, z));
436 "weak_damping_kimg_kernel", inputs.back()->size());
470 void run(
const size_t time_index) {
471 dataset.
read(file, time_index);
485 sync = std::thread([
this] (
const size_t i) ->
void {
486 dataset.
write(file, i);
Base class for absoption models.
Definition absorption.hpp:111
static constexpr bool safe_math
Retrieve template parameter of safe math.
Definition absorption.hpp:116
T base
Type def to retrieve the backend base type.
Definition absorption.hpp:114
virtual void run(const size_t time_index)=0
Run the workflow.
virtual void compile()=0
Compile the workitems.
Class interface for the root finder.
Definition absorption.hpp:145
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:200
void run(const size_t time_index)
Run the workflow.
Definition absorption.hpp:303
void compile()
Compile the workitems.
Definition absorption.hpp:282
~root_finder()
Destructor.
Definition absorption.hpp:275
Class interface weak damping approximation.
Definition absorption.hpp:334
void run(const size_t time_index)
Run the workflow.
Definition absorption.hpp:470
~weak_damping()
Destructor.
Definition absorption.hpp:442
void compile()
Compile the workitems.
Definition absorption.hpp:449
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:387
Cold Plasma expansion disperison function.
Definition dispersion.hpp:1007
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 Disperison function.
Definition dispersion.hpp:1034
Hot Plasma Expansion Disperison function.
Definition dispersion.hpp:1210
Hot Plasma Disperison function.
Definition dispersion.hpp:1095
Class interface to build dispersion relation functions.
Definition dispersion.hpp:218
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:133
Namespace for power absorption models.
Definition absorption.hpp:100
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:994
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
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
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
Sets up the kernel for a newtons method.
Impliments output files in a netcdf format.