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