StrainExtract seem not working

Asked by Wasin Meesuay

Hi, It's me again,

Recently, I am using the strainextract tool to convert the checkpointer snapshot file to strain.vtu file.
But after I execute the

> strainextract -i snapshot_t=600000_2.txt -o strain_60_2.vtu -grid 60 4 0 5.0

through terminal, it take some few minute to complete and produce an empty vtu file(only contain unstructured data and nothing ).
It would be grateful if anyone could shed a light to fix this problem for me please.

*My simulation is in 2D

Many thanks for advance,
Wasin

_________________________________________________________________________

Here is the last few sentence of the result of
> strainextract -i snapshot_t=600000_2.txt -o strain_60_2.vtu -grid 60 4 0 5.0

.
.
.
237057
237951
2
239854
264715
2
239985
243605
2
243543
272807
2
246919
248085
2
249509
252462
2
252462
253401
2
TMIG
0
inserted 0 particles
_______________________________________________________________________

Here is the strain_60_2.vtu file

<VTKFile type="UnstructuredGrid" version="0.1">
<UnstructuredGrid>
<Piece NumberOfPoints="0" NumberOfCells="0">
<Points>
<DataArray NumberOfComponents="3" type="Float64" format="ascii">
</DataArray>
</Points>
<PointData Scalars="radius">
<DataArray type="Float64" Name="radius" NumberOfComponents="1" format="ascii">
</DataArray>
</PointData>
<PointData Scalars="">
<DataArray type="Float64" Name="radius" NumberOfComponents="1" format="ascii">
</DataArray>
</PointData>
<Cells>
<DataArray type="Int32" NumberOfComponents="1" Name="connectivity" format="ascii">
</DataArray>
<DataArray type="UInt8" NumberOfComponents="1" Name="types" format="ascii">
</DataArray>
</Cells>
</Piece>
</UnstructuredGrid>
</VTKFile>

________________________________________________________________

Question information

Language:
English Edit question
Status:
Solved
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Solved by:
Dion Weatherley
Solved:
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Wasin Meesuay (kakkunno) said :
#2

Sorry to add another comment on this thread, but I would really appreciate some help

Revision history for this message
Wasin Meesuay (kakkunno) said :
#3

[Just adding another details and comment, in case that it might be helpful]
As the respond of the strainextract is the empty vtk file, I am not sure if this is the same case with this bug??
>>https://bugs.launchpad.net/esys-particle/+bug/1727586

So, I have tried what all I could do, reading and trying to understand through codes of main.cpp of either ExtractStrain and other tools (dump2vtk ,etc.). It seem that the main.cpp of strainextract tool just use the "infilename" variable, while others (like dump2vtk) just use "basefilename" instead.

Based on my understanding, my hypothesis is that the "infilename" only allows a single file for the input which mean that you are not allow to input "series" of checkpointer of a single timeframe. (In my case, I define 3 workers for simulation which make them produce 3 checkpointers per time frame.)

So, what I am thinking is that to make strainextract run properly, only a single worker must be define at the simulation (to produce only a single checkpointer file per timeframe, excluding the header). (This is why, I guessed, Tao said his strainextract still work well [https://answers.launchpad.net/esys-particle/+question/226129], because he might only have a single checkpointer.)

I am not sure if it is the right one, but to discuss and ask further, if this is the case, how can we edit the code of main.cpp to make strainextract also work for "series" of checkpointers (I am quite a beginner in programming, would appreciate very much if someone could help or guide me on this problem).

Revision history for this message
Dion Weatherley (d-weatherley) said :
#4

Hi Wasin,

Looking at the code for the DataExtractor.read(..) subroutine, it appears that StrainExtract needs you to supply the name of a checkpoint header file (ending in '_0.txt') as the input filename. Consequently, you should try a commandline like this:

 strainextract -i snapshot_t=600000_0.txt -o strain_60.vtu -grid 60 4 0 5.0

This should produce a single VTK file for timestep 600000, reading particle data from all of the worker's checkpoint files.

Assuming this works, you can issue the following command in the terminal to sequentially convert a whole series of checkpoint files:

for (( i = 0 ; i < 100 ; i++ )); do infilename='snapshot_'$i'0000_0.txt'; outfilename='strain_'$i'.vtu'; strainextract -i $infilename -o $outfilename -grid 60 4 0 5.0; done

This uses the shell 'for' loop to step through the sequence of checkpoint files.

Alternatively you can make a shell script to do this. Copy the following into a text file called "strain_convert.sh":

#start of strain_convert.sh
for (( i = 0 ; i < 100 ; i++ ))
do
   infilename='snapshot_'$i'0000_0.txt'
   outfilename='strain_'$i'.vtu'
   strainextract -i $infilename -o $outfilename -grid 60 4 0 5.0
done
#end of strain_convert.sh

Cheers,

Dion

Revision history for this message
Wasin Meesuay (kakkunno) said :
#5

Dear Dion,

Thank you for your kindly answer.
However, I have tried
>> strainextract -i snapshot_t=600000_0.txt -o strain_60.vtu -grid 60 4 0 5.0
and the results still be the empty vtk files.

Here is the respond from terminal:

version : 3
infilename : snapshot_t=600000_0.txt
nr. of filenames: 3
snapshot_t=600000_1.txt
snapshot_t=600000_2.txt
snapshot_t=600000_3.txt
inserted 0 particles

The command just work very quickly (less than a second) which I think it might not read those series of chekpointer files. (If i tried the in put as _1/_2/_3.txt file, it would take a while to process but still be the empty vtk result.)

Regards,
Wasin

Revision history for this message
Dion Weatherley (d-weatherley) said :
#6

Hi Wasin,

The output from the terminal suggests that strainextract is correctly reading the files when you supply the header file as the input filename.

Another possible reason for the failure to read particles is that your checkpoint files were generated in a simulation using NRotSphere as the particle type. It looks like strainextract expects the checkpoint files to contain rotational information for each particle (orientation quaternions and angular velocity). What particle type are you using in your simulations, NRotSphere or RotSphere?

Cheers,

Dion

Revision history for this message
Wasin Meesuay (kakkunno) said :
#7

Dear Prof. Dion,

I am using the RotSphere in my 2D simulation.

Regards.
Wasin

Revision history for this message
Best Dion Weatherley (d-weatherley) said :
#8

Hi Wasin,

Thanks for sending me some example checkpoint data. The reason StrainExtract is not reading any particle information is that you've specified 0 gridcells in the Z-direction. If you change your command to permit 1 gridcell in the Z-direction, the particle information gets read correctly e.g.
strainextract -i snapshot_t=600000_0.txt -o strain_60.vtu -grid 60 4 1 5.0

However, the data you sent me throws a new error once the particle information is read:

terminate called after throwing an instance of 'MatSingularError'
Aborted (core dumped)

This error originates from a call to Matrix3::solve() and implies that the displacement gradient tensor is singular (determinant==0). Without spending a lot more time on this, I suspect the problem is that StrainExtract is designed to work only for 3D simulations. You could try moving all of your particles so that they have a Z-coordinate that is non-zero, but I am doubtful this will solve the problem.

Cheers,

Dion

Revision history for this message
Wasin Meesuay (kakkunno) said :
#9

Thanks Dion Weatherley, that solved my question.