Commit 48c8aaf5 authored by Frédéric Dubois's avatar Frédéric Dubois
Browse files

wip lmgc90 interface

parent 3f947730
......@@ -24,7 +24,7 @@ import numpy as np
import os
import math
class Lmgc90Interface(object):
class ParticleProblem(object):
"""
A class definition holding data of lmgc90
in a compatible form to use coupling with
......@@ -51,7 +51,7 @@ class Lmgc90Interface(object):
def __init__(self,dim,period=0,xp=0,yp=0) :
"""
Initialize LMGC90
Initialize lmgc90
"""
self._dim=dim
......@@ -167,7 +167,7 @@ class Lmgc90Interface(object):
def iterate(self, dt, forces, tol=None, gsit1=None, gsit2=None):
"""
Do one step of a LMGC90 computation.
Do one step of a lmgc90 computation.
"""
if tol is not None : self._solver_params['conv'] = tol
......@@ -269,7 +269,7 @@ class Lmgc90Interface(object):
chipy.CloseDisplayFiles()
chipy.Finalize()
def scontactToLmgc90(dirname, dim, it=0, fric = 0., assume_box=False):
def scontactTolmgc90(dirname, dim, it=0, fric = 0., assume_box=False):
from migflow import scontact
from pylmgc90 import pre
datbox_path = 'DATBOX'
......
......@@ -103,8 +103,8 @@ tEnd = 10 #final time
# Initialise particles
genInitialPosition(outputdir, N, r, lx, ly, rhop)
friction = 0.3 #friction coefficient
lmgc90Interface.scontactToLmgc90(outputdir, 2, 0, friction)
p = lmgc90Interface.Lmgc90Interface(2)
lmgc90Interface.scontactTolmgc90(outputdir, 2, 0, friction)
p = lmgc90Interface.ParticleProblem(2)
# Initial time and iteration
t = 0
......
......@@ -22,11 +22,16 @@
#!/usr/bin/env python
# TESTCASE DESCRIPTION
# Grains in circular shear flow.
# This example shows how to set boundary conditions as a function of some parametres.
# Grains in circular shear flow generated by a rotating drum.
# This example shows how to set boundary conditions as a function of some parameters.
# A boolean parameter gives the possibility to use lmgc90 to solve contacts instead of scontact.
use_lmgc90 = 0
from migflow import fluid
from migflow import scontact
if use_lmgc90 :
from migflow import lmgc90Interface
import numpy as np
import os
......@@ -34,11 +39,6 @@ import time
import shutil
import random
# Define output directory
outputdir = "output"
if not os.path.isdir(outputdir) :
os.makedirs(outputdir)
def genInitialPosition(filename, r, rout, rin, rhop) :
"""Create a container to initialize particles and write particles in an initial output file.
......@@ -73,6 +73,13 @@ def genInitialPosition(filename, r, rout, rin, rhop) :
p.add_particle((x[i], y[i]), r, r**2 * np.pi * rhop1)
p.write_vtk(filename,0,0)
# Define output directory
outputdir = "output"
if not os.path.isdir(outputdir) :
os.makedirs(outputdir)
# Physical parameters
g = 0 # gravity
rho = 1.253e3 # fluid density
......@@ -94,8 +101,13 @@ r = 397e-6/2 # grains radius
#
# Object particles creation
genInitialPosition(outputdir, r, rout, rin, rhop)
p = scontact.ParticleProblem(2)
p.read_vtk(outputdir,0)
if use_lmgc90 :
friction = 0.1 # friction coefficient
lmgc90Interface.scontactTolmgc90(outputdir,2,0,friction)
p = lmgc90Interface.ParticleProblem(2)
else :
p = scontact.ParticleProblem(2)
p.read_vtk(outputdir,0)
# Initial time and iteration
t = 0
......
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