Homepage Books Releases Docs Discourse

Combination of vtu output files of subsequent simulations

Dear all,

I have a reactive transport model were I run a simulation with a time steps size of 1e+3s for 1e+3 time steps to avoid oscillation at sharp gradients. My start time is 0, my end time will be 1e+6 s.

I woudl like to continue this simulation with another 500 timesteps with a size of 1e+4s.

So I run a 2nd simulation at a starting time of 1e+6s with 500 time steps of 1e+4s step size. I use the $RELOAD option in the *.pcs file to get may last output state as inital state for the new simulation. Fine.

The problem is the results output.

In the first run I have *.vtu files from 0 to 1000 for my 1000 time steps. I move them into a seperate folder before the 2nd simulation. I start the 2nd simulation but the *.vtu output files are started at zero again. I have files with ending 0-500 in total.

How do I combine the two sets of *.vtu output files? Does anybody has a script already developed?

Best regards,

Johannes

Dear Johannes,

  I do not have a script standing there. But I can provide you some thoughts and a reference Python script.

In your case, there is severa things need to be done.

  1) Change the names of VTU files produced in the second simulation

  That's relatively easy. You can do it with a script. Simply loop over all files in a folder and rename. A google search gives me this:

Looks good enough. So I consider step 1) can be done.

  1. Change the time informaiton in each of the VTU files above.

    Have a look at the figure below. Although I am not sure whether line #2 will actually be read by Paraview, it would be better to change it. Or is it already correct in your output? I am not sure.

This only requires to change a particular line in a file filled with the right content. Search on the same site gives:

3) Reorganize the the PVD file. The PVD file should be 100% correct to link all the VTUs. Especially the time information must fit. If you could finish step #2, then it is the same script spitting out 1000 lines with correct time info and file names. You should be able to figure it out. Well, above is just my thoughts. I attach a python script with this email together with its corresponding input file. I wrote it to dig the temperature values from a TEC plot file. I have cut short the TEC file so that it only contains a few time steps. Essentially some part of it can be used in your script I hope. Anyway, enjoy OGS and happy scripting. Best, Haibing

plot_T_out_6h.py (2.21 KB)

BHE1_ply_ply_BHE0_t1_HEAT_TRANSPORT_BHE_short_version.tec (376 KB)

···

https://stackoverflow.com/questions/2759067/rename-multiple-files-in-a-directory-in-pythonhttps://stackoverflow.com/questions/16622754/how-do-you-replace-a-line-of-text-in-a-text-file-python

  Am 8/24/2017 um 2:19 PM schrieb 'Johannes Boog' via ogs-users:

Dear all,

      I have a reactive transport model were I run a simulation with a time steps size of 1e+3s for 1e+3 time steps to avoid oscillation at sharp gradients. My start time is 0, my end time will be 1e+6 s.
      I woudl like to continue this simulation with another 500 timesteps with a size of 1e+4s.
      So I run a 2nd simulation at a starting time of 1e+6s  with 500 time steps of 1e+4s step size. I use the $RELOAD option in the *.pcs file to get may last output state as inital state for the new simulation. Fine.
      The problem is the results output.
      In the first run I have *.vtu files from 0 to 1000 for my 1000 time steps. I move them into a seperate folder before the 2nd simulation. I start the 2nd simulation but the *.vtu output files are started at zero again. I have files with ending 0-500 in total.
      How do I combine the two sets of *.vtu output files? Does anybody has a script already developed?

Best regards,

Johannes

  You received this message because you are subscribed to the Google Groups "ogs-users" group.

  To unsubscribe from this group and stop receiving emails from it, send an email to ogs-users+unsubscribe@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

-- ------------------------------------------------------ Junior-Prof. Dr. Haibing Shao Department Environmental Informatics Helmholtz Centre for Environmental Reserach (UFZ) Faculty of Geoscience, Geotechnics and Mining Freiberg University of Mining and Technology (TU BAF) Permoserstr. 15, D-04103 Leipzig, Germany Tel: +49 341 235 1884 Mobile: +49 170 681 5930 Email: Weboage: ------------------------------------------------------

haibing.shao@ufz.dewww.ufz.de/geothermal-systems-analysis

Dear Haibing,

thanks for your infos and scripts. In fact I found another workaround. I just rename the *.vtk files as you already suggested (without changing the time information in the files itself), combine them with the ones of the previous run and then load all *.vtu files in Paraview instead of the *.pvd file.

Best,

Johannes

Dear Johannes,

  I do not have a script standing there. But I can provide you some thoughts and a reference Python script.

In your case, there is severa things need to be done.

  1) Change the names of VTU files produced in the second simulation

  That's relatively easy. You can do it with a script. Simply loop over all files in a folder and rename. A google search gives me this:

https://stackoverflow.com/questions/2759067/rename-multiple-files-in-a-directory-in-python

Looks good enough. So I consider step 1) can be done.

  1. Change the time informaiton in each of the VTU files above.

    Have a look at the figure below. Although I am not sure whether line #2 will actually be read by Paraview, it would be better to change it. Or is it already correct in your output? I am not sure.

This only requires to change a particular line in a file filled with the right content. Search on the same site gives:

https://stackoverflow.com/questions/16622754/how-do-you-replace-a-line-of-text-in-a-text-file-python

3) Reorganize the the PVD file. The PVD file should be 100% correct to link all the VTUs. Especially the time information must fit.

If you could finish step #2, then it is the same script spitting out 1000 lines with correct time info and file names. You should be able to figure it out.

Well, above is just my thoughts. I attach a python script with this email together with its corresponding input file. I wrote it to dig the temperature values from a TEC plot file. I have cut short the TEC file so that it only contains a few time steps. Essentially some part of it can be used in your script I hope.

Anyway, enjoy OGS and happy scripting.

Best,

Haibing
···

Haibing Shao haibing.shao@ufz.de schrieb am 15:24 Donnerstag, 24.August 2017:

  Am 8/24/2017 um 2:19 PM schrieb 'Johannes Boog' via ogs-users:

Dear all,

      I have a reactive transport model were I run a simulation with a time steps size of 1e+3s for 1e+3 time steps to avoid oscillation at sharp gradients. My start time is 0, my end time will be 1e+6 s.
      I woudl like to continue this simulation with another 500 timesteps with a size of 1e+4s.
      So I run a 2nd simulation at a starting time of 1e+6s  with 500 time steps of 1e+4s step size. I use the $RELOAD option in the *.pcs file to get may last output state as inital state for the new simulation. Fine.
      The problem is the results output.
      In the first run I have *.vtu files from 0 to 1000 for my 1000 time steps. I move them into a seperate folder before the 2nd simulation. I start the 2nd simulation but the *.vtu output files are started at zero again. I have files with ending 0-500 in total.
      How do I combine the two sets of *.vtu output files? Does anybody has a script already developed?

Best regards,

Johannes

  You received this message because you are subscribed to the Google Groups "ogs-users" group.

  To unsubscribe from this group and stop receiving emails from it, send an email to ogs-users+unsubscribe@googlegroups.com.

  For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

-- ------------------------------------------------------ Junior-Prof. Dr. Haibing Shao Department Environmental Informatics Helmholtz Centre for Environmental Reserach (UFZ) Faculty of Geoscience, Geotechnics and Mining Freiberg University of Mining and Technology (TU BAF) Permoserstr. 15, D-04103 Leipzig, Germany Tel: +49 341 235 1884 Mobile: +49 170 681 5930 Email: haibing.shao@ufz.de
Weboage: [www.ufz.de/geothermal-systems-analysis](http://www.ufz.de/geothermal-systems-analysis)
------------------------------------------------------

You received this message because you are subscribed to the Google Groups “ogs-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to ogs-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.