How to write a loop in .sif file

Numerical methods and mathematical models of Elmer
Post Reply
sunyuan
Posts: 16
Joined: 20 Apr 2022, 11:28
Antispam: Yes

How to write a loop in .sif file

Post by sunyuan »

Dear experts

I want to calculate the static electric field for several wires and need to set many bodies. How can I write a loop to done this which in c++ looks like:
```
for(int I;i<10;i++){
int body = i;
//body i
// equation i
// material i
//End
}
```
what will this loop looks like in .sif?
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: How to write a loop in .sif file

Post by raback »

Hi

Unfortunately the command file of Elmer is not a programming language so there you are limited by what has been programmed. You can have loops over nonlinear iterations, steady state iterations, time, pseudo time etc. Different parts are of course looped internally when creating FE equations but this is not available at the sif level.

What property do you need to set in many bodies? Do you need to perform same analysis for many different bodies? Perform permutations of different bodies? Devil lies in the detail.

-Peter
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: How to write a loop in .sif file

Post by kevinarden »

I have seen this approached by writing a C, FORTRAN, or Python program to write out the body section of the sif to a text file and then copy and paste into the into the sif. Some even generate it with a spreadsheet.
Post Reply