Skip to content

Commit

Permalink
add example cavity script
Browse files Browse the repository at this point in the history
  • Loading branch information
Jianhui committed Aug 17, 2022
1 parent b4e09bc commit 13bcb7d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Single_phase/example_cavity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import LBM_3D_SinglePhase_Solver as lb3dsp
import time

time_init = time.time()
time_now = time.time()
time_pre = time.time()


lb3d = lb3dsp.LB3D_Solver_Single_Phase(50,50,50)

lb3d.init_geo('./geo_cavity.dat')
lb3d.set_bc_vel_x1([0.0,0.0,0.1])
lb3d.init_simulation()

for iter in range(50000+1):
lb3d.step()

if (iter%1000==0):

time_pre = time_now
time_now = time.time()
diff_time = int(time_now-time_pre)
elap_time = int(time_now-time_init)
m_diff, s_diff = divmod(diff_time, 60)
h_diff, m_diff = divmod(m_diff, 60)
m_elap, s_elap = divmod(elap_time, 60)
h_elap, m_elap = divmod(m_elap, 60)

print('----------Time between two outputs is %dh %dm %ds; elapsed time is %dh %dm %ds----------------------' %(h_diff, m_diff, s_diff,h_elap,m_elap,s_elap))
print('The %dth iteration, Max Force = %f, force_scale = %f\n\n ' %(iter, 10.0, 10.0))

if (iter%10000==0):
lb3d.export_VTK(iter)

0 comments on commit 13bcb7d

Please sign in to comment.