Skip to content

Commit f0136e6

Browse files
committed
TL: added documentation
1 parent 5569514 commit f0136e6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

pySDC/helpers/fieldsIO.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,31 @@ def nDoF(self):
454454
return np.prod(self.nX)
455455

456456
def toVTR(self, baseName, varNames, suffix="{:06d}_t={:1.2f}s"):
457+
"""
458+
Convert all 3D fields stored in binary format (FieldsIO) into a list
459+
of VTR files, that can be read later with Paraview or equivalent to
460+
make videos.
461+
462+
Parameters
463+
----------
464+
baseName : str
465+
Base name of the VTR file.
466+
varNames : list[str]
467+
Variable names of the fields.
468+
suffix : str, optional
469+
Formating string for the suffix of the VTR file, containing the
470+
index in first position, and the time in second position.
471+
The default is "{:06d}_t={:1.2f}s".
472+
473+
Example
474+
-------
475+
>>> # Suppose the FieldsIO object is already writen into outputs.pysdc
476+
>>> import os
477+
>>> from pySDC.utils.fieldsIO import Rectilinear
478+
>>> os.makedirs("vtrFiles") # to store all VTR files into a subfolder
479+
>>> Rectilinear.fromFile("outputs.pysdc").toVTR(
480+
>>> baseName="field", varNames=["u", "v", "w", "T", "p"])
481+
"""
457482
assert self.dim == 3, "can only be used with 3D fields"
458483
from pySDC.helpers.vtkIO import writeToVTR
459484

0 commit comments

Comments
 (0)