get deltax as staticmethod
@@ -125,6 +125,8 @@ class StraightWake(generator_interface.BaseGenerator):
if self.in_dict['dxmax'] == -1:
self.dxmax = self.dx1
+ else:
+ self.dxmax = self.in_dict['dxmax']
def generate(self, params):
# Renaming for convenience
@@ -140,14 +142,8 @@ class StraightWake(generator_interface.BaseGenerator):
M, N = zeta_star[isurf][0, :, :].shape
for j in range(N):
zeta_star[isurf][:, 0, j] = zeta[isurf][:, -1, j]
- zeta_star[isurf][:, 1, j] = zeta_star[isurf][:, 0, j] + self.dx1*self.u_inf_direction
- for i in range(2, self.ndx1 + 1):
- zeta_star[isurf][:, i, j] = zeta_star[isurf][:, i-1, j] + self.dx1*self.u_inf_direction
- for i in range(self.ndx1 + 1, M):
- # print(self.dx1, self.r, i, self.ndx1)
- deltax = self.dx1*self.r**(i - self.ndx1)
- if deltax > self.dxmax:
- deltax = self.dxmax
+ for i in range(1, M):
+ deltax = self.get_deltax(i, self.dx1, self.ndx1, self.r, self.dxmax)
zeta_star[isurf][:, i, j] = zeta_star[isurf][:, i - 1, j] + deltax*self.u_inf_direction
gamma[isurf] *= 0.
gamma_star[isurf] *= 0.
@@ -162,3 +158,14 @@ class StraightWake(generator_interface.BaseGenerator):
zeta_star[isurf][:, i - 1, j]))
for j in range(0, N - 1):
wake_conv_vel[isurf][:, j] = self.u_inf
+
+
+ @staticmethod
+ def get_deltax(i, dx1, ndx1, r, dxmax):
+ if (i < ndx1 + 1) :
+ deltax = dx1
+ else:
+ deltax = dx1*r**(i - ndx1)
+ deltax = min(deltax, dxmax)
+
+ return deltax
