more parameters and friction

This commit is contained in:
zomseffen 2022-01-02 11:33:28 +01:00
parent 54bda855e5
commit a783afbc7e

View file

@ -21,6 +21,9 @@ def main():
tau = 0.6 # collision timescale
Nt = 80000 # number of timesteps
plotRealTime = True # switch on for plotting as the simulation goes along
render_frequency = 10
close_up_frequency = 10
friction = 0.0001
params = FluidSimParameter(Ny)
# params = WaterParameter(Ny)
@ -180,6 +183,8 @@ def main():
# uy += g / 2.0
# u_length = np.maximum(np.abs(ux), np.abs(uy))
# safe guard against supersonic streams WIP
u_length1 = np.sqrt(np.square(ux) + np.square(uy1))
u_length2 = np.sqrt(np.square(ux) + np.square(uy2))
@ -195,6 +200,11 @@ def main():
uy1 = (uy1 / u_max_length) * np.sqrt(2)
uy2 = (uy2 / u_max_length) * np.sqrt(2)
# apply friction
ux *= (1 - friction)
uy1 *= (1 - friction)
uy2 *= (1 - friction)
print('max vector part: %f' % u_max_length)
# ux /= u_max_length
# uy /= u_max_length
@ -286,8 +296,10 @@ def main():
print('min Temp: %f' % np.min(np.sum(temperature, 2)[no_cylinder_mask]))
print('max Temp: %f' % np.max(np.sum(temperature, 2)))
if it > render_frequency:
render_frequency = close_up_frequency
# plot in real time - color 1/2 particles blue, other half red
if (plotRealTime and (it % 10) == 0) or (it == Nt - 1):
if (plotRealTime and (it % render_frequency) == 0) or (it == Nt - 1):
fig.clear()
plt.cla()
ux[cylinder] = 0