XGC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
analytic_I.hpp
Go to the documentation of this file.
1 #ifndef ANALYTIC_I_HPP
2 #define ANALYTIC_I_HPP
3 
4 #include "globals.hpp"
5 #include "magnetic_field.hpp"
6 
7 // Provides setup and get I for an analytic example of I
8 // get_analytic_I() will be replaced with interp eventually
9 
10 namespace{
11 
12 // Simple expression for I and dI/dpsi
13 double get_analytic_I(double psi, double magnitude){
14  return magnitude/(psi+0.1);
15 }
16 
17 double get_analytic_dIdpsi(double psi, double magnitude){
18  return -magnitude/((psi+0.1)*(psi+0.1));
19 }
20 
21 // Create an I grid based off the analytic I
22 View<double*, HostType> analytic_I_grid(double magnitude, const View<double*, HostType>& psi){
23  View<double*, HostType> I_grid("I_grid",psi.size());
24  for (int i=0; i<psi.size(); i++){
25  I_grid(i) = get_analytic_I(psi(i), magnitude);
26  }
27  return I_grid;
28 }
29 
30 }
31 #endif