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());
242 auto D = dispersion::hot_plasma<T,
243 dispersion::z_erfi<T, SAFE_MATH>,
262 work.add_item(inputs, {}, setters, {}, NULL,
263 "final_kamp", inputs.back()->size());
279 dataset.create_variable(file,
"kamp", this->kamp, work.get_context());
289 file.end_define_mode();
297 void run(
const size_t time_index) {
298 dataset.read(file, time_index);
312 sync = std::thread([
this] (
const size_t i) ->
void {
313 dataset.write(file, i);
327 template<jit::complex_scalar T,
bool SAFE_MATH=true>
391 const std::string &filename=
"",
392 const size_t index=0) :
393 kamp(kamp), w(w), kx(kx), ky(ky), kz(kz), x(x), y(y), z(z), t(t),
394 work(index), index(index), file(filename), dataset(file), sync([]{}) {
395 auto k_vec = kx*eq->get_esup1(x, y, z)
396 + ky*eq->get_esup2(x, y, z)
397 + kz*eq->get_esup3(x, y, z);
398 auto k_unit = k_vec->unit();
404 SAFE_MATH> ().D(w, k_vec,
407 auto kamp1 = k_vec->length()
408 - Dw/k_unit->dot(Dc->df(kx)*eq->get_esup1(x, y, z) +
409 Dc->df(ky)*eq->get_esup2(x, y, z) +
410 Dc->df(kz)*eq->get_esup3(x, y, z));
428 work.add_item(inputs, {}, setters, {}, NULL,
429 "weak_damping_kimg_kernel", inputs.back()->size());
445 dataset.create_variable(file,
"kamp", this->kamp, work.get_context());
455 file.end_define_mode();
463 void run(
const size_t time_index) {
464 dataset.read(file, time_index);
478 sync = std::thread([
this] (
const size_t i) ->
void {
479 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.
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:297
void compile()
Compile the work items.
Definition absorption.hpp:276
~root_finder()
Destructor.
Definition absorption.hpp:269
void run(const size_t time_index)
Run the workflow.
Definition absorption.hpp:463
~weak_damping()
Destructor.
Definition absorption.hpp:435
void compile()
Compile the work items.
Definition absorption.hpp:442
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:381
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
Class interface to build dispersion relation functions.
Definition dispersion.hpp:289
Class representing a netcdf dataset.
Definition output.hpp:166
Class representing a netcdf based output file.
Definition output.hpp:32
Class representing a workflow manager.
Definition workflow.hpp:400
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:1153
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:2151
std::shared_ptr< leaf_node< T, SAFE_MATH > > shared_leaf
Convenience type alias for shared leaf nodes.
Definition node.hpp:690
shared_variable< T, SAFE_MATH > variable_cast(shared_leaf< T, SAFE_MATH > x)
Cast to a variable node.
Definition node.hpp:2171
std::vector< shared_variable< T, SAFE_MATH > > input_nodes
Convenience type alias for a vector of inputs.
Definition node.hpp:2148
void newton(workflow::manager< T, SAFE_MATH > &work, graph::output_nodes< T, SAFE_MATH > vars, graph::input_nodes< T, SAFE_MATH > inputs, graph::atomic_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
Sets up the kernel for a newtons method.
Implements output files in a netcdf format.