Assigning frequency dependent material property in EDITFEKO

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi,

I have a design in EDITFEKO where I want to assign a specific material property to my structure. I used CADFEKO to create first EDITFEKO file(.pre) then tried to simulate it in EDITFEKO, but it's not taking my assigned material, instead, it's taking PEC. I've attached my CADFEKO(), EDITFEKO() files and the material property() with STL file() of the structure. Would you please help me to assign frequency dependent material property in EDITFEKO? 

 

Thanks in Advance,

Khadimul

Unable to find an attachment - read this blog

Tagged:

Answers

  • JIF
    JIF
    Altair Employee
    edited April 2018

    Hello Khadimul,

     

    My first question when EDITFEKO is being used is always, why? Everything that you want to do (what you have tried to do thus far) is possible in CADFEKO, also using scripting.Consider using CADFEKO, but there is nothing wrong with using EDITFEKO, so I'll respond to your EDITFEKO question.

     

    The *.pre file that you have defines a dielectric, but it never applies that dielectric. You need to apply a medium with the ME card (for dielectric volumes) or with the SK card (lossy metals and thin dielectric sheets). Your model is a simple plate and not a closed volume. That means that you can't model it as a dielectric volume (a medium on the one side and a different medium on the other side). Since I don't have control over the mesh, I decided to model it as a thin dielectric sheet, but then I need to define the sheet thickness and I picked an arbitrary value that you will have to modify. The layered dielectric is defined using the DL card and uses the definition created with the DI card. Finally, the thin dielectric sheet is applied using the SK card.

     

    I have included the modified *.pre file as reference. Obviously it needs to be modified by you, but it shows how to do it.

    Unable to find an attachment - read this blog

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2018

    Hi JIF,

    Thanks a lot for your reply. I appreciate your help.

    My first question when EDITFEKO is being used is always, why?

    This is because we have hundreds of shapes to simulate and we have our automated Matlab program to create STL file then simulate and extract results using EDITFEKO. According to my limited knowledge, for CADFEKO, I've to upload the stl file each time, assign material and then simulate which is tough for hundreds of shapes. I've recorded lua script (), and then tried to run RUNFEKO to make it automated using Matlab (!'C:\Program Files\Altair\2017\feko\bin\runfeko.exe' Macro_test), but I failed. If you have the way, please help me, it would be great for me.

     

    I have included the modified *.pre file as reference. Obviously it needs to be modified by you, but it shows how to do it. e

    In ' DL: Graphene_layer : 0 : 1 : Graphene :  : 0.01', is 0.001 thickness of the layer? and what is 1? And in 'SK:  : 4 : -1 : Graphene_layer', what is 4 and -1? I'm sorry for my ignorance, but I'm asking this because it's giving me a different result than CADFEKO(attached image). And for being more clear, we denoted a thickness (0.6 um) for the sheet(10um x 10um) while making the STL file, so can we use it as dielectric volume. 

     

     

    Thanks in Advance

    <?xml version="1.0" encoding="UTF-8"?>EDITFEKO_CADFEKO results.JPG

    Unable to find an attachment - read this blog

  • JIF
    JIF
    Altair Employee
    edited April 2018

    This is because we have hundreds of shapes to simulate and we have our automated Matlab program to create STL file then simulate and extract results using EDITFEKO. According to my limited knowledge, for CADFEKO, I've to upload the stl file each time, assign material and then simulate which is tough for hundreds of shapes. I've recorded lua script (), and then tried to run RUNFEKO to make it automated using Matlab (!'C:\Program Files\Altair\2017\feko\bin\runfeko.exe' Macro_test), but I failed. If you have the way, please help me, it would be great for me.

    What you are trying to do is very easily possible, but there are many ways to do the same thing and I'll pick one (maybe not the one that works best for you). The Lua scripts are CADFEKO (or POSTFEKO) scripts and thus you need to use them in CADFEKO (or POSTFEKO), not runfeko. The runfeko application will take a FEKO model (either a *.cfx file, *.pre file or *.fek file) and performs the simulation. FEKO only understand *.fek files, but runfeko knows what to do with *.cfx and *.pre files to create the *.fek file and then run FEKO (that produces the *.bof, *.out and many other files).

    I looked at your recording and most of it is fine, but there are a few problems and the crucial bit is missing. Firstly, since you are creating the mesh in an external application and then importing it, there is no reason to remesh in CADFEKO, so I removed that section. The crucial bit that you missed is that you also need to define the layered dielectric (in your case, just a single 0.6 um layer of Graphene) and then apply it to the imported face. I have adjusted the script accordingly (this is similar to what I did previously with your *.pre file).

    You have a few options, you could either create a script that creates the and saves the CADFEKO model (*.cfx) and then run runfeko on that model or (as you did), launch runfeko from withing CADFEKO (in the script). I would probably rather split the two (create CADFEKO model and run the solver), but for now I decided to just stick with your script and run it from CAFEKO.

    Here is the modified script: .

     

    As I have mentioned, you need to run the script in CADFEKO, but that does not mean that you have to click it manually. You can run CADFEKO in non-interactive mode from command line or an external application. Here is an example:

     cadfeko --run-script BuildModelAndSimulate.lua --non-interactive --configure-script 'modelName='testName.cfx' ; stlName='graph_001.stl'' | more

    As you can see, it runs CADFEKO, provides the script that CADFEKO should execute, ensures that the GUI does not display (if you remove this, CADFEKO will remain open after the script has completed, but with this option it will close once completed) and then it also passes some configuration (just normal Lua code that is executed before the script execution starts) and finally the output (stdout) is piped to more (I added this so that I can see errors in the script since GUI applications don't write to the console in Windows - in Linux this is not required). As part of the script, the solver will also be run, but as I mentioned, if I had to do this, I would remove that from the script and do a second call to runfeko instead (I'll leave that simple change to you).

     

    With the steps above, you can adjust the name of the stl file to import and the name of the resulting model and thus it easily fits into any automated system. For reference, here are the results (0.6 um Graphene compared to PEC):

    Graphene_vs_PEC.png

    It is not the same as your graph, but after changing the *.pre file to also use 0.6 um Graphene, the results match perfectly (as expected).

     

    In ' DL: Graphene_layer : 0 : 1 : Graphene :  : 0.01', is 0.001 thickness of the layer? and what is 1? And in 'SK:  : 4 : -1 : Graphene_layer', what is 4 and -1? I'm sorry for my ignorance, but I'm asking this because it's giving me a different result than CADFEKO(attached image).

    Yes, 0.001 was the thickness. If you change it to 0.6, you get the results above? I don't want to explain each parameter, since it is not required. When you are on a card in EDITFEKO, press F1 and then modify the parameters in the panel. The same goes for the 4 and the -1 of the SK card - don't worry about them and use the panel and they will be adjusted to the correct values corresponding to the options selected and entered in the panel.

    Unable to find an attachment - read this blog

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2018

    Hi JIF,

    I'm glad to see your response, i appreciate it.

     

    You have a few options, you could either create a script that creates the and saves the CADFEKO model (*.cfx) and then run runfeko on that model or (as you did), launch runfeko from withing CADFEKO (in the script)

     

    With the steps above, you can adjust the name of the stl file to import and the name of the resulting model and thus it easily fits into any automated system.

    What i understood is that To create the .cfx file and run runfeko automatically, I've to run lua script automatically and save the results and again call the script for next stl file. Is it possible to do it in feko terminal? or which way you'll suggest for us. I tried to find the way to call the lua script from matlab which would be best for us, but couldn't find any method. For our case, we don't need to change the name, we'll create the stl files with same in each cycle and extract the result. 

     

    Thanks

  • JIF
    JIF
    Altair Employee
    edited April 2018

    I already provided the details in my previous comment. If you don't need to change the name of the stl or cfx file, then the command (in a FEKO terminal) would simply be:

     cadfeko --run-script BuildModelAndSimulate.lua --non-interactive

    You should be able to run CADFEKO (or the command above) from Matlab, but then you will have to use the full absolute path to the cadfeko application binary (since the environment won't be setup inside Matlab).

    I don't have access to Matlab, but I know many users have called FEKO components from external applications, including Matlab. I hope this answers your question.

     

    For extracting the data, you may want to consider a Lua script for POSTFEKO to write the data that you want to disk. See

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2018

    Thanks a lot for your kind reply and sorry for asking lot's of questions.

    We usually use this command in matlab to run .pre file in our automated system 

    !'C:\Program Files\Altair\2017\feko\bin\prefeko.exe' filename.pre 

    and for lua script i've tried follow your command line using this command, 

    !'C:\Program Files\Altair\2017\feko\bin\cadfeko --run-script BuildModelAndSimulate.lua --non-interactive and

    !'C:\Program Files\Altair\2017\feko\bin\cadfeko.exe cadfeko --run-script BuildModelAndSimulate.lua --non-interactive and also

    !'C:\Program Files\Altair\2017\feko\bin\cadfeko.exe --run-script BuildModelAndSimulate.lua --non-interactive

    but the matlab is showing the error,

    ''C:\Program Files\Altair\2017\feko\bin\cadfeko --run-script BuildModelAndSimulate.lua --non-interactive'' is not recognized as an internal or external command, 
    operable program or batch file. 

    However, i'm trying to get it running. Thanks again for your valuable time.

     

  • JIF
    JIF
    Altair Employee
    edited April 2018

    I suspect it should be:

    !'C:\Program Files\Altair\2017\feko\bin\cadfeko.exe' --run-script BuildModelAndSimulate.lua --non-interactive

     

    Note that I have put quotes around the application and in your prefeko example and the rest is passed as a parameter as that seems to be what you did for 'filename.pre'.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2018

    Thank you very much JIF, it's working. It will help us a lot, we appreciate your help.

     

    Best Regards,

    Khadimul