Difference between revisions of "VTKArchive Custom Task"
(64 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
A [[MPM Input Files#Custom Tasks|custom task]] to archive grid results to a series of "VTK Legacy" files. | |||
== Introduction == | == Introduction == | ||
A VTKArchive custom task allows exporting of data extrapolated to the grid during the calculation. The [[MPM Archiving Options|standard archiving]] is based on particle data. This task's alternative to get grid data is most useful for visualization of results from 3D calculations. The files can be read by third-party visualization applications. | A <tt>VTKArchive</tt> custom task allows exporting of data extrapolated to the grid during the calculation. The [[MPM Archiving Options|standard archiving]] is based on particle data. This task's alternative to get grid data is most useful for visualization of results from 3D calculations. The files can be read by third-party visualization applications. Two good options are [[ParaView]] or [[VisIt]]. The exported files have been written to work well with [[ParaView]] or [[VisIt]]. If you export multiple archives in a single run, [[ParaView]] or [[VisIt]] can load them as a block and animate the results. There are books and [http://www.paraview.org web sites] on the use of ParaView and some quick-start examples when using [[NairnMPM]] output in [[ParaView]] or [[VisIt]]. | ||
== Task Scheduling == | == Task Scheduling == | ||
In scripted files, a VTKArchive custom | In scripted files, a <tt>VTKArchive</tt> custom task is scheduled using | ||
CustomTask VTKArchive | |||
Parameter archiveTime,(timeInterval) | Parameter archiveTime,(timeInterval) | ||
Parameter firstArchiveTime,(firstTime) | Parameter firstArchiveTime,(firstTime) | ||
Parameter (quantity) | Parameter selectMaterial,(matnum) | ||
Parameter (quantity),<(extra)> | |||
. . . | . . . | ||
Line 18: | Line 21: | ||
<Parameter name='archiveTime'>(timeInterval)</Parameter> | <Parameter name='archiveTime'>(timeInterval)</Parameter> | ||
<Parameter name='firstArchiveTime'>(firstTime)</Parameter> | <Parameter name='firstArchiveTime'>(firstTime)</Parameter> | ||
<Parameter name='(quantity)'/> | <Parameter name='selectMaterial'>(matnum)</Parameter> | ||
<Parameter name='(quantity)'>(extra)</Parameter> | |||
. . . | . . . | ||
</Schedule> | </Schedule> | ||
Line 24: | Line 28: | ||
where the first two parameters, both of which are optional, are | where the first two parameters, both of which are optional, are | ||
* <tt>(timeInterval)</tt> - Enter the time interval (in | * <tt>(timeInterval)</tt> - Enter the time interval (in [[ConsistentUnits Command#Legacy and Consistent Units|alt time units]]) between saving of VTK archives. If this parameter is omitted, the VTK archive files are written on the same steps as the [[MPM Archiving Options|particle archives]]. The one difference is that the first particle archive file is written ''before'' the calculations start while the first VTK archive file is written after the first time step is completed. | ||
* <tt>(firstTime)</tt> - Enter the time to save the first results (in | * <tt>(firstTime)</tt> - Enter the time to save the first results (in [[ConsistentUnits Command#Legacy and Consistent Units|alt time units]]). After this time is reached, subsequent archives will be spaced by the entered <tt>(timeInterval)</tt> This parameter is ignored unless the <tt>(timeInterval)</tt> parameter is set as well. | ||
* <tt>(matnum)</tt> selects a material (by material number only) to archive grid results only from that material. You can use multiple <tt>VTKArchive</tt> custom tasks to output different materials. The default is to omit this parameter and export from all materials. | |||
When first setting up calculations, it is useful to create the grid and particles and check them before running a long calculation. When checking the mesh using particle archives, the process is to [[Options for Running Calculations|run the calculations]] with the <tt>-a</tt> flag, which aborts the calculations after setup but before the start. If you want to check the setup using VTK archives, however, this abort will happen before the first VTK archive is written. The solution is run with a very small [[MPM Methods and Simulation Timing#Input Commands|maximum time]] (less than the time step). The calculations will then stop after the first time step and the first VTK archive file will be available for visualization. | |||
=== Archivable Quantities === | === Archivable Quantities === | ||
All remaining parameters define a calculation value (by name in <tt>(quantity)</tt>) to be archived. You can specify any number of quantities to include as | All remaining parameters define a calculation value (by name in <tt>(quantity)</tt>) to be archived. A few quantities need an <tt>(extra)</tt> value to be complete. You can specify any number of quantities to include as many results as you want in the output VTK files. Each one can be entered with just the quantity name or can be enter in the format "quantity:Name in VTK File" where "quantity" before the colon is an item listed below and "Name in the VTK File" after the colon is the name written to the VTK file. For example, if history number 1 is tracking equivalent plastic strains, one could use script command: | ||
Parameter "history:Equivalent Plastic Strain",1 | |||
or XML command | |||
<Parameter name="history:Equivalent Plastic Strain">1</Parameter> | |||
Third party software will display using the provided name (such as "Equivalent Plastic Strain") instead of the [[NairnMPM]] quantity name (such as "history 1"). This option is most useful when archiving history data. Note the such names in VTK files cannot have spaces. If you use spaces in a name, the spaces will be replaced by underscores. | |||
The currently available <tt>(quantity)</tt> options for VTK archiving are: | |||
* <tt>mass</tt> - Archive nodal mass (in | * <tt>mass</tt> - Archive nodal mass (in [[ConsistentUnits Command#Legacy and Consistent Units|mass units]]). This option is needed for creating contours that visualize the boundaries of the object. The surface can then be colored in any other archived result. Note that mass is always archived; you do not need to specify it. | ||
* <tt>material</tt> - The material number to visualize different materials in a composite (it is extrapolated to the grid, which will blur material edges compared to particle plots). | * <tt>material</tt> - The material number to visualize different materials in a composite (it is extrapolated to the grid, which will blur material edges compared to particle plots). | ||
* <tt>displacement</tt> - Archive displacement vector (in | * <tt>displacement</tt> - Archive displacement vector (in [[ConsistentUnits Command#Legacy and Consistent Units|length units]]). | ||
* <tt>velocity</tt> - Archive velocity vector (in | * <tt>velocity</tt> - Archive velocity vector (in [[ConsistentUnits Command#Legacy and Consistent Units|velocity units]]). For problems with cracks, it is the center of mass velocity. | ||
* <tt>stress</tt> - Archive stress tensor (in | * <tt>stress</tt> - Archive stress tensor (in [[ConsistentUnits Command#Legacy and Consistent Units|pressure units]]). | ||
* <tt>pressure</tt> - Archive pressure (in | * <tt>pressure</tt> - Archive pressure (in [[ConsistentUnits Command#Legacy and Consistent Units|pressure units]]). | ||
* <tt>equivstress</tt> - Archive equivalent stress (also know as von Mises stress) (in | * <tt>equivstress</tt> - Archive equivalent stress (also know as von Mises stress) (in [[ConsistentUnits Command#Legacy and Consistent Units|pressure units]]). | ||
* <tt>strain</tt> - Archive strain tensor, | * <tt>defgrad</tt> - the deformation gradient (absolute) | ||
* <tt>totalstrain</tt> - Archive total [[#Biot Strain|Biot]] strain tensor (absolute). | |||
* <tt>elasticstrain</tt> - Archive elastic [[#Biot Strain|Biot]] strain tensor (absolute, can be "strain" as well). | |||
* <tt>plasticstrain</tt> - Archive plastic [[#Biot Strain|Biot]] strain tensor, which is total strain minus elastic strain for plasticity materials (absolute) | |||
* <tt>deltav</tt> - Archive relative volume change (V-V0)/V0 (absolute). | * <tt>deltav</tt> - Archive relative volume change (V-V0)/V0 (absolute). | ||
* <tt>equivstrain</tt> - Archive equivalent strain from above strain (absolute). | * <tt>equivstrain</tt> - Archive equivalent strain from above strain (absolute). | ||
* <tt>temperature</tt> - Archive temperature (in K). Mostly useful when [[Thermal Calculations|conduction calculation]]s are activated. | * <tt>temperature</tt> - Archive temperature (in K). Mostly useful when [[Thermal Calculations|conduction calculation]]s are activated. | ||
* <tt>concentration</tt> - | * <tt>concentration</tt> or <tt>porepressure</tt> - particle concentration (in wt %, when doing [[Diffusion Calculations|diffusion calculations]]) or particle pore pressure (in [[ConsistentUnits Command#Legacy and Consistent Units|pressure units]], when doing [[Poroelasticity Calculations|poroelasticity calculations]]). | ||
* <tt>strainenergy</tt> - Archive strain energy in | * <tt>strainenergy</tt> - Archive strain energy in [[ConsistentUnits Command#Legacy and Consistent Units|energy units]]. | ||
* <tt>heatenergy</tt> - Archive heat energy in | * <tt>heatenergy</tt> - Archive heat energy in [[ConsistentUnits Command#Legacy and Consistent Units|energy units]]. | ||
* <tt>plasticenergy</tt> - Archive plastic energy (in | * <tt>plasticenergy</tt> - Archive plastic energy (in [[ConsistentUnits Command#Legacy and Consistent Units|energy units]]). | ||
* <tt>contactforce</tt> - | * <tt>history,(num)</tt> - Archive history number <tt>(num)</tt> enter as the Parameter's <tt>(extra)</tt> value. | ||
* <tt>contactforce</tt> - Archive nodal force on the grid for [[Multimaterial MPM|multimaterial mode]] simulations when they include [[Rigid Material|rigid materials]] that have <tt>direction=8</tt>. It is vector of force for the rigid material on the object (in [[ConsistentUnits Command#Legacy and Consistent Units|force units]]). | |||
* <tt>volumegradient,(mat)</tt> - The volume gradient for material <tt>(mat)</tt> on the nodes entered as the Parameter's <tt>(extra)</tt> value. This gradient is the one used in contact calculations. The gradient vectors can be [[#Visualizing Vector Quantities|visualized in software]]. The <tt>(mat)</tt> is required and specified by [[Material Command Block|material ID]] in scripted input files, but must be by [[Material Command Block#Referencing Materials in XML Files|material number]] in <tt>XML</tt> input files. When cracks are present, the archives gradient is for material field on same side of the crack as the node. | |||
* <tt>numpoints</tt> - The number of material points that extrapolate to a node. | |||
==== Biot Strain ==== | |||
= | When archiving of strain tensors, they are calculated as a Biot strain in the current configuration. The Biot strain is defined is '''V-I''' where '''V''' is the left-stretch tensor. This strain is also the Seth-Hill strain with m=1/2 in current configuration. For small strain problems it is equivalent to the small strain tensor. | ||
==== Visualizing Vector Quantities ==== | |||
If you save vector results, such as volume gradient for some materials, you can visualize them as vectors in [[ParaView]] by using arrow glyphs. The basic process is: | |||
# Open the stack of <tt>vtk</tt> files saved by this custom tasks in ParaView and click apply. | |||
# To see the grid, "Solid Color" and "Wireframe" (being sure to click apply when needed). | |||
# Click "Glyph" icon to add Glyph option to the pipe line, set its properties (clicking apply after each property change). The key properties are: | |||
#* Vectors: select the volume gradient to plot (by material number) | |||
#* Scaling: set scale mode to "vector" and adjust "scale factor" for good size arrows (1 appears good). | |||
#* Coloring: decide how to color the arrows | |||
#* Masking: select "All Points" (otherwise only selected arrows will get plotted) | |||
For volume gradients to work well with contact calculations, they should be vectors normal to the surface of any materials and pointing out of the material. |
Latest revision as of 14:49, 14 November 2023
A custom task to archive grid results to a series of "VTK Legacy" files.
Introduction
A VTKArchive custom task allows exporting of data extrapolated to the grid during the calculation. The standard archiving is based on particle data. This task's alternative to get grid data is most useful for visualization of results from 3D calculations. The files can be read by third-party visualization applications. Two good options are ParaView or VisIt. The exported files have been written to work well with ParaView or VisIt. If you export multiple archives in a single run, ParaView or VisIt can load them as a block and animate the results. There are books and web sites on the use of ParaView and some quick-start examples when using NairnMPM output in ParaView or VisIt.
Task Scheduling
In scripted files, a VTKArchive custom task is scheduled using
CustomTask VTKArchive Parameter archiveTime,(timeInterval) Parameter firstArchiveTime,(firstTime) Parameter selectMaterial,(matnum) Parameter (quantity),<(extra)> . . .
In XML files, this tasks is scheduled using a Schedule element, which must be within the single <CustomTasks> block:
<Schedule name='VTKArchive'> <Parameter name='archiveTime'>(timeInterval)</Parameter> <Parameter name='firstArchiveTime'>(firstTime)</Parameter> <Parameter name='selectMaterial'>(matnum)</Parameter> <Parameter name='(quantity)'>(extra)</Parameter> . . . </Schedule>
where the first two parameters, both of which are optional, are
- (timeInterval) - Enter the time interval (in alt time units) between saving of VTK archives. If this parameter is omitted, the VTK archive files are written on the same steps as the particle archives. The one difference is that the first particle archive file is written before the calculations start while the first VTK archive file is written after the first time step is completed.
- (firstTime) - Enter the time to save the first results (in alt time units). After this time is reached, subsequent archives will be spaced by the entered (timeInterval) This parameter is ignored unless the (timeInterval) parameter is set as well.
- (matnum) selects a material (by material number only) to archive grid results only from that material. You can use multiple VTKArchive custom tasks to output different materials. The default is to omit this parameter and export from all materials.
When first setting up calculations, it is useful to create the grid and particles and check them before running a long calculation. When checking the mesh using particle archives, the process is to run the calculations with the -a flag, which aborts the calculations after setup but before the start. If you want to check the setup using VTK archives, however, this abort will happen before the first VTK archive is written. The solution is run with a very small maximum time (less than the time step). The calculations will then stop after the first time step and the first VTK archive file will be available for visualization.
Archivable Quantities
All remaining parameters define a calculation value (by name in (quantity)) to be archived. A few quantities need an (extra) value to be complete. You can specify any number of quantities to include as many results as you want in the output VTK files. Each one can be entered with just the quantity name or can be enter in the format "quantity:Name in VTK File" where "quantity" before the colon is an item listed below and "Name in the VTK File" after the colon is the name written to the VTK file. For example, if history number 1 is tracking equivalent plastic strains, one could use script command:
Parameter "history:Equivalent Plastic Strain",1
or XML command
<Parameter name="history:Equivalent Plastic Strain">1</Parameter>
Third party software will display using the provided name (such as "Equivalent Plastic Strain") instead of the NairnMPM quantity name (such as "history 1"). This option is most useful when archiving history data. Note the such names in VTK files cannot have spaces. If you use spaces in a name, the spaces will be replaced by underscores.
The currently available (quantity) options for VTK archiving are:
- mass - Archive nodal mass (in mass units). This option is needed for creating contours that visualize the boundaries of the object. The surface can then be colored in any other archived result. Note that mass is always archived; you do not need to specify it.
- material - The material number to visualize different materials in a composite (it is extrapolated to the grid, which will blur material edges compared to particle plots).
- displacement - Archive displacement vector (in length units).
- velocity - Archive velocity vector (in velocity units). For problems with cracks, it is the center of mass velocity.
- stress - Archive stress tensor (in pressure units).
- pressure - Archive pressure (in pressure units).
- equivstress - Archive equivalent stress (also know as von Mises stress) (in pressure units).
- defgrad - the deformation gradient (absolute)
- totalstrain - Archive total Biot strain tensor (absolute).
- elasticstrain - Archive elastic Biot strain tensor (absolute, can be "strain" as well).
- plasticstrain - Archive plastic Biot strain tensor, which is total strain minus elastic strain for plasticity materials (absolute)
- deltav - Archive relative volume change (V-V0)/V0 (absolute).
- equivstrain - Archive equivalent strain from above strain (absolute).
- temperature - Archive temperature (in K). Mostly useful when conduction calculations are activated.
- concentration or porepressure - particle concentration (in wt %, when doing diffusion calculations) or particle pore pressure (in pressure units, when doing poroelasticity calculations).
- strainenergy - Archive strain energy in energy units.
- heatenergy - Archive heat energy in energy units.
- plasticenergy - Archive plastic energy (in energy units).
- history,(num) - Archive history number (num) enter as the Parameter's (extra) value.
- contactforce - Archive nodal force on the grid for multimaterial mode simulations when they include rigid materials that have direction=8. It is vector of force for the rigid material on the object (in force units).
- volumegradient,(mat) - The volume gradient for material (mat) on the nodes entered as the Parameter's (extra) value. This gradient is the one used in contact calculations. The gradient vectors can be visualized in software. The (mat) is required and specified by material ID in scripted input files, but must be by material number in XML input files. When cracks are present, the archives gradient is for material field on same side of the crack as the node.
- numpoints - The number of material points that extrapolate to a node.
Biot Strain
When archiving of strain tensors, they are calculated as a Biot strain in the current configuration. The Biot strain is defined is V-I where V is the left-stretch tensor. This strain is also the Seth-Hill strain with m=1/2 in current configuration. For small strain problems it is equivalent to the small strain tensor.
Visualizing Vector Quantities
If you save vector results, such as volume gradient for some materials, you can visualize them as vectors in ParaView by using arrow glyphs. The basic process is:
- Open the stack of vtk files saved by this custom tasks in ParaView and click apply.
- To see the grid, "Solid Color" and "Wireframe" (being sure to click apply when needed).
- Click "Glyph" icon to add Glyph option to the pipe line, set its properties (clicking apply after each property change). The key properties are:
- Vectors: select the volume gradient to plot (by material number)
- Scaling: set scale mode to "vector" and adjust "scale factor" for good size arrows (1 appears good).
- Coloring: decide how to color the arrows
- Masking: select "All Points" (otherwise only selected arrows will get plotted)
For volume gradients to work well with contact calculations, they should be vectors normal to the surface of any materials and pointing out of the material.