How to colour in the particles in my own specific way (sequence)

Asked by Xifan Li

Hi, I'm a new Yader.
Since I wanted to paint the deformation of the specimen in Figure 11 of this article, the idea I came up with was to use a different colour on the diagonal than the other areas so that I could see the result I wanted after the deformation. Of course by paraview.

Here is the paper: https://ascelibrary.org/doi/full/10.1061/(ASCE)GM.1943-5622.0001001

I want to ask your opinions about:

[1] Is the idea correct? If so, how can I use the different colours on the diagonal of my sample?
[2] If not, could you please give some suggestions?

I will be very grateful to wait for your answers and many thanks for your help!

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Bruno Chareyre
Solved:
Last query:
Last reply:
Revision history for this message
Robert Caulk (rcaulk) said :
#1

Hello,

What is "the diagonal?" What is "the other areas?" What is "the result I wanted?"

Please review our forum guidelines: https://www.yade-dem.org/wiki/Howtoask

Cheers,

Robert

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

Hi,

That's how bodies are colored based on their subdomain in the mpi module, it should apply for anything else with appropriate tuning:

import colorsys
colorScale = [Vector3(colorsys.hsv_to_rgb(value*1.0/numThreads, 1, 1)) for value in range(0, numThreads)]
for b in O.bodies:
   b.shape.color = colorScale[b.subdomain]

Bruno

Revision history for this message
Xifan Li (shelvan) said :
#3

Thanks Bruno Chareyre, that solved my question.