Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What‘s the unit in the code? #2

Closed
Junang-Wang opened this issue Oct 16, 2023 · 9 comments
Closed

What‘s the unit in the code? #2

Junang-Wang opened this issue Oct 16, 2023 · 9 comments

Comments

@Junang-Wang
Copy link

Hi alantes,

I have been going though your paper. Very nice paper. However, I have a question about the units in your code. In the paper, your robot is in size of 20mm * 8mm * 0.8mm with Young's modulus and density setting to 84.5kPa and 1860kg/m^3 respectively. However, in your following code, you set length = 20, but Young's modulus = 84.5*10^6 and density = 1860.
image
So I am thinking which units you are using?
image
Looking forward to your reply. Thanks for advance.

@alantes
Copy link
Owner

alantes commented Oct 16, 2023

Hi, Junang-Wang! Thank you for your interest and sorry for the confusion. The work went through many trials and errors and it was not maintained neatly throughout the process. And many apologies for that I did not have enough time and energy to clean up my code before publishing since I have already graduated and get occupied by many other commitments.

Anyway, strictly speaking, I did not use standard SI units but rather a scaled version. As you may know, many numerical softwares (like Abaqus subroutines) will not qualify the units you use, meaning that you do not have to adopt standard SI (though I believe it will be better to use SI, of course).

In my case, heights and lengths are in the units of mm.

Density of the materials is 1860 kg/m^3 = 1.86 * 10^6 g/(1000 mm)^3 = 1.86 * 10^-3 g/ mm^3, which was set in my programs to be 1.86e3/1000 = 1.86. So, you can see that my unit of mass is 10^-3 g.

Gravitational acceleration was -9.80665e0 * 1000. This is because 9.8 m/s^2 = 9.8 * 10^3 mm/s^2.

Like wise, Young's modulus is 84.5kPa = 84.5 * 10^3 * N/m^2 = 84.5 * 10^3 * (kg*m/s^2)/(m^2) = 84.5 * 10^3 * kg/(m * s^2) = 84.5 * 10^3 *10^6 * (10^-3 g)/(10^3 mm * s^2) = 84.5 * 10^6 * (10^-3 g)/(mm * s^2) = 84500000 (10^-3 g)/(mm * s^2).

In any cases, the units of time were not scaled.

If I recollect it correctly, I hoped to avoid extremely small numbers in Python in the first glance. For example, if I use SI, the small scale of the robots will make the mass of them very small, which might lead to some numerical problems in Python. But I am not sure if it is still the case. If you are willing to, you can turn all of the numbers into SI and have a try.

Let me know if you have other questions.

@Junang-Wang
Copy link
Author

Hi, alantes! Thank you for your reply, now I understand the unit problem.

I also have some other questions regarding your code. In your code, damping constant (denoted as "nu")is setting to 150. However, I am woundering how should I choose the appropriate damping constant in my system, is there any standard poccess or guideline I can follow?

The other equstion, quoting from your paper:
"As for Cosserat rod models, we noticed that the PyElastica numerical package had difficulties dealing with small scale soft robots", "We found that if we increased the density of the robots while at the same time inverse-proportionally decreased gravitational acceleration, the gravity as well as deformation of robots remain the same, and timesteps can be set to larger values. In our case, when we set density to be 10.5 times larger and gravity acceleration to be 10.5 times smalle", so how should I choose the proper scale number? And does this approximation effectively reduce the Young's module? What do you think?

I appreciate your help in advance.

@alantes
Copy link
Owner

alantes commented Oct 17, 2023

1.) To the best of my knowledge, no, there are no standardized procedures of choosing damping coefficient. You can check this thread for more discussions: https://www.researchgate.net/post/Damping-ratio-is-always-the-parameter-that-determine-with-greatest-degree-of-uncertainty

2.) In my opinion, the difficulties of calculating motion quantities of small-scale rods in PyElastica is not something well expected or examined. As I might have mentioned in my paper, a possible reason for the problem is that small-scale dimensions make moments extremely small, and as a result of this, in my experiments with PyElastica, after several steps of calculating the velocities will soon became extremely large and the program will generate NaN numbers. You can consider that there might be a curve describing the difficulties of calculating, and the x-axis is how small your models are. When the dimensions of your models are regular values, like 1.0 m or above, everything is fine; however, if your dimenisons are below a threshold, the smaller your dimensions are, the harder it is for PyElastica to converge and calculate dynamics. I do not mean to attribute this as a bug of PyElastica because there will be tons of unexpected conditions when you are developing a large and comprehensive numerical software. As a researcher using the public repository for unregular purposes, I believe we should try to figuring out tricks to circumvent the limitations of the package. So, my way was to scale acceleration, and in my own experiments I found that 10.5 times larger will take the total computational time to what I can afford, and did not perform large tests to the convergence performance of PyElastica, i.e., the "curve" I described above. Therefore, I do not have a standardized procecesure for you to choose the scale factor. Sorry. However, as a general suggestion, the smaller your models are, the larger scale factor you should choose.

3.) I do not think Young's modules are reduced, nor do the elastic forces. Any details about why you think so?

@Junang-Wang
Copy link
Author

Thanks for you reply, Alantes. Your discussion helps me a lot.

(1) Is the only method for determining damping constant through a manul comparsion of experiments and simulations and manually picking a number?

(2) I agree with your option that after several steps of evaluation, the velocities of small scale rods elements will become extremely large. Your explanation is reasonable.

(3) Let's say If one were to makes density 10.5 times larger. For an unshearable rod, from Newton's law, F=m* a, and the stress F = E \sigma, where m* is scale mass(10.5times), E is Young's modulus and \sigma is strain. So that , m*a = E \sigma, and acceleration a and strain \sigma are given be current state which is not affected by scale mass. So, for my perspective, if one make density 10.5 times large, it will effectively scale down Young's modulus. I am not sure if my logic is current. What do you think?

@alantes
Copy link
Owner

alantes commented Oct 17, 2023

  1. Sorry. I am not an expert in this field, so I may not provide you with a definite answer.
  2. Thanks.
  3. When mass is scaled, gravitational acceleration will be scaled inversely, and the gravitational force will remain the same. So, m*g will not change. And you agreed that strain \sigma will not be affected by scaled mass, then Young's modulus will stay the same.

@Junang-Wang
Copy link
Author

Junang-Wang commented Oct 17, 2023

  1. I understand m* g will not change. But I am discussing about total force rather than only gravity. From the Newton law, F_total = F_externel + F_gravity = m* (a_externel + g) = E \sigma. The contribution of gravity may not effectively affect Young's modulus but the externel part affects effectively.

@alantes
Copy link
Owner

alantes commented Oct 17, 2023

In static and equilibrium cases, a_external = 0, meaning that the stable deformations will the the same as the unscaled version. In dynamic cases, the increased mass will increase the inertia of the robots, and acceleration will be smaller than the unscaled version. Young's modulus, as is set in the programs, stays the same. I hope it is clear now.

@alantes
Copy link
Owner

alantes commented Oct 17, 2023

rnal = 0, meaning that the stable deformations will the the same as the unscaled version. In dynamic cases, the increased mass will increase the inertia of the robots, and acceleration will be smaller than the unscaled version. Young's modulus

I think m*a = E \sigma may not be appropriate. m*a represents the total effect of internal forces and external forces. And I am guessing that you may have assumed a to be constant, which makes you feel that E will change with m*a. But a is not a constant. It is E \sigma, along with other forces, that determines a, but not inversely.

@Junang-Wang
Copy link
Author

Thanks man. It is much clear now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants