Error while using move/mesh command

Submitted by laudari on Wed, 07/14/2021 - 15:33

Hello everyone,
I was trying to move mesh up and down linearly,

I think somehow I ended up with moving down. My mesh file just goes down and doesn't come up.

I just want little bit of change in position.i.e move mesh little bit up and little bit down while doing simulation.

Right now I am using this command:

`fix move all move/mesh mesh cad linear 0.0 0.0 -1.0`

how can I control mesh while moving down so that it linearly moves up and down?

Thank you.

SHUBHAM AGARWAL | Fri, 07/16/2021 - 22:55

Hello
You can use 'if' statement for your purpose, following is an example
%%%%%%%%%
variable top_vel equal -1 # define initial velocity of the mesh
if "step >=1000" then &
"variable top_vel equal -1" &
else "variable top_vel equal 1"

fix move all move/mesh mesh cad linear 0.0 0.0 ${top_vel}
%%%%%%%%%%%%

Here I have shown velocity change based on the number of steps, you can change as per your requirement.

Please let me know if you have further questions
Hope it helps :)

laudari | Sat, 07/17/2021 - 08:27

Hi Shubham, Thanks for your reply. I will check it .

laudari | Sat, 07/17/2021 - 08:41

Hi Shubham , I tried to follow if and else loop in my script. Furthermore I tried to go through if and else tutorial from liggghts homepage.
When i tried to add if and else in my script, I got following error,
```
Invalid Boolean syntax in if command (/build/liggghts-YO7u74/liggghts-3.8.0+repack1/src/variable.cpp:3837)
```
I tried to edit and modify by following tutorial but still gives same error. Any idea, where did I do mistake?
Thanks

laudari | Sat, 07/17/2021 - 08:44

I used the above script which you provided for an example.
variable top_vel equal -1 # define initial velocity of the mesh
if "step >=1000" then &
"variable top_vel equal -1" &
else "variable top_vel equal 1"

SHUBHAM AGARWAL | Sat, 07/17/2021 - 19:33

Hello
As far as format for 'if-else" is concerned, there should be no problem, nevertheless, you can try the following:

variable curr_step equal step # define step as a variable
variable top_vel equal -1 # define initial velocity of the mesh
if "${curr_step} >=1000" then "variable top_vel equal -1" else "variable top_vel equal 1"

Sometimes it shows error due to incorrect indentation style, to avoid you can write the full statement in single line

Cheers