108 unsigned short i,
j, n_func, ial, iby, ibz;
109 unsigned short i_alpha, i_By, i_Bz;
110 unsigned short j_alpha, j_By, j_Bz;
116 double V_al[3], V_by[3], V_bz[3];
118 double DXV_v_drift [N_Func];
119 double DXV_x_drift [N_Func];
120 double DXV_delta_x [N_Func];
121 double DXV_x_width_m[N_Func];
122 double DXV_x_width_p[N_Func];
132 switch(interpolate) {
133 case 1: n_func = N_Func;
134 for ( j=0 ; j<N_Func ; j++ ) {
138 DXV_x_width_m[
j] = -1;
139 DXV_x_width_p[
j] = -1;
146 default: printf (
"*** ERROR, MB_DT_drift_distance: invalid interpolate value = %d\n",interpolate);
154 printf (
"\nMB_DT_drift_distance: Function called with values:\n\n");
155 printf (
"MB_DT_drift_distance: time = %f\n",
time );
156 printf (
"MB_DT_drift_distance: alpha = %f\n",
alpha);
157 printf (
"MB_DT_drift_distance: by = %f\n",by );
158 printf (
"MB_DT_drift_distance: bz = %f\n",bz );
178 printf(
"MB_DT_drift_distance:\n");
179 printf(
"MB_DT_drift_distance: i_alpha j_alpha alpha_value's %d %d %.0f %.0f\n",i_alpha,j_alpha,
alpha_value[i_alpha],
alpha_value[j_alpha]);
180 printf(
"MB_DT_drift_distance: i_By j_By By_value's %d %d %.2f %.2f\n",i_By ,j_By ,
By_value[i_By] ,
By_value[j_By]);
181 printf(
"MB_DT_drift_distance: i_Bz j_Bz Bz_value's %d %d %.2f %.2f\n",i_Bz ,j_Bz ,
Bz_value[i_Bz] ,
Bz_value[j_Bz]);
186 for ( j=0 ; j<n_func ; j++ ) {
188 ial = (j&4) ? j_alpha : i_alpha;
189 iby = (j&2) ? j_By : i_By ;
190 ibz = (j&1) ? j_Bz : i_Bz ;
192 for ( i=0 ; i<
N_Par_x ; i++ ) par_x[i] =
fun_x[ial][iby][ibz][i];
195 OffSet = par_x[N_Par_x-1];
197 DXV_v_drift[
j] = par_x[0];
199 DXV_x_drift[
j] =
MB_DT_dist (
time, par_x) + DXV_delta_x[
j] - OffSet*par_x[0];
200 DXV_x_width_m[
j] =
MB_DT_sigma_t_m (DXV_x_drift[j], par_sigma_t) * DXV_v_drift[
j];
201 DXV_x_width_p[
j] =
MB_DT_sigma_t_p (DXV_x_drift[j], par_sigma_t) * DXV_v_drift[
j];
204 printf(
"MB_DT_drift_LOOP: OffSet = %f\n",OffSet);
205 printf(
"MB_DT_drift_LOOP: time, v_drift, x_drift, lin, x_width_m, x_width_p = %f %f %f %f %f %f\n",
206 time, DXV_v_drift[j], DXV_x_drift[j], DXV_delta_x[j], DXV_x_width_m[j], DXV_x_width_p[j]) ;
212 if ( interpolate == 0 ) {
214 DX->v_drift = DXV_v_drift[0];
215 DX->delta_x = DXV_delta_x[0];
216 DX->x_drift = DXV_x_drift[0];
217 DX->x_width_m = DXV_x_width_m[0];
218 DX->x_width_p = DXV_x_width_p[0];
234 printf(
"MB_DT_drift_distance: time, v_drift, x_drift, lin, x_width_m, x_width_p = %f %f %f %f %f %f\n",
235 time, DX->v_drift, DX->x_drift, DX->delta_x, DX->x_width_m, DX->x_width_p) ;
static const double fun_sigma_t[N_alpha][N_By][N_Bz][N_Sigma_t]
static const double Bz_value[N_Bz]
static const double By_value[N_By]
double MB_DT_delta_x(double, double *) const
double MB_DT_dist(double, double *) const
double MB_DT_sigma_t_p(double, double *) const
void MB_DT_Get_grid_points(double alpha, double by, double bz, unsigned short *p_alpha, unsigned short *p_By, unsigned short *p_Bz, unsigned short *q_alpha, unsigned short *q_By, unsigned short *q_Bz) const
double MB_DT_MLInterpolation(double *al, double *by, double *bz, double *f) const
unsigned short MB_DT_Check_boundaries(double distime, double alpha, double by, double bz, short ifl) const
double MB_DT_sigma_t_m(double, double *) const
static const double alpha_value[N_alpha]
static const double fun_x[N_alpha][N_By][N_Bz][N_Par_x]