I have two sets of magnets. One set consists of two electromagnets (Shown below: Blue) and the other set consists of two NdFeB N40 permanent magnets. Both sets of magnets lie on the same plane. I want to plot the force of attraction/ repulsion between the two sets of magnets as the distance between them varies from 10cm to 100cm (Y-axis below is in mm - and shows the initial condition of 10cm (100mm) separation).
I have modeled this setup using Radia Free software found here. You must have Mathematica (I am currently using version 11.2) to use Radia.
My problem: When Radia solves the model and produces an output of Force vs. Distance I expect ALL the force measurements to be EITHER positive OR negative - meaning either attraction or repulsion between the two sets of magnets. What actually happens though is after about 50cm separation Radia produces a mixture of positive and negative force results. The First plot looks accurate (yellow and blue lines) but on closer inspection some of the values are negative and this becomes glaringly obvious when the Force axis (Y) is made logarithmic.
And the logarithmic version:
Included in the graph (orange) is the solution I obtained (Force vs. Distance) from a 2D magnetostatics software called FEMM. This is purely a reference (which I believe is what the yellow and blue lines should look like especially in the logarithmic version) showing a Force>0 for all distances from 10cm to 100cm.
I don't know where I am going wrong and would really appreciate some help. I have read on the Radia documentation that correct subdivision is crucial - especially to iron components. I have tried to subdivide my iron core using radObjDivMag[]
Radia Functions but I can't get it to work (keep in mind I used the same function on a bar magnet (cuboid) and the function worked perfectly, I have also tried to use the function argument {"cyl",....} but it will still not subdivide my component, if you know where I am going wrong please comment).
I would like to attach my Mathematica notebook (heavily commented however if you have any questions please ask me) which I used to create and solve the model and the Excel spreadsheet used to plot my data but don't seem to be able to - Please message me and I can send it to you.
Has anyone used Radia before? Should I be using different software?