Extension: Geometries
#include "dg/geometries/geometries.h"
polynomial_parameters.h
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include <vector>
4#ifdef JSONCPP_VERSION_STRING
5#include <dg/file/json_utilities.h>
6#endif
11namespace dg
12{
13namespace geo
14{
15namespace polynomial
16{
46{
47 double R_0,
50 a,
53 unsigned M,
54 N;
55 std::vector<double> c;
56 std::string description;
57#ifdef JSONCPP_VERSION_STRING
66 Parameters( const dg::file::WrappedJsonValue& js) {
67 pp = js.get( "PP", 1).asDouble();
68 pi = js.get( "PI", 1).asDouble();
69 M = js.get( "M", 1).asUInt();
70 N = js.get( "N", 1).asUInt();
71 c.resize(M*N);
72 for (unsigned i=0;i<M*N;i++)
73 c[i] = js["c"].get(i,0.).asDouble();
74
75 R_0 = js.get( "R_0", 0.).asDouble();
76 a = R_0*js.get( "inverseaspectratio", 0.).asDouble();
77 elongation=js.get( "elongation", 1.).asDouble();
78 triangularity=js.get( "triangularity", 0.).asDouble();
79 description = js.get( "description", "standardX").asString();
80 }
87 Json::Value dump( ) const
88 {
89 Json::Value js;
90 js["M"] = M;
91 js["N"] = N;
92 js["PP"] = pp;
93 js["PI"] = pi;
94 for (unsigned i=0;i<N*N;i++) js["c"][i] = c[i];
95 js["R_0"] = R_0;
96 js["inverseaspectratio"] = a/R_0;
97 js["elongation"] = elongation;
98 js["triangularity"] = triangularity;
99 js[ "equilibrium"] = "polynomial";
100 js[ "description"] = description;
101 return js;
102 }
103#endif // JSONCPP_VERSION_STRING
109 bool isToroidal() const{
110 if( pp == 0)
111 return true;
112 return false;
113 }
115 void display( std::ostream& os = std::cout ) const
116 {
117 os << "Polynomial Geometrical parameters are: \n"
118 <<" Prefactor Psi = "<<pp<<"\n"
119 <<" Prefactor I = "<<pi<<"\n"
120 <<" number in R = "<<M<<"\n"
121 <<" number in Z = "<<N<<"\n";
122 for( unsigned i=0; i<M*N; i++)
123 os<<" c"<<i+1<<"\t\t = "<<c[i]<<"\n";
124
125 os <<" R0 = "<<R_0<<"\n"
126 <<" a = "<<a<<"\n"
127 <<" epsilon_a = "<<a/R_0<<"\n"
128 <<" description = "<<description<<"\n"
129 <<" elongation = "<<elongation<<"\n"
130 <<" triangularity = "<<triangularity<<"\n";
131 os << std::flush;
132
133 }
134};
135} //namespace polynomial
136} //namespace geo
137} //namespace dg
description
How flux function looks like. Decider on whether and what flux aligned grid to construct.
Definition: magnetic_field.h:48
@ polynomial
dg::geo::polynomial::Psip
Constructs and display geometric parameters for the polynomial fields.
Definition: polynomial_parameters.h:46
Parameters(const dg::file::WrappedJsonValue &js)
Construct from Json dataset.
Definition: polynomial_parameters.h:66
std::string description
Definition: polynomial_parameters.h:56
void display(std::ostream &os=std::cout) const
Write variables as a formatted string.
Definition: polynomial_parameters.h:115
double triangularity
triangularity of the magnetic surfaces
Definition: polynomial_parameters.h:52
double pp
prefactor for Psi_p
Definition: polynomial_parameters.h:48
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:55
double R_0
major tokamak radius
Definition: polynomial_parameters.h:47
double a
little tokamak radius
Definition: polynomial_parameters.h:50
unsigned N
number of coefficients in Z
Definition: polynomial_parameters.h:54
double elongation
elongation of the magnetic surfaces
Definition: polynomial_parameters.h:51
unsigned M
number of coefficients in R
Definition: polynomial_parameters.h:53
Json::Value dump() const
Put values into a json string.
Definition: polynomial_parameters.h:87
double pi
prefactor for current I
Definition: polynomial_parameters.h:49