If-statement

Submitted by rsharma on Wed, 03/31/2021 - 07:42

Hi,
I have been trying to apply a stress with the help of if-statement i.e., when the wall reaches a certain amount of force it should stop applying force.
I am not getting a proper way to implement this logic. Please let me know how can I extract dumped force and put it into if-statement.

Thanks in advance.

AlexSM | Wed, 03/31/2021 - 13:09

To extract the dumped force you need to define a mesh/surface/stress or mesh/surface/stress/servo. It depends on how you move your surface.
If this fix is named cad you can extract the dumped force by f_cad. See https://www.cfdem.com/media/DEM/docu/fix_mesh_surface_stress_servo.html

"This fix stores a global vector with 9 components for access by various output commands. The first 3 components are equal to the total force on the mesh, the next 3 components store the total torque on the mesh. The last 3 components output the wall position."

I think you can use this variable in your if.

Alexandre

rsharma | Wed, 03/31/2021 - 19:23

Hi Alexandre. I implemented the following piece of code but still getting the error.
if "f_twall_csr[3] <= ${sigma_1_min}*${sample_width}*${sample_width}" then "fix move_twall3 all move/mesh mesh twall_csr linear 0.0 0.0 0.0" &
"print 'Seating load (10% of Deviator Stress) achieved'"

ERROR: Invalid Boolean syntax in if command (/build/liggghts-YO7u74/liggghts-3.8.0+repack1/src/variable.cpp:3837)

AlexSM | Thu, 04/01/2021 - 11:31

I test from my part, you need to declare a variable

"variable Reaction equal f_wall_csr[3] " and then
if "${Reaction} <= ${sigma_1_min}*${sample_width}*${sample_width}" then "fix move_twall3 all move/mesh mesh twall_csr linear 0.0 0.0 0.0" &
"print 'Seating load (10% of Deviator Stress) achieved'"

More over you can use "unfix ID" (ID is the name of the previous fix move/mesh which moves the mesh) if you want to stop the mesh movement.

If you want to do a if loop/while see https://www.cfdem.com/forums/if-loop-liggghts because if is one time test

rsharma | Sat, 04/03/2021 - 08:37

After unfixing the mesh, will the stress level be maintained where I left, for n number of steps?

Kashminder | Mon, 11/15/2021 - 20:56

I am using a If command (if "${b} <= ${bod1}" then "variable bod1 equal v_b") and getting an error (Compute used in variable between runs is not current. Use the update_on_run_end option for computes to avoid this.) I am trying to define update on run. when i try to do that they say illegal variable command. how and where to define update on run in variable defined in if command. I have defined variable like this (variable bod1 equal 1e-5) (variable b equal c_kash[1] ) (compute kash all property/atom z ). Can you please help me editing these commands to get rid of an error.

Thanks
Kashminder