Commit 675aeba1 authored by Michel Henry's avatar Michel Henry
Browse files

update show_problem for velocity_p2

parent 02f3a33f
......@@ -6,15 +6,39 @@ try :
except:
raise ValueError("Cannot get the directory of the active source.")
Delete()
# Show the fluid velocity
def showFluid(fluid, renderView, animationScene):
# Animation Scene
animationScene = GetAnimationScene()
animationScene.PlayMode = 'Snap To TimeSteps'
renderView = GetActiveViewOrCreate('RenderView')
renderView.InteractionMode = '2D'
# Show the fluid pressure
def showFluid(fluid, renderView):
fluidDisplay = Show(fluid, renderView)
fluidDisplay.Representation = 'Surface'
ColorBy(fluidDisplay, ('POINTS', 'velocity', 'Magnitude'))
ColorBy(fluidDisplay, ('POINTS', 'pressure'))
fluidDisplay.SetScalarBarVisibility(renderView, True)
RenameSource('Fluid', fluid)
Hide(fluid, renderView)
return fluidDisplay
# Show the fluid velocity
def showVelocity(fluid, renderView):
try:
velocity = MigFlowp2velocity(fluid)
velocityDisplay = Show(velocity, renderView)
ColorBy(velocityDisplay, ('POINTS', 'velocity', 'Magnitude'))
animationScene.GoToLast()
velocityDisplay.RescaleTransferFunctionToDataRange(True, False)
RenameSource('velocity', velocity)
except NameError:
print("MigFlow p2 velocity filter has not been charged !\nPlease see the wiki to add it in your Paraview filter.")
# Show the particles
def showParticles(particleProblem, renderView):
particles = ExtractBlock(particleProblem)
......@@ -31,6 +55,7 @@ def showParticles(particleProblem, renderView):
RenameSource('Glyph', glyph)
return particles, glyph
#Show the boundaries
def showBoundaries(particleProblem, renderView):
boundaries = ExtractBlock(particleProblem)
......@@ -78,11 +103,6 @@ def showFluidVelocity(fluid, renderView):
# Animation Scene
animationScene = GetAnimationScene()
animationScene.PlayMode = 'Snap To TimeSteps'
renderView = GetActiveViewOrCreate('RenderView')
renderView.InteractionMode = '2D'
# Read the pvd files
particleProblemFile = str(dirname)+"/particle_problem.pvd"
......@@ -98,16 +118,15 @@ if isfile(particleProblemFile):
if isfile(fluidFile):
fluid = PVDReader(FileName=fluidFile)
fluidDisplay = showFluid(fluid, renderView ,animationScene)
fluidDisplay = showFluid(fluid, renderView)
showVelocity(fluid, renderView)
if isfile(particleProblemFile):
Hide(fluid, renderView)
showFluidVelocity(fluid, renderView)
else:
animationScene.GoToLast()
fluidDisplay.RescaleTransferFunctionToDataRange(False, True)
# Show the first time step
animationScene.GoToFirst()
renderView.Update()
......
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