Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: 3D Elasticity #41

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions examples/linelast/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ file(COPY config/linelast.comp_train.h5 DESTINATION ${CMAKE_BINARY_DIR}/examples
file(COPY linelast.opt_comp_train.yml DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast)
file(COPY linelast.opt_comp_fom.yml DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast)
file(COPY config/linelast.optfom.h5 DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/config)
file(COPY config/linelast.simpleL3D.h5 DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/config)
file(COPY linelast.simpleL3D.yml DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast)
file(COPY config/linelast.3dcwfom.h5 DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/config)
file(COPY config/linelast.3dcw_train0.h5 DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/config)
file(COPY config/linelast.3dcw_train1.h5 DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/config)
file(COPY config/linelast.3dcw_train2.h5 DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/config)
file(COPY config/linelast.3dcw_train3.h5 DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/config)
file(COPY linelast.3dcw_fom.yml DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast)
file(COPY linelast.3dcw_comp_train.yml DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast)


file(COPY meshes/beam-tri.mesh DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/meshes)
file(COPY meshes/beam-tet.mesh DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/meshes)
Expand All @@ -21,3 +31,9 @@ file(COPY meshes/rod2D_V.mesh DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/
file(COPY meshes/optjoint.mesh DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/meshes)
file(COPY meshes/optbeam.mesh DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/meshes)
file(COPY meshes/optcol.mesh DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/meshes)
file(COPY meshes/3d_joint.mesh DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/meshes)
file(COPY meshes/3d_beam.mesh DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/meshes)
file(COPY meshes/3d_col.mesh DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/meshes)
file(COPY meshes/3dcw_joint.mesh DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/meshes)
file(COPY meshes/3dcw_beamH.mesh DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/meshes)
file(COPY meshes/3dcw_beamV.mesh DESTINATION ${CMAKE_BINARY_DIR}/examples/linelast/meshes)
89 changes: 89 additions & 0 deletions examples/linelast/apply_warp_by_vector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# trace generated using paraview version 5.11.2
#import paraview
#paraview.compatibility.major = 5
#paraview.compatibility.minor = 11


def apply_warpvector(filename):
# find source
srcsol = FindSource(filename)
# set active source
SetActiveSource(srcsol)

# get color transfer function/color map for 'solution'
solutionLUT = GetColorTransferFunction('solution')

# get opacity transfer function/opacity map for 'solution'
solutionPWF = GetOpacityTransferFunction('solution')

# get 2D transfer function for 'solution'
solutionTF2D = GetTransferFunction2D('solution')

# get active view
renderView1 = GetActiveViewOrCreate('RenderView')

# get display properties
srcsolDisplay = GetDisplayProperties(srcsol, view=renderView1)

# create a new 'Warp By Vector'
warpByVector = WarpByVector(registrationName='WarpByVector_'+filename, Input=srcsol)
warpByVector.Vectors = ['POINTS', 'solution']

# set active source
SetActiveSource(warpByVector)

# show data in view
warpByVectorDisplay = Show(warpByVector, renderView1, 'UnstructuredGridRepresentation')

# trace defaults for the display properties.
warpByVectorDisplay.Representation = 'Surface'
warpByVectorDisplay.ColorArrayName = ['POINTS', 'solution']
warpByVectorDisplay.LookupTable = solutionLUT
warpByVectorDisplay.SelectTCoordArray = 'None'
warpByVectorDisplay.SelectNormalArray = 'None'
warpByVectorDisplay.SelectTangentArray = 'None'
warpByVectorDisplay.OSPRayScaleArray = 'solution'
warpByVectorDisplay.OSPRayScaleFunction = 'PiecewiseFunction'
warpByVectorDisplay.SelectOrientationVectors = 'None'
warpByVectorDisplay.ScaleFactor = 1.0034994557994217
warpByVectorDisplay.SelectScaleArray = 'None'
warpByVectorDisplay.GlyphType = 'Arrow'
warpByVectorDisplay.GlyphTableIndexArray = 'None'
warpByVectorDisplay.GaussianRadius = 0.05017497278997109
warpByVectorDisplay.SetScaleArray = ['POINTS', 'solution']
warpByVectorDisplay.ScaleTransferFunction = 'PiecewiseFunction'
warpByVectorDisplay.OpacityArray = ['POINTS', 'solution']
warpByVectorDisplay.OpacityTransferFunction = 'PiecewiseFunction'
warpByVectorDisplay.DataAxesGrid = 'GridAxesRepresentation'
warpByVectorDisplay.PolarAxes = 'PolarAxesRepresentation'
warpByVectorDisplay.ScalarOpacityFunction = solutionPWF
warpByVectorDisplay.ScalarOpacityUnitDistance = 1.2815333878254977
warpByVectorDisplay.OpacityArrayName = ['POINTS', 'solution']
warpByVectorDisplay.SelectInputVectors = ['POINTS', 'solution']
warpByVectorDisplay.WriteLog = ''

# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
warpByVectorDisplay.ScaleTransferFunction.Points = [-0.01822456776713409, 0.0, 0.5, 0.0, 0.01827591453119054, 1.0, 0.5, 0.0]

# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
warpByVectorDisplay.OpacityTransferFunction.Points = [-0.01822456776713409, 0.0, 0.5, 0.0, 0.01827591453119054, 1.0, 0.5, 0.0]

# show color bar/color legend
warpByVectorDisplay.SetScalarBarVisibility(renderView1, True)

# hide data in view
Hide(srcsol, renderView1)

#### import the simple module from the paraview
from paraview.simple import *
import os
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

root_dir = '/Users/larsson4/repos/scaleupROM/build/examples/linelast'
prefix = "paraview_output"
os.chdir(root_dir)
filenames = [str(f)+'.pvd' for f in os.listdir('.') if os.path.isdir(f) and '_'.join(f.split('_')[0:-1]) == prefix]
for filename in filenames:
print(filename)
apply_warpvector(filename)
Binary file added examples/linelast/config/linelast.3dcw_train0.h5
Binary file not shown.
Binary file added examples/linelast/config/linelast.3dcw_train1.h5
Binary file not shown.
Binary file added examples/linelast/config/linelast.3dcw_train2.h5
Binary file not shown.
Binary file added examples/linelast/config/linelast.3dcw_train3.h5
Binary file not shown.
Binary file added examples/linelast/config/linelast.3dcwfom.h5
Binary file not shown.
Binary file added examples/linelast/config/linelast.simpleL3D.h5
Binary file not shown.
Loading
Loading