Hello, and thanks in advance for taking a look at my question. Generally, I am trying to make a railgun force model. Since railguns depend on the magnetic field created around the rails (and the resulting Lorentz force) I need to model the magnetic field created by the current that flows through the rails. The problem is, when I compute the magnetic field using my implementation of Biot-Savart, I get something around 2500 T as an average field strength between 0 and 1.2 cm away from a 1 x 1 cm rail carrying 20,000 A of current (I get about 3100 T as a maximum closest to the rail). The magnetic field around a circular conductor (simplification made for a sanity check) is around 0.5 T closest to the "rail" when you take both rails into account. I cannot for the life of me figure out this huge discrepancy. I've checked units, I've quadruple-checked all my constants, I've run a mesh refinement analysis, I've even made an animation to show that my indexing is working properly. Perhaps most convincing is that when using another implementation of Biot-Savart (a more simple equation), I get a result pretty close to the simple wire value. I have no idea what's wrong, and I'm hoping someone can help me out. I should mention that I'm an aerospace engineering student, with a graduate focus in structures...so neither I, nor my advisor, are EM experts. Here's a simple diagram if you're not familiar with railguns. I am essentially using Biot-Savart to compute the magnetic field in a discrete armature section (P) from a discrete rail section (P'). I am doing this following equation 2 from this paper in MATLAB. To my understanding, this equation shows the magnetic field at an arbitrary point (P: x,y,z) outside the rail. So, to find the magnetic field at each point in the armature, I currently use 5 loops. Two to loop through the rail positions (y' and z' with the long rail dimension being essentially infinite) and three to loop through the armature positions (x, y, z). I am following a test case Here is a block diagram of my current code. Additional Question: Even though I'm not currently doing this, I will be adding a temporal loop as well. This will mean the length of rail producing magnetic field will change, and I will need to add a 6th loop to account for discrete rail sections in the x (long) direction. How do I define volumetric current density? The current is not contained in the long (flowing) direction that way. It seems incorrect to just divide current by the length of each section because the current flows that direction. However, I cannot just not divide because then my solution is simply a factor of my mesh size, since the magnetic field contribution from each section gets added together. I am computing the integrals as simple sums (midpoint rule, I guess), but I see relatively little change by adjusting mesh size. If this sort of simple integration were a problem, I should see significant and unstable changes with mesh size, correct? Below is the mesh refinement analysis I did, where the average magnetic field is plotted for varying mesh size. As you can see, the one unstable variable is the mesh size of the armature width. As the size gets smaller, more elements get closer to the rail (r goes to 0) and this influences the average more than the other points in the center bring it down. But this doesn't show a problem with this formulation, correct? Finally, here are links to my code. The input case I'm running is based off of this paper. That paper also contains the simplified version of Biot-Savart that seems to be working. The more complicated Biot-Savart implementation I'm interested in fixing is the MATLAB code. The "Gif" section at the bottom (and option at the top) are only done to make a movie showing that point P' computes B field at point P, and then loops through all of these values. As I mentioned at the top, this was done to make sure my indexing runs correctly. Gist || Dropbox Required Function for the MATLAB Code: Gist || Dropbox The simpler Biot-Savart code is in the Mathematica code (Section ILR1). Everything in this code seems accurate with the exception of a mysterious factor of two in the ILR1 force integral, and the in-progress F1 section. Gist || Dropbox Update: I have used MATLAB's integral2 to do the integration now. There are now only 3 loops in the computation. I loop through each armature position, and compute the magnetic field at that point by integrating over the rail sections. The old computation is in the code still for comparison. The answer given by this code is different, but it still does not match up with the simpler wire code, or the simpler Biot-Savart equation. Instead of ~2500 T as an average, I get ~0.0025 T. And yes, most of the values are about a factor of 10-6 different from the previous values. But, as I said, this doesn't match ~0.5 T that I get from the simpler formulations. Does anyone know why this might be ? I still don't understand why I am getting such smaller values now. I know I was summing up each loop, but I was also dividing by the width and height, so I should get the same answer at the end. Especially since the result is stable with increasing mesh size.... Here is the code for the new file: Gist || Dropbox For convenience, here is a hyperphysics calculator that does the wire calculation. To get the maximum value, I compute the B field at 0.01m (the width of the rail) and then add the B field at 0.01 + 0.012 m (the width of the second rail, plus the rail separation) to get ~0.5 T (this one actually comes out to ~0.58 T). Additionally, I have run an ANSYS Workbench Magnetostatic simulation to check my values further. This gives me yet another result.... I made the mistake of using the wrong scale and going a little to detailed with this model, as you'll notice the rail is hollow (this is a way of getting around using a transient solution because in a railgun the current pulse is so fast, it operates like AC current and only travels in the skin of the rail...I'll deal with that in the rest of my analysis later). The reigon of square mesh next to the rail (copper) is the armature (aluminum), and the surrounding area is just air. I have run another version, but the simulation license is now being used by someone else, so I don't have that result to post. If I recall correctly, that result gave even smaller values. As you can see, the magnetic field in the armature is 0.017 to 0.19 T. Sure, this seems to be at least on the same order of magnitude, but, as shown by the second result image, most of the armature is near the low end of this. Yes, the other simulation has smaller values, but not something near what the MATLAB code is getting now (though I'd have trouble trusting that anyway since I believe the simple approximations the most). Would the result be significantly smaller because the Biot-Savart solutions don't consider the magnetic field needing to penetrate another metal?