[fcb33e4] | 1 | // NOTE that "length" here is the full height of the core! |
---|
[44e8a93] | 2 | static double |
---|
| 3 | form_volume(double r_minor, |
---|
| 4 | double x_core, |
---|
| 5 | double thick_rim, |
---|
| 6 | double thick_face, |
---|
| 7 | double length) |
---|
[fcb33e4] | 8 | { |
---|
[44e8a93] | 9 | return M_PI*(r_minor+thick_rim)*(r_minor*x_core+thick_rim)*(length+2.0*thick_face); |
---|
[fcb33e4] | 10 | } |
---|
| 11 | |
---|
[44e8a93] | 12 | static double |
---|
| 13 | Iq(double q, |
---|
| 14 | double r_minor, |
---|
| 15 | double x_core, |
---|
| 16 | double thick_rim, |
---|
| 17 | double thick_face, |
---|
| 18 | double length, |
---|
| 19 | double rhoc, |
---|
| 20 | double rhoh, |
---|
| 21 | double rhor, |
---|
| 22 | double rhosolv) |
---|
[fcb33e4] | 23 | { |
---|
| 24 | double si1,si2,be1,be2; |
---|
| 25 | // core_shell_bicelle_elliptical, RKH Dec 2016, based on elliptical_cylinder and core_shell_bicelle |
---|
| 26 | // tested against limiting cases of cylinder, elliptical_cylinder and core_shell_bicelle |
---|
| 27 | // const double uplim = M_PI_4; |
---|
| 28 | const double halfheight = 0.5*length; |
---|
| 29 | //const double va = 0.0; |
---|
| 30 | //const double vb = 1.0; |
---|
| 31 | // inner integral limits |
---|
| 32 | //const double vaj=0.0; |
---|
| 33 | //const double vbj=M_PI; |
---|
| 34 | |
---|
[44e8a93] | 35 | const double r_major = r_minor * x_core; |
---|
| 36 | const double rA = 0.5*(square(r_major) + square(r_minor)); |
---|
| 37 | const double rB = 0.5*(square(r_major) - square(r_minor)); |
---|
| 38 | const double dr1 = (rhoc-rhoh) *M_PI*r_minor*r_major*(2.0*halfheight);; |
---|
| 39 | const double dr2 = (rhor-rhosolv)*M_PI*(r_minor+thick_rim)*(r_major+thick_rim)*2.0*(halfheight+thick_face); |
---|
| 40 | const double dr3 = (rhoh-rhor) *M_PI*r_minor*r_major*2.0*(halfheight+thick_face); |
---|
| 41 | //const double vol1 = M_PI*r_minor*r_major*(2.0*halfheight); |
---|
| 42 | //const double vol2 = M_PI*(r_minor+thick_rim)*(r_major+thick_rim)*2.0*(halfheight+thick_face); |
---|
| 43 | //const double vol3 = M_PI*r_minor*r_major*2.0*(halfheight+thick_face); |
---|
[fcb33e4] | 44 | |
---|
| 45 | //initialize integral |
---|
| 46 | double outer_sum = 0.0; |
---|
| 47 | for(int i=0;i<76;i++) { |
---|
| 48 | //setup inner integral over the ellipsoidal cross-section |
---|
| 49 | // since we generate these lots of times, why not store them somewhere? |
---|
| 50 | //const double cos_alpha = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0; |
---|
| 51 | const double cos_alpha = ( Gauss76Z[i] + 1.0 )/2.0; |
---|
| 52 | const double sin_alpha = sqrt(1.0 - cos_alpha*cos_alpha); |
---|
| 53 | double inner_sum=0; |
---|
[f4f85b3] | 54 | double sinarg1 = q*halfheight*cos_alpha; |
---|
[44e8a93] | 55 | double sinarg2 = q*(halfheight+thick_face)*cos_alpha; |
---|
[1e7b0db0] | 56 | si1 = sas_sinx_x(sinarg1); |
---|
| 57 | si2 = sas_sinx_x(sinarg2); |
---|
[fcb33e4] | 58 | for(int j=0;j<76;j++) { |
---|
| 59 | //76 gauss points for the inner integral (WAS 20 points,so this may make unecessarily slow, but playing safe) |
---|
| 60 | //const double beta = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0; |
---|
| 61 | const double beta = ( Gauss76Z[j] +1.0)*M_PI_2; |
---|
| 62 | const double rr = sqrt(rA - rB*cos(beta)); |
---|
[f4f85b3] | 63 | double besarg1 = q*rr*sin_alpha; |
---|
[44e8a93] | 64 | double besarg2 = q*(rr+thick_rim)*sin_alpha; |
---|
[592343f] | 65 | be1 = sas_2J1x_x(besarg1); |
---|
| 66 | be2 = sas_2J1x_x(besarg2); |
---|
[fcb33e4] | 67 | inner_sum += Gauss76Wt[j] *square(dr1*si1*be1 + |
---|
| 68 | dr2*si2*be2 + |
---|
| 69 | dr3*si2*be1); |
---|
| 70 | } |
---|
| 71 | //now calculate outer integral |
---|
| 72 | outer_sum += Gauss76Wt[i] * inner_sum; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | return outer_sum*2.5e-05; |
---|
| 76 | } |
---|
| 77 | |
---|
[44e8a93] | 78 | static double |
---|
[fcb33e4] | 79 | Iqxy(double qx, double qy, |
---|
[44e8a93] | 80 | double r_minor, |
---|
[fcb33e4] | 81 | double x_core, |
---|
[44e8a93] | 82 | double thick_rim, |
---|
| 83 | double thick_face, |
---|
[fcb33e4] | 84 | double length, |
---|
| 85 | double rhoc, |
---|
| 86 | double rhoh, |
---|
| 87 | double rhor, |
---|
| 88 | double rhosolv, |
---|
| 89 | double theta, |
---|
| 90 | double phi, |
---|
| 91 | double psi) |
---|
| 92 | { |
---|
| 93 | // THIS NEEDS TESTING |
---|
[f4f85b3] | 94 | double q, xhat, yhat, zhat; |
---|
| 95 | ORIENT_ASYMMETRIC(qx, qy, theta, phi, psi, q, xhat, yhat, zhat); |
---|
[fcb33e4] | 96 | const double dr1 = rhoc-rhoh; |
---|
| 97 | const double dr2 = rhor-rhosolv; |
---|
| 98 | const double dr3 = rhoh-rhor; |
---|
[44e8a93] | 99 | const double r_major = r_minor*x_core; |
---|
[fcb33e4] | 100 | const double halfheight = 0.5*length; |
---|
[44e8a93] | 101 | const double vol1 = M_PI*r_minor*r_major*length; |
---|
| 102 | const double vol2 = M_PI*(r_minor+thick_rim)*(r_major+thick_rim)*2.0*(halfheight+thick_face); |
---|
| 103 | const double vol3 = M_PI*r_minor*r_major*2.0*(halfheight+thick_face); |
---|
[fcb33e4] | 104 | |
---|
[44e8a93] | 105 | // Compute effective radius in rotated coordinates |
---|
| 106 | const double r_hat = sqrt(square(r_major*xhat) + square(r_minor*yhat)); |
---|
| 107 | const double rshell_hat = sqrt(square((r_major+thick_rim)*xhat) |
---|
| 108 | + square((r_minor+thick_rim)*yhat)); |
---|
[f4f85b3] | 109 | const double be1 = sas_2J1x_x( q*r_hat ); |
---|
| 110 | const double be2 = sas_2J1x_x( q*rshell_hat ); |
---|
| 111 | const double si1 = sas_sinx_x( q*halfheight*zhat ); |
---|
[44e8a93] | 112 | const double si2 = sas_sinx_x( q*(halfheight + thick_face)*zhat ); |
---|
[fcb33e4] | 113 | const double Aq = square( vol1*dr1*si1*be1 + vol2*dr2*si2*be2 + vol3*dr3*si2*be1); |
---|
| 114 | return 1.0e-4 * Aq; |
---|
| 115 | } |
---|
| 116 | |
---|