Large number of boundary conditions

Numerical methods and mathematical models of Elmer
Post Reply
sabrina
Posts: 27
Joined: 16 Sep 2019, 14:26
Antispam: Yes

Large number of boundary conditions

Post by sabrina »

Dear all,

I am trying to do a simulation of a field cage, which is basically a certain number of ring electrodes one next to the other to ensure the electric field between the cathode and the anode is uniform.

My test cases are just a cathode and an anode with a low number of electrodes, which work fine. However, the real simulation should contain 200 electrodes, each with a slightly different potential. Since I don't think writing 200 boundary conditions is efficient, I would like to use a for loop in the sif file. Although I have looked the MATC user manual, I did not fully understand the syntax and I was not able to make anything work.

What I had in mind was something like this:

for (i =1:200)
Boundary Condition i
Target Boundaries = i
Potential = i*5
End
end

The complete sif file is attached.

But, not surprisingly, this does not work. Does anyone know how I could get this to work?

Thank you in advance!

Cheers,

Sabrina
Attachments
field_cage_0.sif
(1.81 KiB) Downloaded 221 times
raback
Site Admin
Posts: 4828
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Large number of boundary conditions

Post by raback »

Hi

Scripting may be included in keyword expression but not in the structure of the sif itself.

Now is there no other geometric way to select the different BCs than the index? Position? If there is one could use "Default Target" for the BCs and write a small piece of code that selects the potential.

Or perhaps just setting a very large permittivity that will effectively yield a constant potential. Or do you have a system where this constant potential may be set i.e. it is not floating?

-Peter
sabrina
Posts: 27
Joined: 16 Sep 2019, 14:26
Antispam: Yes

Re: Large number of boundary conditions

Post by sabrina »

Dear Peter,

Thank you so much for your reply.

I am rather new to Elmer and maybe this is why I don't fully understand your suggestion:
Now is there no other geometric way to select the different BCs than the index? Position? If there is one could use "Default Target" for the BCs and write a small piece of code that selects the potential.
How is the 'Default target' used? I could not find it in the manuals. FWI: I am building the system in gmsh and then importing it into Elmer. I am right if I say that the only way of selecting the BCs is, in this case, with the index? I would not know how to do it differently.
Or perhaps just setting a very large permittivity that will effectively yield a constant potential. Or do you have a system where this constant potential may be set i.e. it is not floating?
The aim of the simulation is to see how the uniformity of the field changes with different electrodes, cathode and anode geometries, so I guess this is alternative is not possible (if I understood you correctly).

Thank you for your help,

Sabrina
kevinarden
Posts: 2310
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Large number of boundary conditions

Post by kevinarden »

In your sif file there is not two ends, only the end of the boundary condition, there need to be something that ends the for loop.

for (i=1:2)
! Elecrode 1
Boundary Condition i+2
Target Boundaries = i+2
Potential = 5*i
End
! Details of the calculation procedure: all that must
! be calculated is the potential.
sabrina
Posts: 27
Joined: 16 Sep 2019, 14:26
Antispam: Yes

Re: Large number of boundary conditions

Post by sabrina »

Thank you for your comment but, unfortunately, that did not work either. I get the error message: ERROR:: Model Input: Unknown input section name: for.

Cheers,

Sabrina
kevinarden
Posts: 2310
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Large number of boundary conditions

Post by kevinarden »

you could write a quick fortran or C program to generate the text file for the boundary. You could even generate it with a spread sheet. Cut and paste the text file into your sif file. Clunky, but should work.
sabrina
Posts: 27
Joined: 16 Sep 2019, 14:26
Antispam: Yes

Re: Large number of boundary conditions

Post by sabrina »

I guess that's what I'll do.

Thank you!
Post Reply