Extension: Geometries
#include "dg/geometries/geometries.h"
Loading...
Searching...
No Matches
solovev_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>
5
10namespace dg
11{
12namespace geo
13{
14namespace solovev
15{
43{
44 double A,
48 a,
51 std::vector<double> c;
52 std::string description;
53 Parameters() = default;
62 Parameters( const dg::file::WrappedJsonValue& js) {
63 A = js.get("A", 0).asDouble();
64 pp = js.get("PP", 1).asDouble();
65 pi = js.get("PI", 1).asDouble();
66 c.resize(12);
67 for (unsigned i=0;i<12;i++)
68 c[i] = js["c"].get(i,0.).asDouble();
69
70 R_0 = js.get( "R_0", 0.).asDouble();
71 a = R_0* js.get( "inverseaspectratio", 0.).asDouble();
72 elongation= js.get( "elongation", 1.).asDouble();
73 triangularity= js.get( "triangularity", 0.).asDouble();
74 try{
75 description = js.get( "description", "standardX").asString();
76 } catch ( std::exception& err)
77 {
78 if( isToroidal())
79 description = "none";
80 else if( !hasXpoint())
81 description = "standardO";
82 else
83 description = "standardX";
84 }
85 }
91 dg::file::JsonType dump( ) const
92 {
93 dg::file::JsonType js;
94 js["A"] = A;
95 js["PP"] = pp;
96 js["PI"] = pi;
97 for (unsigned i=0;i<12;i++) js["c"][i] = c[i];
98 js["R_0"] = R_0;
99 js["inverseaspectratio"] = a/R_0;
100 js["elongation"] = elongation;
101 js["triangularity"] = triangularity;
102 js[ "equilibrium"] = "solovev";
103 js[ "description"] = description;
104 return js;
105 }
115 bool hasXpoint( ) const{
116 bool Xpoint = false;
117 for( int i=7; i<12; i++)
118 if( fabs(c[i]) >= 1e-10)
119 Xpoint = true;
120 return Xpoint;
121 }
127 bool isToroidal() const{
128 if( pp == 0)
129 return true;
130 return false;
131 }
133 void display( std::ostream& os = std::cout ) const
134 {
135 dg::file::WrappedJsonValue js = dump();
136 os << "Solovev Geometrical parameters are: \n"
137 <<js.toStyledString();
138 os << std::flush;
139 }
140};
141} //namespace solovev
142} //namespace geo
143} //namespace dg
description
How flux function looks like. Decider on whether and what flux aligned grid to construct.
Definition magnetic_field.h:50
@ solovev
dg::geo::solovev::Psip
Constructs and display geometric parameters for the solovev and taylor fields.
Definition solovev_parameters.h:43
double pp
prefactor for Psi_p
Definition solovev_parameters.h:46
double R_0
major tokamak radius
Definition solovev_parameters.h:45
double a
little tokamak radius
Definition solovev_parameters.h:48
dg::file::JsonType dump() const
Put values into a json string.
Definition solovev_parameters.h:91
double A
A coefficient.
Definition solovev_parameters.h:44
bool isToroidal() const
True if pp==0.
Definition solovev_parameters.h:127
Parameters(const dg::file::WrappedJsonValue &js)
Construct from Json dataset.
Definition solovev_parameters.h:62
std::string description
Definition solovev_parameters.h:52
std::vector< double > c
12 coefficients for the solovev equilibrium;
Definition solovev_parameters.h:51
double pi
prefactor for current I
Definition solovev_parameters.h:47
double elongation
elongation of the magnetic surfaces
Definition solovev_parameters.h:49
bool hasXpoint() const
True if any coefficient c_i!=0 with 7<=i<12.
Definition solovev_parameters.h:115
double triangularity
triangularity of the magnetic surfaces
Definition solovev_parameters.h:50
void display(std::ostream &os=std::cout) const
Write variables as a formatted string.
Definition solovev_parameters.h:133