path probleme for JointedCohesiveFrictionalPM.cpp

Asked by Thomas Chauve

Hello

Just to report something a bit annoying for me.

I am doing multiple simulation using yade-batch. And I like to have all my file output for one run in the same folder.

I am using JointedCohesiveFrictionalPM.

In my script I do something like :

###
OUT=folder1/Sim1

O.engines=[
       ....
       ....
 InteractionLoop(
  .... [Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(smoothJoint=True,neverErase=1,recordCracks=True,Key=OUT,label='interactionLaw')]
 ),
        .......
       ......
        VTKRecorder(iterPeriod=int(1),initRun=True,fileName=OUT+'-',recorders=['spheres','bstresses','cracks'],Key=OUT,label='saveSolid',dead=0)
]
##########
There is more in the ...... but for clarity I just put what is necessary.

The thing is like this it does not record the crack using "Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM" because in this file Key must be a file without folder path.

You can see this in JointedCohesiveFrictionalPM.cpp line 30
############
string fileCracks = "cracks_"+Key+".txt";
############
It cannot work in my case beacause it give "cracks_folder1/Sim1.txt" and the folder "cracks_folder1" doesn t exist.

I wonder if I can change this line by :
############
string fileCracks = ""+Key+"_cracks.txt";
############
which can be better for me. But do I have to change this also somewhere else ?
For instance in VTKrecorder line 1058
############
string fileCracks = "cracks_"+Key+".txt";
############
because overwise it will not find the file.

I hope my understand me and my questions are :
Is there an other way to export all the result from one simulation in one folder ?
How do you propose to do it or do you need to modified the code ?

Thanks a lot
Thomas

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jérôme Duriez (jduriez) said :
#1

Hi,

In my case, I used to put all VTK files in different folders for the different jobs of the batch simulation (the different runs as you said), and to have all "cracks*.txt" in the same parent folder.

Then, it was OK for me to define different Key attributes as "Sim1", ... and to define the different fileName attributes as "folder1/", or (why not ?) "Sim1/".

Doing so, I identified the cracks txt file because of their file name, and the VTK files thanks to the folder they were in (all "spheres*.vtu" files for all the runs were just named "spheresItNumber.vtu" files)

I understand this is not exactly what you want. All this is just a matter of taste and I may agree you have a better taste than I used to have. I think having things flavored the way you describe requires changing the code.

Then, in case the above "solution" is not satisfying for you, I would suggest to open a discussion on yade-dev mailing list, hoping to catch therein all JCFpm users' attention.

Jérôme

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#2

>It cannot work in my case beacause it give "cracks_folder1/Sim1.txt" and the folder "cracks_folder1" doesn t exist.

It is a bit of a naive implementation to hardcode a write-path to a folder without checking/creating if it exists or not, but it exists in Yade in a few places unfortunately. You can make it work with a mkdir in your scripts.
But still, it is not a very nice feature for a program to pop up new folders here and there without a way to control it. The default should write in current path.

A good fix would be to add a "folder" attribute to the class, make it "" by default, then:
string fileCracks = folder+"_cracks_"+Key+".txt";

Or even simpler (and that's done in many classes), declare a variable "filename" (default "cracks_"), which can then be just a name or also path+name:
string fileCracks = filename+Key+".txt";
then later:
filename = "~/path/cracks_"

We could patch yade sources if you spend the time to fix this and send us the changes.

Bruno

Can you help with this problem?

Provide an answer of your own, or ask Thomas Chauve for more information if necessary.

To post a message you must log in.