Jump to content
bouvy

Size of Mesh Cell Reference in .os File

Recommended Posts

Hello, 

 

I am using FEKO 2017. From POSTFEKO, I am exporting the surface current and get the .os file. I then import the .os file into MATLAB to do some processing. I would like to calculate the area of the mesh cell for which the current is given for each entry in the .os file. Is this data available within one of the headings of the .os file? I have looked through the user manual but can't find anything relevant.

 

I've attached an example .os file at which I am looking.

 

feko_surfacecurrent_f16.os

 

Thanks,

Alex

Share this post


Link to post
Share on other sites

Hello bouvy / Alex

As you have noticed, the .os file does not contain the triangle vertices and thus you can't calculate the area from the information in that file. The information is available at other places. The following list contains some options:

  • Use the POSTFEKO API to access the data that you need. In this case you are only looking for the mesh details so that you can calculate the area. At the end of this comment is an example (from the manual) that shows you how to access the mesh elements. You can also access all the current information in a similar way and if you want to continue with the post processing in Matlab / Compose, you can create your own file format and export it from POSTFEKO with all the info that you require in Matlab / Compose. You could also do the processing in POSTFEKO directly (possibly).
  • You can also export the mesh to a format that you are able to read (Nastran / STL) and access the triangles that way.
  • There is an option to export the mesh info the .out file. With this option, you get all the info including the area. I would not parse the .out file (I never advise to do that), but it can be used to check your calculations.

I hope this helps. My preference would definitely be the POSTFEKO scripting. You can even use the --run-script and --non-interactive command line options to call POSTFEKO (without a GUI) to execute a script and export all the info that you need to a file (should be very easy to integrate into Matlab / Compose in that way).

 

Example script to access mesh elements in POSTFEKO:

app = pf.GetApplication()
app:NewProject()
app:OpenFile(FEKO_HOME..[[/shared/Resources/Automation/startup.fek]])
sConf = app.Models["startup"].Configurations[1]
mesh = sConf.Mesh
points = mesh.Points

    -- Iterate through 'TriangleFaces' and print the first two 'Triangles' 
    -- vertex indices as well as their locations
    
TriangleFaces_count = mesh.TriangleFaces.Count
for i = 1, TriangleFaces_count do
    triangle = mesh.TriangleFaces[i].Triangles -- Create a member to ensure the best performance
    for j = 1, 2 do
       print("Triangle "..j)
       print(triangle[j])
       print("Vertex locations")
       print(points[triangle[j].VertexIndices[1]]) -- Accessing member here will be faster than
       print(points[triangle[j].VertexIndices[2]]) -- querying the mesh for its points each time
       print(points[triangle[j].VertexIndices[3]])
    end
end

 

bouvy likes this

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...