kandelabr |
August 23, 2018 07:10 |
rotatingMotion: omega too low
In my dynamicMeshDict I have defined the following:
Code:
...
#include "variables"
...
motionSolver solidBody;
cellZone impeller;
solidBodyMotionFunction rotatingMotion;
rotatingMotionCoeffs
{
origin (0 0 0);
axis (1 0 0);
omega $vOmegaRotating; // rad/s
}
where vOmegaRotating is defined in constant/variables:
Code:
vRpm 3700.0; // revolutions per minute
vOmegaRotating #calc "$vRpm * 2.0 * 3.14159 / 60.0";
Therefore, cellZone impeller should be rotating with 387.5 rad/s.
I chose a point on the edge of impeller and took its coordinates for the last 20 timesteps. Divided by timestep, I get 372 rad/s. The python script is below.
Does anyone have an idea what would be wrong with my setup?
Can I print out the value calculated with #calc "" function?
Thanks!
Code:
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 23 11:54:56 2018
@author: jnejc
"""
import numpy as np
def unit_vector(vector):
""" Returns the unit vector of the vector. """
return vector / np.linalg.norm(vector)
def angle_between(v1, v2):
""" Kudos: https://stackoverflow.com/questions/2827393/
Returns the angle in radians between vectors 'v1' and 'v2':
>>> angle_between((1, 0, 0), (0, 1, 0))
1.5707963267948966
>>> angle_between((1, 0, 0), (1, 0, 0))
0.0
>>> angle_between((1, 0, 0), (-1, 0, 0))
3.141592653589793
"""
v1_u = unit_vector(v1)
v2_u = unit_vector(v2)
return np.arccos(np.clip(np.dot(v1_u, v2_u), -1.0, 1.0))
def vector(x, y, z):
return np.array([x, y, z])
# point id = 52515
positions = [
vector(-0.00611921, 0.00777754, -0.019457),
vector(-0.00611921, 0.0137424, -0.0158181),
vector(-0.00611921, 0.0145818, -0.0150478),
vector(-0.00611921, 0.0153579, -0.0142548),
vector(-0.00611921, 0.0160918, -0.0134208),
vector(-0.00611921, 0.0174789, -0.0115565),
vector(-0.00611921, 0.0189125, -0.00902112),
vector(-0.00611921, 0.0199236, -0.00648966),
vector(-0.00611921, 0.0205293, -0.00419667),
vector(-0.00611921, 0.0208551, -0.00203244),
vector(-0.00611921, 0.020952, 0.000283341),
vector(-0.00611921, 0.0207245, 0.00309213),
vector(-0.00611921, 0.0201434, 0.00577128),
vector(-0.00611921, 0.0192372, 0.00830631),
vector(-0.00611921, 0.0180004, 0.0107261),
vector(-0.00611921, 0.0163262, 0.0131347),
vector(-0.00611921, 0.0143235, 0.0152938),
vector(-0.00611921, 0.0120302, 0.0171563),
vector(-0.00611921, 0.00936239, 0.0187459),
vector(-0.00611921, 0.00628985, 0.0199876),
vector(-0.00611921, 0.0039477, 0.0205786)
]
times = [
0.0162497,
0.01711435,
0.01725469,
0.01739138,
0.01752823,
0.01781459,
0.01817363,
0.01850961,
0.01880188,
0.01907158,
0.01935721,
0.01970456,
0.02004247,
0.02037429,
0.02070925,
0.02107084,
0.02143386,
0.02179805,
0.02218091,
0.02258951,
0.0228872,
]
omegas = []
rpms = []
for i in range(1, len(positions)):
angle = angle_between(positions[i-1], positions[i])
omega = angle/(times[i-1] - times[i])
rpm = omega/(2*np.pi)*60
omegas.append(omega)
rpms.append(rpm)
|