[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

# Re: Lua sample of line integral

- To: femm@yahoogroups.com
- Subject: Re: Lua sample of line integral
- From: jim271@hotmail.com
- Date: Thu, 16 Aug 2001 14:58:49 -0000
- In-reply-to: <F26868V8zDv60gxapzh0000928d@hotmail.com>
- User-agent: eGroups-EW/0.82

    There is a sample script file that's distributed with FEMM 3.1
    showing how to do this very thing using the Lorentz force on the
    coil. I've found this to be much easier than drawing a contour to use
    for the stress tensor. Just highlight the object used for the coil
    and then calculate the Lorentz force. The force on the coil is equal
    and opposite (opposite sign) to the force on the plunger.

    I've included a script file that I use, which also shows some
    additional formating I've incorporated. One thing I found helpful is
    to restore the original fem file after running the script. When first
    learning to use lua, I often made edit changes to the "temp" file
    left in the display after running a script. Of course, this doesn't
    work, so I started reloading the original file automatically. You
    have to "save" the file in order to change the file name that appears
    in the upper left corner of the screen.

    **** Primary script : *********

    open_femm_file("coil_1inch.fem")
    save_femm_file("temp.fem")

    handle=openfile("lua_data.txt","a");

    write(handle,"\n","======= ",date("%c"),"
    =================================================","\n")

    closefile(handle)

    seteditmode("group")
    for n=0,15 do
    analyse()
    runpost("lua_post.lua")
    if (n<16) then
    selectgroup(1)
    move_translate(0,0.1) -- move plunger upward.
    end

    end
    open_femm_file("coil_1inch.fem") -- Restore original fem file
    save_femm_file("coil_1inch.fem")

    ******* End of primary lua file
    **********************************************

    *** lua_post.lua *** Post processing script:

    handle=openfile("lua_data.txt","a");
    groupselectblock(2) -- select the coil
    fzr=blockintegral(12) -- Lorentz force

    write(handle,format("LForce= %8.2f \n",fzr))

    closefile(handle)
    exitpost()

    ************* End of post processing
    **********************************

    -- Jim

- References:
  - Lua sample of line integral
    - From: "Israel Kehaty" <tsiporak@hotmail.com>

- Prev by Date: Lua sample of line integral
- Next by Date: Re: [femm] Re: What is the best way to model Horseshoe magnets
- Previous by thread: Lua sample of line integral
- Next by thread: Re: [femm] Re: What is the best way to model Horseshoe magnets
- Index(es):
  - Date
  - Thread