height =  0.41
nHeight = 50
l_h = 5
nLength = nHeight*l_h 
dx = height/nHeight
length = nLength*dx
--length = 2.2
nLength_bnd = nLength+2
--nLength = 200
--dx = length_bnd/(2^level)
--dx_ini = length/nLength 
level = math.ceil(math.log(nLength_bnd)/math.log(2))
length_bnd = (2^level)*dx
--level = 9
--dx = length_bnd/2^level
--nLength = math.ceil((length)/dx)
--nHeight = math.ceil((height)/dx)
dx_half = dx*0.5
zpos = dx_half
sph_pos = {0.2,0.2,zpos}
radius = 0.05
Dia = radius*2.0

--flow parameters
Re = 100
nu_phy = 1e-3 --m^2/s
rho0_p = 1.0
u_mean_phy = Re*nu_phy/height
u_in_phy = 3.0*u_mean_phy/2.0
massflow_rate = rho0_p*u_mean_phy*nHeight*dx^2

anal_prsDrop = length*8*nu_phy*u_in_phy/(height*height)
nL = math.ceil(Dia/dx)
Re_check = u_mean_phy*Dia/nu_phy
-- set true for acoustic scaling, false for diffusive scaling
acoustic_scaling = true

if acoustic_scaling == true then
--acoustic scaling
  u_in_L = 0.08
  dt = u_in_L*dx/u_in_phy
  u_mean_L = 2.0*u_in_L/3.0
  nu_L = nu_phy*dt/dx^2.
  omega = 1.0/(3.0*nu_L+0.5)
else
--diffusive scaling
  omega = 1.92
  nu_L = (1.0/omega-0.5)/3.0
  dt = nu_L*dx^2/nu_phy
  u_mean_L = u_mean_phy*dt/dx
  u_in_L = 3.0*u_mean_L/2.0
end

function u_inflow(x,y,z,t) 
  return 4.0*u_in_L*y*(height-y)/height^2.0
end

function omega_spatial(x,y,z,t)
  if x<1.0 then
    return x
  else
    return 1.0
  end
end
--nSteps = math.ceil(dx/dt*nLength*10)
nSteps =  100000

--subprefix = 'lh'..l_h..'/nH'..nHeight..'/'
