Transient Simulation with seperate file at the end

General discussion about Elmer
Post Reply
kdarte
Posts: 5
Joined: 28 Nov 2022, 14:19
Antispam: Yes

Transient Simulation with seperate file at the end

Post by kdarte »

Dear all,

I want to run a transient simulation while saving intermediate time steps.
Coming from freeCAD I noticed that there, I guess in order to save the last state, the following is added to the .sif - File:

Code: Select all

Solver 2
  Coordinate Scaling Revert = Logical True
  Equation = String "ResultOutput"
  Exec Solver = String "After simulation"
  Output File Name = File "case"
  Procedure = File "ResultOutputSolve" "ResultOutputSolver"
  Vtu Format = Logical True
End
Hower, this causes Elmer to abandon the naming scheme "...0001.vtu; ...0002.vtu". Instead, it just writes every output into the same file as given by the "post File" entry in the simulation section of the .sif file. Hence, the file gets constantly overwritten and is not usuable. At the end of the simulation, a single file "case.vtu" is written, as desired.

Is this there a way to prevent this, i.e. saving the files like "timestep_0001.vtu; timestep_0002.vtu, ..." and a single file at the end "case.vtu"?

Thanks for the help!
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Transient Simulation with seperate file at the end

Post by kevinarden »

If you delete solver 2, and just use the
Post File = case.vtu

in the simulation section you will get what you want, the last file is the last state, you do not need an extra solver to get it.
kdarte
Posts: 5
Joined: 28 Nov 2022, 14:19
Antispam: Yes

Re: Transient Simulation with seperate file at the end

Post by kdarte »

thanks for the reply.


So from this I get that it is not possible to have "solver 2" and a working naming scheme at the same time?
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Transient Simulation with seperate file at the end

Post by kevinarden »

It is possible, but the Simulation section sets several default options and sets naming of the file.

Your solver 2 also specify a file naming convention and sets options.

So the two are trying to do the same thing in two different ways.

Best to use one or the other. Internally the code is not doing much different steps, but the sif fil is giving it two sets of instructions to do the same thing. The intent was one or the other.
Rich_B
Posts: 421
Joined: 24 Aug 2009, 20:18

Re: Transient Simulation with seperate file at the end

Post by Rich_B »

Hello,

As Kevin said, the suggested practice is to either add 'case.vtu' to the simulation section, or include the additional ResultOutput solver.

Assuming you want to add the second solver, you can try changing the Result Output Solver setting from
Exec Solver = String "After simulation"
to
Exec Solver = String "After timestep"
This should save a file after each transient time step, and should show up with the appended numbering in the file name.

I saw your post on the Freecad forum, nicely summarized! https://forum.freecadweb.org/viewtopic.php?f=18&t=73768

Regarding 'Output Interval', the default is 1, to output the vtu file after each step. If you set 'Output Interval' to a value such as 10 or 20, then the vtu file will be saved only every 10 or 20 steps. Also, if you set 'Output Interval' to 0 (zero), then the vtu file will only be output after the simulation is done, saving only the final result. As you mentioned in the Freecad post, 'Output Interval' definitely should not be set equal to 'Timestep Intervals'.

Rich.

Edit: The notes about 'Output Interval' only apply when one uses the first method, adding 'Post File = case.vtu' to the simulation section.
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Transient Simulation with seperate file at the end

Post by raback »

There is also slot "after saving" (and "before saving") where "output intervals" apply.
Rich_B
Posts: 421
Joined: 24 Aug 2009, 20:18

Re: Transient Simulation with seperate file at the end

Post by Rich_B »

Peter, thanks for the correction.

If we want to only use the second solver, by adding ResultOutputSolver and using 'Exec Solver = after saving', (or before saving) then adding 'Output Intervals = 10' in the simulation section, works nicely, outputting the vtu file every ten steps. Note that the files are still numbered sequentially, such as 001,002,003, etc.

Rich.
Rich_B
Posts: 421
Joined: 24 Aug 2009, 20:18

Re: Transient Simulation with seperate file at the end

Post by Rich_B »

Testing the options with this test case:
elmerfem\fem\tests\EMWavePiola2D
shows that the 'Output Intervals' can control both methods of saving vtu files.

Rich.
Post Reply