how to add a new field in controller GUI in order to pass a parameter to a specific law

Asked by mansour talhaoui on 2013-11-27

Hi There,

I just started using Yade.

Presently I use those commands to launch the controller view (GUI)

1- I run the command yade then Ipress F12

I would like to add a new field (Real value) in Generate Panel, especially when choosing "CohesiveTriaxialTest" in order to pass this new value to cohesiveFrictionalRelationships of type Ip2_CohFrictMat_CohFrictMat_CohFrictPhys in class CohesiveTriaxialTest when creating actors.

Could please help me to resolve this problem?

Kind regards,
Mansour

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jérôme Duriez
Solved:
2013-11-28
Last query:
2013-11-28
Last reply:
2013-11-28

Hi Mansour,
What you ask is not difficult to do, however I'm not sure it is a good
thing for you to follow this line. Nowadays the preprocessors are only
usefull for showing yade to someone in less than 5 seconds. Other than
that they really lack the flexibility of python scripts (and they force
you to recompile the code each time you change the simulation setup).
I suggest you check example scripts (namely examples/triax-tutorial),
where similar things are achieved without the graphical interface.

Bruno

Hi Bruno,

Thank you very much. much appreciated.

I have checked your example but really it is not clear enough because I don't know how to use python.

I totally agree with you that changing c++ code will always lead to recompile the code for each modification but it is not a big deal for me (at least in this step of prove of concept) as I would like to do a tweak modification ( adding a constant to formula of calculation of normal adhesion) in C++ code and I think there is no impact or regression that's why I prefer to follow this line to avoid having a wrong results.

I already tried to adapt the scripts to meet my requirements but it does not work. honestly it is so difficult for me to use python.

cheers!

Anton Gladky (gladky-anton) said : #3

Hi,

2013/11/27 mansour talhaoui <email address hidden>:
> I already tried to adapt the scripts to meet my requirements but it does
> not work. honestly it is so difficult for me to use python.

you do not need to know "the whole" Python to write simulation
scripts for Yade. Just basic commands.

Anton

Christian Jakob (jakob-ifgt) said : #4

> honestly it is so difficult for me to use python.

It is not difficult!

Change the script, like bruno suggested and run it in your console, like:

yade scriptname.py

Best Jérôme Duriez (jduriez) said : #5

If you really want achieve your goal through c++, I guess you have to add a line in YADE_CLASS_BASE_DOC_ATTRS_INIT_CTOR_PY block in the source file (pkg/dem/CohesiveTriaxialTest.hpp). Look at other lines from this block, or to https://www.yade-dem.org/doc/prog.html#yade-class-base-doc-macro-family, for the syntax.

But actually, this way is also the one to access and modify variables through Python. And (if you need another point of view different than yours ;-) ) I confirm it's probably worth for you to learn to deal with "python use" of yade

Jerome

Hi,

Thank you for you support. the problem is solved now.

Thanks jduriez, that solved my question.