1 #ifndef ANALYTIC_3D_MAG_HPP
2 #define ANALYTIC_3D_MAG_HPP
12 double get_circular_analytic_psi3d(
const Equilibrium& equil,
double r,
double z,
double phi){
16 double phi_factor = 1.0 + 0.1*sin(phi);
18 return (rp*rp + zp*zp)*phi_factor;
21 double get_analytic_dpsidr(
const Equilibrium& equil,
double r,
double z,
double phi){
25 double phi_factor = 1.0 + 0.1*sin(phi);
30 double get_analytic_dpsidz(
const Equilibrium& equil,
double r,
double z,
double phi){
34 double phi_factor = 1.0 + 0.1*sin(phi);
39 double get_analytic_dpsidphi(
const Equilibrium& equil,
double r,
double z,
double phi){
43 return (rp*rp + zp*zp)*0.1*cos(phi);
47 double get_analytic_Br(
const Equilibrium& equil,
double r,
double z,
double phi){
51 double phi_factor = 1.0 + 0.1*sin(phi);
57 double get_analytic_Bz(
const Equilibrium& equil,
double r,
double z,
double phi){
61 double phi_factor = 1.0 + 0.1*sin(phi);
66 double get_analytic_Bphi(
const Equilibrium& equil,
double r,
double z,
double phi){
67 double phi_factor = 1.0 + 0.1*cos(phi);
73 Kokkos::View<double***, Kokkos::LayoutRight, HostType> analytic_3d_psi_grid(
const Equilibrium& equil,
74 const View<double*, HostType>& r,
75 const View<double*, HostType>& z,
76 const View<double*, HostType>& phi){
78 Kokkos::View<double***, Kokkos::LayoutRight, HostType> psi_grid(
"psi_grid",phi.size(), z.size(), r.size());
79 for (
int k=0; k<phi.size(); k++){
80 for (
int j=0; j<z.size(); j++){
81 for (
int i=0; i<r.size(); i++){
82 psi_grid(k,j,i) = get_circular_analytic_psi3d(equil, r(i), z(j), phi(k));
90 Kokkos::View<double***, Kokkos::LayoutRight, HostType> analytic_3d_Br_grid(
const Equilibrium& equil,
91 const View<double*, HostType>& r,
92 const View<double*, HostType>& z,
93 const View<double*, HostType>& phi){
95 Kokkos::View<double***, Kokkos::LayoutRight, HostType> Br_grid(
"Br_grid",phi.size(), z.size(), r.size());
96 for (
int k=0; k<phi.size(); k++){
97 for (
int j=0; j<z.size(); j++){
98 for (
int i=0; i<r.size(); i++){
99 Br_grid(k,j,i) = get_analytic_Br(equil, r(i), z(j), phi(k));
107 Kokkos::View<double***, Kokkos::LayoutRight, HostType> analytic_3d_Bz_grid(
const Equilibrium& equil,
108 const View<double*, HostType>& r,
109 const View<double*, HostType>& z,
110 const View<double*, HostType>& phi){
112 Kokkos::View<double***, Kokkos::LayoutRight, HostType> Bz_grid(
"Bz_grid",phi.size(), z.size(), r.size());
113 for (
int k=0; k<phi.size(); k++){
114 for (
int j=0; j<z.size(); j++){
115 for (
int i=0; i<r.size(); i++){
116 Bz_grid(k,j,i) = get_analytic_Bz(equil, r(i), z(j), phi(k));
124 Kokkos::View<double***, Kokkos::LayoutRight, HostType> analytic_3d_Bphi_grid(
const Equilibrium& equil,
125 const View<double*, HostType>& r,
126 const View<double*, HostType>& z,
127 const View<double*, HostType>& phi){
129 Kokkos::View<double***, Kokkos::LayoutRight, HostType> Bphi_grid(
"Bphi_grid",phi.size(), z.size(), r.size());
130 for (
int k=0; k<phi.size(); k++){
131 for (
int j=0; j<z.size(); j++){
132 for (
int i=0; i<r.size(); i++){
133 Bphi_grid(k,j,i) = get_analytic_Bphi(equil, r(i), z(j), phi(k));
double z
Definition: grid_structs.hpp:30
RZBounds bounds
Min and max for r and z.
Definition: equil.hpp:86
double r
Definition: grid_structs.hpp:29
KOKKOS_INLINE_FUNCTION double get_z_width() const
Definition: rz_bounds.hpp:28
KOKKOS_INLINE_FUNCTION double get_r_width() const
Definition: rz_bounds.hpp:24
RZPair axis
coordinates of axis
Definition: equil.hpp:96