diff --git a/data/input_files/.gitignore b/data/input_files/.gitignore deleted file mode 100644 index 024004d..0000000 --- a/data/input_files/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.h5 -*.inp -!.gitignore diff --git a/data/results/mat_parameters1.pdf b/data/results/mat_parameters1.pdf deleted file mode 100644 index 23f7f22..0000000 Binary files a/data/results/mat_parameters1.pdf and /dev/null differ diff --git a/data/results/mat_parameters2.pdf b/data/results/mat_parameters2.pdf deleted file mode 100644 index c491c12..0000000 Binary files a/data/results/mat_parameters2.pdf and /dev/null differ diff --git a/data/results/sig0_parameter.pdf b/data/results/sig0_parameter.pdf deleted file mode 100644 index 264e2b5..0000000 Binary files a/data/results/sig0_parameter.pdf and /dev/null differ diff --git a/data/validation/.gitignore b/data/validation/.gitignore deleted file mode 100644 index 111c26e..0000000 --- a/data/validation/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.h5 -!.gitignore diff --git a/data/vtk-notch/.gitignore b/data/vtk-notch/.gitignore deleted file mode 100644 index 925be04..0000000 --- a/data/vtk-notch/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.h5 -*.odb -*.res -*.vtk -!.gitignore diff --git a/data/vtk/.gitignore b/data/vtk/.gitignore deleted file mode 100644 index 925be04..0000000 --- a/data/vtk/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.h5 -*.odb -*.res -*.vtk -!.gitignore diff --git a/data/vtk/postprocess_ntfa_293-800.py b/data/vtk/postprocess_ntfa_293-800.py deleted file mode 100644 index 5d17078..0000000 --- a/data/vtk/postprocess_ntfa_293-800.py +++ /dev/null @@ -1,189 +0,0 @@ -# trace generated using paraview version 5.10.0-RC1 -# import paraview -# paraview.compatibility.major = 5 -# paraview.compatibility.minor = 10 - -# import the simple module from the paraview -from paraview.simple import * -import glob - -# disable automatic camera reset on 'Show' -paraview.simple._DisableFirstRenderCameraReset() - -directory = r"/home/julius/bwSyncShare/FNO/vtk/" - -# create a new 'Legacy VTK Reader' -nTFA293K_fine_temp_293800_ = LegacyVTKReader( - registrationName="NTFA293K_fine_temp_293-800_*", - FileNames=glob.glob(directory + "NTFA293K_fine_temp_293-800_*.vtk"), -) - -# get animation scene -animationScene1 = GetAnimationScene() - -# update animation scene based on data timesteps -animationScene1.UpdateAnimationUsingDataTimeSteps() - -# get active view -renderView1 = GetActiveViewOrCreate("RenderView") - -# show data in view -nTFA293K_fine_temp_293800_Display = Show( - nTFA293K_fine_temp_293800_, renderView1, "UnstructuredGridRepresentation" -) - -# get color transfer function/color map for 'DISPLACEMENTS' -dISPLACEMENTSLUT = GetColorTransferFunction("DISPLACEMENTS") - -# get opacity transfer function/opacity map for 'DISPLACEMENTS' -dISPLACEMENTSPWF = GetOpacityTransferFunction("DISPLACEMENTS") - -# trace defaults for the display properties. -nTFA293K_fine_temp_293800_Display.Representation = "Surface" -nTFA293K_fine_temp_293800_Display.ColorArrayName = ["POINTS", "DISPLACEMENTS"] -nTFA293K_fine_temp_293800_Display.LookupTable = dISPLACEMENTSLUT -nTFA293K_fine_temp_293800_Display.SelectTCoordArray = "None" -nTFA293K_fine_temp_293800_Display.SelectNormalArray = "None" -nTFA293K_fine_temp_293800_Display.SelectTangentArray = "None" -nTFA293K_fine_temp_293800_Display.OSPRayScaleArray = "DISPLACEMENTS" -nTFA293K_fine_temp_293800_Display.OSPRayScaleFunction = "PiecewiseFunction" -nTFA293K_fine_temp_293800_Display.SelectOrientationVectors = "DISPLACEMENTS" -nTFA293K_fine_temp_293800_Display.ScaleFactor = 11.0 -nTFA293K_fine_temp_293800_Display.SelectScaleArray = "DISPLACEMENTS" -nTFA293K_fine_temp_293800_Display.GlyphType = "Arrow" -nTFA293K_fine_temp_293800_Display.GlyphTableIndexArray = "DISPLACEMENTS" -nTFA293K_fine_temp_293800_Display.GaussianRadius = 0.55 -nTFA293K_fine_temp_293800_Display.SetScaleArray = ["POINTS", "DISPLACEMENTS"] -nTFA293K_fine_temp_293800_Display.ScaleTransferFunction = "PiecewiseFunction" -nTFA293K_fine_temp_293800_Display.OpacityArray = ["POINTS", "DISPLACEMENTS"] -nTFA293K_fine_temp_293800_Display.OpacityTransferFunction = "PiecewiseFunction" -nTFA293K_fine_temp_293800_Display.DataAxesGrid = "GridAxesRepresentation" -nTFA293K_fine_temp_293800_Display.PolarAxes = "PolarAxesRepresentation" -nTFA293K_fine_temp_293800_Display.ScalarOpacityFunction = dISPLACEMENTSPWF -nTFA293K_fine_temp_293800_Display.ScalarOpacityUnitDistance = 2.6566498575704793 -nTFA293K_fine_temp_293800_Display.OpacityArrayName = ["POINTS", "DISPLACEMENTS"] - -# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction' -nTFA293K_fine_temp_293800_Display.ScaleTransferFunction.Points = [ - 0.0, - 0.0, - 0.5, - 0.0, - 1.1757813367477812e-38, - 1.0, - 0.5, - 0.0, -] - -# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction' -nTFA293K_fine_temp_293800_Display.OpacityTransferFunction.Points = [ - 0.0, - 0.0, - 0.5, - 0.0, - 1.1757813367477812e-38, - 1.0, - 0.5, - 0.0, -] - -# reset view to fit data -renderView1.ResetCamera(False) - -# show color bar/color legend -nTFA293K_fine_temp_293800_Display.SetScalarBarVisibility(renderView1, True) - -# update the view to ensure updated data information -renderView1.Update() - -animationScene1.GoToLast() - -# set scalar coloring -ColorBy(nTFA293K_fine_temp_293800_Display, ("CELLS", "QBAR")) - -# Hide the scalar bar for this color map if no visible data is colored by it. -HideScalarBarIfNotNeeded(dISPLACEMENTSLUT, renderView1) - -# rescale color and/or opacity maps used to include current data range -nTFA293K_fine_temp_293800_Display.RescaleTransferFunctionToDataRange(True, False) - -# show color bar/color legend -nTFA293K_fine_temp_293800_Display.SetScalarBarVisibility(renderView1, True) - -# get color transfer function/color map for 'QBAR' -qBARLUT = GetColorTransferFunction("QBAR") - -# get opacity transfer function/opacity map for 'QBAR' -qBARPWF = GetOpacityTransferFunction("QBAR") - -# Rescale transfer function -qBARLUT.RescaleTransferFunction(0.01, 0.08) - -# Rescale transfer function -qBARPWF.RescaleTransferFunction(0.01, 0.08) - -# Rescale transfer function -qBARLUT.RescaleTransferFunction(0.01, 0.06) - -# Rescale transfer function -qBARPWF.RescaleTransferFunction(0.01, 0.06) - -# Apply a preset using its name. Note this may not work as expected when presets have duplicate names. -qBARLUT.ApplyPreset("Rainbow Uniform", True) - -# get color legend/bar for qBARLUT in view renderView1 -qBARLUTColorBar = GetScalarBar(qBARLUT, renderView1) - -# change scalar bar placement -qBARLUTColorBar.WindowLocation = "Any Location" -qBARLUTColorBar.Position = [0.8985637342908438, 0.32594235033259417] -qBARLUTColorBar.ScalarBarLength = 0.33000000000000035 - -# Properties modified on qBARLUTColorBar -qBARLUTColorBar.Title = "Q" -qBARLUTColorBar.TitleFontFamily = "Times" -qBARLUTColorBar.LabelFontFamily = "Times" - -# hide color bar/color legend -nTFA293K_fine_temp_293800_Display.SetScalarBarVisibility(renderView1, False) - -# show color bar/color legend -nTFA293K_fine_temp_293800_Display.SetScalarBarVisibility(renderView1, True) - -# Properties modified on qBARLUTColorBar -qBARLUTColorBar.ScalarBarThickness = 48 - -# change scalar bar placement -qBARLUTColorBar.Position = [0.8138597869224228, 0.3181818181818181] -qBARLUTColorBar.ScalarBarLength = 0.3300000000000005 - -# Properties modified on renderView1 -renderView1.OrientationAxesVisibility = 0 - -# ================================================================ -# addendum: following script captures some of the application -# state to faithfully reproduce the visualization during playback -# ================================================================ - -# get layout -layout1 = GetLayout() - -# -------------------------------- -# saving layout sizes for layouts - -# layout/tab size in pixels -layout1.SetSize(1216, 902) - -# ----------------------------------- -# saving camera placements for views - -# current camera placement for renderView1 -renderView1.CameraPosition = [0.0, 0.0, 269.2767700257741] -renderView1.CameraFocalPoint = [0.0, 0.0, 2.5] -renderView1.CameraViewUp = [-1.0, 2.220446049250313e-16, 0.0] -renderView1.CameraParallelScale = 57.063561052566634 - -# -------------------------------------------- -# uncomment the following to render all views -# RenderAllViews() -# alternatively, if you want to write images, you can use SaveScreenshot(...). diff --git a/download_data.sh b/download_data.sh new file mode 100644 index 0000000..cc285c1 --- /dev/null +++ b/download_data.sh @@ -0,0 +1,12 @@ +OPTIONS="-q --show-progress" +DATASET=https://darus.uni-stuttgart.de/api/access/datafile/:persistentId\?persistentId\=doi:10.18419/darus-4509 +wget $OPTIONS $DATASET/1 -O results/NTFA293K_coarse_temp_293-800.h5 +wget $OPTIONS $DATASET/2 -O results/NTFA293K_fine_temp_293-800.h5 +wget $OPTIONS $DATASET/3 -O ntfa/ntfa_6loadings_10samples_N12.h5 +wget $OPTIONS $DATASET/4 -O ntfa/ntfa_6loadings_10samples_N18.h5 +wget $OPTIONS $DATASET/5 -O ntfa/ntfa_6loadings_10samples_N24.h5 +wget $OPTIONS $DATASET/7 -O results/reproduction_6loadings_100samples_N12.h5 +wget $OPTIONS $DATASET/8 -O results/reproduction_6loadings_100samples_N18.h5 +wget $OPTIONS $DATASET/9 -O results/reproduction_6loadings_100samples_N24.h5 +wget $OPTIONS $DATASET/10 -O rve/rve_thermoplastic_6loadings_10samples.h5 +wget $OPTIONS $DATASET/11 -O rve/twoscale_notch_rve.h5 diff --git a/examples/material_parameters.ipynb b/examples/material_parameters.ipynb index 46820c1..1c2651c 100644 --- a/examples/material_parameters.ipynb +++ b/examples/material_parameters.ipynb @@ -127,14 +127,6 @@ "stiffness_cu = lambda x: bulk_modulus_cu(x) * IxI + 2.0 * shear_modulus_cu(x) * P2" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "438cfe95", - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "markdown", "id": "49cccd0a", @@ -391,7 +383,7 @@ " gca1.legend(loc=\"upper left\", facecolor=(0.9, 0.9, 0.9, 0.6), edgecolor=\"black\")\n", " gca2.legend(loc=\"center right\", facecolor=(0.9, 0.9, 0.9, 0.6), edgecolor=\"black\")\n", " plt.tight_layout(pad=0.025)\n", - " plt.savefig(os.path.join(data_path, \"results\", f\"{fig_name}.pdf\"))\n", + " plt.savefig(os.path.join(data_path, \"figures\", f\"{fig_name}.pdf\"))\n", " plt.show()" ] }, @@ -520,7 +512,7 @@ " gca1.grid(ls=\"--\", color=\"gray\", linewidth=0.5)\n", " gca1.legend(loc=\"upper right\", facecolor=(0.9, 0.9, 0.9, 0.6), edgecolor=\"black\")\n", " plt.tight_layout(pad=0.025)\n", - " plt.savefig(os.path.join(data_path, \"results\", f\"{fig_name}.pdf\"))\n", + " plt.savefig(os.path.join(data_path, \"figures\", f\"{fig_name}.pdf\"))\n", " plt.show()" ] }, diff --git a/examples/material_parameters.py b/examples/material_parameters.py index 9f0db00..1fad707 100644 --- a/examples/material_parameters.py +++ b/examples/material_parameters.py @@ -73,8 +73,6 @@ ) stiffness_cu = lambda x: bulk_modulus_cu(x) * IxI + 2.0 * shear_modulus_cu(x) * P2 -# %% - # %% [markdown] # ## Temperature-dependent material parameters of wsc/FTC phase (phase no. 1) @@ -278,7 +276,7 @@ gca1.legend(loc="upper left", facecolor=(0.9, 0.9, 0.9, 0.6), edgecolor="black") gca2.legend(loc="center right", facecolor=(0.9, 0.9, 0.9, 0.6), edgecolor="black") plt.tight_layout(pad=0.025) - plt.savefig(os.path.join(data_path, "results", f"{fig_name}.pdf")) + plt.savefig(os.path.join(data_path, "figures", f"{fig_name}.pdf")) plt.show() # %% [markdown] @@ -372,7 +370,7 @@ def my_sig_y( gca1.grid(ls="--", color="gray", linewidth=0.5) gca1.legend(loc="upper right", facecolor=(0.9, 0.9, 0.9, 0.6), edgecolor="black") plt.tight_layout(pad=0.025) - plt.savefig(os.path.join(data_path, "results", f"{fig_name}.pdf")) + plt.savefig(os.path.join(data_path, "figures", f"{fig_name}.pdf")) plt.show() # %% diff --git a/examples/reproduce_article.ipynb b/examples/reproduce_article.ipynb index c8aa659..aa2d0fa 100644 --- a/examples/reproduce_article.ipynb +++ b/examples/reproduce_article.ipynb @@ -170,26 +170,14 @@ "id": "2fa3edb7-cffc-4c02-8f7b-5c0cc8241a05", "metadata": {}, "source": [ - "## Mode study\n", - "\n", "## Training reproduction tests\n", "\n", - "## Analysis of the training directions of the temperature range\n", + "Analysis of the training directions of the temperature range\n", "\n", "### Load data from hdf5 files\n", "- compare efficiency of the interpolation over the temperature\n", "- show select stress-strain curves\n", - "- results are generated based on `generate_inputs.py` and external C/C++ UMAT\n", - "\n", - "### Analysis of the training directions of the temperature range\n", - "\n", - "First figure: comparison of $\\theta$-NTFA and FEM for training scenarios\n", - "\n", - "loadcases: 0, 2, 5\n", - "\n", - "temperatures: 0, 3, 9 (0, 33, -1)\n", - "\n", - "N_modes: 12, 18, 24" + "- results are generated based on `generate_inputs.py` and external C/C++ UMAT" ] }, { @@ -270,6 +258,16 @@ "id": "8221681f-2959-46eb-97a3-a1b6e72c5dc6", "metadata": {}, "source": [ + "### Analysis of the training directions of the temperature range\n", + "\n", + "First figure: comparison of $\\theta$-NTFA and FEM for training scenarios\n", + "\n", + "loadcases: 0, 2, 5\n", + "\n", + "temperatures: 0, 3, 9 (0, 33, -1)\n", + "\n", + "N_modes: 12, 18, 24\n", + "\n", "### Relative error in sig_bar for 300K, 633.3K and 1300 K" ] }, diff --git a/examples/reproduce_article.py b/examples/reproduce_article.py index a63f0aa..1018294 100644 --- a/examples/reproduce_article.py +++ b/examples/reproduce_article.py @@ -152,26 +152,14 @@ def rel_error(A, A_ref, r_min=None): A.dim = A.data.shape # %% [markdown] -# ## Mode study -# # ## Training reproduction tests # -# ## Analysis of the training directions of the temperature range +# Analysis of the training directions of the temperature range # # ### Load data from hdf5 files # - compare efficiency of the interpolation over the temperature # - show select stress-strain curves # - results are generated based on `generate_inputs.py` and external C/C++ UMAT -# -# ### Analysis of the training directions of the temperature range -# -# First figure: comparison of $\theta$-NTFA and FEM for training scenarios -# -# loadcases: 0, 2, 5 -# -# temperatures: 0, 3, 9 (0, 33, -1) -# -# N_modes: 12, 18, 24 # %% data_sig_ntfa = np.zeros((3, 3, 3, 11, 6)) @@ -227,6 +215,16 @@ def rel_error(A, A_ref, r_min=None): data_sig_fans[2, 2, i, :, :] = fans_sig[-1, 5, :, :] # %% [markdown] +# ### Analysis of the training directions of the temperature range +# +# First figure: comparison of $\theta$-NTFA and FEM for training scenarios +# +# loadcases: 0, 2, 5 +# +# temperatures: 0, 3, 9 (0, 33, -1) +# +# N_modes: 12, 18, 24 +# # ### Relative error in sig_bar for 300K, 633.3K and 1300 K # %% diff --git a/pyproject.toml b/pyproject.toml index f3521f6..86b9bd3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta" [project] name = "thermontfa" -version = "0.0.1" -description = "" +version = "0.1.0" +description = "This repository contains a material routine written in Python for the thermo-elasto-plastic Nonuniform Transformation Field Analysis (ThermoNTFA)" authors = [ {name="Felix Fritzen", email="fritzen@simtech.uni-stuttgart.de"}, {name="Julius Herb", email="julius.herb@mib.uni-stuttgart.de"},