[CIG-SHORT] Adding fields to HDF5/Xdmf files

Brad Aagaard baagaard at usgs.gov
Wed Dec 4 13:47:26 PST 2013


Xiao,

You can add new fields to the HDF5 file using the create_dataset 
function in the h5py module. To update the Xdmf file, use the 
pylith_genxdmf script supplied with PyLith:

For example, in a Python script I do something like:

field = h5.create_dataset('vertex_fields/pstress', data=pstress[:,:,:])
field.attrs['vector_field_type'] = 'tensor'
h5.close()

# Regenerate XDMF file.
import os
os.system('pylith_genxdmf --file=statevars.h5')


Regards,
Brad


On 12/04/2013 01:26 PM, Ma, Xiao wrote:
> Hi Brad,
> What I mean is that I want to use the principle values to generate the Xdmf file , to visualize in the paraview.
> Best,
> Xiao
> ________________________________________
> From: Brad Aagaard [baagaard at usgs.gov]
> Sent: Wednesday, December 04, 2013 14:57
> To: cig-short at geodynamics.org; Ma, Xiao
> Subject: Re: [CIG-SHORT] (no subject)
>
> Xiao,
>
> The stresses are computed at each of the quadrature points within a
> cell. This is true for all cell related data. By default the output
> includes the values at all of the quadrature points. You can use the
> CellFilterAvgMesh filter (see the tutorials in the manual and the
> examples) to have PyLith average the values over the quadrature points
> so you end up with the values (e.g., stress tensor) at just point per cell.
>
> Regards,
> Brad
>
>
> On 12/04/2013 12:45 PM, Ma, Xiao wrote:
>> Hi Brad,
>> I am able to use the h5py , put the stress into a variable called stress, however the shape of this stress variable is [500,10000,12], I know the first tow 500 is the total times steps, and 10000 is the total element numbers, however why there is 12 components for the stress  tensor?
>> Best,
>> Xiao
>>
>>
>>
>> _______________________________________________
>> CIG-SHORT mailing list
>> CIG-SHORT at geodynamics.org
>> http://geodynamics.org/cgi-bin/mailman/listinfo/cig-short
>>
>



More information about the CIG-SHORT mailing list