Commit 45cb5578 authored by Frédéric Dubois's avatar Frédéric Dubois
Browse files

wip lmgc90 interface

parent d94bed4d
Pipeline #4530 failed with stage
in 20 seconds
#!/usr/bin/env python
use_lmgc = False #True
use_lmgc90 = False #True
from migflow import fluid
from migflow import scontact
if use_lmgc :
from migflow import lmgc2Interface
if use_lmgc90 :
from migflow import lmgc90Interface
import numpy as np
import os
......@@ -51,10 +51,11 @@ lypart = 150*r
lxpart = 50*r
genInitialPosition(outputdir, r, x0part, y0part, lxpart, lypart, rhop)
if use_lmgc :
friction = 0.1 # friction coefficient
lmgc2Interface.scontactToLmgc90(outputdir,0,friction)
p = lmgc2Interface.LmgcInterface()
if use_lmgc90 :
# friction coefficient
friction = 0.1
lmgc90Interface.scontactTolmgc90(outputdir,2,0,friction)
p = lmgc90Interface.ParticleProblem(2)
else :
p = scontact.ParticleProblem(2)
p.read_vtk(outputdir,0)
......@@ -66,8 +67,6 @@ print("r = %g, m = %g\n" % (p.r()[0], p.mass()[0]))
print("RHOP = %g" % rhop)
outf = 20 #000
fluid = fluid.FluidProblem(2,g,nu*rho,rho)
fluid.load_msh("mesh.msh")
fluid.set_strong_boundary("Box",0,0)
......@@ -75,7 +74,7 @@ fluid.set_strong_boundary("Box",1,0)
fluid.set_strong_boundary("Left",0,0.001)
fluid.set_strong_boundary("Right",2,0)
fluid.set_weak_boundary("Left","Inflow")
fluid.set_weak_boundary("Right","Outlow")
fluid.set_weak_boundary("Right","Outflow")
fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity())
fluid.export_vtk(outputdir,0,0)
......@@ -95,8 +94,7 @@ while t < tEnd :
t += dt
if ii %outf == 0 :
ioutput = int(ii/outf) + 1
if not use_lmgc : p.write_vtk(outputdir, ioutput, t)
#if not use_lmgc : p.write_boundary_vtk(outputdir, ioutput, t)
if not use_lmgc90 : p.write_vtk(outputdir, ioutput, t)
fluid.export_vtk(outputdir, t, ioutput)
ii += 1
print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic))
......
......@@ -25,7 +25,7 @@
# Falling particles in a sandglass
from migflow import fluid
from migflow import scontact
from migflow import lmgc2Interface
from migflow import lmgc90Interface
import numpy as np
import os
......@@ -71,14 +71,14 @@ lxpart = 0.015 # semi-width of the grains
dt = 1e-3 # time step
#Enable the use of lmgc90
use_lmgc = True
use_lmgc90 = True
#Object particles creation
genInitialPosition(outputdir, r, 0., y0part, lxpart, lypart, rhop)
if use_lmgc :
if use_lmgc90 :
friction=0.1 # friction coefficient
lmgc2Interface.scontactToLmgc90(outputdir, 0, friction)
p = lmgc2Interface.LmgcInterface()
lmgc90Interface.scontactTolmgc90(outputdir, 2, 0, friction)
p = lmgc90Interface.ParticleProblem(2)
else :
p = scontact.ParticleProblem(2)
p.read_vtk(outputdir,0)
......@@ -123,4 +123,4 @@ while t < tEnd :
p.write_vtk(outputdir, ioutput, t)
fluid.export_vtk(outputdir, t, ioutput)
ii += 1
print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic))
\ No newline at end of file
print("%i : %.2g/%.2g (cpu %.6g)" % (ii, t, tEnd, time.time() - tic))
......@@ -22,7 +22,7 @@
#!/usr/bin/env python
from migflow import fluid
from migflow import scontact
from migflow import lmgc2Interface
from migflow import lmgc90Interface
import numpy as np
import os
......@@ -58,12 +58,12 @@ for i in range(len(p1.position()[:,0])):
p.add_particle((p1.position()[i,0], p1.position()[i,1]), p1.r()[i], p1.r()[i]**2 * np.pi * rhop)
p.write_vtk(outputdir, 0, 0)
#Use lmgc for friction or not without friction
use_lmgc = True
if use_lmgc :
#Use lmgc90 for friction or not without friction
use_lmgc90 = True
if use_lmgc90 :
friction=0.3 #friction coefficient
lmgc2Interface.scontactToLmgc90(outputdir, 0, friction)
p = lmgc2Interface.LmgcInterface()
lmgc90Interface.scontactTolmgc90(outputdir, 2, 0, friction)
p = lmgc90Interface.ParticleProblem(2)
else :
p = scontact.ParticleProblem(2)
p.read_vtk(outputdir,0)
......
Supports Markdown
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