Automating output of VTK files for each state

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • tcdoe
    Junior Member
    • Nov 2019
    • 2

    Automating output of VTK files for each state

    Hello Steve and All,
    Hope all is going well!
    A quick question, I searched the forum but didn't see anything.
    I have written my own pre-processing code to generate multiple (100s) of *.feb files, which I then distribute to 100s of machines/cpus.
    I've run into a situation where I need to output a vtk file for each state, e.g. as if I had done it manually by 'saving as' in FebioStudio.

    I was quite sure in the past, that I could add a line to the Output section of the *.feb file, something like this:
    (note this might be completely wrong, it was a long time ago)

    <plotfile type="vtk" name="out_state" state="#"/>

    I am getting the error: tag "plotfile" (line 403794) : invalid value for attribute "type"
    Which doesn't look good .

    For reference, here is my current simple output section where I'm generating two data files.
    I just need to output a vtk file for each step too.
    I'm guessing this is do-able, but didn't see anything specific in the docs (perhaps missed it).

    Thanks much for any suggestions. If this is not do-able, any other advice is very welcome.
    Best!
    Todd D.

    Current output section:
    ​ <Output>
    <plotfile type="febio">
    <var type="displacement" />
    <var type="nodal stress" />
    <var type="stress" />
    </plotfile>
    <logfile>
    <element_data data="s1;s2;s3" file=".\outFEstress_Beam01_solid_bc00.dat" />
    <node_data data="ux;uy;uz" file=".\outFEdisp_Beam01_solid_bc00.dat" />
    </logfile>
    </Output>
  • maas
    Lead Code Developer
    • Nov 2007
    • 3573

    #2
    Hi Todd,

    FEBio has never been able to output directly to VTK files, however, coincidentally, this is something I am currently looking into. It probably won't make it in the upcoming 2.1 release, but perhaps in the next one. Feel free to check back in a few weeks to find out more.

    Best,

    Steve
    Department of Bioengineering, University of Utah
    Scientific Computing and Imaging institute, University of Utah

    Comment

    • tcdoe
      Junior Member
      • Nov 2019
      • 2

      #3
      Hi Steve,
      Thanks, I guess my memory is not very good. I might have mis-remembered for some old command line option or something. But that's great coincidence.
      I've made a feeble attempt to try using 'febio-python' or pyFEBio to parse the xplt file, but I just get errors like "MatDef module does not exist" right after I do an "import febio".
      I know that is not your code, just thought I'd mention.
      If there's a working python xplt parser that you know of, that would be very helpful.

      I guess I'm stuck doing it manually for now in febiostudio, for 120 files per run... Not fun. Maybe I can do something with AutoHotKey.
      Thanks again and I'll check back.
      Best!
      Todd

      Comment

      • biomath
        Junior Member
        • Aug 2022
        • 24

        #4
        Hi Todd,

        I have adapted some code from interFEBio and written a converter using Python and pyvista that works for the FSI xplt files I generate using febio3. You should be able to use if for your purposes. See example.py at https://gitlab.com/utsekaj/febpy and let me know if you need any further guidance on how to use it. (Of course maybe there are some complications that it can't handle, so no promises.)

        -Jacob

        Comment

        • dvijay
          Junior Member
          • Mar 2023
          • 6

          #5
          Originally posted by maas View Post
          Hi Todd,

          FEBio has never been able to output directly to VTK files, however, coincidentally, this is something I am currently looking into. It probably won't make it in the upcoming 2.1 release, but perhaps in the next one. Feel free to check back in a few weeks to find out more.

          Best,

          Steve
          Hey Steve,

          I too am in need of doing something similar. I would like to run (possibly hundreds) of .feb file and then have the data in a .vtk file for each of them.

          Did this feature you have mentioned which is in works made its way into a current development version? If so, how to use it?

          Regards,
          Vijay

          Comment

          • maas
            Lead Code Developer
            • Nov 2007
            • 3573

            #6
            Hi Vijay,

            There is (limited) support for VTK output in the latest FEBio release (febio 4.4). Just specify the following syntax for the plotfile tag:

            Code:
                    <plotfile type="vtk">
                        <var type="displacement"/>
                        <var type="stress"/>
                        <var type="relative volume"/>
                    </plotfile>​
            (So, add the type="vtk" attribute). It will output a family of vtk files, one for each time step. There are some limitations in that not all plot variables can be exported to vtk, but please give it a try and let me know if it works for you.

            Best,

            Steve
            Department of Bioengineering, University of Utah
            Scientific Computing and Imaging institute, University of Utah

            Comment

            • dvijay
              Junior Member
              • Mar 2023
              • 6

              #7
              Hey Steve,

              Thanks for this feature! I used this approach in a test case with my pipeline and it works well and as expected. I'll try it for a larger problem and post here if there are some issues.

              Regards,
              Vijay

              Comment

              • tschenkel
                Junior Member
                • Dec 2022
                • 4

                #8
                Thanks. That's a great feature, which we need dearly, because all our post in in ParaView.

                In a quick test, it seemed that the VTK file does not include different parts or surfaces. Is there a way to get the named selections outputted into the VTK file, so I can select them in Paraview?

                Alternatively: Is there a way to have two (or more) <plotfile ...> sections in the feb file? If I add a second one (to selectively output solid and fluid parts separately) it seems to ignore the first one (if I give both a file name), or the second (if I only give the first one a filename).

                Comment

                • maas
                  Lead Code Developer
                  • Nov 2007
                  • 3573

                  #9
                  Hi,

                  At the moment, FEBio outputs to the legacy VTK file format, which as far as I know, does not support named selections. I'm going to look into supporting the newer VTK formats, which I think do support it.

                  Currently you cannot output more than one plot file. That is something else I will look into, since it's been requested a few times.

                  I made github issues for these requests if you would like to follow progress (#74, #75).

                  Best,

                  Steve
                  Department of Bioengineering, University of Utah
                  Scientific Computing and Imaging institute, University of Utah

                  Comment

                  • ff10
                    Junior Member
                    • Apr 2023
                    • 17

                    #10
                    Originally posted by maas View Post
                    Hi Vijay,

                    There is (limited) support for VTK output in the latest FEBio release (febio 4.4). Just specify the following syntax for the plotfile tag:

                    Code:
                    <plotfile type="vtk">
                    <var type="displacement"/>
                    <var type="stress"/>
                    <var type="relative volume"/>
                    </plotfile>​
                    (So, add the type="vtk" attribute). It will output a family of vtk files, one for each time step. There are some limitations in that not all plot variables can be exported to vtk, but please give it a try and let me know if it works for you.

                    Best,

                    Steve

                    Is it possible to specify which material we want to plot using the <plotfile type="vtk">? I know this is possible to do with FebioStudio by selecting the elements of the material and saving them as vtk.

                    Thanks

                    Comment

                    • maas
                      Lead Code Developer
                      • Nov 2007
                      • 3573

                      #11
                      Hi,

                      That is currently not possible. FEBio will output all the data (using either the "febio" or "vtk" output formats) and there is no mechanism for restricting the output to an element set. However, you may be able to use the logfile output option.
                      It's not mentioned in the online documentation, but you can request to output for a particular element set, by adding the elem_set attribute.

                      Code:
                      <element_data data="sx;sy;sz;sxy;syz;sxz" name="element stresses" elem_set="my_element_set"/>
                      The "my_element_set" is an element set that is defined in the Mesh section. This won't produce a vtk file, however, you can format the data such that you could perhaps copy/paste it into a vtk file. Not an ideal solution, but hopefully it will help.

                      Best,

                      Steve
                      Department of Bioengineering, University of Utah
                      Scientific Computing and Imaging institute, University of Utah

                      Comment

                      • ff10
                        Junior Member
                        • Apr 2023
                        • 17

                        #12
                        Originally posted by maas View Post
                        Hi,

                        That is currently not possible. FEBio will output all the data (using either the "febio" or "vtk" output formats) and there is no mechanism for restricting the output to an element set. However, you may be able to use the logfile output option.
                        It's not mentioned in the online documentation, but you can request to output for a particular element set, by adding the elem_set attribute.

                        Code:
                        <element_data data="sx;sy;sz;sxy;syz;sxz" name="element stresses" elem_set="my_element_set"/>
                        The "my_element_set" is an element set that is defined in the Mesh section. This won't produce a vtk file, however, you can format the data such that you could perhaps copy/paste it into a vtk file. Not an ideal solution, but hopefully it will help.

                        Best,

                        Steve
                        Hi Steve,

                        Thanks for your help. I managed to do what I need by using the code at: https://gitlab.com/utsekaj/febpy.

                        Comment

                        Working...
                        X