Make dealing with units in PyRolL easier #204
GRPlan
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
Very good and reusable solution Geralt. Thanks for sharing. @ChRen95, @axtimhaus: In the future, the calculation of the units in mm and degrees celsius should be integrated directly into the core. This will make it much more user friendly for users. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In PyRolL there is the convention that SI-Units are to be used. E.g. length in meters, temperatures in Kelvin.
To convert units more easily I use a dictionary that contains the conversion factors.
convert_SI = {
'length':
1.e-3,
'stress': 1.e6,
'density': 1.e12,
'cp': 1.e-6,
'temperature': 273.15,
'frequency': 1./60,
}
convert_SI['area'] = convert_SI['length']**2
convert_SI['volume'] = convert_SI['length']**3
When you prepare PyRolL input then you just need to multiply (or add) by the convert_SI and provide the appropriate key
E.g.
InDiameter = 71.
StartTemperature = 1000.
Rod = pr.Profile.round(diameter=InDiameter * convert_SI['length'], **MatProps)
Rod.temperature = StartTemperature + convert_SI['temperature']
When you retrieve data from PyRolL results conversion can be done by dividing (subtracting)
E.g.
for rollpass in Rollpass.roll_passes:
print(rollpass.label, rollpass.strain_rate, rollpass.roll.rotational_frequency / convert_SI['frequency'])
Used in Examplenotebook #205
Beta Was this translation helpful? Give feedback.
All reactions