mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge remote-tracking branch 'origin/develop' into develop-pre-release
This commit is contained in:
@ -66,10 +66,33 @@ communication
|
||||
// Output file of forces, written by OpenFOAM
|
||||
outputName forces.out;
|
||||
|
||||
// Log of points/forces/moments during the simulation
|
||||
logName movement.log;
|
||||
|
||||
inputFormat dictionary;
|
||||
outputFormat dictionary;
|
||||
|
||||
debugTable "<case>/output.txt";
|
||||
|
||||
// Scaling applied to values read from 'inputName'
|
||||
scaleInput
|
||||
{
|
||||
//- Length multiplier (to metres). Eg 0.001 for [mm] -> [m]
|
||||
length 1;
|
||||
}
|
||||
|
||||
// Scaling applied to values written to 'outputName'
|
||||
scaleOutput
|
||||
{
|
||||
//- Length multiplier (from metres). Eg 1000 for [m] -> [mm]
|
||||
length 1;
|
||||
|
||||
//- Force units multiplier (from Pa)
|
||||
force 1;
|
||||
|
||||
//- Moment units multiplier (from N.m)
|
||||
moment 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -4,19 +4,23 @@ functions
|
||||
{
|
||||
catalyst
|
||||
{
|
||||
#includeEtc "caseDicts/postProcessing/catalyst/default.cfg"
|
||||
|
||||
mkdir "<case>/insitu";
|
||||
|
||||
// Selected fields (words or regex). Must have cellMask for overset!
|
||||
fields ( cellMask U p );
|
||||
#includeEtc "caseDicts/insitu/catalyst/catalyst.cfg"
|
||||
|
||||
scripts
|
||||
(
|
||||
"<system>/scripts/overset.py"
|
||||
"<system>/scripts/writeOverset.py"
|
||||
"<system>/scripts/pressure.py"
|
||||
// "<system>/scripts/vorticity.py"
|
||||
// "<etc>/caseDicts/insitu/catalyst/writeMesh.py"
|
||||
);
|
||||
|
||||
inputs
|
||||
{
|
||||
region
|
||||
{
|
||||
// Selected fields (words or regex).
|
||||
fields ( U p );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,11 +10,13 @@ from paraview import coprocessing
|
||||
imageFileNamePadding=4
|
||||
rescale_lookuptable=False
|
||||
|
||||
|
||||
# ----------------------- CoProcessor definition -----------------------
|
||||
|
||||
def CreateCoProcessor():
|
||||
def _CreatePipeline(coprocessor, datadescription):
|
||||
class Pipeline:
|
||||
# state file generated using paraview version 5.5.0
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# setup views used in the visualization
|
||||
@ -27,16 +29,15 @@ def CreateCoProcessor():
|
||||
|
||||
# Create a new 'Render View'
|
||||
renderView1 = CreateView('RenderView')
|
||||
renderView1.ViewSize = [1077, 763]
|
||||
renderView1.ViewSize = [1091, 766]
|
||||
renderView1.AxesGrid = 'GridAxes3DActor'
|
||||
renderView1.CenterOfRotation = [0.00784385809674859, 0.005000000004656613, 0.004999999888241291]
|
||||
renderView1.CenterOfRotation = [0.009999999776482582, 0.004999999888241291, 0.004999999888241291]
|
||||
renderView1.StereoType = 0
|
||||
renderView1.CameraPosition = [0.0072242101003740155, 0.0002877833685303474, 0.035060283710920806]
|
||||
renderView1.CameraFocalPoint = [0.00868966107678934, 0.004150999005211765, 0.0049322758242629034]
|
||||
renderView1.CameraViewUp = [0.3542102656908786, 0.9252429122682538, 0.135869941401907]
|
||||
renderView1.CameraParallelScale = 0.00787069031419879
|
||||
renderView1.CameraPosition = [0.009999999776482582, 0.004999999888241291, 0.04819751509880177]
|
||||
renderView1.CameraFocalPoint = [0.009999999776482582, 0.004999999888241291, 0.004999999888241291]
|
||||
renderView1.CameraParallelScale = 0.011180339637598877
|
||||
renderView1.CameraParallelProjection = 1
|
||||
renderView1.Background = [0.32, 0.34, 0.43]
|
||||
renderView1.Background = [0, 0, 0]
|
||||
|
||||
# init the 'GridAxes3DActor' selected for 'AxesGrid'
|
||||
renderView1.AxesGrid.XTitleFontFile = ''
|
||||
@ -50,7 +51,7 @@ def CreateCoProcessor():
|
||||
# and provide it with information such as the filename to use,
|
||||
# how frequently to write the images, etc.
|
||||
coprocessor.RegisterView(renderView1,
|
||||
filename='insitu/image_%t.png', freq=1, fittoscreen=0, magnification=1, width=1077, height=763, cinema={})
|
||||
filename='press_%t.png', freq=1, fittoscreen=0, magnification=1, width=1091, height=766, cinema={})
|
||||
renderView1.ViewTime = datadescription.GetTime()
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
@ -62,89 +63,101 @@ def CreateCoProcessor():
|
||||
# setup the data processing pipelines
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# a producer from a simulation input
|
||||
input1 = coprocessor.CreateProducer(datadescription, 'mesh')
|
||||
# create a new 'XML MultiBlock Data Reader'
|
||||
# create a producer from a simulation input
|
||||
regionmesh = coprocessor.CreateProducer(datadescription, 'region/mesh')
|
||||
|
||||
# cellMask [0,1]
|
||||
threshold1 = Threshold(Input=input1)
|
||||
threshold1.Scalars = ['CELLS', 'cellMask']
|
||||
threshold1.ThresholdRange = [0.9, 1.1]
|
||||
# create a new 'Slice'
|
||||
slice1 = Slice(Input=regionmesh)
|
||||
slice1.SliceType = 'Plane'
|
||||
slice1.SliceOffsetValues = [0.0]
|
||||
|
||||
# init the 'Plane' selected for 'SliceType'
|
||||
slice1.SliceType.Origin = [0.01, 0.005, 0.005]
|
||||
slice1.SliceType.Normal = [0.0, 0.0, 1.0]
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# setup the visualization in view 'renderView1'
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# show data from threshold1
|
||||
threshold1Display = Show(threshold1, renderView1)
|
||||
# show data from slice1
|
||||
slice1Display = Show(slice1, renderView1)
|
||||
|
||||
# get color transfer function/color map for 'cellTypes'
|
||||
cellTypesLUT = GetColorTransferFunction('cellTypes')
|
||||
cellTypesLUT.RGBPoints = [0.0, 0.231373, 0.298039, 0.752941, 1.000244140625, 0.865003, 0.865003, 0.865003, 2.00048828125, 0.705882, 0.0156863, 0.14902]
|
||||
cellTypesLUT.ScalarRangeInitialized = 1.0
|
||||
|
||||
# get opacity transfer function/opacity map for 'cellTypes'
|
||||
cellTypesPWF = GetOpacityTransferFunction('cellTypes')
|
||||
cellTypesPWF.Points = [0.0, 0.0, 0.5, 0.0, 2.00048828125, 1.0, 0.5, 0.0]
|
||||
cellTypesPWF.ScalarRangeInitialized = 1
|
||||
# get color transfer function/color map for 'p'
|
||||
pLUT = GetColorTransferFunction('p')
|
||||
pLUT.RGBPoints = [-0.2227432131767273, 0.231373, 0.298039, 0.752941, 0.0011433586478233337, 0.865003, 0.865003, 0.865003, 0.22502993047237396, 0.705882, 0.0156863, 0.14902]
|
||||
pLUT.ScalarRangeInitialized = 1.0
|
||||
|
||||
# trace defaults for the display properties.
|
||||
threshold1Display.Representation = 'Surface With Edges'
|
||||
threshold1Display.ColorArrayName = ['CELLS', 'cellTypes']
|
||||
threshold1Display.LookupTable = cellTypesLUT
|
||||
threshold1Display.OSPRayScaleArray = 'U'
|
||||
threshold1Display.OSPRayScaleFunction = 'PiecewiseFunction'
|
||||
threshold1Display.SelectOrientationVectors = 'None'
|
||||
threshold1Display.ScaleFactor = 0.0019999999552965165
|
||||
threshold1Display.SelectScaleArray = 'None'
|
||||
threshold1Display.GlyphType = 'Arrow'
|
||||
threshold1Display.GlyphTableIndexArray = 'None'
|
||||
threshold1Display.GaussianRadius = 9.999999776482583e-05
|
||||
threshold1Display.SetScaleArray = ['POINTS', 'U']
|
||||
threshold1Display.ScaleTransferFunction = 'PiecewiseFunction'
|
||||
threshold1Display.OpacityArray = ['POINTS', 'U']
|
||||
threshold1Display.OpacityTransferFunction = 'PiecewiseFunction'
|
||||
threshold1Display.DataAxesGrid = 'GridAxesRepresentation'
|
||||
threshold1Display.SelectionCellLabelFontFile = ''
|
||||
threshold1Display.SelectionPointLabelFontFile = ''
|
||||
threshold1Display.PolarAxes = 'PolarAxesRepresentation'
|
||||
threshold1Display.ScalarOpacityFunction = cellTypesPWF
|
||||
threshold1Display.ScalarOpacityUnitDistance = 0.0017065741933059136
|
||||
slice1Display.Representation = 'Surface'
|
||||
slice1Display.ColorArrayName = ['POINTS', 'p']
|
||||
slice1Display.LookupTable = pLUT
|
||||
slice1Display.OSPRayScaleArray = 'U'
|
||||
slice1Display.OSPRayScaleFunction = 'PiecewiseFunction'
|
||||
slice1Display.SelectOrientationVectors = 'None'
|
||||
slice1Display.ScaleFactor = 0.0019999999552965165
|
||||
slice1Display.SelectScaleArray = 'None'
|
||||
slice1Display.GlyphType = 'Arrow'
|
||||
slice1Display.GlyphTableIndexArray = 'None'
|
||||
slice1Display.GaussianRadius = 9.999999776482583e-05
|
||||
slice1Display.SetScaleArray = ['POINTS', 'U']
|
||||
slice1Display.ScaleTransferFunction = 'PiecewiseFunction'
|
||||
slice1Display.OpacityArray = ['POINTS', 'U']
|
||||
slice1Display.OpacityTransferFunction = 'PiecewiseFunction'
|
||||
slice1Display.DataAxesGrid = 'GridAxesRepresentation'
|
||||
slice1Display.SelectionCellLabelFontFile = ''
|
||||
slice1Display.SelectionPointLabelFontFile = ''
|
||||
slice1Display.PolarAxes = 'PolarAxesRepresentation'
|
||||
|
||||
# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
|
||||
threshold1Display.ScaleTransferFunction.Points = [-0.2505497634410858, 0.0, 0.5, 0.0, 0.3270378112792969, 1.0, 0.5, 0.0]
|
||||
slice1Display.ScaleTransferFunction.Points = [-0.2436095029115677, 0.0, 0.5, 0.0, 0.2753259241580963, 1.0, 0.5, 0.0]
|
||||
|
||||
# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
|
||||
threshold1Display.OpacityTransferFunction.Points = [-0.2505497634410858, 0.0, 0.5, 0.0, 0.3270378112792969, 1.0, 0.5, 0.0]
|
||||
slice1Display.OpacityTransferFunction.Points = [-0.2436095029115677, 0.0, 0.5, 0.0, 0.2753259241580963, 1.0, 0.5, 0.0]
|
||||
|
||||
# init the 'GridAxesRepresentation' selected for 'DataAxesGrid'
|
||||
threshold1Display.DataAxesGrid.XTitleFontFile = ''
|
||||
threshold1Display.DataAxesGrid.YTitleFontFile = ''
|
||||
threshold1Display.DataAxesGrid.ZTitleFontFile = ''
|
||||
threshold1Display.DataAxesGrid.XLabelFontFile = ''
|
||||
threshold1Display.DataAxesGrid.YLabelFontFile = ''
|
||||
threshold1Display.DataAxesGrid.ZLabelFontFile = ''
|
||||
slice1Display.DataAxesGrid.XTitleFontFile = ''
|
||||
slice1Display.DataAxesGrid.YTitleFontFile = ''
|
||||
slice1Display.DataAxesGrid.ZTitleFontFile = ''
|
||||
slice1Display.DataAxesGrid.XLabelFontFile = ''
|
||||
slice1Display.DataAxesGrid.YLabelFontFile = ''
|
||||
slice1Display.DataAxesGrid.ZLabelFontFile = ''
|
||||
|
||||
# init the 'PolarAxesRepresentation' selected for 'PolarAxes'
|
||||
threshold1Display.PolarAxes.PolarAxisTitleFontFile = ''
|
||||
threshold1Display.PolarAxes.PolarAxisLabelFontFile = ''
|
||||
threshold1Display.PolarAxes.LastRadialAxisTextFontFile = ''
|
||||
threshold1Display.PolarAxes.SecondaryRadialAxesTextFontFile = ''
|
||||
slice1Display.PolarAxes.PolarAxisTitleFontFile = ''
|
||||
slice1Display.PolarAxes.PolarAxisLabelFontFile = ''
|
||||
slice1Display.PolarAxes.LastRadialAxisTextFontFile = ''
|
||||
slice1Display.PolarAxes.SecondaryRadialAxesTextFontFile = ''
|
||||
|
||||
# setup the color legend parameters for each legend in this view
|
||||
|
||||
# get color legend/bar for cellTypesLUT in view renderView1
|
||||
cellTypesLUTColorBar = GetScalarBar(cellTypesLUT, renderView1)
|
||||
cellTypesLUTColorBar.Title = 'cellTypes'
|
||||
cellTypesLUTColorBar.ComponentTitle = ''
|
||||
cellTypesLUTColorBar.TitleFontFile = ''
|
||||
cellTypesLUTColorBar.LabelFontFile = ''
|
||||
# get color legend/bar for pLUT in view renderView1
|
||||
pLUTColorBar = GetScalarBar(pLUT, renderView1)
|
||||
pLUTColorBar.Title = 'p'
|
||||
pLUTColorBar.ComponentTitle = ''
|
||||
pLUTColorBar.TitleFontFile = ''
|
||||
pLUTColorBar.LabelFontFile = ''
|
||||
|
||||
# set color bar visibility
|
||||
cellTypesLUTColorBar.Visibility = 1
|
||||
pLUTColorBar.Visibility = 1
|
||||
|
||||
# show color legend
|
||||
threshold1Display.SetScalarBarVisibility(renderView1, True)
|
||||
slice1Display.SetScalarBarVisibility(renderView1, True)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# setup color maps and opacity mapes used in the visualization
|
||||
# note: the Get..() functions create a new object, if needed
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# get opacity transfer function/opacity map for 'p'
|
||||
pPWF = GetOpacityTransferFunction('p')
|
||||
pPWF.Points = [-0.2227432131767273, 0.0, 0.5, 0.0, 0.22502993047237396, 1.0, 0.5, 0.0]
|
||||
pPWF.ScalarRangeInitialized = 1
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# finally, restore active source
|
||||
SetActiveSource(slice1)
|
||||
# ----------------------------------------------------------------
|
||||
return Pipeline()
|
||||
|
||||
class CoProcessor(coprocessing.CoProcessor):
|
||||
@ -152,8 +165,8 @@ def CreateCoProcessor():
|
||||
self.Pipeline = _CreatePipeline(self, datadescription)
|
||||
|
||||
coprocessor = CoProcessor()
|
||||
# Frequencies at which the coprocessor updates.
|
||||
freqs = {'mesh': [1, 1, 1]}
|
||||
# these are the frequencies at which the coprocessor updates.
|
||||
freqs = {'region/mesh': [1, 1, 1]}
|
||||
coprocessor.SetUpdateFrequencies(freqs)
|
||||
return coprocessor
|
||||
|
||||
@ -167,7 +180,7 @@ coprocessor = CreateCoProcessor()
|
||||
|
||||
#--------------------------------------------------------------
|
||||
# Enable Live-Visualizaton with ParaView and the update frequency
|
||||
coprocessor.EnableLiveVisualization(True, 1)
|
||||
coprocessor.EnableLiveVisualization(False, 1)
|
||||
|
||||
# ---------------------- Data Selection method ----------------------
|
||||
|
||||
@ -0,0 +1,233 @@
|
||||
|
||||
from paraview.simple import *
|
||||
from paraview import coprocessing
|
||||
|
||||
|
||||
#--------------------------------------------------------------
|
||||
# Code generated from cpstate.py to create the CoProcessor.
|
||||
# paraview version 5.5.0
|
||||
|
||||
#--------------------------------------------------------------
|
||||
# Global screenshot output options
|
||||
imageFileNamePadding=4
|
||||
rescale_lookuptable=False
|
||||
|
||||
|
||||
# ----------------------- CoProcessor definition -----------------------
|
||||
|
||||
def CreateCoProcessor():
|
||||
def _CreatePipeline(coprocessor, datadescription):
|
||||
class Pipeline:
|
||||
# state file generated using paraview version 5.5.0
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# setup views used in the visualization
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# trace generated using paraview version 5.5.0
|
||||
|
||||
#### disable automatic camera reset on 'Show'
|
||||
paraview.simple._DisableFirstRenderCameraReset()
|
||||
|
||||
# Create a new 'Render View'
|
||||
renderView1 = CreateView('RenderView')
|
||||
renderView1.ViewSize = [1091, 766]
|
||||
renderView1.AxesGrid = 'GridAxes3DActor'
|
||||
renderView1.CenterOfRotation = [0.009999999776482582, 0.004999999888241291, 0.004999999888241291]
|
||||
renderView1.StereoType = 0
|
||||
renderView1.CameraPosition = [0.009999999776482582, 0.004999999888241291, 0.05232050690623429]
|
||||
renderView1.CameraFocalPoint = [0.009999999776482582, 0.004999999888241291, 0.004999999888241291]
|
||||
renderView1.CameraParallelScale = 0.01224744844016408
|
||||
renderView1.CameraParallelProjection = 1
|
||||
renderView1.Background = [0, 0, 0]
|
||||
|
||||
# init the 'GridAxes3DActor' selected for 'AxesGrid'
|
||||
renderView1.AxesGrid.XTitleFontFile = ''
|
||||
renderView1.AxesGrid.YTitleFontFile = ''
|
||||
renderView1.AxesGrid.ZTitleFontFile = ''
|
||||
renderView1.AxesGrid.XLabelFontFile = ''
|
||||
renderView1.AxesGrid.YLabelFontFile = ''
|
||||
renderView1.AxesGrid.ZLabelFontFile = ''
|
||||
|
||||
# register the view with coprocessor
|
||||
# and provide it with information such as the filename to use,
|
||||
# how frequently to write the images, etc.
|
||||
coprocessor.RegisterView(renderView1,
|
||||
filename='vorticity_%t.png', freq=1, fittoscreen=0, magnification=1, width=1091, height=766, cinema={})
|
||||
renderView1.ViewTime = datadescription.GetTime()
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# restore active view
|
||||
SetActiveView(renderView1)
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# setup the data processing pipelines
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# create a new 'XML MultiBlock Data Reader'
|
||||
# create a producer from a simulation input
|
||||
regionmesh = coprocessor.CreateProducer(datadescription, 'region/mesh')
|
||||
|
||||
# create a new 'Slice'
|
||||
slice1 = Slice(Input=regionmesh)
|
||||
slice1.SliceType = 'Plane'
|
||||
slice1.SliceOffsetValues = [0.0]
|
||||
|
||||
# init the 'Plane' selected for 'SliceType'
|
||||
slice1.SliceType.Origin = [0.01, 0.005, 0.005]
|
||||
slice1.SliceType.Normal = [0.0, 0.0, 1.0]
|
||||
|
||||
# create a new 'Stream Tracer'
|
||||
streamTracer1 = StreamTracer(Input=slice1,
|
||||
SeedType='High Resolution Line Source')
|
||||
streamTracer1.Vectors = ['POINTS', 'U']
|
||||
streamTracer1.MaximumStreamlineLength = 0.019999999552965164
|
||||
|
||||
# init the 'High Resolution Line Source' selected for 'SeedType'
|
||||
streamTracer1.SeedType.Point1 = [0.0, 0.0, 0.005]
|
||||
streamTracer1.SeedType.Point2 = [0.02, 0.01, 0.005]
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# setup the visualization in view 'renderView1'
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# show data from streamTracer1
|
||||
streamTracer1Display = Show(streamTracer1, renderView1)
|
||||
|
||||
# get color transfer function/color map for 'Vorticity'
|
||||
vorticityLUT = GetColorTransferFunction('Vorticity')
|
||||
vorticityLUT.RGBPoints = [0.0, 0.229806, 0.298718, 0.753683, 37.5, 0.303869, 0.406535, 0.844959, 75.0, 0.383013, 0.509419, 0.917388, 112.5, 0.466667, 0.604563, 0.968155, 150.0, 0.552953, 0.688929, 0.995376, 187.5, 0.639176, 0.7596, 0.998151, 225.0, 0.722193, 0.813953, 0.976575, 262.5, 0.798692, 0.849786, 0.931689, 300.0, 0.865395, 0.86541, 0.865396, 337.5, 0.924128, 0.827385, 0.774508, 375.0, 0.958853, 0.769768, 0.678008, 412.5, 0.969954, 0.694267, 0.579375, 450.0, 0.958003, 0.602842, 0.481776, 487.50000000000006, 0.923945, 0.497309, 0.38797, 525.0, 0.869187, 0.378313, 0.300267, 562.5, 0.795632, 0.241284, 0.220526, 600.0, 0.705673, 0.0155562, 0.150233]
|
||||
vorticityLUT.ColorSpace = 'Lab'
|
||||
vorticityLUT.ScalarRangeInitialized = 1.0
|
||||
|
||||
# trace defaults for the display properties.
|
||||
streamTracer1Display.Representation = 'Surface'
|
||||
streamTracer1Display.ColorArrayName = ['POINTS', 'Vorticity']
|
||||
streamTracer1Display.LookupTable = vorticityLUT
|
||||
streamTracer1Display.OSPRayScaleArray = 'AngularVelocity'
|
||||
streamTracer1Display.OSPRayScaleFunction = 'PiecewiseFunction'
|
||||
streamTracer1Display.SelectOrientationVectors = 'Normals'
|
||||
streamTracer1Display.ScaleFactor = 0.001999993808567524
|
||||
streamTracer1Display.SelectScaleArray = 'AngularVelocity'
|
||||
streamTracer1Display.GlyphType = 'Arrow'
|
||||
streamTracer1Display.GlyphTableIndexArray = 'AngularVelocity'
|
||||
streamTracer1Display.GaussianRadius = 9.99996904283762e-05
|
||||
streamTracer1Display.SetScaleArray = ['POINTS', 'AngularVelocity']
|
||||
streamTracer1Display.ScaleTransferFunction = 'PiecewiseFunction'
|
||||
streamTracer1Display.OpacityArray = ['POINTS', 'AngularVelocity']
|
||||
streamTracer1Display.OpacityTransferFunction = 'PiecewiseFunction'
|
||||
streamTracer1Display.DataAxesGrid = 'GridAxesRepresentation'
|
||||
streamTracer1Display.SelectionCellLabelFontFile = ''
|
||||
streamTracer1Display.SelectionPointLabelFontFile = ''
|
||||
streamTracer1Display.PolarAxes = 'PolarAxesRepresentation'
|
||||
|
||||
# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
|
||||
streamTracer1Display.ScaleTransferFunction.Points = [-1.1626180405813291e-11, 0.0, 0.5, 0.0, 1.7840937690112886e-11, 1.0, 0.5, 0.0]
|
||||
|
||||
# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
|
||||
streamTracer1Display.OpacityTransferFunction.Points = [-1.1626180405813291e-11, 0.0, 0.5, 0.0, 1.7840937690112886e-11, 1.0, 0.5, 0.0]
|
||||
|
||||
# init the 'GridAxesRepresentation' selected for 'DataAxesGrid'
|
||||
streamTracer1Display.DataAxesGrid.XTitleFontFile = ''
|
||||
streamTracer1Display.DataAxesGrid.YTitleFontFile = ''
|
||||
streamTracer1Display.DataAxesGrid.ZTitleFontFile = ''
|
||||
streamTracer1Display.DataAxesGrid.XLabelFontFile = ''
|
||||
streamTracer1Display.DataAxesGrid.YLabelFontFile = ''
|
||||
streamTracer1Display.DataAxesGrid.ZLabelFontFile = ''
|
||||
|
||||
# init the 'PolarAxesRepresentation' selected for 'PolarAxes'
|
||||
streamTracer1Display.PolarAxes.PolarAxisTitleFontFile = ''
|
||||
streamTracer1Display.PolarAxes.PolarAxisLabelFontFile = ''
|
||||
streamTracer1Display.PolarAxes.LastRadialAxisTextFontFile = ''
|
||||
streamTracer1Display.PolarAxes.SecondaryRadialAxesTextFontFile = ''
|
||||
|
||||
# setup the color legend parameters for each legend in this view
|
||||
|
||||
# get color legend/bar for vorticityLUT in view renderView1
|
||||
vorticityLUTColorBar = GetScalarBar(vorticityLUT, renderView1)
|
||||
vorticityLUTColorBar.Title = 'Vorticity'
|
||||
vorticityLUTColorBar.ComponentTitle = 'Magnitude'
|
||||
vorticityLUTColorBar.TitleFontFile = ''
|
||||
vorticityLUTColorBar.LabelFontFile = ''
|
||||
|
||||
# set color bar visibility
|
||||
vorticityLUTColorBar.Visibility = 1
|
||||
|
||||
# show color legend
|
||||
streamTracer1Display.SetScalarBarVisibility(renderView1, True)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# setup color maps and opacity mapes used in the visualization
|
||||
# note: the Get..() functions create a new object, if needed
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# get opacity transfer function/opacity map for 'Vorticity'
|
||||
vorticityPWF = GetOpacityTransferFunction('Vorticity')
|
||||
vorticityPWF.Points = [0.0, 0.0, 0.5, 0.0, 600.0, 1.0, 0.5, 0.0]
|
||||
vorticityPWF.ScalarRangeInitialized = 1
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# finally, restore active source
|
||||
SetActiveSource(streamTracer1)
|
||||
# ----------------------------------------------------------------
|
||||
return Pipeline()
|
||||
|
||||
class CoProcessor(coprocessing.CoProcessor):
|
||||
def CreatePipeline(self, datadescription):
|
||||
self.Pipeline = _CreatePipeline(self, datadescription)
|
||||
|
||||
coprocessor = CoProcessor()
|
||||
# these are the frequencies at which the coprocessor updates.
|
||||
freqs = {'region/mesh': [1, 1, 1]}
|
||||
coprocessor.SetUpdateFrequencies(freqs)
|
||||
return coprocessor
|
||||
|
||||
|
||||
#--------------------------------------------------------------
|
||||
# Global variable that will hold the pipeline for each timestep
|
||||
# Creating the CoProcessor object, doesn't actually create the ParaView pipeline.
|
||||
# It will be automatically setup when coprocessor.UpdateProducers() is called the
|
||||
# first time.
|
||||
coprocessor = CreateCoProcessor()
|
||||
|
||||
#--------------------------------------------------------------
|
||||
# Enable Live-Visualizaton with ParaView and the update frequency
|
||||
coprocessor.EnableLiveVisualization(True, 1)
|
||||
|
||||
# ---------------------- Data Selection method ----------------------
|
||||
|
||||
def RequestDataDescription(datadescription):
|
||||
"Callback to populate the request for current timestep"
|
||||
global coprocessor
|
||||
if datadescription.GetForceOutput() == True:
|
||||
# We are just going to request all fields and meshes from the simulation
|
||||
# code/adaptor.
|
||||
for i in range(datadescription.GetNumberOfInputDescriptions()):
|
||||
datadescription.GetInputDescription(i).AllFieldsOn()
|
||||
datadescription.GetInputDescription(i).GenerateMeshOn()
|
||||
return
|
||||
|
||||
# setup requests for all inputs based on the requirements of the
|
||||
# pipeline.
|
||||
coprocessor.LoadRequestedData(datadescription)
|
||||
|
||||
# ------------------------ Processing method ------------------------
|
||||
|
||||
def DoCoProcessing(datadescription):
|
||||
"Callback to do co-processing for current timestep"
|
||||
global coprocessor
|
||||
|
||||
# Update the coprocessor by providing it the newly generated simulation data.
|
||||
# If the pipeline hasn't been setup yet, this will setup the pipeline.
|
||||
coprocessor.UpdateProducers(datadescription)
|
||||
|
||||
# Write output data, if appropriate.
|
||||
coprocessor.WriteData(datadescription);
|
||||
|
||||
# Write image capture (Last arg: rescale lookup table), if appropriate.
|
||||
coprocessor.WriteImages(datadescription, rescale_lookuptable=rescale_lookuptable,
|
||||
image_quality=0, padding_amount=imageFileNamePadding)
|
||||
|
||||
# Live Visualization, if enabled.
|
||||
coprocessor.DoLiveVisualization(datadescription, "localhost", 22222)
|
||||
@ -18,13 +18,8 @@ def CreateCoProcessor():
|
||||
# a producer from a simulation input
|
||||
input1 = coprocessor.CreateProducer(datadescription, 'mesh')
|
||||
|
||||
# cellMask [0,1]
|
||||
threshold1 = Threshold(Input=input1)
|
||||
threshold1.Scalars = ['CELLS', 'cellMask']
|
||||
threshold1.ThresholdRange = [0.9, 1.1]
|
||||
|
||||
writer1 = servermanager.writers.XMLMultiBlockDataWriter(Input=threshold1)
|
||||
coprocessor.RegisterWriter(writer1, filename='insitu/overset_%t.vtm', freq=1, paddingamount=0)
|
||||
writer1 = servermanager.writers.XMLMultiBlockDataWriter(Input=input1)
|
||||
coprocessor.RegisterWriter(writer1, filename='insitu/mesh_%t.vtm', freq=1, paddingamount=0)
|
||||
|
||||
return Pipeline()
|
||||
|
||||
Reference in New Issue
Block a user