I wanted to share on the forums a simple way to do scanning simulations (kinda like COMSOL parameter sweeps). I have two reasons for doing that:

- People have been helping me, so I wanted to "balance the karma" sharing a solution for a problem which I hope will help someone else.
- There are other threads on this, and also documentation covers the topic. However, solution in threads is not clearly stated and documentation on this topic is not very detailed. For a newbie like me it is not the best situation.

So, I think that just using what I did as an example will make it clear for other newbies.

Let's assume we have an acoustic simulation we solve with the Helmholtz solver. We define the frequency vector containing all the frequencies we want to test in the Header of the sif (Model > Setup > Header > Free Text):

- Code: Select all
`$ f = 500 1000 2200`

We shift now to Simulation and we select Scanning. f is declared, with that syntax, as a MATC vector. It has clearly 3 components, so we set Timestep intervals to 3. Scanning produces a sort of time axis with integer values. So, time will look like this: time = 1, 2,3 ...

Then, when we edit the Helmholtz equation, we write this into Angular Frequency:

- Code: Select all
`Variable time; Real MATC "2 * pi * f(tx - 1)"`

Which means that at each timestep a value of frequency is taken from the vector f and used to calculate the simulation Angular Frequency. You can do the same for boundary conditions. For example, this updates the flux of a constant velocity radiator:

- Code: Select all
`Boundary Condition 2`

Target Boundaries(1) = 10

Name = "Radiator"

Wave Flux 1 = 0

Wave Flux 2 = Variable time;Real MATC "2 * pi * f(tx - 1) * 1.205 * v"

End

tx - 1 is used because MATC vectors are 0 indexed: f(0) = 500, f(1) = 1000, f(2) = 2200. tx has the current value of time, which can be 1 ,2 or 3. Hence, you see why we subtract 1.

If you have any solver saving data for you, just set Exec Solver to After Timestep (Equation > Your-Saver-Equation > Edit Solver Settings > General). Here how my Save-My-Stuff setup looks like:

- Code: Select all
`Equation 2`

Name = "Result Output EQ"

Active Solvers(1) = 3

End

Solver 3

Equation = Result Output

Save Geometry Ids = True

Output Format = Vtu

Procedure = "ResultOutputSolve" "ResultOutputSolver"

Save Linear Elements = True

Output File Name = case

Exec Solver = After Timestep

End

This way, the solution after each simulation at a given frequency is saved.

Hope this helps somebody.

Related threads:

viewtopic.php?f=3&t=4239

viewtopic.php?f=3&t=3392

Related documentation:

http://www.nic.funet.fi/pub/sci/physics ... Manual.pdf

http://www.nic.funet.fi/pub/sci/physics ... ection.2.3

P.S.

Ehm... look at this equation:

- Code: Select all
`Real MATC "2 * pi * f(tx - 1) * 1.205 * v"`

1.205 is the density of air, which is a parameter of the material I am using. Is there a way to get it from the material parameters? Couldn't find a way to do it...