outfile = "iron_entry_results.txt" start_time = date() handle=openfile(outfile,"a") write(handle, "\nInvestigating iron washer at entry to coil\n") write(handle, "Start time: ", start_time, "\n") write(handle, "Coil is 40mm long\n") write(handle, " 4mm inside radius\n") write(handle, " 10mm outside radius\n") write(handle, " 4 layers of 31 turns each\n") write(handle, "Projectile is 30mm long\n") write(handle, " 2.25mm radius\n") write(handle, " made of M-19 steel\n") write(handle, " starting 47mm away from center\n") closefile(handle) -- Save the model in temp file just to be safe save_femm_file("temp.fem") seteditmode("group") -- Amount the washer grows in thickness increment = 0.5 ------------------------------------------------------- -- Solve with different thicknesses of iron washer ------------------------------------------------------- for i=0,10 do thickness = 0.1 + (i * increment) -- Announce the current test condition handle = openfile(outfile,"a") write(handle, "Iron washer thickness = ", thickness, "\n") closefile(handle) -- Inner loop nudges projectile along the firing axis. -- It starts 40mm away from center and we do a few extra -- points in case the magnetic field is not centered. for n=1,54 do showmesh() analyse() -- Save current position for post-processor handle = openfile("tempfile","w") pos = n-48 write(handle, pos) closefile(handle) run_post("iron_entry_post.lua") -- move projectile selectgroup(1) move_translate(0,1) end -- move projectile back to start selectgroup(1) move_translate(0,-54) -- increase washer thickness selectgroup(3) move_translate(0,-increment) end ----------------------------------------------- -- Document the total run time and finish up ----------------------------------------------- handle = openfile(outfile, "a") end_time = date() write(handle, "\nEnd time: ", end_time ) closefile(handle) messagebox("All done!\n\nStarted " .. start_time .. "\nFinished " .. end_time)