34 x_grid = (x_max - x_min) / ( n_x - 1 * (bc_x ==
NATURALBC) );
50 for(
int i_x=0; i_x<n_x; i_x++) {
52 c[i_x*2 + 1] = c[i_x*2+1] / (x_grid*x_grid);
69 int n_x,
int bc_x,
real x_min,
real x_max) {
74 real x_grid = (x_max - x_min) / ( n_x - 1 * (bc_x ==
NATURALBC) );
110 real dx3 = dx * (dx*dx - 1.0);
112 real dxi3 = dxi * (dxi*dxi - 1.0);
122 x1 = -(str->
n_x-1)*x1;
130 dxi *str->
c[n+0]+dx *str->
c[n+x1+0]
131 +(xg2/6)*(dxi3*str->
c[n+1]+dx3*str->
c[n+x1+1]);
168 real dx3 = dx * (dx*dx - 1.0);
169 real dx3dx = 3*dx*dx - 1;
171 real dxi3 = dxi * (dxi*dxi - 1);
172 real dxi3dx = -3*dxi*dxi + 1;
184 x1 = -(str->
n_x-1)*x1;
193 dxi *str->
c[n+0]+dx *str->
c[n+x1+0]
194 +(xg2/6)*(dxi3*str->
c[n+1]+dx3*str->
c[n+x1+1]);
198 xgi*(str->
c[n+x1+0]- str->
c[n+0])
199 +(xg/6)*(dx3dx*str->
c[n+x1+1]+dxi3dx*str->
c[n+1]);
202 f_df[2] = dxi*str->
c[n+1]+dx*str->
c[n+x1+1];
Main header file for ASCOT5.
unsigned long int a5err
Simulation error flag.
int interp1Dcomp_init_coeff(real *c, real *f, int n_x, int bc_x, real x_min, real x_max)
Calculate cubic spline interpolation coefficients for scalar 1D data.
a5err interp1Dcomp_eval_f(real *f, interp1D_data *str, real x)
Evaluate interpolated value of 1D scalar field.
a5err interp1Dcomp_eval_df(real *f_df, interp1D_data *str, real x)
Evaluate interpolated value of 1D and its 1st and 2nd derivatives.
void interp1Dcomp_init_spline(interp1D_data *str, real *c, int n_x, int bc_x, real x_min, real x_max)
Initialize a cubic spline.
Spline interpolation library.
real fmod(real x, real y)
Compute the modulus of two real numbers.
Header file for splineexpl.c and splinecomp.c.
void splinecomp(real *f, int n, int bc, real *c)
Calculate compact cubic spline interpolation coefficients in 1D.
Cubic interpolation struct.