1
$\begingroup$

Previously, I've used 2-dimensioned [radius, zeta] output from NDSolve ({InterpolatingFunction, InterpolatingFunction}] and used the FieldTransform to convert the axial-symmetric cylindrical slice to 3D cartesian space for future NDSolve functions. When I try to do that with a multi-dimensioned data list and use Interpolation, it doesn't structure the result the same. I'm looking for a result like the following:

desired result

Here is my code:

bField = {{{0, -0.0602087}, {0, -0.0950287}, {0, -0.124952}, {0, -0.14618}, {0, -0.155613}, 
           {0, -0.159372}, {0, -0.162784}, {0, -0.168384}, {0, -0.175639}, {0, -0.179005}, 
           {0, -0.175288}, {0, -0.1582}, {0, -0.106581}}, 
          {{0.018056, -0.0599793}, {0.0169553, -0.0970272}, {0.0127164, -0.127771}, 
           {0.00729817, -0.147934}, {0.00259357, -0.157179}, {0.00100155, -0.159464}, 
           {0.00218095, -0.161942}, {0.00361777, -0.168195}, {0.00327177, -0.176241}, 
           {0.000512439, -0.180925}, {-0.00414832, -0.178067}, {-0.0119931, -0.165746}, 
           {-0.0431867, -0.121498}}, 
          {{0.0390599, -0.0595938}, {0.036579, -0.101196}, {0.0270982, -0.136852}, 
           {0.0135705, -0.157793}, {0.00256824, -0.162421}, {-0.000178479, -0.158853}, 
           {0.00408384, -0.158385}, {0.0089802, -0.166161}, {0.0087702, -0.17868}, 
           {0.0020529, -0.18713}, {-0.00678186, -0.184855}, {-0.0130875, -0.176824}, 
           {-0.0100346, -0.184251}}, 
         {{0.0644084, -0.0559792}, {0.0629479, -0.109121}, {0.0453611, -0.154392}, 
          {0.0174589, -0.17746}, {-0.00442631, -0.172572}, {-0.00786805, -0.155377}, 
          {0.00534545, -0.147518}, {0.0192717, -0.160265}, {0.0198827, -0.18429}, 
          {0.00518068, -0.200208}, {-0.0129943, -0.194885}, {-0.0184665, -0.176816},
          {-0.00632971, -0.163783}}};

data = Flatten[ 
         Table[{{r, zeta}, bField[[r + 1, zeta + 7]]}, {r, 0, 3}, {zeta, -6,6}],
       1];

interpB = Interpolation[data]
bFieldCart3D =  TransformedField["Cylindrical" -> "Cartesian", 
               interpB[r, zeta], {r, th, zeta} -> {x, y, z}]
$\endgroup$
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.