Using VTK extension commands in FLAC3D

Hello Itasca Forums.

I know from the results of FLAC3D that I can use paraview.

I made a simple model to simply experience how to use it.

I tried using exported *.vtu in FLAC3D, but it is difficult to apply in paraview.

Is there something wrong with the code I wrote?

Use of VTK commands is at the bottom.

model new 
model configure dynamic
program thread automatic

zone create brick point 0 (0, 0, 0) point 1 (10, 0, 0) point 2 (0, 10, 0) point 4 (10, 10, 0) &
                  point 3 (0, 0, 100) point 6 (10, 0, 100) point 5 (0, 10, 100) point 7 (10, 10, 100) size 1 1 10 group 'rock'

zone cmodel assign elastic

zone property density 2400 shear 2.3e9 bulk 4.72e9 range group 'rock'

model gravity (0,0,-9.81) 


zone face apply velocity-normal 0.0 range position-z 0.0
zone face apply velocity-normal 0.0 range position-x 0 ; 
zone face apply velocity-normal 0.0 range position-x 10.0
zone face apply velocity-normal 0.0 range position-Y 0.0 ; 
zone face apply velocity-normal 0.0 range position-Y 10.0 ; 

model dynamic active off
model mechanical active on
model large-strain off 

model solve

;--- initialize displacement
zone gridpoint initialize displacement (0, 0, 0)

;--- Analysis Setting
model fluid active off
model largestrain on
model mechanical active on
model dynamic active on

zone dynamic damping rayleigh 0.01 2.0

;--- Read input motion
table '100' import 'Large_Port_Island.ACC'

zone face apply acceleration-x 1.0 table '100' range position-z 0.0

;--- apply free field
zone dynamic free-field 

zone dynamic multi-step on

;zone results extra on
zone results displacements on
zone results forces on
zone results model-mechanical on

zone VTK range position-x 0 10 position-y 0 10
zone VTK displacement on
zone VTK forces on
zone VTK model-mechanical on
zone VTK filename 'practice.vtu'

model dynamic time-total 0.0
model solve dynamic time 30

Hello,
Unlike the results command, the vtk command is not able to export the results during the dynamic simulation. We’ll add it into the development list.
What you can do right now is to write a fishcall which triggers the vtk command during the dynamic event.
Huy

Hello, LSU & Huy~~!

If you write a fishcall or loop function using the vtk instruction during a dynamic event:

However, you have to press the “rescale to visible data range” button time by time in the paraview.

;------------------------------------------------------------------------------
model new
model configure dynamic
program thread automatic

zone create brick point 0 (0, 0, 0) point 1 (10, 0, 0) point 2 (0, 10, 0) point 4 (10, 10, 0) &
point 3 (0, 0, 100) point 6 (10, 0, 100) point 5 (0, 10, 100) point 7 (10, 10, 100) size 1 1 10 group ‘rock’

zone cmodel assign elastic

zone property density 2400 shear 2.3e9 bulk 4.72e9 range group ‘rock’

model gravity (0,0,-9.81)

zone face apply velocity-normal 0.0 range position-z 0.0
zone face apply velocity-normal 0.0 range position-x 0 ;
zone face apply velocity-normal 0.0 range position-x 10.0
zone face apply velocity-normal 0.0 range position-Y 0.0 ;
zone face apply velocity-normal 0.0 range position-Y 10.0 ;

model dynamic active off
model mechanical active on
model large-strain off

model solve

;— initialize displacement
zone gridpoint initialize displacement (0, 0, 0)

;— Analysis Setting
; model fluid active off
model largestrain on
model mechanical active on
model dynamic active on

zone dynamic damping rayleigh 0.01 2.0

;— Read input motion
table ‘100’ import ‘gilroy1.ACC’

zone face apply acceleration-x 1.0 table ‘100’ range position-z 0.0

;— apply free field
zone dynamic free-field

zone dynamic multi-step on

;zone results extra on
zone results displacements on
zone results forces on
zone results model-mechanical on

model dynamic time-total 0.0
; ; ; ; ; ; ; ; ; ; ; model solve dynamic time 30

fish define Func_Solve
Loop num (1,30)
sav_name = ‘Dyn_’ + string(num) + ‘.sav’
age_T = num*1
command
model solve dynamic time-total @age_T
zone VTK range position-x 0 10 position-y 0 10
zone VTK displacement on
zone VTK forces on
zone VTK model-mechanical on
zone VTK filename [‘Dyn_’+string(num) + ‘.vtu’]
model results export [‘Dyn_’+string(num)]
End_command
End_Loop
end
;
@Func_Solve

I was also very curious about how to solve this problem, but after seeing HUY’s answer, I got an idea. The solution was to use a LOOP FUNCTION to solve the problem. And when I opened the “DYN_*.VTU” file in PARAVIEW, I was able to select the bundled VTU file and check the results of each time. However, in PARAVIEW, I found out that the value is not updated by time, so it is displayed properly only when I press the “rescale to visible data range” button. Can’t I see it automatically in PARAVIEW? Or should I wait for it to be developed in FLAC3D?

I think that a JSON file which specifies the time value is what you need?

{
“file-series-version” : “1.0”,
“files” : [
{ “name” : “dyn_1.vtk”, “time” : 0.0 },
{ “name” : “dyn_2.vtk”, “time” : 1.0 },
{ “name” : “dyn_3.vtk”, “time” : 2.0 }

]
}

Thanks for your reply!.
But i couldn’t solve it with json file.
So, as a result of researching more about paraview, I found out that the program includes a method to automatically set the range of values according to time, as shown in the figure below.

image

As an additional remark for those interested:

For larger models it is often unfeasible to store this many *.vtu files and create the animation after the simulation, especially if you want to do an animation with many timesteps. In these cases it is possible to prepare a Paraview *.pvsm file of your desired view based on a general “results.vtu” file.
Then, you can construct a python cycle routine which regularly overwrites this particular file after X cycles or a given time and then you can use the threading module of python to spawn a separate rendering thread to render your current frame /with pvbatch) while your model is already cycling further (e.g. you don’t need to wait for the render to complete before your simulation continues)

thread = threading.Thread(target=subprocess.run,args=(['C:/Program Files/ParaView 5.11.1/bin/pvbatch.exe','pvbatch.py',f'{image_prefix}',f'{image_index}'],))

In that example you can supply further arguments (e.g. image_index) so that the correct filename for the frame is produced.

The drawback of this method is that you really need to know what you want to animate beforehand, but the advantage is a very high resolution animation without much memory overhead.