Commit 001a378e authored by Michel Henry's avatar Michel Henry
Browse files

Paraview : add contacts in show_problem

parent 2c38c432
......@@ -17,6 +17,7 @@ def showFluid(fluid, renderView, animationScene):
fluidDisplay.SetScalarBarVisibility(renderView, True)
animationScene.GoToLast()
fluidDisplay.RescaleTransferFunctionToDataRange(False, True)
RenameSource('Fluid', fluid)
return fluidDisplay
# Show the particles
......@@ -31,7 +32,8 @@ def showParticles(particleProblem, renderView):
glyph.ScaleFactor = 2.0
glyph.GlyphMode = 'All Points'
Show(glyph, renderView)
RenameSource('Particles', particles)
RenameSource('Glyph', glyph)
return particles, glyph
#Show the boundaries
......@@ -39,8 +41,26 @@ def showBoundaries(particleProblem, renderView):
boundaries = ExtractBlock(particleProblem)
boundaries.BlockIndices = [2]
Show(boundaries, renderView)
RenameSource('Boundaries', boundaries)
return boundaries
#Show the contacts
def showContacts(particleProblem, renderView):
try:
contacts = MigFlowextractcontacts(Input=particleProblem)
contacts.nf = 4
contacts.rf = 5e-5
contactsDisplay = Show(contacts, renderView)
contactsDisplay.AmbientColor = [0.0, 0.0, 0.0]
contactsDisplay.DiffuseColor = [0.0, 0.0, 0.0]
Hide(contacts, renderView)
RenameSource('Contacts', contacts)
return contacts
except NameError:
print("MigFlow extract contacts Filter has not been charged !\nPlease see the wiki to add it in your Paraview filter.")
return None
# Animation Scene
animationScene = GetAnimationScene()
animationScene.PlayMode = 'Snap To TimeSteps'
......@@ -53,19 +73,14 @@ fluidFile = str(dirname)+"/fluid.pvd"
if isfile(particleProblemFile):
particleProblem = PVDReader(FileName=particleProblemFile)
particles, glyph = showParticles(particleProblem, renderView)
boundaries = showBoundaries(particleProblem, renderView)
showContacts(particleProblem, renderView)
showParticles(particleProblem, renderView)
showBoundaries(particleProblem, renderView)
RenameSource('Particle Problem', particleProblem)
RenameSource('Particles', particles)
RenameSource('Glyph', glyph)
RenameSource('Boundaries', boundaries)
if isfile(fluidFile):
fluid = PVDReader(FileName=fluidFile)
showFluid(fluid, renderView ,animationScene)
RenameSource('Fluid', fluid)
# Show the first time step
animationScene.GoToFirst()
......
......@@ -101,7 +101,7 @@ if use_lmgc90 :
p = lmgc90Interface.ParticleProblem(2)
else :
p = scontact.ParticleProblem(2,True,True)
p.read_vtk(outputdir,0)
# p.read_vtk(outputdir,0)
p.set_friction_coefficient(0.1,"Sand","Sand") # Particle-Particle
p.set_friction_coefficient(0.1,"Sand","Steel")# Particle-Wall
# Initial time and iteration
......
......@@ -35,7 +35,7 @@ import time
import shutil
import random
def genInitialPosition(filename, r, H, ly, lx, rhop) :
def genInitialPosition(p,filename, r, H, ly, lx, rhop) :
"""Set all the particles centre positions and create the particles objects to add in the computing structure
Keyword arguments:
......@@ -47,7 +47,7 @@ def genInitialPosition(filename, r, H, ly, lx, rhop) :
rhop -- particles density
"""
# Particles structure builder
p = scontact.ParticleProblem(2)
# p = scontact.ParticleProblem(2)
# Load mesh.msh file specifying physical boundaries names
p.load_msh_boundaries("mesh.msh", ["Top", "Lateral","Bottom"])
......@@ -88,9 +88,9 @@ H = 0.6 # domain height
# PARTICLE PROBLEM
#
# Initialise particles
genInitialPosition(outputdir, r, H, ly, lx, rhop)
p = scontact.ParticleProblem(2)
p.read_vtk(outputdir,0)
genInitialPosition(p,outputdir, r, H, ly, lx, rhop)
# p.read_vtk(outputdir,0)
print("r = %g, m = %g\n" % (p.r()[0], p.mass()[0]))
print("RHOP = %g" % rhop)
......
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