Commit 4ed79c4c authored by Matthieu Constant's avatar Matthieu Constant
Browse files

visc and density in test case

parent b29fc430
Pipeline #3803 failed with stage
in 22 seconds
#!/usr/bin/env python
from marblesbag import fluid as fluid
from marblesbag import scontact2
import numpy as np
import os
import time
import shutil
import random
outputdir = "output"
if not os.path.isdir(outputdir) :
os.makedirs(outputdir)
t = 0
ii = 0
r = 5e-3
ly = 5e-2
#R = np.random.uniform(45e-06, 90e-06, len(x))
#physical parameters
g = -9.81
print(g)
rho0 = 1000
rho1 = 1001
nu0 = 1e-5
nu1 = 1e-5
V = 0.5 # todo : estimate V base on limit velocity
print('V',V)
tEnd = 100
#numerical parameters
lcmin = 0.05 # approx r*100 but should match the mesh size
dt = 1e-4
alpha = 1e-4
epsilon = alpha*lcmin**2 /nu0
print('epsilon',epsilon)
shutil.copy("mesh.msh", outputdir +"/mesh.msh")
outf = 50
outf1 = 100000
ii = 0
strong_boundaries = [("Top",4,0.),("Top",2,0),("Bottom",2,0.),("Lateral",1,0.),("Injection",0,0),("Injection",2,1)]
fluid = fluid.fluid_problem("mesh.msh",g,[nu0*rho0,nu1*rho1],[rho0,rho1],epsilon,strong_boundaries,2)
s = fluid.solution()
s[:,3] = 1
fluid.export_vtk(outputdir,0,0)
tic = time.clock()
while t < tEnd :
fluid.implicit_euler(dt)
t += dt
if ii %outf == 0 :
ioutput = int(ii/outf) + 1
fluid.export_vtk(outputdir, t, ioutput)
ii += 1
print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.clock() - tic))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment