Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fluidparticles
MigFlow
Commits
48c8aaf5
Commit
48c8aaf5
authored
Nov 05, 2018
by
Frédéric Dubois
Browse files
wip lmgc90 interface
parent
3f947730
Changes
3
Hide whitespace changes
Inline
Side-by-side
python/lmgc90Interface.py
View file @
48c8aaf5
...
...
@@ -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
LMGC
90
Initialize
lmgc
90
"""
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
LMGC
90 computation.
Do one step of a
lmgc
90 computation.
"""
if
tol
is
not
None
:
self
.
_solver_params
[
'conv'
]
=
tol
...
...
@@ -269,7 +269,7 @@ class Lmgc90Interface(object):
chipy
.
CloseDisplayFiles
()
chipy
.
Finalize
()
def
scontactTo
L
mgc90
(
dirname
,
dim
,
it
=
0
,
fric
=
0.
,
assume_box
=
False
):
def
scontactTo
l
mgc90
(
dirname
,
dim
,
it
=
0
,
fric
=
0.
,
assume_box
=
False
):
from
migflow
import
scontact
from
pylmgc90
import
pre
datbox_path
=
'DATBOX'
...
...
testcases/avalanch/avalanch2fluids/avalanch2fluids.py
View file @
48c8aaf5
...
...
@@ -103,8 +103,8 @@ tEnd = 10 #final time
# Initialise particles
genInitialPosition
(
outputdir
,
N
,
r
,
lx
,
ly
,
rhop
)
friction
=
0.3
#friction coefficient
lmgc90Interface
.
scontactTo
L
mgc90
(
outputdir
,
2
,
0
,
friction
)
p
=
lmgc90Interface
.
Lmgc90Interface
(
2
)
lmgc90Interface
.
scontactTo
l
mgc90
(
outputdir
,
2
,
0
,
friction
)
p
=
lmgc90Interface
.
ParticleProblem
(
2
)
# Initial time and iteration
t
=
0
...
...
testcases/couette-2d/melangeur.py
View file @
48c8aaf5
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment