Commit 9a79ab0b authored by Matthieu Constant's avatar Matthieu Constant
Browse files

test inject 3d draft

parent de947f31
Pipeline #4855 passed with stage
in 25 seconds
# MigFlow - Copyright (C) <2010-2018>
# <Universite catholique de Louvain (UCL), Belgium
# Universite de Montpellier, France>
#
# List of the contributors to the development of MigFlow: see AUTHORS file.
# Description and complete License: see LICENSE file.
#
# This program (MigFlow) is free software:
# you can redistribute it and/or modify it under the terms of the GNU Lesser General
# Public License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program (see COPYING and COPYING.LESSER files). If not,
# see <http://www.gnu.org/licenses/>.
#!/usr/bin/env python
# TESTCASE DESCRIPTION
# Injection of a light fluid in a heavier fluid
from migflow import fluid
import numpy as np
import os
import time
import shutil
import random
outputdir = "output"
if not os.path.isdir(outputdir) :
os.makedirs(outputdir)
# physical parameters
g = -9.81 # gravity
rho0 = 900 # fluid density
rho1 = 1000
nu1 = 1e-6 # kinematic viscosity
nu0 = nu1
r = 5e-4
N = 10000
rhop = 1500
# numerical parameters
tEnd = 10 # final time
dt = .01 # time step
outf = 1 # number of iterations between output files
def outerBndV(x) :
a = np.where(np.abs(x[:,0]-0.111) < 0.01, 0.4*max(np.sin(t*np.pi*2./1),0),0)
return a
fluid = fluid.FluidProblem(3,g,[nu0*rho0,nu1*rho1],[rho0,rho1])
fluid.load_msh("mesh.msh")
fluid.set_wall_boundary("XVel")
fluid.set_wall_boundary("ZVel")
fluid.set_open_boundary("Top",pressure=0,concentration=0)
fluid.set_open_boundary("Bottom",velocity=[0,outerBndV,0],concentration=1)
#fluid.set_concentration_cg(np.where(fluid.coordinates()[:,1]>0.32,1,0))
ii = 0
t = 0
fluid.export_vtk(outputdir,0,0)
tic = time.time()
while t < tEnd :
#Fluid solver
fluid.implicit_euler(dt)
t += dt
#Output files writting
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.time() - tic))
L = .111;
H = .26;
P = .111;
y = 0;
lc = 0.02;
SetFactory("OpenCASCADE");
Box(1) = {-L,-H,-P,2*L,2*H,2*P};
Physical Surface("Top") = {4};
Physical Surface("Bottom") = {3};
Physical Surface("ZVel") = {5,6};
Physical Surface("XVel") = {1,2};
Physical Point("PtFix") = {5};
Physical Volume("Domain") = {1};
Characteristic Length{ PointsOf{ Volume{:}; } } = lc;
Mesh.MshFileVersion = 2;
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