Extension: Geometries
#include "dg/geometries/geometries.h"
Loading...
Searching...
No Matches
polynomial_parameters.h
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include <vector>
4#include <dg/file/json_utilities.h>
9namespace dg
10{
11namespace geo
12{
13namespace polynomial
14{
43{
44 double R_0,
47 a,
50 unsigned M,
51 N;
52 std::vector<double> c;
53 std::string description;
54 Parameters() = default;
62 Parameters( const dg::file::WrappedJsonValue& js) {
63 pp = js.get( "PP", 1).asDouble();
64 pi = js.get( "PI", 1).asDouble();
65 M = js.get( "M", 1).asUInt();
66 N = js.get( "N", 1).asUInt();
67 c.resize(M*N);
68 for (unsigned i=0;i<M*N;i++)
69 c[i] = js["c"].get(i,0.).asDouble();
70
71 R_0 = js.get( "R_0", 0.).asDouble();
72 a = R_0*js.get( "inverseaspectratio", 0.).asDouble();
73 elongation=js.get( "elongation", 1.).asDouble();
74 triangularity=js.get( "triangularity", 0.).asDouble();
75 description = js.get( "description", "standardX").asString();
76 }
82 dg::file::JsonType dump( ) const
83 {
84 dg::file::JsonType js;
85 js["M"] = M;
86 js["N"] = N;
87 js["PP"] = pp;
88 js["PI"] = pi;
89 for (unsigned i=0;i<M*N;i++) js["c"][i] = c[i];
90 js["R_0"] = R_0;
91 js["inverseaspectratio"] = a/R_0;
92 js["elongation"] = elongation;
93 js["triangularity"] = triangularity;
94 js[ "equilibrium"] = "polynomial";
95 js[ "description"] = description;
96 return js;
97 }
103 bool isToroidal() const{
104 if( pp == 0)
105 return true;
106 return false;
107 }
109 void display( std::ostream& os = std::cout ) const
110 {
111 dg::file::WrappedJsonValue js = dump();
112 os << "Polynomial Geometrical parameters are: \n"
113 <<js.toStyledString();
114 os << std::flush;
115
116 }
117};
118} //namespace polynomial
119} //namespace geo
120} //namespace dg
description
How flux function looks like. Decider on whether and what flux aligned grid to construct.
Definition magnetic_field.h:50
@ polynomial
dg::geo::polynomial::Psip
Constructs and display geometric parameters for the polynomial fields.
Definition polynomial_parameters.h:43
Parameters(const dg::file::WrappedJsonValue &js)
Construct from Json dataset.
Definition polynomial_parameters.h:62
std::string description
Definition polynomial_parameters.h:53
void display(std::ostream &os=std::cout) const
Write variables as a formatted string.
Definition polynomial_parameters.h:109
double triangularity
triangularity of the magnetic surfaces
Definition polynomial_parameters.h:49
dg::file::JsonType dump() const
Put values into a json string.
Definition polynomial_parameters.h:82
double pp
prefactor for Psi_p
Definition polynomial_parameters.h:45
bool isToroidal() const
True if pp==0.
Definition polynomial_parameters.h:103
std::vector< double > c
M*N coefficients for the polynomial equilibrium, c[i*N+j] corresponds to R^i Z^j;.
Definition polynomial_parameters.h:52
double R_0
major tokamak radius
Definition polynomial_parameters.h:44
double a
little tokamak radius
Definition polynomial_parameters.h:47
unsigned N
number of coefficients in Z
Definition polynomial_parameters.h:51
double elongation
elongation of the magnetic surfaces
Definition polynomial_parameters.h:48
unsigned M
number of coefficients in R
Definition polynomial_parameters.h:50
double pi
prefactor for current I
Definition polynomial_parameters.h:46