diff --git a/dune/microstructure/prestrain_material_geometry.hh b/dune/microstructure/prestrain_material_geometry.hh index 27fed7b4a6b416319e542855d5cbc87a92d4f9b5..4522baef8c95f754ee706c0b19e16ba951665611 100644 --- a/dune/microstructure/prestrain_material_geometry.hh +++ b/dune/microstructure/prestrain_material_geometry.hh @@ -81,13 +81,14 @@ public: return muTerm; } else if (imp == "parametrized_Laminate"){ - double mu1 = parameters.get<double>("mu1",10.0); + double mu1 = parameters.get<double>("mu1",1.0); double beta = parameters.get<double>("beta",2.0); double mu2 = beta*mu1; auto muTerm = [mu1, mu2, theta] (const Domain& z) { // std::cout << "Analytical-MU is used" << std::endl; - if (abs(z[0]) > (theta/2.0)) +// if (abs(z[0]) >= (theta/2.0)) + if (abs(z[0]) > (theta/2.0)) return mu1; else return mu2; diff --git a/inputs/cellsolver.parset b/inputs/cellsolver.parset index 535be32ea8a6fbf12b9f04f0f15c90831d870081..594a8bbb2bc7bb0d2b1eed08268407d57a5b3696 100644 --- a/inputs/cellsolver.parset +++ b/inputs/cellsolver.parset @@ -68,7 +68,7 @@ gamma=1.0 beta = 2.0 # ratio between material parameters mu1 & mu2 .... beta = 1.0 corresponds to homogeneous case mu1=1.0 -lambda1=5.0 +lambda1=0.0 diff --git a/inputs/computeMuGamma.parset b/inputs/computeMuGamma.parset index 924f8e8d28b25bbae4ba9f147293746515970e38..561be018606473876fdbedf8396afb1d2c12de95 100644 --- a/inputs/computeMuGamma.parset +++ b/inputs/computeMuGamma.parset @@ -28,8 +28,15 @@ nElements = 32 32 +#nElements = 64 64 +#nElements = 64 64 +#nElements = 94 94 +#nElements = 40 40 +#nElements = 52 52 +#nElements = 104 104 -gamma=1000000 + +gamma=3.0 ############################################# # Material parameters @@ -37,7 +44,7 @@ gamma=1000000 write_materialFunctions = true # VTK mu-functions , lambda-functions -beta=2.0 +beta=10.0 mu1=1.0 @@ -66,7 +73,7 @@ write_prestrainFunctions = false # VTK norm of B , rho1=1.0 alpha=2.0 -theta=0.125 +theta=0.25 #theta = 0.3 # volume fraction #default = 1.0/4.0 #theta = 0.25 # volume fraction diff --git a/src/2DPhaseDiagram_PlotScriptV2.py b/src/2DPhaseDiagram_PlotScriptV2.py index 378cb51052a26ad84d8dec343c562b867cf6667b..70f27ad2734ae460e2f27263e056261d975e0d88 100644 --- a/src/2DPhaseDiagram_PlotScriptV2.py +++ b/src/2DPhaseDiagram_PlotScriptV2.py @@ -12,23 +12,55 @@ paraview.simple._DisableFirstRenderCameraReset() case = 1 case = 2 +case = 3 # drawLine = False -curvature = 1 +curvature = 0 +gamma = 'infinity' +gamma = '0' +gamma = 0.05 +# gamma = 0.25 +gamma = 0.5 +gamma = 0.75 +gamma = 1.0 +gamma = 1.25 +gamma = 1.5 +# gamma = 1.5 +smallerRegion = True + # create a new 'XML Structured Grid Reader' -if case == 1: - phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_0_4000P.vts']) - # phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_0.vts']) +# if case == 1: +if gamma == '0': + # phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_0_4000P.vts']) + phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_0.vts']) -if case == 2: +# if case == 2: +elif gamma == 'infinity': phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_infinity_4000P.vts']) - # phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_infinity.vts']) - # phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_0.5.vts']) + phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_infinity.vts']) + +else : +# if case == 3: + smallerRegion = True + if gamma == 0.05: + phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_0.05.vts']) + if gamma == 0.25: + phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_0.25.vts']) + if gamma == 0.5: + phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_0.5.vts']) + if gamma == 0.75: + phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_0.75.vts']) + if gamma == 1.0: + phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_1.0.vts']) + if gamma == 1.25: + phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_1.25.vts']) + if gamma == 1.5: + phaseDiagram2DGamma_infinity55_4000spvts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/PhaseDiagram2DGamma_1.5.vts']) @@ -400,8 +432,35 @@ transform1.Transform.Translate = [0.0, 0.0, 0.0] transform1.Transform.Rotate = [0.0, 0.0, 0.0] transform1.Transform.Scale = [1.0, 1.0, 1.0] -# Properties modified on transform1.Transform -transform1.Transform.Scale = [0.1, 1.0, 1.0] + + + +# if case == 3 : +# # Properties modified on transform1.Transform +# transform1.Transform.Scale = [0.0666667, 1.0, 1.0] +# else : +# # Properties modified on transform1.Transform +# transform1.Transform.Scale = [0.1, 1.0, 1.0] + + + +# if gamma == '0' or gamma == 'infinity': +# # Properties modified on transform1.Transform +# transform1.Transform.Scale = [0.1, 1.0, 1.0] +# else : +# # Properties modified on transform1.Transform +# transform1.Transform.Scale = [0.0666667, 1.0, 1.0] + + +if smallerRegion: + # Properties modified on transform1.Transform + transform1.Transform.Scale = [0.0666667, 1.0, 1.0] + +else : + # Properties modified on transform1.Transform + transform1.Transform.Scale = [0.1, 1.0, 1.0] + + # show data in view transform1Display = Show(transform1, renderView1) @@ -1153,8 +1212,8 @@ renderView1.CameraParallelScale = 0.7506135276429463 # -if case == 1: - +# if case == 1: +if gamma == '0': # get color transfer function/color map for 'angles' anglesLUT = GetColorTransferFunction('angles') anglesLUT.AutomaticRescaleRangeMode = "Grow and update on 'Apply'" @@ -1238,7 +1297,6 @@ if case == 1: - if curvature == 1 : # find source @@ -1428,6 +1486,75 @@ if curvature == 1 : # rescale color and/or opacity maps used to exactly fit the current data range transform1Display.RescaleTransferFunctionToDataRange(False, True) + + + +# if case == 3: +# if gamma != '0' and gamma != 'infinity': +if smallerRegion: + paraview.simple._DisableFirstRenderCameraReset() + + # get active view + renderView1 = GetActiveViewOrCreate('RenderView') + # uncomment following to set a specific view size + # renderView1.ViewSize = [1184, 905] + + #### saving camera placements for all active views + + renderView1.AxesGrid.DataScale = [0.0666667, 1.0, 1.0] + + + + # Properties modified on renderView1.AxesGrid + renderView1.AxesGrid.ZAxisLabels = [ 0.4, 0.5, 0.6] + + # Properties modified on renderView1.AxesGrid + renderView1.AxesGrid.ShowEdges = 0 + + # Properties modified on renderView1.AxesGrid + renderView1.AxesGrid.XAxisPrecision = 1 + renderView1.AxesGrid.XAxisLabels = [0.0] + + # Properties modified on renderView1.AxesGrid + renderView1.AxesGrid.ZAxisPrecision = 1 + + # Properties modified on renderView1.AxesGrid + renderView1.AxesGrid.XAxisUseCustomLabels = 1 + renderView1.AxesGrid.XAxisLabels = [-2.0, -1.0, 0.0, 1.0] + # current camera placement for renderView1 + renderView1.InteractionMode = '2D' + renderView1.CameraPosition = [0.0, -14.510745305395833, 0.5] + renderView1.CameraFocalPoint = [0.0, 5.0, 0.5] + renderView1.CameraViewUp = [0.0, 0.0, 1.0] + renderView1.CameraParallelScale = 0.7506135276429463 + + + if gamma == '0' or gamma == 'infinity': + # Properties modified on transform1Display + transform1Display.GaussianRadius = 0.00075 + + else : + # transform1Display.GaussianRadius= 0.00001 + transform1Display.GaussianRadius= 0.00075 + # reset view to fit data + renderView1.ResetCamera() + + + # # current camera placement for renderView1 + # renderView1.InteractionMode = '2D' + # renderView1.CameraPosition = [-0.03333335, 9.453589701883667, 0.5] + # renderView1.CameraFocalPoint = [-0.03333335, 10.0, 0.5] + # renderView1.CameraViewUp = [0.0, 0.0, 1.0] + # renderView1.CameraParallelScale = 0.14142139159265296 + + + + + + + + + #### uncomment the following to render all views # RenderAllViews() # alternatively, if you want to write images, you can use SaveScreenshot(...). @@ -1437,7 +1564,11 @@ if curvature == 1 : # SaveScreenshot('/home/klaus/Desktop/PhaseDiagramPlot.png', renderView1, ImageResolution=[2514, 1868]) # SaveScreenshot('/home/klaus/Desktop/PhaseDiagramPlot.png', renderView1, ImageResolution=[1063, 657]) +outputName = '/home/klaus/Desktop/2DPhaseDiagram_' + str(gamma) + ".png" + + +# SaveScreenshot('/home/klaus/Desktop/2DPhaseDiagram.png', renderView1, ImageResolution=[2126, 1314]) -SaveScreenshot('/home/klaus/Desktop/2DPhaseDiagram.png', renderView1, ImageResolution=[2126, 1314]) +SaveScreenshot(outputName , renderView1, ImageResolution=[2126, 1314]) # export view # ExportView('/home/klaus/Desktop/PhaseDiagramPlot.pdf', view=renderView1) diff --git a/src/2DPhaseDiagram_Ratios_PlotScript.py b/src/2DPhaseDiagram_Ratios_PlotScript.py new file mode 100644 index 0000000000000000000000000000000000000000..be77851528d03608f4060855ed6dcb28616a93bd --- /dev/null +++ b/src/2DPhaseDiagram_Ratios_PlotScript.py @@ -0,0 +1,579 @@ +## trace generated using paraview version 5.7.0 +# +# To ensure correct image size when batch processing, please search +# for and uncomment the line `# renderView*.ViewSize = [*,*]` + +#### import the simple module from the paraview +from paraview.simple import * +#### disable automatic camera reset on 'Show' +paraview.simple._DisableFirstRenderCameraReset() + + + +case = 1 +case = 2 +case = 3 +# +drawLine = False + +prestrain = 1 + +gamma = 'infinity' + + + + + + + +# trace generated using paraview version 5.7.0 +# +# To ensure correct image size when batch processing, please search +# for and uncomment the line `# renderView*.ViewSize = [*,*]` + +#### import the simple module from the paraview +from paraview.simple import * +#### disable automatic camera reset on 'Show' +paraview.simple._DisableFirstRenderCameraReset() + +# create a new 'XML Structured Grid Reader' +elasticRatiovts = XMLStructuredGridReader(FileName=['/home/klaus/Desktop/DUNE/dune-microstructure/outputs/ElasticRatio.vts']) +elasticRatiovts.PointArrayStatus = ['elasticRatio', 'prestrainRatio', 'Type', 'angles', 'curvature'] + +# get active view +renderView1 = GetActiveViewOrCreate('RenderView') +# uncomment following to set a specific view size +# renderView1.ViewSize = [1067, 518] + +# show data in view +elasticRatiovtsDisplay = Show(elasticRatiovts, renderView1) + +# get color transfer function/color map for 'elasticRatio' +elasticRatioLUT = GetColorTransferFunction('elasticRatio') +elasticRatioLUT.RGBPoints = [0.3303091106505249, 0.001462, 0.000466, 0.013866, 0.33293563447422064, 0.002258, 0.001295, 0.018331, 0.33556148860800733, 0.003279, 0.002305, 0.023708, 0.33818801243170304, 0.004512, 0.00349, 0.029965, 0.34081386656548973, 0.00595, 0.004843, 0.03713, 0.3434403903891855, 0.007588, 0.006356, 0.044973, 0.346066244522972, 0.009426, 0.008022, 0.052844, 0.3486927683466678, 0.011465, 0.009828, 0.06075, 0.3513192921703637, 0.013708, 0.011771, 0.068667, 0.3539451463041502, 0.016156, 0.01384, 0.076603, 0.35657167012784596, 0.018815, 0.016026, 0.084584, 0.35919752426163265, 0.021692, 0.01832, 0.09261, 0.3618240480853284, 0.024792, 0.020715, 0.100676, 0.36444990221911505, 0.028123, 0.023201, 0.108787, 0.3670764260428108, 0.031696, 0.025765, 0.116965, 0.3697029498665066, 0.03552, 0.028397, 0.125209, 0.3723288040002933, 0.039608, 0.03109, 0.133515, 0.37495532782398905, 0.04383, 0.03383, 0.141886, 0.3775811819577757, 0.048062, 0.036607, 0.150327, 0.38020770578147145, 0.05232, 0.039407, 0.158841, 0.38283355991525797, 0.056615, 0.04216, 0.167446, 0.38546008373895374, 0.060949, 0.044794, 0.176129, 0.3880866075626497, 0.06533, 0.047318, 0.184892, 0.39071246169643614, 0.069764, 0.049726, 0.193735, 0.3933389855201319, 0.074257, 0.052017, 0.20266, 0.3959648396539186, 0.078815, 0.054184, 0.211667, 0.39859136347761437, 0.083446, 0.056225, 0.220755, 0.40121721761140106, 0.088155, 0.058133, 0.229922, 0.4038437414350968, 0.092949, 0.059904, 0.239164, 0.40646959556888346, 0.097833, 0.061531, 0.248477, 0.4090961193925792, 0.102815, 0.06301, 0.257854, 0.411722643216275, 0.107899, 0.064335, 0.267289, 0.41434849735006163, 0.113094, 0.065492, 0.276784, 0.4169750211737574, 0.118405, 0.066479, 0.286321, 0.4196008753075439, 0.123833, 0.067295, 0.295879, 0.4222273991312397, 0.12938, 0.067935, 0.305443, 0.4248532532650264, 0.135053, 0.068391, 0.315, 0.42747977708872215, 0.140858, 0.068654, 0.324538, 0.43010630091241786, 0.146785, 0.068738, 0.334011, 0.43273215504620455, 0.152839, 0.068637, 0.343404, 0.4353586788699003, 0.159018, 0.068354, 0.352688, 0.437984533003687, 0.165308, 0.067911, 0.361816, 0.4406110568273828, 0.171713, 0.067305, 0.370771, 0.4432369109611694, 0.178212, 0.066576, 0.379497, 0.4458634347848652, 0.184801, 0.065732, 0.387973, 0.44848995860856095, 0.19146, 0.064818, 0.396152, 0.45111581274234747, 0.198177, 0.063862, 0.404009, 0.45374233656604335, 0.204935, 0.062907, 0.411514, 0.4563681906998299, 0.211718, 0.061992, 0.418647, 0.4589947145235257, 0.218512, 0.061158, 0.425392, 0.4616205686573123, 0.225302, 0.060445, 0.431742, 0.4642470924810081, 0.232077, 0.059889, 0.437695, 0.46687361630470386, 0.238826, 0.059517, 0.443256, 0.4694994704384905, 0.245543, 0.059352, 0.448436, 0.47212599426218627, 0.25222, 0.059415, 0.453248, 0.47475184839597295, 0.258857, 0.059706, 0.45771, 0.4773783722196687, 0.265447, 0.060237, 0.46184, 0.4800042263534554, 0.271994, 0.060994, 0.46566, 0.4826307501771512, 0.278493, 0.061978, 0.46919, 0.4852572740008469, 0.284951, 0.063168, 0.472451, 0.4878831281346336, 0.291366, 0.064553, 0.475462, 0.4905096519583293, 0.29774, 0.066117, 0.478243, 0.49313550609211587, 0.304081, 0.067835, 0.480812, 0.49576202991581164, 0.310382, 0.069702, 0.483186, 0.4983878840495983, 0.316654, 0.07169, 0.48538, 0.5010144078732941, 0.322899, 0.073782, 0.487408, 0.5036409316969899, 0.329114, 0.075972, 0.489287, 0.5062667858307764, 0.335308, 0.078236, 0.491024, 0.5088933096544722, 0.341482, 0.080564, 0.492631, 0.5115191637882589, 0.347636, 0.082946, 0.494121, 0.5141456876119547, 0.353773, 0.085373, 0.495501, 0.5167715417457412, 0.359898, 0.087831, 0.496778, 0.5193980655694371, 0.366012, 0.090314, 0.49796, 0.5220245893931329, 0.372116, 0.092816, 0.499053, 0.5246504435269194, 0.378211, 0.095332, 0.500067, 0.5272769673506152, 0.384299, 0.097855, 0.501002, 0.5299028214844018, 0.390384, 0.100379, 0.501864, 0.5325293453080976, 0.396467, 0.102902, 0.502658, 0.5351551994418843, 0.402548, 0.10542, 0.503386, 0.53778172326558, 0.408629, 0.10793, 0.504052, 0.5404075773993666, 0.414709, 0.110431, 0.504662, 0.5430341012230624, 0.420791, 0.11292, 0.505215, 0.5456606250467582, 0.426877, 0.115395, 0.505714, 0.5482864791805449, 0.432967, 0.117855, 0.50616, 0.5509130030042406, 0.439062, 0.120298, 0.506555, 0.5535388571380273, 0.445163, 0.122724, 0.506901, 0.5561653809617231, 0.451271, 0.125132, 0.507198, 0.5587912350955095, 0.457386, 0.127522, 0.507448, 0.5614177589192055, 0.463508, 0.129893, 0.507652, 0.5640442827429011, 0.46964, 0.132245, 0.507809, 0.5666701368766878, 0.47578, 0.134577, 0.507921, 0.5692966607003835, 0.481929, 0.136891, 0.507989, 0.5719225148341702, 0.488088, 0.139186, 0.508011, 0.574549038657866, 0.494258, 0.141462, 0.507988, 0.5771748927916527, 0.500438, 0.143719, 0.50792, 0.5798014166153485, 0.506629, 0.145958, 0.507806, 0.5824279404390442, 0.512831, 0.148179, 0.507648, 0.5850537945728308, 0.519045, 0.150383, 0.507443, 0.5876803183965266, 0.52527, 0.152569, 0.507192, 0.5903061725303131, 0.531507, 0.154739, 0.506895, 0.592932696354009, 0.537755, 0.156894, 0.506551, 0.5955585504877956, 0.544015, 0.159033, 0.506159, 0.5981850743114914, 0.550287, 0.161158, 0.505719, 0.6008115981351871, 0.556571, 0.163269, 0.50523, 0.6034374522689737, 0.562866, 0.165368, 0.504692, 0.6060639760926695, 0.569172, 0.167454, 0.504105, 0.6086898302264562, 0.57549, 0.16953, 0.503466, 0.6113163540501519, 0.581819, 0.171596, 0.502777, 0.6139422081839385, 0.588158, 0.173652, 0.502035, 0.6165687320076343, 0.594508, 0.175701, 0.501241, 0.6191952558313301, 0.600868, 0.177743, 0.500394, 0.6218211099651167, 0.607238, 0.179779, 0.499492, 0.6244476337888125, 0.613617, 0.181811, 0.498536, 0.6270734879225992, 0.620005, 0.18384, 0.497524, 0.6297000117462948, 0.626401, 0.185867, 0.496456, 0.6323258658800814, 0.632805, 0.187893, 0.495332, 0.6349523897037772, 0.639216, 0.189921, 0.49415, 0.637578913527473, 0.645633, 0.191952, 0.49291, 0.6402047676612597, 0.652056, 0.193986, 0.491611, 0.6428312914849554, 0.658483, 0.196027, 0.490253, 0.6454571456187421, 0.664915, 0.198075, 0.488836, 0.6480836694424379, 0.671349, 0.200133, 0.487358, 0.6507095235762246, 0.677786, 0.202203, 0.485819, 0.6533360473999203, 0.684224, 0.204286, 0.484219, 0.6559625712236161, 0.690661, 0.206384, 0.482558, 0.6585884253574028, 0.697098, 0.208501, 0.480835, 0.6612149491810986, 0.703532, 0.210638, 0.479049, 0.663840803314885, 0.709962, 0.212797, 0.477201, 0.6664673271385809, 0.716387, 0.214982, 0.47529, 0.6690931812723676, 0.722805, 0.217194, 0.473316, 0.6717197050960633, 0.729216, 0.219437, 0.471279, 0.67434555922985, 0.735616, 0.221713, 0.46918, 0.6769720830535457, 0.742004, 0.224025, 0.467018, 0.6795986068772415, 0.748378, 0.226377, 0.464794, 0.6822244610110281, 0.754737, 0.228772, 0.462509, 0.6848509848347238, 0.761077, 0.231214, 0.460162, 0.6874768389685104, 0.767398, 0.233705, 0.457755, 0.6901033627922063, 0.773695, 0.236249, 0.455289, 0.6927292169259929, 0.779968, 0.238851, 0.452765, 0.6953557407496885, 0.786212, 0.241514, 0.450184, 0.6979822645733844, 0.792427, 0.244242, 0.447543, 0.7006081187071711, 0.798608, 0.24704, 0.444848, 0.7032346425308668, 0.804752, 0.249911, 0.442102, 0.7058604966646533, 0.810855, 0.252861, 0.439305, 0.7084870204883493, 0.816914, 0.255895, 0.436461, 0.7111128746221358, 0.822926, 0.259016, 0.433573, 0.7137393984458316, 0.828886, 0.262229, 0.430644, 0.7163659222695273, 0.834791, 0.26554, 0.427671, 0.718991776403314, 0.840636, 0.268953, 0.424666, 0.7216183002270098, 0.846416, 0.272473, 0.421631, 0.7242441543607965, 0.852126, 0.276106, 0.418573, 0.7268706781844922, 0.857763, 0.279857, 0.415496, 0.7294965323182787, 0.86332, 0.283729, 0.412403, 0.7321230561419747, 0.868793, 0.287728, 0.409303, 0.7347495799656703, 0.874176, 0.291859, 0.406205, 0.7373754340994569, 0.879464, 0.296125, 0.403118, 0.7400019579231529, 0.884651, 0.30053, 0.400047, 0.7426278120569394, 0.889731, 0.305079, 0.397002, 0.7452543358806352, 0.8947, 0.309773, 0.393995, 0.7478801900144219, 0.899552, 0.314616, 0.391037, 0.7505067138381176, 0.904281, 0.31961, 0.388137, 0.7531332376618134, 0.908884, 0.324755, 0.385308, 0.7557590917956001, 0.913354, 0.330052, 0.382563, 0.7583856156192957, 0.917689, 0.3355, 0.379915, 0.7610114697530823, 0.921884, 0.341098, 0.377376, 0.7636379935767782, 0.925937, 0.346844, 0.374959, 0.7662638477105649, 0.929845, 0.352734, 0.372677, 0.7688903715342605, 0.933606, 0.358764, 0.370541, 0.7715168953579563, 0.937221, 0.364929, 0.368567, 0.774142749491743, 0.940687, 0.371224, 0.366762, 0.7767692733154387, 0.944006, 0.377643, 0.365136, 0.7793951274492253, 0.94718, 0.384178, 0.363701, 0.7820216512729212, 0.95021, 0.39082, 0.362468, 0.7846475054067077, 0.953099, 0.397563, 0.361438, 0.7872740292304035, 0.955849, 0.4044, 0.360619, 0.7899005530540992, 0.958464, 0.411324, 0.360014, 0.7925264071878859, 0.960949, 0.418323, 0.35963, 0.7951529310115817, 0.96331, 0.42539, 0.359469, 0.7977787851453684, 0.965549, 0.432519, 0.359529, 0.8004053089690639, 0.967671, 0.439703, 0.35981, 0.8030311631028506, 0.96968, 0.446936, 0.360311, 0.8056576869265466, 0.971582, 0.45421, 0.36103, 0.8082835410603333, 0.973381, 0.46152, 0.361965, 0.8109100648840288, 0.975082, 0.468861, 0.363111, 0.8135365887077248, 0.97669, 0.476226, 0.364466, 0.8161624428415113, 0.97821, 0.483612, 0.366025, 0.8187889666652071, 0.979645, 0.491014, 0.367783, 0.8214148207989938, 0.981, 0.498428, 0.369734, 0.8240413446226895, 0.982279, 0.505851, 0.371874, 0.826667198756476, 0.983485, 0.51328, 0.374198, 0.829293722580172, 0.984622, 0.520713, 0.376698, 0.8319202464038677, 0.985693, 0.528148, 0.379371, 0.8345461005376542, 0.9867, 0.535582, 0.38221, 0.8371726243613502, 0.987646, 0.543015, 0.38521, 0.8397984784951367, 0.988533, 0.550446, 0.388365, 0.8424250023188324, 0.989363, 0.557873, 0.391671, 0.8450508564526191, 0.990138, 0.565296, 0.395122, 0.8476773802763149, 0.990871, 0.572706, 0.398714, 0.8503039041000107, 0.991558, 0.580107, 0.402441, 0.8529297582337974, 0.992196, 0.587502, 0.406299, 0.8555562820574931, 0.992785, 0.594891, 0.410283, 0.8581821361912796, 0.993326, 0.602275, 0.41439, 0.8608086600149754, 0.993834, 0.609644, 0.418613, 0.863434514148762, 0.994309, 0.616999, 0.42295, 0.8660610379724578, 0.994738, 0.62435, 0.427397, 0.8686875617961536, 0.995122, 0.631696, 0.431951, 0.8713134159299403, 0.99548, 0.639027, 0.436607, 0.8739399397536358, 0.99581, 0.646344, 0.441361, 0.8765657938874225, 0.996096, 0.653659, 0.446213, 0.8791923177111185, 0.996341, 0.660969, 0.45116, 0.881818171844905, 0.99658, 0.668256, 0.456192, 0.8844446956686007, 0.996775, 0.675541, 0.461314, 0.8870712194922967, 0.996925, 0.682828, 0.466526, 0.8896970736260832, 0.997077, 0.690088, 0.471811, 0.892323597449779, 0.997186, 0.697349, 0.477182, 0.8949494515835656, 0.997254, 0.704611, 0.482635, 0.8975759754072614, 0.997325, 0.711848, 0.488154, 0.9002018295410479, 0.997351, 0.719089, 0.493755, 0.9028283533647439, 0.997351, 0.726324, 0.499428, 0.9054548771884396, 0.997341, 0.733545, 0.505167, 0.9080807313222261, 0.997285, 0.740772, 0.510983, 0.9107072551459221, 0.997228, 0.747981, 0.516859, 0.9133331092797088, 0.997138, 0.75519, 0.522806, 0.9159596331034043, 0.997019, 0.762398, 0.528821, 0.918585487237191, 0.996898, 0.769591, 0.534892, 0.9212120110608868, 0.996727, 0.776795, 0.541039, 0.9238385348845826, 0.996571, 0.783977, 0.547233, 0.9264643890183692, 0.996369, 0.791167, 0.553499, 0.929090912842065, 0.996162, 0.798348, 0.55982, 0.9317167669758517, 0.995932, 0.805527, 0.566202, 0.9343432907995475, 0.99568, 0.812706, 0.572645, 0.9369691449333339, 0.995424, 0.819875, 0.57914, 0.9395956687570297, 0.995131, 0.827052, 0.585701, 0.9422215228908164, 0.994851, 0.834213, 0.592307, 0.9448480467145122, 0.994524, 0.841387, 0.598983, 0.9474745705382079, 0.994222, 0.84854, 0.605696, 0.9501004246719944, 0.993866, 0.855711, 0.612482, 0.9527269484956904, 0.993545, 0.862859, 0.619299, 0.9553528026294769, 0.99317, 0.870024, 0.626189, 0.9579793264531726, 0.992831, 0.877168, 0.633109, 0.9606051805869593, 0.99244, 0.88433, 0.640099, 0.9632317044106551, 0.992089, 0.89147, 0.647116, 0.9658582282343509, 0.991688, 0.898627, 0.654202, 0.9684840823681375, 0.991332, 0.905763, 0.661309, 0.9711106061918333, 0.99093, 0.912915, 0.668481, 0.9737364603256198, 0.99057, 0.920049, 0.675675, 0.9763629841493158, 0.990175, 0.927196, 0.682926, 0.9789888382831025, 0.989815, 0.934329, 0.690198, 0.981615362106798, 0.989434, 0.94147, 0.697519, 0.984241885930494, 0.989077, 0.948604, 0.704863, 0.9868677400642807, 0.988717, 0.955742, 0.712242, 0.9894942638879762, 0.988367, 0.962878, 0.719649, 0.9921201180217629, 0.988033, 0.970012, 0.727077, 0.9947466418454587, 0.987691, 0.977154, 0.734536, 0.9973724959792454, 0.987387, 0.984288, 0.742002, 0.9999990198029411, 0.987053, 0.991438, 0.749504] +elasticRatioLUT.ColorSpace = 'RGB' +elasticRatioLUT.NanColor = [0.0, 1.0, 0.0] +elasticRatioLUT.ScalarRangeInitialized = 1.0 + +# get opacity transfer function/opacity map for 'elasticRatio' +elasticRatioPWF = GetOpacityTransferFunction('elasticRatio') +elasticRatioPWF.Points = [0.3303091106505249, 0.8602941036224365, 0.5, 0.0, 0.47351324129727485, 0.625, 0.5, 0.0, 0.5724925603293413, 0.6691176295280457, 0.5, 0.0, 0.7767467248559744, 0.8676470518112183, 0.5, 0.0, 0.8230997759230788, 0.6911764740943909, 0.5, 0.0, 0.9999990198029411, 0.8014705777168274, 0.5, 0.0] +elasticRatioPWF.ScalarRangeInitialized = 1 + +# trace defaults for the display properties. +elasticRatiovtsDisplay.Representation = 'Surface' +elasticRatiovtsDisplay.ColorArrayName = ['POINTS', 'elasticRatio'] +elasticRatiovtsDisplay.LookupTable = elasticRatioLUT +elasticRatiovtsDisplay.OSPRayScaleArray = 'elasticRatio' +elasticRatiovtsDisplay.OSPRayScaleFunction = 'PiecewiseFunction' +elasticRatiovtsDisplay.SelectOrientationVectors = 'None' +elasticRatiovtsDisplay.ScaleFactor = 0.9 +elasticRatiovtsDisplay.SelectScaleArray = 'elasticRatio' +elasticRatiovtsDisplay.GlyphType = 'Arrow' +elasticRatiovtsDisplay.GlyphTableIndexArray = 'elasticRatio' +elasticRatiovtsDisplay.GaussianRadius = 0.045 +elasticRatiovtsDisplay.SetScaleArray = ['POINTS', 'elasticRatio'] +elasticRatiovtsDisplay.ScaleTransferFunction = 'PiecewiseFunction' +elasticRatiovtsDisplay.OpacityArray = ['POINTS', 'elasticRatio'] +elasticRatiovtsDisplay.OpacityTransferFunction = 'PiecewiseFunction' +elasticRatiovtsDisplay.DataAxesGrid = 'GridAxesRepresentation' +elasticRatiovtsDisplay.PolarAxes = 'PolarAxesRepresentation' +elasticRatiovtsDisplay.ScalarOpacityFunction = elasticRatioPWF +elasticRatiovtsDisplay.ScalarOpacityUnitDistance = 0.24673084980136809 + +# init the 'PiecewiseFunction' selected for 'OSPRayScaleFunction' +elasticRatiovtsDisplay.OSPRayScaleFunction.Points = [1.0, 0.8602941036224365, 0.5, 0.0, 1.213836476688135, 0.625, 0.5, 0.0, 1.3616352081298828, 0.6691176295280457, 0.5, 0.0, 1.6666333299996667, 0.8676470518112183, 0.5, 0.0, 1.7358490228652954, 0.6911764740943909, 0.5, 0.0, 2.0, 0.8014705777168274, 0.5, 0.0] + +# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction' +elasticRatiovtsDisplay.ScaleTransferFunction.Points = [0.3303091106505249, 0.8602941036224365, 0.5, 0.0, 0.47351324129727485, 0.625, 0.5, 0.0, 0.5724925603293413, 0.6691176295280457, 0.5, 0.0, 0.7767467248559744, 0.8676470518112183, 0.5, 0.0, 0.8230997759230788, 0.6911764740943909, 0.5, 0.0, 0.9999990198029411, 0.8014705777168274, 0.5, 0.0] + +# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction' +elasticRatiovtsDisplay.OpacityTransferFunction.Points = [0.3303091106505249, 0.8602941036224365, 0.5, 0.0, 0.47351324129727485, 0.625, 0.5, 0.0, 0.5724925603293413, 0.6691176295280457, 0.5, 0.0, 0.7767467248559744, 0.8676470518112183, 0.5, 0.0, 0.8230997759230788, 0.6911764740943909, 0.5, 0.0, 0.9999990198029411, 0.8014705777168274, 0.5, 0.0] + +# reset view to fit data +renderView1.ResetCamera() + +#changing interaction mode based on data extents +renderView1.InteractionMode = '2D' +renderView1.CameraPosition = [9999.5, 5.51, 0.5] +renderView1.CameraFocalPoint = [-0.5, 5.51, 0.5] +renderView1.CameraViewUp = [0.0, 0.0, 1.0] + +# show color bar/color legend +elasticRatiovtsDisplay.SetScalarBarVisibility(renderView1, True) + +# update the view to ensure updated data information +renderView1.Update() + +# create a new 'Transform' +transform1 = Transform(Input=elasticRatiovts) +transform1.Transform = 'Transform' + +# Properties modified on transform1.Transform +transform1.Transform.Scale = [1.0, 0.1, 1.0] + +# show data in view +transform1Display = Show(transform1, renderView1) + +# trace defaults for the display properties. +transform1Display.Representation = 'Surface' +transform1Display.ColorArrayName = ['POINTS', 'elasticRatio'] +transform1Display.LookupTable = elasticRatioLUT +transform1Display.OSPRayScaleArray = 'elasticRatio' +transform1Display.OSPRayScaleFunction = 'PiecewiseFunction' +transform1Display.SelectOrientationVectors = 'None' +transform1Display.ScaleFactor = 0.098 +transform1Display.SelectScaleArray = 'elasticRatio' +transform1Display.GlyphType = 'Arrow' +transform1Display.GlyphTableIndexArray = 'elasticRatio' +transform1Display.GaussianRadius = 0.0049 +transform1Display.SetScaleArray = ['POINTS', 'elasticRatio'] +transform1Display.ScaleTransferFunction = 'PiecewiseFunction' +transform1Display.OpacityArray = ['POINTS', 'elasticRatio'] +transform1Display.OpacityTransferFunction = 'PiecewiseFunction' +transform1Display.DataAxesGrid = 'GridAxesRepresentation' +transform1Display.PolarAxes = 'PolarAxesRepresentation' +transform1Display.ScalarOpacityFunction = elasticRatioPWF +transform1Display.ScalarOpacityUnitDistance = 0.03626244811262771 + +# init the 'PiecewiseFunction' selected for 'OSPRayScaleFunction' +transform1Display.OSPRayScaleFunction.Points = [1.0, 0.8602941036224365, 0.5, 0.0, 1.213836476688135, 0.625, 0.5, 0.0, 1.3616352081298828, 0.6691176295280457, 0.5, 0.0, 1.6666333299996667, 0.8676470518112183, 0.5, 0.0, 1.7358490228652954, 0.6911764740943909, 0.5, 0.0, 2.0, 0.8014705777168274, 0.5, 0.0] + +# init the 'PiecewiseFunction' selected for 'ScaleTransferFunction' +transform1Display.ScaleTransferFunction.Points = [0.3303091106505249, 0.8602941036224365, 0.5, 0.0, 0.47351324129727485, 0.625, 0.5, 0.0, 0.5724925603293413, 0.6691176295280457, 0.5, 0.0, 0.7767467248559744, 0.8676470518112183, 0.5, 0.0, 0.8230997759230788, 0.6911764740943909, 0.5, 0.0, 0.9999990198029411, 0.8014705777168274, 0.5, 0.0] + +# init the 'PiecewiseFunction' selected for 'OpacityTransferFunction' +transform1Display.OpacityTransferFunction.Points = [0.3303091106505249, 0.8602941036224365, 0.5, 0.0, 0.47351324129727485, 0.625, 0.5, 0.0, 0.5724925603293413, 0.6691176295280457, 0.5, 0.0, 0.7767467248559744, 0.8676470518112183, 0.5, 0.0, 0.8230997759230788, 0.6911764740943909, 0.5, 0.0, 0.9999990198029411, 0.8014705777168274, 0.5, 0.0] + +# hide data in view +Hide(elasticRatiovts, renderView1) + +# show color bar/color legend +transform1Display.SetScalarBarVisibility(renderView1, True) + +# update the view to ensure updated data information +renderView1.Update() + +# reset view to fit data +renderView1.ResetCamera() + +# reset view to fit data +renderView1.ResetCamera() + +# toggle 3D widget visibility (only when running from the GUI) +Hide3DWidgets(proxy=transform1.Transform) + +# Apply a preset using its name. Note this may not work as expected when presets have duplicate names. +elasticRatioLUT.ApplyPreset('Warm to Cool (Extended)', True) + +# change representation type +transform1Display.SetRepresentationType('Point Gaussian') + +# Properties modified on transform1Display +transform1Display.ShaderPreset = 'Plain circle' + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.Visibility = 1 + + + + + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.XTitle = '' +renderView1.AxesGrid.ZTitle = ' $\\theta$ ' +renderView1.AxesGrid.YTitle = ' $\\theta_\\mu$ ' +renderView1.AxesGrid.ZTitleFontSize = 20 +renderView1.AxesGrid.YTitleFontSize = 20 + + + +renderView1.AxesGrid.FacesToRender = 0 +renderView1.AxesGrid.CullFrontface = 0 + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.FacesToRender = 32 + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.FacesToRender = 16 + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.FacesToRender = 4 + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.FacesToRender = 1 + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.ShowEdges = 0 + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.ShowTicks = 0 + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.ShowGrid = 1 +renderView1.AxesGrid.GridColor = [0.1803921568627451, 0.20392156862745098, 0.21176470588235294] +# Properties modified on renderView1.AxesGrid +# renderView1.AxesGrid.ShowGrid = 0 + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.AxesToLabel = 7 + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.DataScale = [1.0, 0.1, 1.0] + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.YAxisUseCustomLabels = 1 +renderView1.AxesGrid.YAxisLabels = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0] + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.ZAxisUseCustomLabels = 1 +renderView1.AxesGrid.ZAxisLabels = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.ZAxisLabels = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] + +# Properties modified on renderView1.AxesGrid +renderView1.AxesGrid.ZAxisLabels = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] + + + +#### saving camera placements for all active views + +# current camera placement for renderView1 +renderView1.InteractionMode = '2D' +renderView1.CameraPosition = [2.0704518571099406, 0.551, 0.5] +renderView1.CameraFocalPoint = [-0.5, 0.551, 0.5] +renderView1.CameraViewUp = [0.0, 0.0, 1.0] +renderView1.CameraParallelScale = 0.6652818951391959 + + + + + +renderView1.AxesGrid.YTitleFontSize = 65 #24 +renderView1.AxesGrid.ZTitleFontSize = 65 +renderView1.AxesGrid.YLabelFontSize = 45 #default:12 +renderView1.AxesGrid.ZLabelFontSize = 45 +#### uncomment the following to render all views +# RenderAllViews() +# alternatively, if you want to write images, you can use SaveScreenshot(...). + + +# -------------------------------------------------------------------------------------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# -------------------------------------------------------------------------------------------------------------------------------------------- + +if prestrain: + # set scalar coloring + ColorBy(transform1Display, ('POINTS', 'prestrainRatio')) + # get color transfer function/color map for 'prestrainRatio' + prestrainRatioLUT = GetColorTransferFunction('prestrainRatio') + prestrainRatioLUT.AutomaticRescaleRangeMode = "Grow and update on 'Apply'" + prestrainRatioLUT.InterpretValuesAsCategories = 0 + prestrainRatioLUT.AnnotationsInitialized = 0 + prestrainRatioLUT.ShowCategoricalColorsinDataRangeOnly = 0 + prestrainRatioLUT.RescaleOnVisibilityChange = 0 + prestrainRatioLUT.EnableOpacityMapping = 0 + prestrainRatioLUT.RGBPoints = [1.0000497462439073, 0.001462, 0.000466, 0.013866, 1.0017355871052882, 0.002258, 0.001295, 0.018331, 1.0034209981245321, 0.003279, 0.002305, 0.023708, 1.005106838985913, 0.004512, 0.00349, 0.029965, 1.006792250005157, 0.00595, 0.004843, 0.03713, 1.008478090866538, 0.007588, 0.006356, 0.044973, 1.0101635018857817, 0.009426, 0.008022, 0.052844, 1.0118493427471627, 0.011465, 0.009828, 0.06075, 1.0135351836085438, 0.013708, 0.011771, 0.068667, 1.0152205946277877, 0.016156, 0.01384, 0.076603, 1.0169064354891686, 0.018815, 0.016026, 0.084584, 1.0185918465084125, 0.021692, 0.01832, 0.09261, 1.0202776873697934, 0.024792, 0.020715, 0.100676, 1.0219630983890373, 0.028123, 0.023201, 0.108787, 1.0236489392504182, 0.031696, 0.025765, 0.116965, 1.0253347801117991, 0.03552, 0.028397, 0.125209, 1.027020191131043, 0.039608, 0.03109, 0.133515, 1.028706031992424, 0.04383, 0.03383, 0.141886, 1.030391443011668, 0.048062, 0.036607, 0.150327, 1.032077283873049, 0.05232, 0.039407, 0.158841, 1.0337626948922927, 0.056615, 0.04216, 0.167446, 1.0354485357536738, 0.060949, 0.044794, 0.176129, 1.0371343766150547, 0.06533, 0.047318, 0.184892, 1.0388197876342986, 0.069764, 0.049726, 0.193735, 1.0405056284956795, 0.074257, 0.052017, 0.20266, 1.0421910395149234, 0.078815, 0.054184, 0.211667, 1.0438768803763043, 0.083446, 0.056225, 0.220755, 1.0455622913955482, 0.088155, 0.058133, 0.229922, 1.0472481322569291, 0.092949, 0.059904, 0.239164, 1.0489335432761733, 0.097833, 0.061531, 0.248477, 1.0506193841375542, 0.102815, 0.06301, 0.257854, 1.052305224998935, 0.107899, 0.064335, 0.267289, 1.053990636018179, 0.113094, 0.065492, 0.276784, 1.05567647687956, 0.118405, 0.066479, 0.286321, 1.0573618878988038, 0.123833, 0.067295, 0.295879, 1.0590477287601847, 0.12938, 0.067935, 0.305443, 1.0607331397794286, 0.135053, 0.068391, 0.315, 1.0624189806408095, 0.140858, 0.068654, 0.324538, 1.0641048215021904, 0.146785, 0.068738, 0.334011, 1.0657902325214343, 0.152839, 0.068637, 0.343404, 1.0674760733828152, 0.159018, 0.068354, 0.352688, 1.0691614844020592, 0.165308, 0.067911, 0.361816, 1.0708473252634403, 0.171713, 0.067305, 0.370771, 1.0725327362826842, 0.178212, 0.066576, 0.379497, 1.074218577144065, 0.184801, 0.065732, 0.387973, 1.075904418005446, 0.19146, 0.064818, 0.396152, 1.07758982902469, 0.198177, 0.063862, 0.404009, 1.0792756698860708, 0.204935, 0.062907, 0.411514, 1.0809610809053147, 0.211718, 0.061992, 0.418647, 1.0826469217666956, 0.218512, 0.061158, 0.425392, 1.0843323327859395, 0.225302, 0.060445, 0.431742, 1.0860181736473205, 0.232077, 0.059889, 0.437695, 1.0877040145087014, 0.238826, 0.059517, 0.443256, 1.0893894255279453, 0.245543, 0.059352, 0.448436, 1.0910752663893262, 0.25222, 0.059415, 0.453248, 1.0927606774085703, 0.258857, 0.059706, 0.45771, 1.0944465182699512, 0.265447, 0.060237, 0.46184, 1.0961319292891951, 0.271994, 0.060994, 0.46566, 1.097817770150576, 0.278493, 0.061978, 0.46919, 1.099503611011957, 0.284951, 0.063168, 0.472451, 1.1011890220312008, 0.291366, 0.064553, 0.475462, 1.1028748628925817, 0.29774, 0.066117, 0.478243, 1.1045602739118257, 0.304081, 0.067835, 0.480812, 1.1062461147732066, 0.310382, 0.069702, 0.483186, 1.1079315257924505, 0.316654, 0.07169, 0.48538, 1.1096173666538314, 0.322899, 0.073782, 0.487408, 1.1113032075152123, 0.329114, 0.075972, 0.489287, 1.1129886185344562, 0.335308, 0.078236, 0.491024, 1.1146744593958373, 0.341482, 0.080564, 0.492631, 1.1163598704150812, 0.347636, 0.082946, 0.494121, 1.1180457112764621, 0.353773, 0.085373, 0.495501, 1.119731122295706, 0.359898, 0.087831, 0.496778, 1.121416963157087, 0.366012, 0.090314, 0.49796, 1.1231028040184678, 0.372116, 0.092816, 0.499053, 1.1247882150377118, 0.378211, 0.095332, 0.500067, 1.1264740558990927, 0.384299, 0.097855, 0.501002, 1.1281594669183366, 0.390384, 0.100379, 0.501864, 1.1298453077797175, 0.396467, 0.102902, 0.502658, 1.1315307187989614, 0.402548, 0.10542, 0.503386, 1.1332165596603425, 0.408629, 0.10793, 0.504052, 1.1349019706795864, 0.414709, 0.110431, 0.504662, 1.1365878115409673, 0.420791, 0.11292, 0.505215, 1.1382736524023482, 0.426877, 0.115395, 0.505714, 1.1399590634215921, 0.432967, 0.117855, 0.50616, 1.141644904282973, 0.439062, 0.120298, 0.506555, 1.143330315302217, 0.445163, 0.122724, 0.506901, 1.1450161561635979, 0.451271, 0.125132, 0.507198, 1.1467015671828418, 0.457386, 0.127522, 0.507448, 1.148387408044223, 0.463508, 0.129893, 0.507652, 1.1500732489056036, 0.46964, 0.132245, 0.507809, 1.1517586599248475, 0.47578, 0.134577, 0.507921, 1.1534445007862284, 0.481929, 0.136891, 0.507989, 1.1551299118054725, 0.488088, 0.139186, 0.508011, 1.1568157526668534, 0.494258, 0.141462, 0.507988, 1.1585011636860973, 0.500438, 0.143719, 0.50792, 1.1601870045474783, 0.506629, 0.145958, 0.507806, 1.1618728454088592, 0.512831, 0.148179, 0.507648, 1.163558256428103, 0.519045, 0.150383, 0.507443, 1.165244097289484, 0.52527, 0.152569, 0.507192, 1.1669295083087279, 0.531507, 0.154739, 0.506895, 1.1686153491701088, 0.537755, 0.156894, 0.506551, 1.1703007601893527, 0.544015, 0.159033, 0.506159, 1.1719866010507336, 0.550287, 0.161158, 0.505719, 1.1736724419121147, 0.556571, 0.163269, 0.50523, 1.1753578529313584, 0.562866, 0.165368, 0.504692, 1.1770436937927395, 0.569172, 0.167454, 0.504105, 1.1787291048119835, 0.57549, 0.16953, 0.503466, 1.1804149456733644, 0.581819, 0.171596, 0.502777, 1.1821003566926083, 0.588158, 0.173652, 0.502035, 1.1837861975539892, 0.594508, 0.175701, 0.501241, 1.18547203841537, 0.600868, 0.177743, 0.500394, 1.187157449434614, 0.607238, 0.179779, 0.499492, 1.188843290295995, 0.613617, 0.181811, 0.498536, 1.1905287013152388, 0.620005, 0.18384, 0.497524, 1.1922145421766197, 0.626401, 0.185867, 0.496456, 1.1938999531958636, 0.632805, 0.187893, 0.495332, 1.1955857940572445, 0.639216, 0.189921, 0.49415, 1.1972716349186254, 0.645633, 0.191952, 0.49291, 1.1989570459378696, 0.652056, 0.193986, 0.491611, 1.2006428867992505, 0.658483, 0.196027, 0.490253, 1.2023282978184944, 0.664915, 0.198075, 0.488836, 1.2040141386798753, 0.671349, 0.200133, 0.487358, 1.2056995496991192, 0.677786, 0.202203, 0.485819, 1.2073853905605, 0.684224, 0.204286, 0.484219, 1.209071231421881, 0.690661, 0.206384, 0.482558, 1.210756642441125, 0.697098, 0.208501, 0.480835, 1.2124424833025058, 0.703532, 0.210638, 0.479049, 1.2141278943217497, 0.709962, 0.212797, 0.477201, 1.2158137351831309, 0.716387, 0.214982, 0.47529, 1.2174991462023748, 0.722805, 0.217194, 0.473316, 1.2191849870637557, 0.729216, 0.219437, 0.471279, 1.2208703980829996, 0.735616, 0.221713, 0.46918, 1.2225562389443805, 0.742004, 0.224025, 0.467018, 1.2242420798057614, 0.748378, 0.226377, 0.464794, 1.2259274908250053, 0.754737, 0.228772, 0.462509, 1.2276133316863862, 0.761077, 0.231214, 0.460162, 1.22929874270563, 0.767398, 0.233705, 0.457755, 1.230984583567011, 0.773695, 0.236249, 0.455289, 1.2326699945862551, 0.779968, 0.238851, 0.452765, 1.2343558354476358, 0.786212, 0.241514, 0.450184, 1.236041676309017, 0.792427, 0.244242, 0.447543, 1.2377270873282609, 0.798608, 0.24704, 0.444848, 1.2394129281896418, 0.804752, 0.249911, 0.442102, 1.2410983392088857, 0.810855, 0.252861, 0.439305, 1.2427841800702666, 0.816914, 0.255895, 0.436461, 1.2444695910895105, 0.822926, 0.259016, 0.433573, 1.2461554319508914, 0.828886, 0.262229, 0.430644, 1.2478412728122723, 0.834791, 0.26554, 0.427671, 1.2495266838315162, 0.840636, 0.268953, 0.424666, 1.2512125246928971, 0.846416, 0.272473, 0.421631, 1.252897935712141, 0.852126, 0.276106, 0.418573, 1.2545837765735222, 0.857763, 0.279857, 0.415496, 1.2562691875927658, 0.86332, 0.283729, 0.412403, 1.257955028454147, 0.868793, 0.287728, 0.409303, 1.2596408693155277, 0.874176, 0.291859, 0.406205, 1.2613262803347718, 0.879464, 0.296125, 0.403118, 1.2630121211961527, 0.884651, 0.30053, 0.400047, 1.2646975322153966, 0.889731, 0.305079, 0.397002, 1.2663833730767775, 0.8947, 0.309773, 0.393995, 1.2680687840960214, 0.899552, 0.314616, 0.391037, 1.2697546249574023, 0.904281, 0.31961, 0.388137, 1.2714404658187832, 0.908884, 0.324755, 0.385308, 1.2731258768380274, 0.913354, 0.330052, 0.382563, 1.274811717699408, 0.917689, 0.3355, 0.379915, 1.276497128718652, 0.921884, 0.341098, 0.377376, 1.278182969580033, 0.925937, 0.346844, 0.374959, 1.279868380599277, 0.929845, 0.352734, 0.372677, 1.2815542214606577, 0.933606, 0.358764, 0.370541, 1.2832400623220388, 0.937221, 0.364929, 0.368567, 1.2849254733412827, 0.940687, 0.371224, 0.366762, 1.2866113142026636, 0.944006, 0.377643, 0.365136, 1.2882967252219075, 0.94718, 0.384178, 0.363701, 1.2899825660832884, 0.95021, 0.39082, 0.362468, 1.2916679771025323, 0.953099, 0.397563, 0.361438, 1.2933538179639132, 0.955849, 0.4044, 0.360619, 1.2950396588252944, 0.958464, 0.411324, 0.360014, 1.296725069844538, 0.960949, 0.418323, 0.35963, 1.2984109107059192, 0.96331, 0.42539, 0.359469, 1.300096321725163, 0.965549, 0.432519, 0.359529, 1.301782162586544, 0.967671, 0.439703, 0.35981, 1.3034675736057877, 0.96968, 0.446936, 0.360311, 1.3051534144671688, 0.971582, 0.45421, 0.36103, 1.3068388254864127, 0.973381, 0.46152, 0.361965, 1.3085246663477936, 0.975082, 0.468861, 0.363111, 1.3102105072091748, 0.97669, 0.476226, 0.364466, 1.3118959182284184, 0.97821, 0.483612, 0.366025, 1.3135817590897994, 0.979645, 0.491014, 0.367783, 1.3152671701090433, 0.981, 0.498428, 0.369734, 1.3169530109704244, 0.982279, 0.505851, 0.371874, 1.318638421989668, 0.983485, 0.51328, 0.374198, 1.3203242628510492, 0.984622, 0.520713, 0.376698, 1.32201010371243, 0.985693, 0.528148, 0.379371, 1.323695514731674, 0.9867, 0.535582, 0.38221, 1.325381355593055, 0.987646, 0.543015, 0.38521, 1.3270667666122988, 0.988533, 0.550446, 0.388365, 1.3287526074736797, 0.989363, 0.557873, 0.391671, 1.3304380184929236, 0.990138, 0.565296, 0.395122, 1.3321238593543048, 0.990871, 0.572706, 0.398714, 1.3338097002156855, 0.991558, 0.580107, 0.402441, 1.3354951112349294, 0.992196, 0.587502, 0.406299, 1.3371809520963103, 0.992785, 0.594891, 0.410283, 1.3388663631155544, 0.993326, 0.602275, 0.41439, 1.3405522039769353, 0.993834, 0.609644, 0.418613, 1.3422376149961792, 0.994309, 0.616999, 0.42295, 1.3439234558575601, 0.994738, 0.62435, 0.427397, 1.345609296718941, 0.995122, 0.631696, 0.431951, 1.347294707738185, 0.99548, 0.639027, 0.436607, 1.3489805485995658, 0.99581, 0.646344, 0.441361, 1.3506659596188098, 0.996096, 0.653659, 0.446213, 1.3523518004801907, 0.996341, 0.660969, 0.45116, 1.3540372114994346, 0.99658, 0.668256, 0.456192, 1.3557230523608155, 0.996775, 0.675541, 0.461314, 1.3574088932221966, 0.996925, 0.682828, 0.466526, 1.3590943042414403, 0.997077, 0.690088, 0.471811, 1.3607801451028214, 0.997186, 0.697349, 0.477182, 1.3624655561220653, 0.997254, 0.704611, 0.482635, 1.3641513969834462, 0.997325, 0.711848, 0.488154, 1.36583680800269, 0.997351, 0.719089, 0.493755, 1.367522648864071, 0.997351, 0.726324, 0.499428, 1.369208489725452, 0.997341, 0.733545, 0.505167, 1.3708939007446959, 0.997285, 0.740772, 0.510983, 1.372579741606077, 0.997228, 0.747981, 0.516859, 1.3742651526253207, 0.997138, 0.75519, 0.522806, 1.3759509934867016, 0.997019, 0.762398, 0.528821, 1.3776364045059455, 0.996898, 0.769591, 0.534892, 1.3793222453673266, 0.996727, 0.776795, 0.541039, 1.3810080862287073, 0.996571, 0.783977, 0.547233, 1.3826934972479514, 0.996369, 0.791167, 0.553499, 1.3843793381093323, 0.996162, 0.798348, 0.55982, 1.3860647491285762, 0.995932, 0.805527, 0.566202, 1.3877505899899572, 0.99568, 0.812706, 0.572645, 1.389436001009201, 0.995424, 0.819875, 0.57914, 1.391121841870582, 0.995131, 0.827052, 0.585701, 1.3928072528898259, 0.994851, 0.834213, 0.592307, 1.394493093751207, 0.994524, 0.841387, 0.598983, 1.3961789346125877, 0.994222, 0.84854, 0.605696, 1.3978643456318316, 0.993866, 0.855711, 0.612482, 1.3995501864932127, 0.993545, 0.862859, 0.619299, 1.4012355975124566, 0.99317, 0.870024, 0.626189, 1.4029214383738373, 0.992831, 0.877168, 0.633109, 1.4046068493930814, 0.99244, 0.88433, 0.640099, 1.4062926902544624, 0.992089, 0.89147, 0.647116, 1.4079785311158433, 0.991688, 0.898627, 0.654202, 1.4096639421350872, 0.991332, 0.905763, 0.661309, 1.411349782996468, 0.99093, 0.912915, 0.668481, 1.413035194015712, 0.99057, 0.920049, 0.675675, 1.4147210348770929, 0.990175, 0.927196, 0.682926, 1.416406445896337, 0.989815, 0.934329, 0.690198, 1.4180922867577177, 0.989434, 0.94147, 0.697519, 1.4197781276190988, 0.989077, 0.948604, 0.704863, 1.4214635386383427, 0.988717, 0.955742, 0.712242, 1.4231493794997236, 0.988367, 0.962878, 0.719649, 1.4248347905189676, 0.988033, 0.970012, 0.727077, 1.4265206313803485, 0.987691, 0.977154, 0.734536, 1.4282060423995924, 0.987387, 0.984288, 0.742002, 1.4298918832609733, 0.987053, 0.991438, 0.749504] + prestrainRatioLUT.UseLogScale = 0 + prestrainRatioLUT.ColorSpace = 'RGB' + prestrainRatioLUT.UseBelowRangeColor = 0 + prestrainRatioLUT.BelowRangeColor = [0.0, 0.0, 0.0] + prestrainRatioLUT.UseAboveRangeColor = 0 + prestrainRatioLUT.AboveRangeColor = [0.5, 0.5, 0.5] + prestrainRatioLUT.NanColor = [0.0, 1.0, 0.0] + prestrainRatioLUT.NanOpacity = 1.0 + prestrainRatioLUT.Discretize = 1 + prestrainRatioLUT.NumberOfTableValues = 256 + prestrainRatioLUT.ScalarRangeInitialized = 1.0 + prestrainRatioLUT.HSVWrap = 0 + prestrainRatioLUT.VectorComponent = 0 + prestrainRatioLUT.VectorMode = 'Magnitude' + prestrainRatioLUT.AllowDuplicateScalars = 1 + prestrainRatioLUT.Annotations = [] + prestrainRatioLUT.ActiveAnnotatedValues = [] + prestrainRatioLUT.IndexedColors = [] + prestrainRatioLUT.IndexedOpacities = [] + + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + prestrainRatioLUT.ApplyPreset('Warm to Cool (Extended)', True) + + # get opacity transfer function/opacity map for 'prestrainRatio' + prestrainRatioPWF = GetOpacityTransferFunction('prestrainRatio') + prestrainRatioPWF.Points = [1.0000497462439073, 0.8602941036224365, 0.5, 0.0, 1.0919656743557353, 0.625, 0.5, 0.0, 1.1554957969270676, 0.6691176295280457, 0.5, 0.0, 1.2865968414177669, 0.8676470518112183, 0.5, 0.0, 1.3163486627542458, 0.6911764740943909, 0.5, 0.0, 1.4298918832609733, 0.8014705777168274, 0.5, 0.0] + prestrainRatioPWF.AllowDuplicateScalars = 1 + prestrainRatioPWF.UseLogScale = 0 + prestrainRatioPWF.ScalarRangeInitialized = 1 + + # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. + prestrainRatioLUT.ApplyPreset('Warm to Cool (Extended)', True) + + # invert the transfer function + prestrainRatioLUT.InvertTransferFunction() + + + + # get active source. + transform1 = GetActiveSource() + + # get active view + renderView1 = GetActiveViewOrCreate('RenderView') + # uncomment following to set a specific view size + # renderView1.ViewSize = [1067, 547] + + # get display properties + transform1Display = GetDisplayProperties(transform1, view=renderView1) + + # show color bar/color legend + transform1Display.SetScalarBarVisibility(renderView1, True) + + # hide color bar/color legend + transform1Display.SetScalarBarVisibility(renderView1, False) + + # show color bar/color legend + transform1Display.SetScalarBarVisibility(renderView1, True) + + # hide color bar/color legend + transform1Display.SetScalarBarVisibility(renderView1, False) + + # set scalar coloring using an separate color/opacity maps + ColorBy(transform1Display, ('POINTS', 'prestrainRatio'), True) + + # get color transfer function/color map for 'prestrainRatio' + prestrainRatioLUT = GetColorTransferFunction('prestrainRatio') + prestrainRatioLUT.RGBPoints = [1.0000497462439073, 0.12549, 0.0, 0.380392, 1.010795799669334, 0.113725, 0.0235294, 0.45098, 1.0215418530947606, 0.105882, 0.0509804, 0.509804, 1.032287906520187, 0.0392157, 0.0392157, 0.560784, 1.043033959945614, 0.0313725, 0.0980392, 0.6, 1.0537800133710404, 0.0431373, 0.164706, 0.639216, 1.0645260667964673, 0.054902, 0.243137, 0.678431, 1.0752721202218938, 0.054902, 0.317647, 0.709804, 1.0860181736473205, 0.0509804, 0.396078, 0.741176, 1.0967642270727471, 0.0392157, 0.466667, 0.768627, 1.1075102804981738, 0.0313725, 0.537255, 0.788235, 1.1234423793067114, 0.0313725, 0.615686, 0.811765, 1.1369149214072372, 0.0235294, 0.709804, 0.831373, 1.1497461390393338, 0.0509804, 0.8, 0.85098, 1.1591553834186372, 0.0705882, 0.854902, 0.870588, 1.1694204434927418, 0.262745, 0.901961, 0.862745, 1.177332977550952, 0.423529, 0.941176, 0.87451, 1.187383976240822, 0.572549, 0.964706, 0.835294, 1.1948688173727002, 0.658824, 0.980392, 0.843137, 1.2014982726519143, 0.764706, 0.980392, 0.866667, 1.2079136665468941, 0.827451, 0.980392, 0.886275, 1.2145409726154233, 0.913725, 0.988235, 0.937255, 1.2149708147524403, 1.0, 1.0, 1.0, 1.2154006568894573, 0.988235, 0.980392, 0.870588, 1.2220279629579864, 0.992157, 0.964706, 0.713725, 1.2278020323845367, 0.988235, 0.956863, 0.643137, 1.2389224783113053, 0.980392, 0.917647, 0.509804, 1.2498288628538392, 0.968627, 0.87451, 0.407843, 1.2598798615437092, 0.94902, 0.823529, 0.321569, 1.2687010818795734, 0.929412, 0.776471, 0.278431, 1.2794471353050003, 0.909804, 0.717647, 0.235294, 1.2901931887304268, 0.890196, 0.658824, 0.196078, 1.3009392421558534, 0.878431, 0.619608, 0.168627, 1.31168529558128, 0.870588, 0.54902, 0.156863, 1.3224313490067068, 0.85098, 0.47451, 0.145098, 1.3331774024321335, 0.831373, 0.411765, 0.133333, 1.3439234558575601, 0.811765, 0.345098, 0.113725, 1.3546695092829868, 0.788235, 0.266667, 0.0941176, 1.3654155627084135, 0.741176, 0.184314, 0.0745098, 1.3761616161338401, 0.690196, 0.12549, 0.0627451, 1.3869076695592666, 0.619608, 0.0627451, 0.0431373, 1.3976537229846933, 0.54902, 0.027451, 0.0705882, 1.40839977641012, 0.470588, 0.0156863, 0.0901961, 1.4191458298355466, 0.4, 0.00392157, 0.101961, 1.4298918832609733, 0.34902, 0.0, 0.129412] + prestrainRatioLUT.ColorSpace = 'Lab' + prestrainRatioLUT.NanColor = [0.250004, 0.0, 0.0] + prestrainRatioLUT.ScalarRangeInitialized = 1.0 + + # Hide the scalar bar for this color map if no visible data is colored by it. + HideScalarBarIfNotNeeded(prestrainRatioLUT, renderView1) + + # rescale color and/or opacity maps used to include current data range + transform1Display.RescaleTransferFunctionToDataRange(True, False) + + # show color bar/color legend + transform1Display.SetScalarBarVisibility(renderView1, True) + + # get separate color transfer function/color map for 'prestrainRatio' + separate_transform1Display_prestrainRatioLUT = GetColorTransferFunction('prestrainRatio', transform1Display, separate=True) + separate_transform1Display_prestrainRatioLUT.RGBPoints = [1.0000497462439073, 0.001462, 0.000466, 0.013866, 1.0017355871052882, 0.002258, 0.001295, 0.018331, 1.0034209981245321, 0.003279, 0.002305, 0.023708, 1.005106838985913, 0.004512, 0.00349, 0.029965, 1.006792250005157, 0.00595, 0.004843, 0.03713, 1.008478090866538, 0.007588, 0.006356, 0.044973, 1.0101635018857817, 0.009426, 0.008022, 0.052844, 1.0118493427471627, 0.011465, 0.009828, 0.06075, 1.0135351836085438, 0.013708, 0.011771, 0.068667, 1.0152205946277877, 0.016156, 0.01384, 0.076603, 1.0169064354891686, 0.018815, 0.016026, 0.084584, 1.0185918465084125, 0.021692, 0.01832, 0.09261, 1.0202776873697934, 0.024792, 0.020715, 0.100676, 1.0219630983890373, 0.028123, 0.023201, 0.108787, 1.0236489392504182, 0.031696, 0.025765, 0.116965, 1.0253347801117991, 0.03552, 0.028397, 0.125209, 1.027020191131043, 0.039608, 0.03109, 0.133515, 1.028706031992424, 0.04383, 0.03383, 0.141886, 1.030391443011668, 0.048062, 0.036607, 0.150327, 1.032077283873049, 0.05232, 0.039407, 0.158841, 1.0337626948922927, 0.056615, 0.04216, 0.167446, 1.0354485357536738, 0.060949, 0.044794, 0.176129, 1.0371343766150547, 0.06533, 0.047318, 0.184892, 1.0388197876342986, 0.069764, 0.049726, 0.193735, 1.0405056284956795, 0.074257, 0.052017, 0.20266, 1.0421910395149234, 0.078815, 0.054184, 0.211667, 1.0438768803763043, 0.083446, 0.056225, 0.220755, 1.0455622913955482, 0.088155, 0.058133, 0.229922, 1.0472481322569291, 0.092949, 0.059904, 0.239164, 1.0489335432761733, 0.097833, 0.061531, 0.248477, 1.0506193841375542, 0.102815, 0.06301, 0.257854, 1.052305224998935, 0.107899, 0.064335, 0.267289, 1.053990636018179, 0.113094, 0.065492, 0.276784, 1.05567647687956, 0.118405, 0.066479, 0.286321, 1.0573618878988038, 0.123833, 0.067295, 0.295879, 1.0590477287601847, 0.12938, 0.067935, 0.305443, 1.0607331397794286, 0.135053, 0.068391, 0.315, 1.0624189806408095, 0.140858, 0.068654, 0.324538, 1.0641048215021904, 0.146785, 0.068738, 0.334011, 1.0657902325214343, 0.152839, 0.068637, 0.343404, 1.0674760733828152, 0.159018, 0.068354, 0.352688, 1.0691614844020592, 0.165308, 0.067911, 0.361816, 1.0708473252634403, 0.171713, 0.067305, 0.370771, 1.0725327362826842, 0.178212, 0.066576, 0.379497, 1.074218577144065, 0.184801, 0.065732, 0.387973, 1.075904418005446, 0.19146, 0.064818, 0.396152, 1.07758982902469, 0.198177, 0.063862, 0.404009, 1.0792756698860708, 0.204935, 0.062907, 0.411514, 1.0809610809053147, 0.211718, 0.061992, 0.418647, 1.0826469217666956, 0.218512, 0.061158, 0.425392, 1.0843323327859395, 0.225302, 0.060445, 0.431742, 1.0860181736473205, 0.232077, 0.059889, 0.437695, 1.0877040145087014, 0.238826, 0.059517, 0.443256, 1.0893894255279453, 0.245543, 0.059352, 0.448436, 1.0910752663893262, 0.25222, 0.059415, 0.453248, 1.0927606774085703, 0.258857, 0.059706, 0.45771, 1.0944465182699512, 0.265447, 0.060237, 0.46184, 1.0961319292891951, 0.271994, 0.060994, 0.46566, 1.097817770150576, 0.278493, 0.061978, 0.46919, 1.099503611011957, 0.284951, 0.063168, 0.472451, 1.1011890220312008, 0.291366, 0.064553, 0.475462, 1.1028748628925817, 0.29774, 0.066117, 0.478243, 1.1045602739118257, 0.304081, 0.067835, 0.480812, 1.1062461147732066, 0.310382, 0.069702, 0.483186, 1.1079315257924505, 0.316654, 0.07169, 0.48538, 1.1096173666538314, 0.322899, 0.073782, 0.487408, 1.1113032075152123, 0.329114, 0.075972, 0.489287, 1.1129886185344562, 0.335308, 0.078236, 0.491024, 1.1146744593958373, 0.341482, 0.080564, 0.492631, 1.1163598704150812, 0.347636, 0.082946, 0.494121, 1.1180457112764621, 0.353773, 0.085373, 0.495501, 1.119731122295706, 0.359898, 0.087831, 0.496778, 1.121416963157087, 0.366012, 0.090314, 0.49796, 1.1231028040184678, 0.372116, 0.092816, 0.499053, 1.1247882150377118, 0.378211, 0.095332, 0.500067, 1.1264740558990927, 0.384299, 0.097855, 0.501002, 1.1281594669183366, 0.390384, 0.100379, 0.501864, 1.1298453077797175, 0.396467, 0.102902, 0.502658, 1.1315307187989614, 0.402548, 0.10542, 0.503386, 1.1332165596603425, 0.408629, 0.10793, 0.504052, 1.1349019706795864, 0.414709, 0.110431, 0.504662, 1.1365878115409673, 0.420791, 0.11292, 0.505215, 1.1382736524023482, 0.426877, 0.115395, 0.505714, 1.1399590634215921, 0.432967, 0.117855, 0.50616, 1.141644904282973, 0.439062, 0.120298, 0.506555, 1.143330315302217, 0.445163, 0.122724, 0.506901, 1.1450161561635979, 0.451271, 0.125132, 0.507198, 1.1467015671828418, 0.457386, 0.127522, 0.507448, 1.148387408044223, 0.463508, 0.129893, 0.507652, 1.1500732489056036, 0.46964, 0.132245, 0.507809, 1.1517586599248475, 0.47578, 0.134577, 0.507921, 1.1534445007862284, 0.481929, 0.136891, 0.507989, 1.1551299118054725, 0.488088, 0.139186, 0.508011, 1.1568157526668534, 0.494258, 0.141462, 0.507988, 1.1585011636860973, 0.500438, 0.143719, 0.50792, 1.1601870045474783, 0.506629, 0.145958, 0.507806, 1.1618728454088592, 0.512831, 0.148179, 0.507648, 1.163558256428103, 0.519045, 0.150383, 0.507443, 1.165244097289484, 0.52527, 0.152569, 0.507192, 1.1669295083087279, 0.531507, 0.154739, 0.506895, 1.1686153491701088, 0.537755, 0.156894, 0.506551, 1.1703007601893527, 0.544015, 0.159033, 0.506159, 1.1719866010507336, 0.550287, 0.161158, 0.505719, 1.1736724419121147, 0.556571, 0.163269, 0.50523, 1.1753578529313584, 0.562866, 0.165368, 0.504692, 1.1770436937927395, 0.569172, 0.167454, 0.504105, 1.1787291048119835, 0.57549, 0.16953, 0.503466, 1.1804149456733644, 0.581819, 0.171596, 0.502777, 1.1821003566926083, 0.588158, 0.173652, 0.502035, 1.1837861975539892, 0.594508, 0.175701, 0.501241, 1.18547203841537, 0.600868, 0.177743, 0.500394, 1.187157449434614, 0.607238, 0.179779, 0.499492, 1.188843290295995, 0.613617, 0.181811, 0.498536, 1.1905287013152388, 0.620005, 0.18384, 0.497524, 1.1922145421766197, 0.626401, 0.185867, 0.496456, 1.1938999531958636, 0.632805, 0.187893, 0.495332, 1.1955857940572445, 0.639216, 0.189921, 0.49415, 1.1972716349186254, 0.645633, 0.191952, 0.49291, 1.1989570459378696, 0.652056, 0.193986, 0.491611, 1.2006428867992505, 0.658483, 0.196027, 0.490253, 1.2023282978184944, 0.664915, 0.198075, 0.488836, 1.2040141386798753, 0.671349, 0.200133, 0.487358, 1.2056995496991192, 0.677786, 0.202203, 0.485819, 1.2073853905605, 0.684224, 0.204286, 0.484219, 1.209071231421881, 0.690661, 0.206384, 0.482558, 1.210756642441125, 0.697098, 0.208501, 0.480835, 1.2124424833025058, 0.703532, 0.210638, 0.479049, 1.2141278943217497, 0.709962, 0.212797, 0.477201, 1.2158137351831309, 0.716387, 0.214982, 0.47529, 1.2174991462023748, 0.722805, 0.217194, 0.473316, 1.2191849870637557, 0.729216, 0.219437, 0.471279, 1.2208703980829996, 0.735616, 0.221713, 0.46918, 1.2225562389443805, 0.742004, 0.224025, 0.467018, 1.2242420798057614, 0.748378, 0.226377, 0.464794, 1.2259274908250053, 0.754737, 0.228772, 0.462509, 1.2276133316863862, 0.761077, 0.231214, 0.460162, 1.22929874270563, 0.767398, 0.233705, 0.457755, 1.230984583567011, 0.773695, 0.236249, 0.455289, 1.2326699945862551, 0.779968, 0.238851, 0.452765, 1.2343558354476358, 0.786212, 0.241514, 0.450184, 1.236041676309017, 0.792427, 0.244242, 0.447543, 1.2377270873282609, 0.798608, 0.24704, 0.444848, 1.2394129281896418, 0.804752, 0.249911, 0.442102, 1.2410983392088857, 0.810855, 0.252861, 0.439305, 1.2427841800702666, 0.816914, 0.255895, 0.436461, 1.2444695910895105, 0.822926, 0.259016, 0.433573, 1.2461554319508914, 0.828886, 0.262229, 0.430644, 1.2478412728122723, 0.834791, 0.26554, 0.427671, 1.2495266838315162, 0.840636, 0.268953, 0.424666, 1.2512125246928971, 0.846416, 0.272473, 0.421631, 1.252897935712141, 0.852126, 0.276106, 0.418573, 1.2545837765735222, 0.857763, 0.279857, 0.415496, 1.2562691875927658, 0.86332, 0.283729, 0.412403, 1.257955028454147, 0.868793, 0.287728, 0.409303, 1.2596408693155277, 0.874176, 0.291859, 0.406205, 1.2613262803347718, 0.879464, 0.296125, 0.403118, 1.2630121211961527, 0.884651, 0.30053, 0.400047, 1.2646975322153966, 0.889731, 0.305079, 0.397002, 1.2663833730767775, 0.8947, 0.309773, 0.393995, 1.2680687840960214, 0.899552, 0.314616, 0.391037, 1.2697546249574023, 0.904281, 0.31961, 0.388137, 1.2714404658187832, 0.908884, 0.324755, 0.385308, 1.2731258768380274, 0.913354, 0.330052, 0.382563, 1.274811717699408, 0.917689, 0.3355, 0.379915, 1.276497128718652, 0.921884, 0.341098, 0.377376, 1.278182969580033, 0.925937, 0.346844, 0.374959, 1.279868380599277, 0.929845, 0.352734, 0.372677, 1.2815542214606577, 0.933606, 0.358764, 0.370541, 1.2832400623220388, 0.937221, 0.364929, 0.368567, 1.2849254733412827, 0.940687, 0.371224, 0.366762, 1.2866113142026636, 0.944006, 0.377643, 0.365136, 1.2882967252219075, 0.94718, 0.384178, 0.363701, 1.2899825660832884, 0.95021, 0.39082, 0.362468, 1.2916679771025323, 0.953099, 0.397563, 0.361438, 1.2933538179639132, 0.955849, 0.4044, 0.360619, 1.2950396588252944, 0.958464, 0.411324, 0.360014, 1.296725069844538, 0.960949, 0.418323, 0.35963, 1.2984109107059192, 0.96331, 0.42539, 0.359469, 1.300096321725163, 0.965549, 0.432519, 0.359529, 1.301782162586544, 0.967671, 0.439703, 0.35981, 1.3034675736057877, 0.96968, 0.446936, 0.360311, 1.3051534144671688, 0.971582, 0.45421, 0.36103, 1.3068388254864127, 0.973381, 0.46152, 0.361965, 1.3085246663477936, 0.975082, 0.468861, 0.363111, 1.3102105072091748, 0.97669, 0.476226, 0.364466, 1.3118959182284184, 0.97821, 0.483612, 0.366025, 1.3135817590897994, 0.979645, 0.491014, 0.367783, 1.3152671701090433, 0.981, 0.498428, 0.369734, 1.3169530109704244, 0.982279, 0.505851, 0.371874, 1.318638421989668, 0.983485, 0.51328, 0.374198, 1.3203242628510492, 0.984622, 0.520713, 0.376698, 1.32201010371243, 0.985693, 0.528148, 0.379371, 1.323695514731674, 0.9867, 0.535582, 0.38221, 1.325381355593055, 0.987646, 0.543015, 0.38521, 1.3270667666122988, 0.988533, 0.550446, 0.388365, 1.3287526074736797, 0.989363, 0.557873, 0.391671, 1.3304380184929236, 0.990138, 0.565296, 0.395122, 1.3321238593543048, 0.990871, 0.572706, 0.398714, 1.3338097002156855, 0.991558, 0.580107, 0.402441, 1.3354951112349294, 0.992196, 0.587502, 0.406299, 1.3371809520963103, 0.992785, 0.594891, 0.410283, 1.3388663631155544, 0.993326, 0.602275, 0.41439, 1.3405522039769353, 0.993834, 0.609644, 0.418613, 1.3422376149961792, 0.994309, 0.616999, 0.42295, 1.3439234558575601, 0.994738, 0.62435, 0.427397, 1.345609296718941, 0.995122, 0.631696, 0.431951, 1.347294707738185, 0.99548, 0.639027, 0.436607, 1.3489805485995658, 0.99581, 0.646344, 0.441361, 1.3506659596188098, 0.996096, 0.653659, 0.446213, 1.3523518004801907, 0.996341, 0.660969, 0.45116, 1.3540372114994346, 0.99658, 0.668256, 0.456192, 1.3557230523608155, 0.996775, 0.675541, 0.461314, 1.3574088932221966, 0.996925, 0.682828, 0.466526, 1.3590943042414403, 0.997077, 0.690088, 0.471811, 1.3607801451028214, 0.997186, 0.697349, 0.477182, 1.3624655561220653, 0.997254, 0.704611, 0.482635, 1.3641513969834462, 0.997325, 0.711848, 0.488154, 1.36583680800269, 0.997351, 0.719089, 0.493755, 1.367522648864071, 0.997351, 0.726324, 0.499428, 1.369208489725452, 0.997341, 0.733545, 0.505167, 1.3708939007446959, 0.997285, 0.740772, 0.510983, 1.372579741606077, 0.997228, 0.747981, 0.516859, 1.3742651526253207, 0.997138, 0.75519, 0.522806, 1.3759509934867016, 0.997019, 0.762398, 0.528821, 1.3776364045059455, 0.996898, 0.769591, 0.534892, 1.3793222453673266, 0.996727, 0.776795, 0.541039, 1.3810080862287073, 0.996571, 0.783977, 0.547233, 1.3826934972479514, 0.996369, 0.791167, 0.553499, 1.3843793381093323, 0.996162, 0.798348, 0.55982, 1.3860647491285762, 0.995932, 0.805527, 0.566202, 1.3877505899899572, 0.99568, 0.812706, 0.572645, 1.389436001009201, 0.995424, 0.819875, 0.57914, 1.391121841870582, 0.995131, 0.827052, 0.585701, 1.3928072528898259, 0.994851, 0.834213, 0.592307, 1.394493093751207, 0.994524, 0.841387, 0.598983, 1.3961789346125877, 0.994222, 0.84854, 0.605696, 1.3978643456318316, 0.993866, 0.855711, 0.612482, 1.3995501864932127, 0.993545, 0.862859, 0.619299, 1.4012355975124566, 0.99317, 0.870024, 0.626189, 1.4029214383738373, 0.992831, 0.877168, 0.633109, 1.4046068493930814, 0.99244, 0.88433, 0.640099, 1.4062926902544624, 0.992089, 0.89147, 0.647116, 1.4079785311158433, 0.991688, 0.898627, 0.654202, 1.4096639421350872, 0.991332, 0.905763, 0.661309, 1.411349782996468, 0.99093, 0.912915, 0.668481, 1.413035194015712, 0.99057, 0.920049, 0.675675, 1.4147210348770929, 0.990175, 0.927196, 0.682926, 1.416406445896337, 0.989815, 0.934329, 0.690198, 1.4180922867577177, 0.989434, 0.94147, 0.697519, 1.4197781276190988, 0.989077, 0.948604, 0.704863, 1.4214635386383427, 0.988717, 0.955742, 0.712242, 1.4231493794997236, 0.988367, 0.962878, 0.719649, 1.4248347905189676, 0.988033, 0.970012, 0.727077, 1.4265206313803485, 0.987691, 0.977154, 0.734536, 1.4282060423995924, 0.987387, 0.984288, 0.742002, 1.4298918832609733, 0.987053, 0.991438, 0.749504] + separate_transform1Display_prestrainRatioLUT.ColorSpace = 'RGB' + separate_transform1Display_prestrainRatioLUT.NanColor = [0.0, 1.0, 0.0] + separate_transform1Display_prestrainRatioLUT.ScalarRangeInitialized = 1.0 + + # get separate opacity transfer function/opacity map for 'prestrainRatio' + separate_transform1Display_prestrainRatioPWF = GetOpacityTransferFunction('prestrainRatio', transform1Display, separate=True) + separate_transform1Display_prestrainRatioPWF.Points = [1.0000497462439073, 0.8602941036224365, 0.5, 0.0, 1.0919656743557353, 0.625, 0.5, 0.0, 1.1554957969270676, 0.6691176295280457, 0.5, 0.0, 1.2865968414177669, 0.8676470518112183, 0.5, 0.0, 1.3163486627542458, 0.6911764740943909, 0.5, 0.0, 1.4298918832609733, 0.8014705777168274, 0.5, 0.0] + separate_transform1Display_prestrainRatioPWF.ScalarRangeInitialized = 1 + + # set scalar coloring + ColorBy(transform1Display, ('POINTS', 'prestrainRatio')) + + # Hide the scalar bar for this color map if no visible data is colored by it. + HideScalarBarIfNotNeeded(separate_transform1Display_prestrainRatioLUT, renderView1) + + # rescale color and/or opacity maps used to include current data range + transform1Display.RescaleTransferFunctionToDataRange(True, False) + + # show color bar/color legend + transform1Display.SetScalarBarVisibility(renderView1, True) + + # get opacity transfer function/opacity map for 'prestrainRatio' + prestrainRatioPWF = GetOpacityTransferFunction('prestrainRatio') + prestrainRatioPWF.Points = [1.0000497462439073, 0.8602941036224365, 0.5, 0.0, 1.0919656743557353, 0.625, 0.5, 0.0, 1.1554957969270676, 0.6691176295280457, 0.5, 0.0, 1.2865968414177669, 0.8676470518112183, 0.5, 0.0, 1.3163486627542458, 0.6911764740943909, 0.5, 0.0, 1.4298918832609733, 0.8014705777168274, 0.5, 0.0] + prestrainRatioPWF.ScalarRangeInitialized = 1 + + # get color legend/bar for prestrainRatioLUT in view renderView1 + prestrainRatioLUTColorBar = GetScalarBar(prestrainRatioLUT, renderView1) + prestrainRatioLUTColorBar.WindowLocation = 'UpperRightCorner' + prestrainRatioLUTColorBar.Position = [0.8912839737582006, 0.6471663619744058] + prestrainRatioLUTColorBar.Title = 'prestrainRatio' + prestrainRatioLUTColorBar.ComponentTitle = '' + + # find source + xMLStructuredGridReader1 = FindSource('XMLStructuredGridReader1') + + # set active source + SetActiveSource(xMLStructuredGridReader1) + + # get color transfer function/color map for 'elasticRatio' + elasticRatioLUT = GetColorTransferFunction('elasticRatio') + elasticRatioLUT.RGBPoints = [0.3303091106505249, 0.34902, 0.0, 0.129412, 0.34705135837933526, 0.4, 0.00392157, 0.101961, 0.3637936061081457, 0.470588, 0.0156863, 0.0901961, 0.3805358538369561, 0.54902, 0.027451, 0.0705882, 0.3972781015657665, 0.619608, 0.0627451, 0.0431373, 0.4140203492945769, 0.690196, 0.12549, 0.0627451, 0.4307625970233873, 0.741176, 0.184314, 0.0745098, 0.4475048447521977, 0.788235, 0.266667, 0.0941176, 0.46424709248100815, 0.811765, 0.345098, 0.113725, 0.48098934020981854, 0.831373, 0.411765, 0.133333, 0.4977315879386289, 0.85098, 0.47451, 0.145098, 0.5144738356674393, 0.870588, 0.54902, 0.156863, 0.5312160833962497, 0.878431, 0.619608, 0.168627, 0.5479583311250602, 0.890196, 0.658824, 0.196078, 0.5647005788538706, 0.909804, 0.717647, 0.235294, 0.581442826582681, 0.929412, 0.776471, 0.278431, 0.5951862028983068, 0.94902, 0.823529, 0.321569, 0.6108455620440179, 0.968627, 0.87451, 0.407843, 0.6278376041089421, 0.980392, 0.917647, 0.509804, 0.6451631517486243, 0.988235, 0.956863, 0.643137, 0.6541590962982686, 0.992157, 0.964706, 0.713725, 0.6644843753175806, 0.988235, 0.980392, 0.870588, 0.6651540652267329, 1.0, 1.0, 1.0, 0.6658237551358854, 0.913725, 0.988235, 0.937255, 0.6761490341551974, 0.827451, 0.980392, 0.886275, 0.6861441560492971, 0.764706, 0.980392, 0.866667, 0.6964727835181548, 0.658824, 0.980392, 0.843137, 0.708134093906226, 0.572549, 0.964706, 0.835294, 0.7237934530519369, 0.423529, 0.941176, 0.87451, 0.7361211048996146, 0.262745, 0.901961, 0.862745, 0.7521139696200834, 0.0705882, 0.854902, 0.870588, 0.7667734817314298, 0.0509804, 0.8, 0.85098, 0.7867643952095386, 0.0235294, 0.709804, 0.831373, 0.8077544860321026, 0.0313725, 0.615686, 0.811765, 0.832576542514837, 0.0313725, 0.537255, 0.788235, 0.8493187902436474, 0.0392157, 0.466667, 0.768627, 0.8660610379724578, 0.0509804, 0.396078, 0.741176, 0.8828032857012682, 0.054902, 0.317647, 0.709804, 0.8995455334300786, 0.054902, 0.243137, 0.678431, 0.916287781158889, 0.0431373, 0.164706, 0.639216, 0.9330300288876996, 0.0313725, 0.0980392, 0.6, 0.94977227661651, 0.0392157, 0.0392157, 0.560784, 0.9665145243453201, 0.105882, 0.0509804, 0.509804, 0.9832567720741308, 0.113725, 0.0235294, 0.45098, 0.9999990198029411, 0.12549, 0.0, 0.380392] + elasticRatioLUT.ColorSpace = 'Lab' + elasticRatioLUT.NanColor = [0.250004, 0.0, 0.0] + elasticRatioLUT.ScalarRangeInitialized = 1.0 + + # get opacity transfer function/opacity map for 'elasticRatio' + elasticRatioPWF = GetOpacityTransferFunction('elasticRatio') + elasticRatioPWF.Points = [0.3303091106505249, 0.8602941036224365, 0.5, 0.0, 0.47351324129727485, 0.625, 0.5, 0.0, 0.5724925603293413, 0.6691176295280457, 0.5, 0.0, 0.7767467248559744, 0.8676470518112183, 0.5, 0.0, 0.8230997759230788, 0.6911764740943909, 0.5, 0.0, 0.9999990198029411, 0.8014705777168274, 0.5, 0.0] + elasticRatioPWF.ScalarRangeInitialized = 1 + + # Properties modified on renderView1.AxesGrid + renderView1.AxesGrid.Visibility = 0 + + # Properties modified on renderView1.AxesGrid + renderView1.AxesGrid.Visibility = 1 + + # get display properties + xMLStructuredGridReader1Display = GetDisplayProperties(xMLStructuredGridReader1, view=renderView1) + + # hide color bar/color legend + xMLStructuredGridReader1Display.SetScalarBarVisibility(renderView1, False) + + # set active source + SetActiveSource(transform1) + + # Properties modified on prestrainRatioLUTColorBar + prestrainRatioLUTColorBar.WindowLocation = 'LowerRightCorner' + + # Properties modified on prestrainRatioLUTColorBar + prestrainRatioLUTColorBar.HorizontalTitle = 1 + +else: + + # get color transfer function/color map for 'elasticRatio' + elasticRatioLUT = GetColorTransferFunction('elasticRatio') + elasticRatioLUT.AutomaticRescaleRangeMode = "Grow and update on 'Apply'" + elasticRatioLUT.InterpretValuesAsCategories = 0 + elasticRatioLUT.AnnotationsInitialized = 0 + elasticRatioLUT.ShowCategoricalColorsinDataRangeOnly = 0 + elasticRatioLUT.RescaleOnVisibilityChange = 0 + elasticRatioLUT.EnableOpacityMapping = 0 + elasticRatioLUT.RGBPoints = [0.3303091106505249, 0.34902, 0.0, 0.129412, 0.34705135837933526, 0.4, 0.00392157, 0.101961, 0.3637936061081457, 0.470588, 0.0156863, 0.0901961, 0.3805358538369561, 0.54902, 0.027451, 0.0705882, 0.3972781015657665, 0.619608, 0.0627451, 0.0431373, 0.4140203492945769, 0.690196, 0.12549, 0.0627451, 0.4307625970233873, 0.741176, 0.184314, 0.0745098, 0.4475048447521977, 0.788235, 0.266667, 0.0941176, 0.46424709248100815, 0.811765, 0.345098, 0.113725, 0.48098934020981854, 0.831373, 0.411765, 0.133333, 0.4977315879386289, 0.85098, 0.47451, 0.145098, 0.5144738356674393, 0.870588, 0.54902, 0.156863, 0.5312160833962497, 0.878431, 0.619608, 0.168627, 0.5479583311250602, 0.890196, 0.658824, 0.196078, 0.5647005788538706, 0.909804, 0.717647, 0.235294, 0.581442826582681, 0.929412, 0.776471, 0.278431, 0.5951862028983068, 0.94902, 0.823529, 0.321569, 0.6108455620440179, 0.968627, 0.87451, 0.407843, 0.6278376041089421, 0.980392, 0.917647, 0.509804, 0.6451631517486243, 0.988235, 0.956863, 0.643137, 0.6541590962982686, 0.992157, 0.964706, 0.713725, 0.6644843753175806, 0.988235, 0.980392, 0.870588, 0.6651540652267329, 1.0, 1.0, 1.0, 0.6658237551358854, 0.913725, 0.988235, 0.937255, 0.6761490341551974, 0.827451, 0.980392, 0.886275, 0.6861441560492971, 0.764706, 0.980392, 0.866667, 0.6964727835181548, 0.658824, 0.980392, 0.843137, 0.708134093906226, 0.572549, 0.964706, 0.835294, 0.7237934530519369, 0.423529, 0.941176, 0.87451, 0.7361211048996146, 0.262745, 0.901961, 0.862745, 0.7521139696200834, 0.0705882, 0.854902, 0.870588, 0.7667734817314298, 0.0509804, 0.8, 0.85098, 0.7867643952095386, 0.0235294, 0.709804, 0.831373, 0.8077544860321026, 0.0313725, 0.615686, 0.811765, 0.832576542514837, 0.0313725, 0.537255, 0.788235, 0.8493187902436474, 0.0392157, 0.466667, 0.768627, 0.8660610379724578, 0.0509804, 0.396078, 0.741176, 0.8828032857012682, 0.054902, 0.317647, 0.709804, 0.8995455334300786, 0.054902, 0.243137, 0.678431, 0.916287781158889, 0.0431373, 0.164706, 0.639216, 0.9330300288876996, 0.0313725, 0.0980392, 0.6, 0.94977227661651, 0.0392157, 0.0392157, 0.560784, 0.9665145243453201, 0.105882, 0.0509804, 0.509804, 0.9832567720741308, 0.113725, 0.0235294, 0.45098, 0.9999990198029411, 0.12549, 0.0, 0.380392] + elasticRatioLUT.UseLogScale = 0 + elasticRatioLUT.ColorSpace = 'Lab' + elasticRatioLUT.UseBelowRangeColor = 0 + elasticRatioLUT.BelowRangeColor = [0.0, 0.0, 0.0] + elasticRatioLUT.UseAboveRangeColor = 0 + elasticRatioLUT.AboveRangeColor = [0.5, 0.5, 0.5] + elasticRatioLUT.NanColor = [0.250004, 0.0, 0.0] + elasticRatioLUT.NanOpacity = 1.0 + elasticRatioLUT.Discretize = 1 + elasticRatioLUT.NumberOfTableValues = 256 + elasticRatioLUT.ScalarRangeInitialized = 1.0 + elasticRatioLUT.HSVWrap = 0 + elasticRatioLUT.VectorComponent = 0 + elasticRatioLUT.VectorMode = 'Magnitude' + elasticRatioLUT.AllowDuplicateScalars = 1 + elasticRatioLUT.Annotations = [] + elasticRatioLUT.ActiveAnnotatedValues = [] + elasticRatioLUT.IndexedColors = [] + elasticRatioLUT.IndexedOpacities = [] + + # get active view + renderView1 = GetActiveViewOrCreate('RenderView') + # uncomment following to set a specific view size + # renderView1.ViewSize = [1067, 547] + + # get color legend/bar for elasticRatioLUT in view renderView1 + elasticRatioLUTColorBar = GetScalarBar(elasticRatioLUT, renderView1) + elasticRatioLUTColorBar.AutoOrient = 1 + elasticRatioLUTColorBar.Orientation = 'Vertical' + elasticRatioLUTColorBar.WindowLocation = 'LowerRightCorner' + elasticRatioLUTColorBar.Position = [0.89, 0.02] + elasticRatioLUTColorBar.Title = 'elasticRatio' + elasticRatioLUTColorBar.ComponentTitle = '' + elasticRatioLUTColorBar.TitleJustification = 'Centered' + elasticRatioLUTColorBar.HorizontalTitle = 0 + elasticRatioLUTColorBar.TitleColor = [1.0, 1.0, 1.0] + elasticRatioLUTColorBar.TitleOpacity = 1.0 + elasticRatioLUTColorBar.TitleFontFamily = 'Arial' + elasticRatioLUTColorBar.TitleFontFile = '' + elasticRatioLUTColorBar.TitleBold = 0 + elasticRatioLUTColorBar.TitleItalic = 0 + elasticRatioLUTColorBar.TitleShadow = 0 + elasticRatioLUTColorBar.TitleFontSize = 16 + elasticRatioLUTColorBar.LabelColor = [1.0, 1.0, 1.0] + elasticRatioLUTColorBar.LabelOpacity = 1.0 + elasticRatioLUTColorBar.LabelFontFamily = 'Arial' + elasticRatioLUTColorBar.LabelFontFile = '' + elasticRatioLUTColorBar.LabelBold = 0 + elasticRatioLUTColorBar.LabelItalic = 0 + elasticRatioLUTColorBar.LabelShadow = 0 + elasticRatioLUTColorBar.LabelFontSize = 16 + elasticRatioLUTColorBar.AutomaticLabelFormat = 1 + elasticRatioLUTColorBar.LabelFormat = '%-#6.3g' + elasticRatioLUTColorBar.DrawTickMarks = 1 + elasticRatioLUTColorBar.DrawTickLabels = 1 + elasticRatioLUTColorBar.UseCustomLabels = 0 + elasticRatioLUTColorBar.CustomLabels = [] + elasticRatioLUTColorBar.AddRangeLabels = 1 + elasticRatioLUTColorBar.RangeLabelFormat = '%-#6.1e' + elasticRatioLUTColorBar.DrawAnnotations = 1 + elasticRatioLUTColorBar.AddRangeAnnotations = 0 + elasticRatioLUTColorBar.AutomaticAnnotations = 0 + elasticRatioLUTColorBar.DrawNanAnnotation = 0 + elasticRatioLUTColorBar.NanAnnotation = 'NaN' + elasticRatioLUTColorBar.TextPosition = 'Ticks right/top, annotations left/bottom' + elasticRatioLUTColorBar.ReverseLegend = 0 + elasticRatioLUTColorBar.ScalarBarThickness = 16 + elasticRatioLUTColorBar.ScalarBarLength = 0.33 + + # Properties modified on elasticRatioLUTColorBar + elasticRatioLUTColorBar.HorizontalTitle = 1 + + + + +renderView1.OrientationAxesVisibility = 0 + +#### uncomment the following to render all views +# RenderAllViews() +# alternatively, if you want to write images, you can use SaveScreenshot(...). +# ----------------- EXPORT ----------------- +# save screenshot +# SaveScreenshot('/home/klaus/Desktop/PhaseDiagramPlot.png', renderView1, ImageResolution=[1257, 934]) +# SaveScreenshot('/home/klaus/Desktop/PhaseDiagramPlot.png', renderView1, ImageResolution=[2514, 1868]) +# SaveScreenshot('/home/klaus/Desktop/PhaseDiagramPlot.png', renderView1, ImageResolution=[1063, 657]) +# +if prestrain: + outputName = '/home/klaus/Desktop/PrestrainRatio' + ".png" + +else: + outputName = '/home/klaus/Desktop/ElasticRatio' + ".png" +# SaveScreenshot('/home/klaus/Desktop/2DPhaseDiagram.png', renderView1, ImageResolution=[2126, 1314]) + +SaveScreenshot(outputName , renderView1, ImageResolution=[2126, 1314]) +# export view +# ExportView('/home/klaus/Desktop/PhaseDiagramPlot.pdf', view=renderView1) diff --git a/src/ParaViewSettings.txt b/src/ParaViewSettings.txt new file mode 100644 index 0000000000000000000000000000000000000000..88039a836e99c07910ca09e482e7c62fe8e5ba9a --- /dev/null +++ b/src/ParaViewSettings.txt @@ -0,0 +1,8 @@ + +Colormap: Cool-to-Warm + +Representation: Point-Gaussian +Opacity: 0.01 +PointSize: 2 +Gaussian-radius: 0.0075 +Shader-Preset: Plain-Circle diff --git a/src/PhaseDiagram.py b/src/PhaseDiagram.py index c7f32e5cd6fe680ca4abe540d76a26b115f699f2..f82a4cb64d992f9564d046e79204aa6dbda55014 100644 --- a/src/PhaseDiagram.py +++ b/src/PhaseDiagram.py @@ -115,7 +115,7 @@ mu1 = 1.0 rho1 = 1.0 alpha = 2.0 beta = 2.0 -beta = 5.0 +# beta = 5.0 theta = 1.0/4.0 #set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value gamma = '0' @@ -159,9 +159,9 @@ print('----------------------------') print('type of gamma:', type(gamma)) # # # -# Gamma_Values = ['0', 'infinity'] -Gamma_Values = ['infinity'] -Gamma_Values = ['0'] +Gamma_Values = ['0', 'infinity'] +# Gamma_Values = ['infinity'] +# Gamma_Values = ['0'] print('(Input) Gamma_Values:', Gamma_Values) for gamma in Gamma_Values: @@ -233,7 +233,7 @@ for gamma in Gamma_Values: # SamplePoints_3D = 400 # Number of sample points in each direction # SamplePoints_2D = 7500 # Number of sample points in each direction SamplePoints_2D = 4000 # 4000 # Number of sample points in each direction - SamplePoints_2D = 200 # 4000 # Number of sample points in each direction + SamplePoints_2D = 400 # 4000 # Number of sample points in each direction if make_3D_PhaseDiagram: alphas_ = np.linspace(-20, 20, SamplePoints_3D) @@ -307,12 +307,16 @@ for gamma in Gamma_Values: # thetas_ = np.linspace(0.05,0.2,SamplePoints_2D) # betas_ = np.linspace(0.01,40.01,1) #fix to one value: - # betas_ = 2.0; + betas_ = 2.0; # betas_ = 10.0; - betas_ = 5.0; - + # betas_ = 5.0; + # betas_ = 0.5; + #intermediate Values + alphas_ = np.linspace(-2, 1, SamplePoints_2D) + thetas_ = np.linspace(0.4,0.6,SamplePoints_2D) + betas_ = 10.0; # TEST # alphas_ = np.linspace(-8, 8, SamplePoints_2D) diff --git a/src/PhaseDiagram_backup.py b/src/PhaseDiagram_backup.py new file mode 100644 index 0000000000000000000000000000000000000000..ae7f66cb9c85ee1c1c07a3137812f7286da77692 --- /dev/null +++ b/src/PhaseDiagram_backup.py @@ -0,0 +1,389 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +import sys +from ClassifyMin import * +from HelperFunctions import * +# from CellScript import * +from mpl_toolkits.mplot3d import Axes3D +import matplotlib.cm as cm +from vtk.util import numpy_support +from pyevtk.hl import gridToVTK + +import time +# print(sys.executable) + +# -------------------------------------------------------------------- +# START : +# INPUT (Parameters): alpha, beta, theta, gamma, mu1, rho1 +# +# -Option 1 : (Case lambda = 0 => q12 = 0) +# compute q1,q2,b1,b2 from Formula +# Option 1.1 : +# set mu_gamma = 'q1' or 'q2' (extreme regimes: gamma \in {0,\infty}) +# Option 1.2 : +# compute mu_gamma with 'Compute_MuGamma' (2D problem much faster then Cell-Problem) +# -Option 2 : +# compute Q_hom & B_eff by running 'Cell-Problem' +# +# -> CLASSIFY ... +# +# OUTPUT: Minimizer G, angle , type, curvature +# ----------------------------------------------------------------------- +# +# +# def GetMuGamma(beta,theta,gamma,mu1,rho1, InputFilePath = os.path.dirname(os.getcwd()) +"/inputs/computeMuGamma.parset", +# OutputFilePath = os.path.dirname(os.getcwd()) + "/outputs/outputMuGamma.txt" ): +# # ------------------------------------ get mu_gamma ------------------------------ +# # ---Scenario 1.1: extreme regimes +# if gamma == '0': +# print('extreme regime: gamma = 0') +# mu_gamma = (1.0/6.0)*arithmeticMean(mu1, beta, theta) # = q2 +# print("mu_gamma:", mu_gamma) +# elif gamma == 'infinity': +# print('extreme regime: gamma = infinity') +# mu_gamma = (1.0/6.0)*harmonicMean(mu1, beta, theta) # = q1 +# print("mu_gamma:", mu_gamma) +# else: +# # --- Scenario 1.2: compute mu_gamma with 'Compute_MuGamma' (much faster than running full Cell-Problem) +# # print("Run computeMuGamma for Gamma = ", gamma) +# with open(InputFilePath, 'r') as file: +# filedata = file.read() +# filedata = re.sub('(?m)^gamma=.*','gamma='+str(gamma),filedata) +# # filedata = re.sub('(?m)^alpha=.*','alpha='+str(alpha),filedata) +# filedata = re.sub('(?m)^beta=.*','beta='+str(beta),filedata) +# filedata = re.sub('(?m)^theta=.*','theta='+str(theta),filedata) +# filedata = re.sub('(?m)^mu1=.*','mu1='+str(mu1),filedata) +# filedata = re.sub('(?m)^rho1=.*','rho1='+str(rho1),filedata) +# f = open(InputFilePath,'w') +# f.write(filedata) +# f.close() +# # --- Run Cell-Problem +# +# # Check Time +# # t = time.time() +# # subprocess.run(['./build-cmake/src/Cell-Problem', './inputs/cellsolver.parset'], +# # capture_output=True, text=True) +# # --- Run Cell-Problem_muGama -> faster +# # subprocess.run(['./build-cmake/src/Cell-Problem_muGamma', './inputs/cellsolver.parset'], +# # capture_output=True, text=True) +# # --- Run Compute_muGamma (2D Problem much much faster) +# +# subprocess.run(['./build-cmake/src/Compute_MuGamma', './inputs/computeMuGamma.parset'], +# capture_output=True, text=True) +# # print('elapsed time:', time.time() - t) +# +# #Extract mu_gamma from Output-File TODO: GENERALIZED THIS FOR QUANTITIES OF INTEREST +# with open(OutputFilePath, 'r') as file: +# output = file.read() +# tmp = re.search(r'(?m)^mu_gamma=.*',output).group() # Not necessary for Intention of Program t output Minimizer etc..... +# s = re.findall(r"[-+]?\d*\.\d+|\d+", tmp) +# mu_gamma = float(s[0]) +# # print("mu_gamma:", mu_gammaValue) +# # -------------------------------------------------------------------------------------- +# return mu_gamma +# + + + +# ----------- SETUP PATHS +# InputFile = "/inputs/cellsolver.parset" +# OutputFile = "/outputs/output.txt" +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + + +# -------------------------- Input Parameters -------------------- +# mu1 = 10.0 # TODO : here must be the same values as in the Parset for computeMuGamma +mu1 = 1.0 +rho1 = 1.0 +alpha = 2.0 +beta = 2.0 +beta = 10.0 +theta = 1.0/4.0 +#set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value +gamma = '0' +gamma = 'infinity' +# gamma = 0.5 +# gamma = 0.25 +# gamma = 1.0 + +# gamma = 5.0 + +#added +# lambda1 = 10.0 +lambda1 = 0.0 + + + + + +print('---- Input parameters: -----') +print('mu1: ', mu1) +print('rho1: ', rho1) +print('alpha: ', alpha) +print('beta: ', beta) +print('theta: ', theta) +print('gamma:', gamma) + +print('lambda1: ', lambda1) +print('----------------------------') +# ---------------------------------------------------------------- + +# +# gamma_min = 0.5 +# gamma_max = 1.0 +# +# # gamma_min = 1 +# # gamma_max = 1 +# Gamma_Values = np.linspace(gamma_min, gamma_max, num=3) +# # # +# # # Gamma_Values = np.linspace(gamma_min, gamma_max, num=13) # TODO variable Input Parameters...alpha,beta... +# print('(Input) Gamma_Values:', Gamma_Values) +# # # +# for gamma in Gamma_Values: + + + # muGamma = GetMuGamma(beta,theta,gamma,mu1,rho1,InputFilePath) + # # muGamma = GetMuGamma(beta,theta,gamma,mu1,rho1) + # print('Test MuGamma:', muGamma) + + # ------- Options -------- + # print_Cases = True + # print_Output = True + + #TODO +# generalCase = True #Read Output from Cell-Problem instead of using Lemma1.4 (special case) +generalCase = False + +# make_3D_plot = True +make_3D_PhaseDiagram = True +make_2D_plot = False +make_2D_PhaseDiagram = False +make_3D_plot = False +# make_3D_PhaseDiagram = False +# make_2D_plot = True +# make_2D_PhaseDiagram = True +# + +# --- Define effective quantities: q1, q2 , q3 = mu_gamma, q12 --- +# q1 = harmonicMean(mu1, beta, theta) +# q2 = arithmeticMean(mu1, beta, theta) +# --- Set q12 +# q12 = 0.0 # (analytical example) # TEST / TODO read from Cell-Output + + + + + +# b1 = prestrain_b1(rho1, beta, alpha, theta) +# b2 = prestrain_b2(rho1, beta, alpha, theta) +# +# print('---- Input parameters: -----') +# print('mu1: ', mu1) +# print('rho1: ', rho1) +# print('alpha: ', alpha) +# print('beta: ', beta) +# print('theta: ', theta) +# print("q1: ", q1) +# print("q2: ", q2) +# print("mu_gamma: ", mu_gamma) +# print("q12: ", q12) +# print("b1: ", b1) +# print("b2: ", b2) +# print('----------------------------') +# print("machine epsilon", sys.float_info.epsilon) + +# G, angle, type, kappa = classifyMin(q1, q2, mu_gamma, q12, b1, b2, print_Cases, print_Output) +# Test = f(1,2 ,q1,q2,mu_gamma,q12,b1,b2) +# print("Test", Test) + +# ---------------------- MAKE PLOT / Write to VTK------------------------------------------------------------------------------ + +# SamplePoints_3D = 10 # Number of sample points in each direction +# SamplePoints_2D = 10 # Number of sample points in each direction +SamplePoints_3D = 300 # Number of sample points in each direction +# SamplePoints_3D = 150 # Number of sample points in each direction +# SamplePoints_3D = 100 # Number of sample points in each direction +# SamplePoints_3D = 200 # Number of sample points in each direction +# SamplePoints_3D = 400 # Number of sample points in each direction +# SamplePoints_2D = 7500 # Number of sample points in each direction +SamplePoints_2D = 4000 # 4000 # Number of sample points in each direction + + +if make_3D_PhaseDiagram: + alphas_ = np.linspace(-20, 20, SamplePoints_3D) + # alphas_ = np.linspace(-10, 10, SamplePoints_3D) + + # betas_ = np.linspace(0.01,40.01,SamplePoints_3D) # Full Range + # betas_ = np.linspace(0.01,20.01,SamplePoints_3D) # FULL Range + + + + # betas_ = np.linspace(0.01,1.0,SamplePoints_3D) # weird part + betas_ = np.linspace(1.01,40.01,SamplePoints_3D) #TEST !!!!! For Beta <1 weird tings happen... + thetas_ = np.linspace(0.01,0.99,SamplePoints_3D) + + + # TEST + # alphas_ = np.linspace(-2, 2, SamplePoints_3D) + # betas_ = np.linspace(1.01,10.01,SamplePoints_3D) + # print('betas:', betas_) + + # TEST : + # alphas_ = np.linspace(-40, 40, SamplePoints_3D) + # betas_ = np.linspace(0.01,80.01,SamplePoints_3D) # Full Range + + # print('type of alphas', type(alphas_)) + # print('Test:', type(np.array([mu_gamma])) ) + alphas, betas, thetas = np.meshgrid(alphas_, betas_, thetas_, indexing='ij') + classifyMin_anaVec = np.vectorize(classifyMin_ana) + + # Get MuGamma values ... + GetMuGammaVec = np.vectorize(GetMuGamma) + muGammas = GetMuGammaVec(betas, thetas, gamma, mu1, rho1) + # Classify Minimizers.... + G, angles, Types, curvature = classifyMin_anaVec(alphas, betas, thetas, muGammas, mu1, rho1) # Sets q12 to zero!!! + + # G, angles, Types, curvature = classifyMin_anaVec(alphas, betas, thetas, muGammas, mu1, rho1, True, True) + # print('size of G:', G.shape) + # print('G:', G) + + # Option to print angles + # print('angles:', angles) + + + # Out = classifyMin_anaVec(alphas,betas,thetas) + # T = Out[2] + # --- Write to VTK + + GammaString = str(gamma) + VTKOutputName = "outputs/PhaseDiagram3D" + "Gamma" + GammaString + gridToVTK(VTKOutputName , alphas, betas, thetas, pointData = {'Type': Types, 'angles': angles, 'curvature': curvature} ) + print('Written to VTK-File:', VTKOutputName ) + +if make_2D_PhaseDiagram: + # alphas_ = np.linspace(-20, 20, SamplePoints_2D) + # alphas_ = np.linspace(0, 1, SamplePoints_2D) + thetas_ = np.linspace(0.01,0.99,SamplePoints_2D) + alphas_ = np.linspace(-5, 5, SamplePoints_2D) + # alphas_ = np.linspace(-5, 15, SamplePoints_2D) + # thetas_ = np.linspace(0.05,0.25,SamplePoints_2D) + + + # good range: + # alphas_ = np.linspace(9, 10, SamplePoints_2D) + # thetas_ = np.linspace(0.075,0.14,SamplePoints_2D) + + # range used: + # alphas_ = np.linspace(8, 10, SamplePoints_2D) + # thetas_ = np.linspace(0.05,0.16,SamplePoints_2D) + + # alphas_ = np.linspace(8, 12, SamplePoints_2D) + # thetas_ = np.linspace(0.05,0.2,SamplePoints_2D) + # betas_ = np.linspace(0.01,40.01,1) + #fix to one value: + # betas_ = 2.0; + betas_ = 10.0; + + # TEST + # alphas_ = np.linspace(-8, 8, SamplePoints_2D) + # thetas_ = np.linspace(0.01,0.99,SamplePoints_2D) + # betas_ = 1.0; #TEST Problem: disvison by zero if alpha = 9, theta = 0.1 ! + # betas_ = 0.9; + # betas_ = 0.5; #TEST!!! + alphas, betas, thetas = np.meshgrid(alphas_, betas_, thetas_, indexing='ij') + + + if generalCase: + classifyMin_matVec = np.vectorize(classifyMin_mat) + GetCellOutputVec = np.vectorize(GetCellOutput, otypes=[np.ndarray, np.ndarray]) + Q, B = GetCellOutputVec(alphas,betas,thetas,gamma,mu1,rho1,lambda1, InputFilePath ,OutputFilePath ) + + + # print('type of Q:', type(Q)) + # print('Q:', Q) + G, angles, Types, curvature = classifyMin_matVec(Q,B) + + else: + classifyMin_anaVec = np.vectorize(classifyMin_ana) + GetMuGammaVec = np.vectorize(GetMuGamma) + muGammas = GetMuGammaVec(betas,thetas,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) + G, angles, Types, curvature = classifyMin_anaVec(alphas,betas,thetas, muGammas, mu1, rho1) # Sets q12 to zero!!! + # print('size of G:', G.shape) + # print('G:', G) + # print('Types:', Types) + # Out = classifyMin_anaVec(alphas,betas,thetas) + # T = Out[2] + # --- Write to VTK + # VTKOutputName = + path + "./PhaseDiagram2DNEW" + + + GammaString = str(gamma) + VTKOutputName = "outputs/PhaseDiagram2D" + "Gamma_" + GammaString + gridToVTK(VTKOutputName , alphas, betas, thetas, pointData = {'Type': Types, 'angles': angles, 'curvature': curvature} ) + print('Written to VTK-File:', VTKOutputName ) + + +# --- Make 3D Scatter plot +if(make_3D_plot or make_2D_plot): + fig = plt.figure() + ax = fig.add_subplot(111, projection='3d') + colors = cm.plasma(Types) + # if make_2D_plot: pnt3d=ax.scatter(alphas,thetas,c=Types.flat) + # if make_3D_plot: pnt3d=ax.scatter(alphas,betas,thetas,c=Types.flat) + if make_2D_plot: pnt3d=ax.scatter(alphas,thetas,c=angles.flat) + if make_3D_plot: pnt3d=ax.scatter(alphas,betas,thetas,c=angles.flat) + # cbar=plt.colorbar(pnt3d) + # cbar.set_label("Values (units)") + plt.axvline(x = 8, color = 'b', linestyle = ':', label='$q_1$') + plt.axhline(y = 0.083333333, color = 'b', linestyle = ':', label='$q_1$') + + ax.set_xlabel('alpha') + ax.set_ylabel('beta') + if make_3D_plot: ax.set_zlabel('theta') + plt.show() + # plt.savefig('common_labels.png', dpi=300) + # print('T:', T) + # print('Type 1 occured here:', np.where(T == 1)) + # print('Type 2 occured here:', np.where(T == 2)) + + + # print(alphas_) + # print(betas_) + + + + + +# ALTERNATIVE +# colors = ("red", "green", "blue") +# groups = ("Type 1", "Type2", "Type3") +# +# # Create plot +# fig = plt.figure() +# ax = fig.add_subplot(1, 1, 1) +# +# for data, color, group in zip(Types, colors, groups): +# # x, y = data +# ax.scatter(alphas, thetas, alpha=0.8, c=color, edgecolors='none', label=group) +# +# plt.title('Matplot scatter plot') +# plt.legend(loc=2) +# plt.show() diff --git a/src/PhaseDiagram_intermediateGamma.py b/src/PhaseDiagram_intermediateGamma.py index a142890ba5d4f0ad44e661acc5725e7eb7348d5e..277f8c34a84bae641e260b0ac84bb59b0c3bd684 100644 --- a/src/PhaseDiagram_intermediateGamma.py +++ b/src/PhaseDiagram_intermediateGamma.py @@ -110,7 +110,8 @@ print("Path: ", path) # -------------------------- Input Parameters -------------------- -mu1 = 10.0 # TODO : here must be the same values as in the Parset for computeMuGamma +# mu1 = 10.0 # TODO : here must be the same values as in the Parset for computeMuGamma +mu1 = 1.0 rho1 = 1.0 alpha = 2.0 beta = 2.0 @@ -137,7 +138,7 @@ print('---- Input parameters: -----') print('mu1: ', mu1) print('rho1: ', rho1) print('alpha: ', alpha) -print('beta: ', beta) +# print('beta: ', beta) print('theta: ', theta) print('gamma:', gamma) @@ -155,7 +156,9 @@ print('----------------------------') # # # # # # Gamma_Values = np.linspace(gamma_min, gamma_max, num=13) # TODO variable Input Parameters...alpha,beta... -Gamma_Values = [0.05, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5] +# Gamma_Values = [0.05, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5] +Gamma_Values = [0.5, 0.75, 1.5, 3.0] +# Gamma_Values = [3.0] # Gamma_Values = ['infinity'] print('(Input) Gamma_Values:', Gamma_Values) # # @@ -222,7 +225,7 @@ for gamma in Gamma_Values: # SamplePoints_2D = 10 # Number of sample points in each direction SamplePoints_3D = 300 # Number of sample points in each direction SamplePoints_2D = 200 # Number of sample points in each direction - + SamplePoints_2D = 50 if make_3D_PhaseDiagram: @@ -272,8 +275,8 @@ for gamma in Gamma_Values: # thetas_ = np.linspace(0.05,0.2,SamplePoints_2D) # betas_ = np.linspace(0.01,40.01,1) #fix to one value: - # betas_ = 2.0; - betas_ = 10.0; + betas_ = 2.0; + # betas_ = 10.0; alphas, betas, thetas = np.meshgrid(alphas_, betas_, thetas_, indexing='ij') diff --git a/src/Plot-1-ParameterFamily.py b/src/Plot-1-ParameterFamily.py index b2a5a9b9664478d243daab89c88841b659ad7733..173f2c6f47dad29aaa0a29c877068b344c3b54c1 100644 --- a/src/Plot-1-ParameterFamily.py +++ b/src/Plot-1-ParameterFamily.py @@ -200,11 +200,11 @@ ax.set_xticks([-np.pi/2, -np.pi/4 ,0, np.pi/4, np.pi/2 ]) -ax.legend(loc='upper right') +# ax.legend(loc='upper right') fig.set_size_inches(width, height) -fig.savefig('Plot-1-ParameterFamily.pdf') +fig.savefig('Plot-1-ParameterFamily2.pdf') plt.show() diff --git a/src/Plot-Angle-Alpha_intermediateGamma.py b/src/Plot-Angle-Alpha_intermediateGamma.py new file mode 100644 index 0000000000000000000000000000000000000000..c070ed4c1678b30a95547ae37cade0a85cfd2c42 --- /dev/null +++ b/src/Plot-Angle-Alpha_intermediateGamma.py @@ -0,0 +1,864 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +from HelperFunctions import * +from ClassifyMin import * + +import matplotlib.ticker as tickers +import matplotlib as mpl +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator +import pandas as pd + +# import tikzplotlib +# # from pylab import * +# from tikzplotlib import save as tikz_save + + +# Needed ? +mpl.use('pdf') + +# from subprocess import Popen, PIPE +#import sys + +###################### makePlot.py ######################### +# Generalized Plot-Script giving the option to define +# quantity of interest and the parameter it depends on +# to create a plot +# +# Input: Define y & x for "x-y plot" as Strings +# - Run the 'Cell-Problem' for the different Parameter-Points +# (alternatively run 'Compute_MuGamma' if quantity of interest +# is q3=muGamma for a significant Speedup) + +########################################################### + + + +# figsize argument takes inputs in inches +# and we have the width of our document in pts. +# To set the figure size we construct a function +# to convert from pts to inches and to determine +# an aesthetic figure height using the golden ratio: +# def set_size(width, fraction=1): +# """Set figure dimensions to avoid scaling in LaTeX. +# +# Parameters +# ---------- +# width: float +# Document textwidth or columnwidth in pts +# fraction: float, optional +# Fraction of the width which you wish the figure to occupy +# +# Returns +# ------- +# fig_dim: tuple +# Dimensions of figure in inches +# """ +# # Width of figure (in pts) +# fig_width_pt = width * fraction +# +# # Convert from pt to inches +# inches_per_pt = 1 / 72.27 +# +# # Golden ratio to set aesthetic figure height +# # https://disq.us/p/2940ij3 +# golden_ratio = (5**.5 - 1) / 2 +# +# # Figure width in inches +# fig_width_in = fig_width_pt * inches_per_pt +# # Figure height in inches +# fig_height_in = fig_width_in * golden_ratio +# +# fig_dim = (fig_width_in, fig_height_in) +# +# return fig_dim +# + + + +def format_func(value, tick_number): + # # find number of multiples of pi/2 + # N = int(np.round(2 * value / np.pi)) + # if N == 0: + # return "0" + # elif N == 1: + # return r"$\pi/2$" + # elif N == 2: + # return r"$\pi$" + # elif N % 2 > 0: + # return r"${0}\pi/2$".format(N) + # else: + # return r"${0}\pi$".format(N // 2) + # find number of multiples of pi/2 + N = int(np.round(4 * value / np.pi)) + if N == 0: + return "0" + elif N == 1: + return r"$\pi/4$" + elif N == 2: + return r"$\pi/2$" + elif N % 2 > 0: + return r"${0}\pi/2$".format(N) + else: + return r"${0}\pi$".format(N // 2) + + + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + + +# TODO +# - Fallunterscheidung (Speedup) falls gesuchter value mu_gamma = q3 +# - Also Add option to plot Minimization Output + + +# ----- Setup Paths ----- +# InputFile = "/inputs/cellsolver.parset" +# OutputFile = "/outputs/output.txt" + +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" + +# path = os.getcwd() +# InputFilePath = os.getcwd()+InputFile +# OutputFilePath = os.getcwd()+OutputFile +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +#--------------------------------------------------------------- + +print('---- Input parameters: -----') +mu1 = 1.0 #10.0 +# lambda1 = 10.0 +rho1 = 1.0 +# alpha = 5.0 +# beta = 10.0 +# alpha = 2.0 +# beta = 2.0 +# theta = 1.0/8.0 #1.0/4.0 + +lambda1 = 0.0 +# gamma = 1.0/4.0 + +# TEST: +# alpha=3.0; + + + + +# # INTERESTING!: +# alpha = 3 +beta = 2.0 +# theta= 1/8 + + + + +#TEST +# beta=2 + + + +gamma = 'infinity' #Elliptic Setting +gamma = '0' #Hyperbolic Setting +# gamma = 0.01 +# # gamma= 3.0 +gamma = 0.5 +gamma = 0.75 +# # gamma = 100.0 +# gamma = 3.0 + +Gamma_Values = [0.5, 0.75, 1.5, 3.0] +Gamma_Values = [ 1.5, 3.0] +# Gamma_Values = [3.0] +# Gamma_Values = ['infinity'] +print('(Input) Gamma_Values:', Gamma_Values) +# # +for gamma in Gamma_Values: + + print('mu1: ', mu1) + print('rho1: ', rho1) + # print('alpha: ', alpha) + print('beta: ', beta) + # print('theta: ', theta) + print('gamma:', gamma) + print('----------------------------') + + + + # --- define Interval of x-va1ues: + xmin = -2.0 + # xmax = 0.41 + xmax = 3.0 + + + xmin = -1.5 + xmax = 2.0 + + xmin = -1.0 + xmax = -0.5 + + + Jumps = False + + + numPoints = 2000 + numPoints = 300 + X_Values = np.linspace(xmin, xmax, num=numPoints) + print(X_Values) + + + Y_Values = [] + + + + + + Angle_Theta01 = [] + Angle_Theta025 = [] + Angle_Theta05 = [] + + Angle_Theta075 = [] + Angle_Theta09 = [] + + + + + + + for alpha in X_Values: + print('Situation of Lemma1.4') + q12 = 0.0 + # q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) + # q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) + # b1 = prestrain_b1(rho1, beta, alpha,theta) + # b2 = prestrain_b2(rho1, beta, alpha,theta) + # b3 = 0.0 + # q3_Theta01 = GetMuGamma(beta,0.1,gamma,mu1,rho1,InputFilePath ,OutputFilePath) + # q3_Theta025 = GetMuGamma(beta,0.25,gamma,mu1,rho1,InputFilePath ,OutputFilePath) + q3_Theta05 = GetMuGamma(beta,0.5,gamma,mu1,rho1,InputFilePath ,OutputFilePath) + # q3_Theta075 = GetMuGamma(beta,0.75,gamma,mu1,rho1,InputFilePath ,OutputFilePath) + # q3_Theta09 = GetMuGamma(beta,0.9,gamma,mu1,rho1,InputFilePath ,OutputFilePath) + + + # G, angle, Type, curvature = classifyMin_ana(alpha,beta,0.1, q3_Theta01, mu1, rho1) + # Angle_Theta01.append(angle) + # + # G, angle, Type, curvature = classifyMin_ana(alpha,beta,0.25, q3_Theta025, mu1, rho1) + # Angle_Theta025.append(angle) + + G, angle, Type, curvature = classifyMin_ana(alpha,beta,0.5, q3_Theta05, mu1, rho1) + Angle_Theta05.append(angle) + + # G, angle, Type, curvature = classifyMin_ana(alpha,beta,0.75, q3_Theta075, mu1, rho1) + # Angle_Theta075.append(angle) + # + # G, angle, Type, curvature = classifyMin_ana(alpha,beta,0.9, q3_Theta09, mu1, rho1) + # Angle_Theta09.append(angle) + + + + + # + # G, angle, Type, curvature = classifyMin_ana(-0.5,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg05 .append(angle) + # G, angle, Type, curvature = classifyMin_ana(-0.25,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg025.append(angle) + # G, angle, Type, curvature = classifyMin_ana(3.0,beta,theta, q3, mu1, rho1) + # Angle_alpha3.append(angle) + # G, angle, Type, curvature = classifyMin_ana(-1.0,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg075.append(angle) + # G, angle, Type, curvature = classifyMin_ana(0,beta,theta, q3, mu1, rho1) + # Angle_alpha0.append(angle) + # # G, angle, Type, curvature = classifyMin_ana(-0.125,beta,theta, q3, mu1, rho1) + # # Angle_alphaNeg0125.append(angle) + # G, angle, Type, curvature = classifyMin_ana(-0.7,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg0125.append(angle) + # + # G, angle, Type, curvature = classifyMin_ana(-0.625,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg0625.append(angle) + # G, angle, Type, curvature = classifyMin_ana(-0.875,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg0875.append(angle) + + # + # + # print("(Output) Values of angle: ", Y_Values) + # + # + # idx = find_nearestIdx(Y_Values, 0) + # print(' Idx of value closest to 0', idx) + # ValueClose = Y_Values[idx] + # print('GammaValue(Idx) with mu_gamma closest to q_3^*', ValueClose) + # + # + # + # # Find Indices where the difference between the next one is larger than epsilon... + # jump_idx = [] + # jump_xValues = [] + # jump_yValues = [] + # tmp = X_Values[0] + # for idx, x in enumerate(X_Values): + # print(idx, x) + # if idx > 0: + # if abs(Y_Values[idx]-Y_Values[idx-1]) > 1: + # print('jump candidate') + # jump_idx.append(idx) + # jump_xValues.append(x) + # jump_yValues.append(Y_Values[idx]) + # + # + # + # + # + # + # + # print("Jump Indices", jump_idx) + # print("Jump X-values:", jump_xValues) + # print("Jump Y-values:", jump_yValues) + # + # y_plotValues = [Y_Values[0]] + # x_plotValues = [X_Values[0]] + # # y_plotValues.extend(jump_yValues) + # for i in jump_idx: + # y_plotValues.extend([Y_Values[i-1], Y_Values[i]]) + # x_plotValues.extend([X_Values[i-1], X_Values[i]]) + # + # + # y_plotValues.append(Y_Values[-1]) + # # x_plotValues = [X_Values[0]] + # # x_plotValues.extend(jump_xValues) + # x_plotValues.append(X_Values[-1]) + # + # + # print("y_plotValues:", y_plotValues) + # print("x_plotValues:", x_plotValues) + + + # Y_Values[np.diff(y) >= 0.5] = np.nan + + + #get values bigger than jump position + # gamma = infty + # x_rest = X_Values[X_Values>x_plotValues[1]] + # Y_Values = np.array(Y_Values) #convert the np array + # y_rest = Y_Values[X_Values>x_plotValues[1]] + # + # + # # gamma = 0 + # x_rest = X_Values[X_Values>x_plotValues[3]] + # Y_Values = np.array(Y_Values) #convert the np array + # y_rest = Y_Values[X_Values>x_plotValues[3]] + + # gamma between + # Y_Values = np.array(Y_Values) #convert the np array + # X_Values = np.array(X_Values) #convert the np array + # + # x_one = X_Values[X_Values>x_plotValues[3]] + # # ax.scatter(X_Values, Y_Values) + # y_rest = Y_Values[X_Values>x_plotValues[3]] + # ax.plot(X_Values[X_Values>0.135], Y_Values[X_Values<0.135]) + # + # + # + + + # y_rest = Y_Values[np.nonzero(X_Values>x_plotValues[1]] + # print('X_Values:', X_Values) + # print('Y_Values:', Y_Values) + # print('x_rest:', x_rest) + # print('y_rest:', y_rest) + # print('np.nonzero(X_Values>x_plotValues[1]', np.nonzero(X_Values>x_plotValues[1]) ) + + + + + # --- Convert to numpy array + Y_Values = np.array(Y_Values) + X_Values = np.array(X_Values) + + Angle_Theta01 = np.array(Angle_Theta01) + Angle_Theta025 = np.array(Angle_Theta025) + + Angle_Theta05 = np.array(Angle_Theta05) + + Angle_Theta075 = np.array(Angle_Theta075) + Angle_Theta09 = np.array(Angle_Theta09) + # ---------------- Create Plot ------------------- + + #--- change plot style: SEABORN + # plt.style.use("seaborn-paper") + + + #--- Adjust gobal matplotlib variables + # mpl.rcParams['pdf.fonttype'] = 42 + # mpl.rcParams['ps.fonttype'] = 42 + mpl.rcParams['text.usetex'] = True + mpl.rcParams["font.family"] = "serif" + mpl.rcParams["font.size"] = "9" + + + # plt.rc('font', family='serif', serif='Times') + # plt.rc('font', family='serif') + # # plt.rc('text', usetex=True) #also works... + # plt.rc('xtick', labelsize=8) + # plt.rc('ytick', labelsize=8) + # plt.rc('axes', labelsize=8) + + + + + + #---- Scale Figure apropriately to fit tex-File Width + # width = 452.9679 + + # width as measured in inkscape + width = 6.28 *0.5 + width = 6.28 *0.333 + # width = 6.28 + height = width / 1.618 + + #setup canvas first + fig = plt.figure() #main + # fig, ax = plt.subplots() + # fig, (ax, ax2) = plt.subplots(ncols=2) + # fig,axes = plt.subplots(nrows=1,ncols=2,figsize=(width,height)) # more than one plot + + + # fig.subplots_adjust(left=.15, bottom=.16, right=.99, top=.97) #TEST + + + # TEST + # mpl.rcParams['figure.figsize'] = (width+0.1,height+0.1) + # fig = plt.figure(figsize=(width+0.1,height+0.1)) + + + # mpl.rcParams['figure.figsize'] = (width,height) + # fig = plt.figure(figsize=(10,6)) # default is [6.4,4.8] 6.4 is the width, 4.8 is the height + # fig = plt.figure(figsize=(width,height)) # default is [6.4,4.8] 6.4 is the width, 4.8 is the height + # fig = plt.figure(figsize=set_size(width)) + # fig = plt.subplots(1, 1, figsize=set_size(width)) + + # --- To create a figure half the width of your document:# + # fig = plt.figure(figsize=set_size(width, fraction=0.5)) + + + + #--- You must select the correct size of the plot in advance + # fig.set_size_inches(3.54,3.54) + + # ax = plt.axes((0.15,0.18,0.8,0.8)) + # ax = plt.axes((0.15,0.18,0.6,0.6)) + # ax = plt.axes((0.15,0.2,0.75,0.75)) + # ax = plt.axes((0.18,0.2,0.75,0.75)) + ax = plt.axes((0.28,0.3,0.65,0.65)) + # ax = plt.axes((0.1,0.1,0.5,0.8)) + # ax = plt.axes((0.1,0.1,1,1)) + # ax = plt.axes() + + # ax.spines['right'].set_visible(False) + # ax.spines['left'].set_visible(False) + # ax.spines['bottom'].set_visible(False) + # ax.spines['top'].set_visible(False) + # ax.tick_params(axis='x',which='major',direction='out',length=10,width=5,color='red',pad=15,labelsize=15,labelcolor='green', + # labelrotation=15) + # ax.tick_params(axis='x',which='major', direction='out',pad=5,labelsize=10) + # ax.tick_params(axis='y',which='major', length=5, width=1, direction='out',pad=5,labelsize=10) + ax.tick_params(axis='x',which='major', direction='out',pad=3) + ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) + # ax.xaxis.set_major_locator(MultipleLocator(0.05)) + # ax.xaxis.set_minor_locator(MultipleLocator(0.025)) + # ax.xaxis.set_major_locator(MultipleLocator(0.1)) + # ax.xaxis.set_minor_locator(MultipleLocator(0.05)) + ax.xaxis.set_major_locator(MultipleLocator(0.25)) + ax.xaxis.set_minor_locator(MultipleLocator(0.125)) + # ax.xaxis.set_major_locator(MultipleLocator(0.5)) + # ax.xaxis.set_minor_locator(MultipleLocator(0.25)) + #---- print data-types + print(ax.xaxis.get_major_locator()) + print(ax.xaxis.get_minor_locator()) + print(ax.xaxis.get_major_formatter()) + print(ax.xaxis.get_minor_formatter()) + + #---- Hide Ticks or Labels + # ax.yaxis.set_major_locator(plt.NullLocator()) + # ax.xaxis.set_major_formatter(plt.NullFormatter()) + + #---- Reducing or Increasing the Number of Ticks + # ax.xaxis.set_major_locator(plt.MaxNLocator(3)) + # ax.yaxis.set_major_locator(plt.MaxNLocator(3)) + + + #----- Fancy Tick Formats + ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 4)) + ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) + ax.yaxis.set_major_formatter(plt.FuncFormatter(format_func)) + + + + + + + + # --- manually change ticks&labels: + # ax.set_xticks([0.2,1]) + # ax.set_xticklabels(['pos1','pos2']) + + # ax.set_yticks([0, np.pi/8, np.pi/4 ]) + # labels = ['$0$',r'$\pi/8$', r'$\pi/4$'] + # ax.set_yticklabels(labels) + + a=ax.yaxis.get_major_locator() + b=ax.yaxis.get_major_formatter() + c = ax.get_xticks() + d = ax.get_xticklabels() + print('xticks:',c) + print('xticklabels:',d) + + ax.grid(True,which='major',axis='both',alpha=0.3) + + + + + + + # plt.figure() + + # f,ax=plt.subplots(1) + + # plt.title(r''+ yName + '-Plot') + # plt.plot(X_Values, Y_Values,linewidth=2, '.k') + # plt.plot(X_Values, Y_Values,'.k',markersize=1) + # plt.plot(X_Values, Y_Values,'.',markersize=0.8) + + # plt.plot(X_Values, Y_Values) + + # ax.plot([[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]]) + + + + # Gamma = '0' + # ax.plot([x_plotValues[0],x_plotValues[1]], [y_plotValues[0],y_plotValues[1]] , 'b') + # + # ax.plot([x_plotValues[1],x_plotValues[3]], [y_plotValues[2],y_plotValues[3]] , 'b') + # + # ax.plot(x_rest, y_rest, 'b') + + + # Gamma between + + # x jump values (gamma 0): [0.13606060606060608, 0.21090909090909093] + + # ax.plot([[0,jump_xValues[0]], [0, 0]] , 'b') + # ax.plot([jump_xValues[0],xmin], [y_plotValues[2],y_plotValues[2]] , 'b') + + # ax.plot([[0,0.13606060606060608], [0, 0]] , 'b') + # ax.plot([[0.13606060606060608,xmin], [(math.pi/2),(math.pi/2)]], 'b') + + # jump_xValues[0] + + + + # --- leave out jumps: + # ax.scatter(X_Values, Y_Values) + + ax.set_xlabel(r"prestrain ratio $\theta_\rho$") + ax.set_ylabel(r"angle $\alpha$") + + + if Jumps: + + # --- leave out jumps: + if gamma == 'infinity': + ax.plot(X_Values[X_Values>=jump_xValues[0]], Y_Values[X_Values>=jump_xValues[0]] , 'royalblue') + ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]], 'royalblue') + + + + # ax.plot(X_Values[X_Values>=jump_xValues[0]], Y_Values[X_Values>=jump_xValues[0]]) + # ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]]) + + + + + # ax.plot(X_Values[X_Values>0.136], Y_Values[X_Values>0.136]) + # ax.plot(X_Values[X_Values<0.135], Y_Values[X_Values<0.135]) + # ax.scatter(X_Values, Y_Values) + # ax.plot(X_Values, Y_Values) + + # plt.plot(x_plotValues, y_plotValues,'.') + # plt.scatter(X_Values, Y_Values, alpha=0.3) + # plt.scatter(X_Values, Y_Values) + # plt.plot(X_Values, Y_Values,'.') + # plt.plot([X_Values[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]]) + # plt.axis([0, 6, 0, 20]) + + # ax.set_xlabel(r"volume fraction $\theta$", size=11) + # ax.set_ylabel(r"angle $\angle$", size=11) + # ax.set_xlabel(r"volume fraction $\theta$") + # # ax.set_ylabel(r"angle $\angle$") + # ax.set_ylabel(r"angle $\alpha$") + # plt.ylabel('$\kappa$') + + # ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$')) + # ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.1)) + + + + + # Plot every other line.. not the jumps... + + if gamma == '0': + tmp = 1 + for idx, x in enumerate(x_plotValues): + if idx > 0 and tmp == 1: + # plt.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]] ) + ax.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]], 'royalblue', zorder=2) + tmp = 0 + else: + tmp = 1 + + # plt.plot([x_plotValues[0],x_plotValues[1]] ,[y_plotValues[0],y_plotValues[1]] ) + # plt.plot([x_plotValues[2],x_plotValues[3]] ,[y_plotValues[2],y_plotValues[3]] ) + # plt.plot([x_plotValues[4],x_plotValues[5]] ,[y_plotValues[4],y_plotValues[5]] ) + # plt.plot([x_plotValues[6],x_plotValues[7]] ,[y_plotValues[6],y_plotValues[7]] ) + + + for x in jump_xValues: + plt.axvline(x,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', linewidth=1, zorder=1) + # plt.axvline(x,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', label=r'$\theta_*$') + + # plt.axvline(x_plotValues[1],ymin=0, ymax= 1, color = 'g',alpha=0.5, linestyle = 'dashed') + + # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') + # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') + # plt.legend() + + + # -- SETUP LEGEND + # ax.legend(prop={'size': 11}) + # ax.legend() + + # ------------------ SAVE FIGURE + # tikzplotlib.save("TesTout.tex") + # plt.close() + # mpl.rcParams.update(mpl.rcParamsDefault) + + # plt.savefig("graph.pdf", + # #This is simple recomendation for publication plots + # dpi=1000, + # # Plot will be occupy a maximum of available space + # bbox_inches='tight', + # ) + # plt.savefig("graph.pdf") + + + + # ---- ADD additional scatter: + # ax.scatter(X_Values,Y_Values,s=1,c='black',zorder=4) + + # Find transition point + lastIdx = len(Y_Values)-1 + + for idx, y in enumerate(Y_Values): + if idx != lastIdx: + if abs(y-0) < 0.01 and abs(Y_Values[idx+1] - 0) > 0.05: + transition_point1 = X_Values[idx+1] + print('transition point1:', transition_point1 ) + if abs(y-0.5*np.pi) < 0.01 and abs(Y_Values[idx+1] -0.5*np.pi)>0.01: + transition_point2 = X_Values[idx] + print('transition point2:', transition_point2 ) + if abs(y-0) > 0.01 and abs(Y_Values[idx+1] - 0) < 0.01: + transition_point3 = X_Values[idx+1] + print('transition point3:', transition_point3 ) + + # Add transition Points: + if gamma == '0': + ax.scatter([transition_point1, transition_point2],[np.pi/2,np.pi/2],s=6, marker='o', cmap=None, norm=None, facecolor = 'black', + edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + + ax.text(transition_point1-0.02 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + ax.text(transition_point2+0.012 , np.pi/2-0.02, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + else: + ax.scatter([transition_point1, transition_point2, transition_point3 ],[np.pi/2,np.pi/2,0 ],s=6, marker='o', cmap=None, norm=None, facecolor = 'black', + edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + + ax.text(transition_point1-0.02 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + ax.text(transition_point2 +0.011 , np.pi/2-0.02, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + ax.text(transition_point3 +0.009 , 0+0.08, r"$3$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + else: + # ax.scatter(X_Values,Y_Values,s=1, marker='o', cmap=None, norm=None, facecolor = 'blue', + # edgecolor = 'none', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # --------------------------------------------------------------- + # l1 = ax.scatter(X_Values,Angle_alpha0,s=1, marker='o', edgecolor = 'black',cmap=None, norm=None, vmin=None, vmax=None, alpha=0.75, linewidths=None, zorder=4) + # l6 = ax.scatter(X_Values,Angle_alphaNeg1,s=2, marker='s', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=1, label=r"$\theta_\rho = -1.0$") + # l4 = ax.scatter(X_Values,Angle_alphaNeg05,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l3 = ax.scatter(X_Values,Angle_alphaNeg025,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l7 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', facecolor = 'none',edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=5) + # # l4 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', markerfacecolor='red',markeredgecolor='black',markeredgewidth=2, cmap=None, norm=None, vmin=None, vmax=None, alpha=0.5, linewidths=None, zorder=3) + # l5 = ax.scatter(X_Values,Angle_alphaNeg075,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l2 = ax.scatter(X_Values,Angle_alphaNeg0125,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # + # line_labels = [r"$\theta_\rho = -1.0$", r"$\theta_\rho = -0.5$", r"$\theta_\rho = -0.25$", r"$\theta_\rho = 3.0$"] + # ax.set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2, 5*np.pi/8 ]) + # labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$',r'$5\pi/8$'] + # ax.set_yticklabels(labels) + # + # ax.legend(handles=[l1,l2,l3,l4, l5, l6, l7], + # labels= [ r"$\theta_\rho = 0$", r"$\theta_\rho = -0.125$", r"$\theta_\rho = -0.25$", r"$\theta_\rho = -0.5$", r"$\theta_\rho = -0.75$", r"$\theta_\rho = -1.0$", r"$\theta_\rho = 3.0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + # --------------------------------------------------------------- + # l1 = ax.scatter(X_Values,Angle_alphaNeg1,s=2, marker='s', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=1) + # l2 = ax.scatter(X_Values,Angle_alphaNeg0875,s=2, marker='o',cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + # l3 = ax.scatter(X_Values,Angle_alphaNeg075,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l4 = ax.scatter(X_Values,Angle_alphaNeg0625,s=2, marker='o',cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + # l5 = ax.scatter(X_Values,Angle_alphaNeg05,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l6 = ax.scatter(X_Values,Angle_alphaNeg025,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l7 = ax.scatter(X_Values,Angle_alphaNeg0125,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l8 = ax.scatter(X_Values,Angle_alpha0,s=2, marker='s', edgecolor = 'black', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + + # l1 = ax.plot(X_Values,Angle_alphaNeg05, color='blue', linewidth=1.5, zorder=3, label=r"$\theta_\rho=-0.5$") + # l2 = ax.plot(X_Values,Angle_alphaNeg055, linewidth=1.5, linestyle = '--', zorder=3,label=r"$\theta_\rho=-0.55$") + # l3 = ax.plot(X_Values,Angle_alphaNeg06,color='orangered', linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.6$") + # l4 = ax.plot(X_Values,Angle_alphaNeg065, linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.65$") + # l5 = ax.plot(X_Values,Angle_alphaNeg07,color='orange', linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.7$") + # l6 = ax.plot(X_Values,Angle_alphaNeg075, linewidth=1.5,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.75$") + # l7 = ax.plot(X_Values,Angle_alphaNeg08, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.8$") + # l8 = ax.plot(X_Values,Angle_alphaNeg085, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.85$") + # l9 = ax.plot(X_Values,Angle_alphaNeg09, color='teal',linestyle = '--', linewidth=1.5 , zorder=3, label=r"$\theta_\rho=-0.9$") + # l10 = ax.plot(X_Values,Angle_alphaNeg095, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.95$") + # l11 = ax.plot(X_Values,Angle_alphaNeg1, color='red', linewidth=1.5 ,zorder=1, label=r"$\theta_\rho=-1.0$") + + + # l1 = ax.plot(X_Values,Angle_Theta01, color='blue', linewidth=1.5, zorder=3, label=r"$\theta=0.1$") + # # l2 = ax.plot(X_Values,Angle_alphaNeg055, linewidth=1.5, linestyle = '--', zorder=3,label=r"$\theta_\rho=-0.55$") + # l3 = ax.plot(X_Values,Angle_Theta025,color='orangered', linewidth=1.5 ,zorder=3, label=r"$\theta = 0.25$") + # # l4 = ax.plot(X_Values,Angle_alphaNeg065, linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.65$") + # l5 = ax.plot(X_Values,Angle_Theta05,color='orange', linewidth=1.5 ,zorder=3, label=r"$\theta = 0.5$") + # # l6 = ax.plot(X_Values,Angle_alphaNeg075, linewidth=1.5,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.75$") + # l7 = ax.plot(X_Values,Angle_Theta075, linewidth=1.5 , zorder=3, label=r"$\theta = 0.75$") + # # l8 = ax.plot(X_Values,Angle_alphaNeg085, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.85$") + # l9 = ax.plot(X_Values,Angle_Theta09, color='teal', linewidth=1.5 , zorder=3, label=r"$\theta =0.9$") + # # l10 = ax.plot(X_Values,Angle_alphaNeg095, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.95$") + + + # l1 = ax.scatter(X_Values,Angle_Theta01, color='blue', s=2, zorder=3, label=r"$\theta=0.1$") + # l2 = ax.plot(X_Values,Angle_alphaNeg055, linewidth=1.5, linestyle = '--', zorder=3,label=r"$\theta_\rho=-0.55$") + # l3 = ax.scatter(X_Values,Angle_Theta025,color='orangered', s=2 ,zorder=3, label=r"$\theta = 0.25$") + # l4 = ax.plot(X_Values,Angle_alphaNeg065, linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.65$") + l5 = ax.scatter(X_Values,Angle_Theta05, color='royalblue', s=0.15 ,zorder=3, label=r"$\theta = 0.5$") + # l6 = ax.plot(X_Values,Angle_alphaNeg075, linewidth=1.5,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.75$") + # l7 = ax.scatter(X_Values,Angle_Theta075, s=2, zorder=3, label=r"$\theta = 0.75$") + # l8 = ax.plot(X_Values,Angle_alphaNeg085, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.85$") + # l9 = ax.scatter(X_Values,Angle_Theta09, color='teal',s=2, zorder=3, alpha=1.0, label=r"$\theta =0.9$") + + # ax.legend(handles=[l1[0],l2[0],l3[0],l4[0], l5[0], l6[0], l7[0], l8[0], l9[0], l10[0], l11[0]], + # # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + + # ax.legend(handles=[l1[0],l3[0], l5[0], l7[0], l9[0]] , + # # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + + # ax.legend(handles=[l1,l3, l5, l7, l9] , + # # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + + # ax.legend(handles=[l5] , + # # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + + # ax.plot(X_Values, Y_Values, marker='o', markerfacecolor='orange', markeredgecolor='black', markeredgewidth=1, linewidth=1, zorder=3) + # l7 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', facecolor = 'none',edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=5) + # l4 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', markerfacecolor='red',markeredgecolor='black',markeredgewidth=2, cmap=None, norm=None, vmin=None, vmax=None, alpha=0.5, linewidths=None, zorder=3) + # l5 = ax.scatter(X_Values,Angle_alphaNeg075,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + + + # line_labels = [r"$\theta_\rho = -1.0$",r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = - \frac{3}{4}$", r"$\theta_\rho = - \frac{5}{8}$",r"$\theta_\rho = - 0.5 $" ,r"$\theta_\rho = - 0.25", r"$\theta_\rho = - \frac{1}{8}" , r"$\theta_\rho = 0$"] + ax.set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2, 5*np.pi/8 ]) + labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$',r'$5\pi/8$'] + ax.set_yticklabels(labels) + + # ax.legend(handles=[l1,l2,l3,l4, l5, l6, l7, l8], + # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + + # + # ax.legend(handles=[l1,l3, l5, l7, l8], + # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + # + + + + + + # fig.legend([l1, l2, l3, l4], # The line objects + # labels=line_labels, # The labels for each line + # # loc="upper center", # Position of legend + # loc='upperleft', bbox_to_anchor=(1,1), + # borderaxespad=0.15 # Small spacing around legend box + # # title="Legend Title" # Title for the legend + # ) + + pdf_outputName = 'Plot-Angle-Alpha_Gamma'+ str(gamma)+ '_transition'+'.pdf' + + fig.set_size_inches(width, height) + # fig.savefig('Plot-Angle-Theta.pdf') + fig.savefig(pdf_outputName) + + + + + # tikz_save('someplot.tex', figureheight='5cm', figurewidth='9cm') + + # tikz_save('fig.tikz', + # figureheight = '\\figureheight', + # figurewidth = '\\figurewidth') + + # ---------------------------------------- + + +# plt.show() +# #--------------------------------------------------------------- diff --git a/src/Plot-Angle-GammaV2.py b/src/Plot-Angle-GammaV2.py index 7982203914e20664c325ff1a58ba07ab397a69bf..8167db04d6ee43f455d655158d878ddf408c4c43 100644 --- a/src/Plot-Angle-GammaV2.py +++ b/src/Plot-Angle-GammaV2.py @@ -139,6 +139,9 @@ theta= 1/8 +alpha = -1.0 +beta = 2.0 +theta= 0.25 @@ -156,7 +159,7 @@ print('----------------------------') gamma_min = 0.01 gamma_max = 1.0 -Gamma_Values = np.linspace(gamma_min, gamma_max, num=100) # TODO variable Input Parameters...alpha,beta... +Gamma_Values = np.linspace(gamma_min, gamma_max, num=10) # TODO variable Input Parameters...alpha,beta... print('(Input) Gamma_Values:', Gamma_Values) # mu_gamma = [] diff --git a/src/Plot-Angle-GammaV2_SubPlots.py b/src/Plot-Angle-GammaV2_SubPlots.py new file mode 100644 index 0000000000000000000000000000000000000000..35ba8cf1540ff290cd244ab2065bbf89093ecd4e --- /dev/null +++ b/src/Plot-Angle-GammaV2_SubPlots.py @@ -0,0 +1,451 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +import sys +from ClassifyMin import * +from HelperFunctions import * +# from CellScript import * +from mpl_toolkits.mplot3d import Axes3D +import matplotlib.cm as cm +from vtk.util import numpy_support +from pyevtk.hl import gridToVTK +import time +import matplotlib.ticker as ticker + +import matplotlib as mpl +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator +import pandas as pd + +# from matplotlib import rc +# rc('text', usetex=True) # Use LaTeX font +# +# import seaborn as sns +# sns.set(color_codes=True) + + +def format_func(value, tick_number): + # # find number of multiples of pi/2 + # N = int(np.round(2 * value / np.pi)) + # if N == 0: + # return "0" + # elif N == 1: + # return r"$\pi/2$" + # elif N == 2: + # return r"$\pi$" + # elif N % 2 > 0: + # return r"${0}\pi/2$".format(N) + # else: + # return r"${0}\pi$".format(N // 2) + # find number of multiples of pi/2 + N = int(np.round(4 * value / np.pi)) + if N == 0: + return "0" + elif N == 1: + return r"$\pi/4$" + elif N == 2: + return r"$\pi/2$" + elif N % 2 > 0: + return r"${0}\pi/2$".format(N) + else: + return r"${0}\pi$".format(N // 2) + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +print('---- Input parameters: -----') +alpha = 10 +mu1 = 1.0 +rho1 = 1.0 +beta = 2.0 #5.0 +theta = 1.0/8.0 +# + +alpha = -0.5 +beta = 40.0 +theta= 1/8.0 + + + +# # INTERESTING! from pi/2: +alpha = -0.5 +beta = 40.0 +theta= 1/8.0 +# +# # # INTERESTING! from pi/2: +# alpha = -0.2 +# beta = 25.0 +# theta= 1/2 + +# INTERESTING!: +# alpha = -0.5 +# beta = 5.0 +# theta= 1/30 + + + +# INTERESTING!: +# alpha = -0.25 +# beta = 10.0 +# theta= 3/4 + + +# # INTERESTING!: +alpha = -0.25 +beta = 10.0 +theta= 1/8 + +# +# INTERESTING!: +# alpha = -0.25 +# beta = 5.0 +# theta= 1/8 +# + + +# # INTERESTING!: +alpha = -0.5 +beta = 10.0 +theta= 1/8 + + + +alpha_1 = -1.0 +alpha_2 = -0.75 +alpha_3 = -0.70 + +angles_1 = [] +angles_2 = [] +angles_3 = [] + +beta = 2.0 +theta= 0.25 + + + + +print('mu1: ', mu1) +print('rho1: ', rho1) +print('alpha_1: ', alpha_1) +print('alpha_2: ', alpha_2) +print('alpha_3: ', alpha_3) +print('beta: ', beta) +print('theta: ', theta) +# print('gamma:', gamma) +print('----------------------------') + +# ---------------------------------------------------------------- + + +gamma_min = 0.01 +gamma_max = 1.5 +Gamma_Values = np.linspace(gamma_min, gamma_max, num=100) # TODO variable Input Parameters...alpha,beta... +print('(Input) Gamma_Values:', Gamma_Values) +# mu_gamma = [] + +# Gamma_Values = '0' + + + +# Get values for mu_Gamma +GetMuGammaVec = np.vectorize(GetMuGamma) +muGammas = GetMuGammaVec(beta,theta,Gamma_Values,mu1,rho1, InputFilePath ,OutputFilePath ) +print('muGammas:', muGammas) + +q12 = 0.0 +q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) +q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) +print('q1: ', q1) +print('q2: ', q2) +b1 = prestrain_b1(rho1, beta, alpha,theta) +b2 = prestrain_b2(rho1, beta, alpha,theta) +q3_star = math.sqrt(q1*q2) +print('q3_star:', q3_star) + +# TODO these have to be compatible with input parameters!!! +# compute certain ParameterValues that this makes sense +# b1 = q3_star +# b2 = q1 +print('b1: ', b1) +print('b2: ', b2) + +# return classifyMin(q1, q2, q3, q12, b1, b2, print_Cases, print_Output) + + + +# classifyMin_anaVec = np.vectorize(classifyMin_ana) +# G, angles, Types, curvature = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) +classifyMin_anaVec = np.vectorize(classifyMin_ana) +G, angles_1, Types, curvature = classifyMin_anaVec(alpha_1, beta, theta, muGammas, mu1, rho1) +G, angles_2, Types, curvature = classifyMin_anaVec(alpha_2, beta, theta, muGammas, mu1, rho1) +G, angles_3, Types, curvature = classifyMin_anaVec(alpha_3, beta, theta, muGammas, mu1, rho1) + +# _,angles,_,_ = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) + +print('angles_1:', angles_1) +print('angles_2:', angles_2) +print('angles_3:', angles_3) + + +idx = find_nearestIdx(muGammas, q3_star) +print('GammaValue Idx closest to q_3^*', idx) +gammaClose = Gamma_Values[idx] +print('GammaValue(Idx) with mu_gamma closest to q_3^*', gammaClose) + + + +determinantVec = np.vectorize(determinant) + +detValues = determinantVec(q1,q2,muGammas,q12) +print('detValues:', detValues) + + +detZeroidx = find_nearestIdx(detValues, 0) +print('idx where det nearest to zero', idx) +gammaClose = Gamma_Values[detZeroidx] +print('gammaClose:', gammaClose) + + +# --- Convert to numpy array +Gamma_Values = np.array(Gamma_Values) + + +angles_1 = np.array(angles_1) +angles_2 = np.array(angles_2) +angles_3 = np.array(angles_3) + +# ---------------- Create Plot ------------------- +# plt.figure() + + +mpl.rcParams['text.usetex'] = True +mpl.rcParams["font.family"] = "serif" +mpl.rcParams["font.size"] = "9" +width = 6.28 +height = width / 1.618 +height = width / 2.5 +fig = plt.figure() + +fig,ax = plt.subplots(nrows=1,ncols=3,figsize=(width,height)) # more than one plot +# fig,ax = plt.subplots(nrows=1,ncols=3,figsize=(width,height),sharey=True) # Share Y-axis + + +fig = plt.figure() +gs = fig.add_gridspec(1,3, hspace=0.2, wspace=0.1) +ax = gs.subplots(sharey=True) + +# ax = plt.axes((0.15,0.21 ,0.75,0.75)) +# ax = plt.axes((0.15,0.21 ,0.8,0.75)) +# ax.tick_params(axis='x',which='major', direction='out',pad=5) +# ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# ax.xaxis.set_major_locator(MultipleLocator(0.1)) +# ax.xaxis.set_minor_locator(MultipleLocator(0.05)) +ax[0].yaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +ax[0].yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +ax[0].yaxis.set_major_formatter(plt.FuncFormatter(format_func)) +ax[1].yaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +ax[1].yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +ax[1].yaxis.set_major_formatter(plt.FuncFormatter(format_func)) +ax[2].yaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +ax[2].yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +ax[2].yaxis.set_major_formatter(plt.FuncFormatter(format_func)) + +ax[0].grid(True,which='major',axis='both',alpha=0.3) +ax[1].grid(True,which='major',axis='both',alpha=0.3) +ax[2].grid(True,which='major',axis='both',alpha=0.3) +# ax.grid(True,which='major',axis='both',alpha=0.3) + + +# # plt.title(r'angle$-\mu_\gamma(\gamma)$-Plot') +# # plt.title(r'angle$-\gamma$-Plot') +# plt.plot(Gamma_Values, angles) +# plt.scatter(Gamma_Values, angles) +# plt.plot(muGammas, angles) +# plt.scatter(muGammas, angles) +# # plt.axis([0, 6, 0, 20]) +# # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') +# # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') +# plt.axvline(x = q1, color = 'b', linestyle = ':', label='$q_1$') +# plt.axvline(x = q2, color = 'r', linestyle = 'dashed', label='$q_2$') +# # plt.axvline(x = q3_star, color = 'r', linestyle = 'dashed', label='$\gamma^*$') + +ax[0].plot(Gamma_Values, angles_1, 'royalblue', zorder=3, ) +ax[1].plot(Gamma_Values, angles_2, 'royalblue', zorder=3, ) +ax[2].plot(Gamma_Values, angles_3, 'royalblue', zorder=3, ) + +ax[0].set_xlabel(r"$\gamma$") +ax[0].set_ylabel(r"angle $\alpha$") +ax[0].xaxis.set_minor_locator(MultipleLocator(0.25)) +ax[0].xaxis.set_major_locator(MultipleLocator(0.5)) + +ax[1].set_xlabel(r"$\gamma$") +# ax[1].set_ylabel(r"angle $\alpha$") +ax[1].xaxis.set_minor_locator(MultipleLocator(0.25)) +ax[1].xaxis.set_major_locator(MultipleLocator(0.5)) + +ax[2].set_xlabel(r"$\gamma$") +# ax[2].set_ylabel(r"angle $\alpha$") +ax[2].xaxis.set_minor_locator(MultipleLocator(0.25)) +ax[2].xaxis.set_major_locator(MultipleLocator(0.5)) +# Labels to use in the legend for each line +line_labels = [r"$\theta_\mu = 1.0$", r"$\theta_\mu = 2.0$", r"$\theta_\mu = 5.0$", r"$\theta_\mu = 10.0$"] + + +# ax.plot(Gamma_Values, angles, 'royalblue', zorder=3, ) +# ax.set_xlabel(r"$\gamma$") +# ax.set_ylabel(r"angle $\alpha$") + +# plt.xlabel("$q_3$") +# plt.xlabel("$\gamma$") +# plt.ylabel("angle") +# ax.grid(True) + + +# ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) +# ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) + +# ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 4)) +# ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) +# ax.yaxis.set_major_formatter(plt.FuncFormatter(format_func)) + +# ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$')) +# ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.25)) + + +# ax.yaxis.set_major_formatter(ticker.FuncFormatter( +# lambda val,pos: '{:.0g}$\pi$'.format(2*val/np.pi) if val !=0 else '0')) +# ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.5*np.pi)) + +# ---------------------------- show pi values ------------------------------------ +# ax.axvline(x = q1, color = 'b', linestyle = ':', label='$q_1$') +# ax.axvline(x = q2, color = 'r', linestyle = 'dashed', label='$q_2$') +# ax.legend() +# # ax.set(xlim=(1.750, 1.880), ylim=(0, math.pi/2.0)) +# ax.set(xlim=(1.760, 1.880), ylim=(-0.1, np.pi/4.0)) +# # ax.set_yticks([0, np.pi/4 ,np.pi/2]) +# # labels = ['$0$', r'$\pi/4$', r'$\pi/2$'] +# ax.set_yticks([0, np.pi/8, np.pi/4 ]) +# labels = ['$0$',r'$\pi/8$', r'$\pi/4$'] +# ax.set_yticklabels(labels) +# --------------------------------------------------------------- + + +# ax.set(xlim=(1.750, 1.880), ylim=(0, math.pi/2.0)) + +# ax.set(xlim=(1.760, 1.880), ylim=(-0.1, np.pi/4.0)) +# ax.set(xlim=(1.760, 1.880), ylim=(-0.1, np.pi/4.0)) +# ax.set_yticks([0, np.pi/4 ,np.pi/2]) +# labels = ['$0$', r'$\pi/4$', r'$\pi/2$'] + + +# OLD : +# ax.set_yticks([0, np.pi/8, np.pi/4 ]) +# labels = ['$0$',r'$\pi/8$', r'$\pi/4$'] + +labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$'] +ax[0].set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2, ]) +ax[1].set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2 ]) +ax[2].set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2 ]) + +ax[0].set_yticklabels(labels) +ax[1].set_yticklabels(labels) +ax[2].set_yticklabels(labels) + +for i in range(3): + ax[i].set_ylim([0-0.1, np.pi/2+0.1]) + +# Plot Gamma Value that is closest to q3_star +l1 = ax[0].axvline(x = gammaClose, color = 'midnightblue', linestyle = 'dashed', linewidth=1, label='$\gamma^*$') +l2 = ax[1].axvline(x = gammaClose, color = 'midnightblue', linestyle = 'dashed', linewidth=1, label='$\gamma^*$') +l3 = ax[2].axvline(x = gammaClose, color = 'midnightblue', linestyle = 'dashed', linewidth=1, label='$\gamma^*$') +# color elliptic/hyperbolic region +# ax.axvspan(gamma_min, gammaClose, color='red', alpha=0.2) +# ax.axvspan(gammaClose, gamma_max, color='green', alpha=0.2) + + +# ax[0].legend(loc='upper right') +# ax[2].legend(l3, +# labels=['$\gamma^*$'], +# loc='upper left', +# bbox_to_anchor=(1,1)) + +# ax[2].legend( +# loc='upper left', +# bbox_to_anchor=(1,1)) + +# fig.legend([l1], # The line objects +# # label='$\gamma^*$', # The labels for each line +# loc="center right", # Position of legend +# borderaxespad=0.15 # Small spacing around legend box +# # title="Legend Title" # Title for the legend +# ) + + +line_labels = [r"$\gamma^*$"] + +fig.legend([l1], [r"$\gamma^*$"], + # bbox_to_anchor=[0.5, 0.92], + bbox_to_anchor=[0.5, 0.94], + loc='center', ncol=3) + + + +# plt.subplots_adjust(wspace=0.4, hspace=0.0) +# plt.tight_layout() + +# Adjust the scaling factor to fit your legend text completely outside the plot +# (smaller value results in more space being made for the legend) +# plt.subplots_adjust(right=0.9) +plt.subplots_adjust(bottom=0.2) + +fig.set_size_inches(width, height) +fig.savefig('Plot-Angle-Gamma.pdf') + +plt.show() + + + + +# plt.figure() +# plt.title(r'angle$-\mu_\gamma(\gamma)$-Plot') +# plt.plot(muGammas, angles) +# plt.scatter(muGammas, angles) +# # plt.axis([0, 6, 0, 20]) +# # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') +# # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') +# plt.axvline(x = 1.90476, color = 'b', linestyle = ':', label='$q_1$') +# plt.axvline(x = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') +# plt.xlabel("$\mu_\gamma$") +# plt.ylabel("angle") +# plt.legend() +# plt.show() +# diff --git a/src/Plot-Curvature-GammaV2_SubPlots.py b/src/Plot-Curvature-GammaV2_SubPlots.py new file mode 100644 index 0000000000000000000000000000000000000000..36a677ddfa1221f480d2628228d93d9a4827654c --- /dev/null +++ b/src/Plot-Curvature-GammaV2_SubPlots.py @@ -0,0 +1,471 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +import sys +from ClassifyMin import * +from HelperFunctions import * +# from CellScript import * +from mpl_toolkits.mplot3d import Axes3D +import matplotlib.cm as cm +from vtk.util import numpy_support +from pyevtk.hl import gridToVTK +import time +import matplotlib.ticker as ticker + +import matplotlib as mpl +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator +import pandas as pd + +# from matplotlib import rc +# rc('text', usetex=True) # Use LaTeX font +# +# import seaborn as sns +# sns.set(color_codes=True) + + +def format_func(value, tick_number): + # # find number of multiples of pi/2 + # N = int(np.round(2 * value / np.pi)) + # if N == 0: + # return "0" + # elif N == 1: + # return r"$\pi/2$" + # elif N == 2: + # return r"$\pi$" + # elif N % 2 > 0: + # return r"${0}\pi/2$".format(N) + # else: + # return r"${0}\pi$".format(N // 2) + # find number of multiples of pi/2 + N = int(np.round(4 * value / np.pi)) + if N == 0: + return "0" + elif N == 1: + return r"$\pi/4$" + elif N == 2: + return r"$\pi/2$" + elif N % 2 > 0: + return r"${0}\pi/2$".format(N) + else: + return r"${0}\pi$".format(N // 2) + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +print('---- Input parameters: -----') +alpha = 10 +mu1 = 1.0 +rho1 = 1.0 +beta = 2.0 #5.0 +theta = 1.0/8.0 +# + +alpha = -0.5 +beta = 40.0 +theta= 1/8.0 + + + +# # INTERESTING! from pi/2: +alpha = -0.5 +beta = 40.0 +theta= 1/8.0 +# +# # # INTERESTING! from pi/2: +# alpha = -0.2 +# beta = 25.0 +# theta= 1/2 + +# INTERESTING!: +# alpha = -0.5 +# beta = 5.0 +# theta= 1/30 + + + +# INTERESTING!: +# alpha = -0.25 +# beta = 10.0 +# theta= 3/4 + + +# # INTERESTING!: +alpha = -0.25 +beta = 10.0 +theta= 1/8 + +# +# INTERESTING!: +# alpha = -0.25 +# beta = 5.0 +# theta= 1/8 +# + + +# # INTERESTING!: +alpha = -0.5 +beta = 10.0 +theta= 1/8 + + + +alpha_1 = -1.0 +alpha_2 = -0.75 +alpha_3 = -0.70 + +angles_1 = [] +angles_2 = [] +angles_3 = [] + +beta = 2.0 +theta= 0.25 + +#Test +beta = 10.0 +# alpha_1 = -1.0 +# alpha_2 = -0.75 +# alpha_3 = -0.5 + + +print('mu1: ', mu1) +print('rho1: ', rho1) +print('alpha_1: ', alpha_1) +print('alpha_2: ', alpha_2) +print('alpha_3: ', alpha_3) +print('beta: ', beta) +print('theta: ', theta) +# print('gamma:', gamma) +print('----------------------------') + +# ---------------------------------------------------------------- + + +gamma_min = 0.01 +gamma_max = 3 +Gamma_Values = np.linspace(gamma_min, gamma_max, num=100) # TODO variable Input Parameters...alpha,beta... +print('(Input) Gamma_Values:', Gamma_Values) +# mu_gamma = [] + +# Gamma_Values = '0' + + + +# Get values for mu_Gamma +GetMuGammaVec = np.vectorize(GetMuGamma) +muGammas = GetMuGammaVec(beta,theta,Gamma_Values,mu1,rho1, InputFilePath ,OutputFilePath ) +print('muGammas:', muGammas) + +q12 = 0.0 +q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) +q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) +print('q1: ', q1) +print('q2: ', q2) +b1 = prestrain_b1(rho1, beta, alpha,theta) +b2 = prestrain_b2(rho1, beta, alpha,theta) +q3_star = math.sqrt(q1*q2) +print('q3_star:', q3_star) + +# TODO these have to be compatible with input parameters!!! +# compute certain ParameterValues that this makes sense +# b1 = q3_star +# b2 = q1 +print('b1: ', b1) +print('b2: ', b2) + +# return classifyMin(q1, q2, q3, q12, b1, b2, print_Cases, print_Output) + + + +# classifyMin_anaVec = np.vectorize(classifyMin_ana) +# G, angles, Types, curvature = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) +classifyMin_anaVec = np.vectorize(classifyMin_ana) +G, angles_1, Types, curvature_1 = classifyMin_anaVec(alpha_1, beta, theta, muGammas, mu1, rho1) +G, angles_2, Types, curvature_2 = classifyMin_anaVec(alpha_2, beta, theta, muGammas, mu1, rho1) +G, angles_3, Types, curvature_3 = classifyMin_anaVec(alpha_3, beta, theta, muGammas, mu1, rho1) + +# _,angles,_,_ = classifyMin_anaVec(alpha, beta, theta, muGammas, mu1, rho1) + +print('angles_1:', angles_1) +print('angles_2:', angles_2) +print('angles_3:', angles_3) + +print('curvature_1:', curvature_1) +print('curvature_2:', curvature_2) +print('curvature_3:', curvature_3) + + +idx = find_nearestIdx(muGammas, q3_star) +print('GammaValue Idx closest to q_3^*', idx) +gammaClose = Gamma_Values[idx] +print('GammaValue(Idx) with mu_gamma closest to q_3^*', gammaClose) + + + +determinantVec = np.vectorize(determinant) + +detValues = determinantVec(q1,q2,muGammas,q12) +print('detValues:', detValues) + + +detZeroidx = find_nearestIdx(detValues, 0) +print('idx where det nearest to zero', idx) +gammaClose = Gamma_Values[detZeroidx] +print('gammaClose:', gammaClose) + + +# --- Convert to numpy array +Gamma_Values = np.array(Gamma_Values) + + +angles_1 = np.array(angles_1) +angles_2 = np.array(angles_2) +angles_3 = np.array(angles_3) + +curvature_1 = np.array(curvature_1) +curvature_2 = np.array(curvature_2) +curvature_3 = np.array(curvature_3) + +# ---------------- Create Plot ------------------- +# plt.figure() + + +mpl.rcParams['text.usetex'] = True +mpl.rcParams["font.family"] = "serif" +mpl.rcParams["font.size"] = "9" +width = 6.28 +height = width / 1.618 +height = width / 2.5 +fig = plt.figure() + +fig,ax = plt.subplots(nrows=1,ncols=3,figsize=(width,height)) # more than one plot + + + +# pos1 = ax.get_position() # get the original position +# pos2 = [pos1.x0 + 0.3, pos1.y0 + 0.3, pos1.width / 2.0, pos1.height / 2.0] +# ax.set_position(pos2) + + + + +# ax = plt.axes((0.15,0.21 ,0.75,0.75)) +# ax = plt.axes((0.15,0.21 ,0.8,0.75)) +# ax.tick_params(axis='x',which='major', direction='out',pad=5) +# ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# ax.xaxis.set_major_locator(MultipleLocator(0.1)) +# ax.xaxis.set_minor_locator(MultipleLocator(0.05)) + + + +# ax[0].yaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +# ax[0].yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +# ax[0].yaxis.set_major_formatter(plt.FuncFormatter(format_func)) +# ax[1].yaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +# ax[1].yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +# ax[1].yaxis.set_major_formatter(plt.FuncFormatter(format_func)) +# ax[2].yaxis.set_major_locator(plt.MultipleLocator(np.pi / 8)) +# ax[2].yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 16)) +# ax[2].yaxis.set_major_formatter(plt.FuncFormatter(format_func)) + +ax[0].grid(True,which='major',axis='both',alpha=0.3) +ax[1].grid(True,which='major',axis='both',alpha=0.3) +ax[2].grid(True,which='major',axis='both',alpha=0.3) +# ax.grid(True,which='major',axis='both',alpha=0.3) + + +# # plt.title(r'angle$-\mu_\gamma(\gamma)$-Plot') +# # plt.title(r'angle$-\gamma$-Plot') +# plt.plot(Gamma_Values, angles) +# plt.scatter(Gamma_Values, angles) +# plt.plot(muGammas, angles) +# plt.scatter(muGammas, angles) +# # plt.axis([0, 6, 0, 20]) +# # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') +# # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') +# plt.axvline(x = q1, color = 'b', linestyle = ':', label='$q_1$') +# plt.axvline(x = q2, color = 'r', linestyle = 'dashed', label='$q_2$') +# # plt.axvline(x = q3_star, color = 'r', linestyle = 'dashed', label='$\gamma^*$') + +# ax[0].plot(Gamma_Values, curvature_1, 'royalblue', zorder=3, ) +# ax[1].plot(Gamma_Values, curvature_2, 'royalblue', zorder=3, ) +# ax[2].plot(Gamma_Values, curvature_3, 'royalblue', zorder=3, ) + +ax[0].plot(Gamma_Values, curvature_1, 'forestgreen', zorder=3, ) +ax[1].plot(Gamma_Values, curvature_2, 'forestgreen', zorder=3, ) +ax[2].plot(Gamma_Values, curvature_3, 'forestgreen', zorder=3, ) + +ax[0].set_xlabel(r"$\gamma$") +ax[0].set_ylabel(r"curvature $\kappa$") +ax[0].xaxis.set_minor_locator(MultipleLocator(0.5)) +ax[0].xaxis.set_major_locator(MultipleLocator(1)) + +ax[1].set_xlabel(r"$\gamma$") +# ax[1].set_ylabel(r"angle $\alpha$") +ax[1].xaxis.set_minor_locator(MultipleLocator(0.5)) +ax[1].xaxis.set_major_locator(MultipleLocator(1)) + +ax[2].set_xlabel(r"$\gamma$") +# ax[2].set_ylabel(r"angle $\alpha$") +ax[2].xaxis.set_minor_locator(MultipleLocator(0.5)) +ax[2].xaxis.set_major_locator(MultipleLocator(1)) +# Labels to use in the legend for each line +line_labels = [r"$\theta_\mu = 1.0$", r"$\theta_\mu = 2.0$", r"$\theta_\mu = 5.0$", r"$\theta_\mu = 10.0$"] + + +# ax.plot(Gamma_Values, angles, 'royalblue', zorder=3, ) +# ax.set_xlabel(r"$\gamma$") +# ax.set_ylabel(r"angle $\alpha$") + +# plt.xlabel("$q_3$") +# plt.xlabel("$\gamma$") +# plt.ylabel("angle") +# ax.grid(True) + + +# ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) +# ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) + +# ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 4)) +# ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) +# ax.yaxis.set_major_formatter(plt.FuncFormatter(format_func)) + +# ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$')) +# ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.25)) + + +# ax.yaxis.set_major_formatter(ticker.FuncFormatter( +# lambda val,pos: '{:.0g}$\pi$'.format(2*val/np.pi) if val !=0 else '0')) +# ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.5*np.pi)) + +# ---------------------------- show pi values ------------------------------------ +# ax.axvline(x = q1, color = 'b', linestyle = ':', label='$q_1$') +# ax.axvline(x = q2, color = 'r', linestyle = 'dashed', label='$q_2$') +# ax.legend() +# # ax.set(xlim=(1.750, 1.880), ylim=(0, math.pi/2.0)) +# ax.set(xlim=(1.760, 1.880), ylim=(-0.1, np.pi/4.0)) +# # ax.set_yticks([0, np.pi/4 ,np.pi/2]) +# # labels = ['$0$', r'$\pi/4$', r'$\pi/2$'] +# ax.set_yticks([0, np.pi/8, np.pi/4 ]) +# labels = ['$0$',r'$\pi/8$', r'$\pi/4$'] +# ax.set_yticklabels(labels) +# --------------------------------------------------------------- + + +# ax.set(xlim=(1.750, 1.880), ylim=(0, math.pi/2.0)) + +# ax.set(xlim=(1.760, 1.880), ylim=(-0.1, np.pi/4.0)) +# ax.set(xlim=(1.760, 1.880), ylim=(-0.1, np.pi/4.0)) +# ax.set_yticks([0, np.pi/4 ,np.pi/2]) +# labels = ['$0$', r'$\pi/4$', r'$\pi/2$'] + + +# OLD : +# ax.set_yticks([0, np.pi/8, np.pi/4 ]) +# labels = ['$0$',r'$\pi/8$', r'$\pi/4$'] + +# labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$'] +# ax[0].set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2, ]) +# ax[1].set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2 ]) +# ax[2].set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2 ]) +# +# ax[0].set_yticklabels(labels) +# ax[1].set_yticklabels(labels) +# ax[2].set_yticklabels(labels) + +# for i in range(3): +# ax[i].set_ylim([0-0.1, np.pi/2+0.1]) + +# Plot Gamma Value that is closest to q3_star +l1 = ax[0].axvline(x = gammaClose, color = 'midnightblue', linestyle = 'dashed', linewidth=1, label='$\gamma^*$', zorder=4) +l2 = ax[1].axvline(x = gammaClose, color = 'midnightblue', linestyle = 'dashed', linewidth=1, label='$\gamma^*$', zorder=4) +l3 = ax[2].axvline(x = gammaClose, color = 'midnightblue', linestyle = 'dashed', linewidth=1, label='$\gamma^*$' ,zorder=4) +# color elliptic/hyperbolic region +# ax.axvspan(gamma_min, gammaClose, color='red', alpha=0.2) +# ax.axvspan(gammaClose, gamma_max, color='green', alpha=0.2) + + +# ax[0].legend(loc='upper right') +# ax[2].legend(l3, +# labels=['$\gamma^*$'], +# loc='upper left', +# bbox_to_anchor=(1,1)) + +# ax[1].legend( +# loc='upper center', +# # bbox_to_anchor=(1,1)) +# bbox_to_anchor=(1.0,1.0)) +# + +line_labels = [r"$\gamma^*$"] + +# fig.legend([l1], # The line objects +# label=line_labels, # The labels for each line +# loc="center right", # Position of legend +# borderaxespad=0.15 # Small spacing around legend box +# # title="Legend Title" # Title for the legend +# ) +fig.legend([l1], [r"$\gamma^*$"], + # bbox_to_anchor=[0.5, 0.92], + bbox_to_anchor=[0.5, 0.94], + loc='center', ncol=3) + +plt.subplots_adjust(wspace=0.4, hspace=0.0) +# plt.tight_layout() + +# Adjust the scaling factor to fit your legend text completely outside the plot +# (smaller value results in more space being made for the legend) +# plt.subplots_adjust(right=0.9) +plt.subplots_adjust(bottom=0.2) + +fig.set_size_inches(width, height) +fig.savefig('Plot-Curvature-Gamma.pdf') + +plt.show() + + + + +# plt.figure() +# plt.title(r'angle$-\mu_\gamma(\gamma)$-Plot') +# plt.plot(muGammas, angles) +# plt.scatter(muGammas, angles) +# # plt.axis([0, 6, 0, 20]) +# # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') +# # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') +# plt.axvline(x = 1.90476, color = 'b', linestyle = ':', label='$q_1$') +# plt.axvline(x = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') +# plt.xlabel("$\mu_\gamma$") +# plt.ylabel("angle") +# plt.legend() +# plt.show() +# diff --git a/src/Plot_Angle_Alpha.py b/src/Plot_Angle_Alpha.py index 8a5ecf4819d75ae2bb7e3bc6125b7c94a592f898..4869f56475fb89e734d95202ec4ff81a83435f2e 100644 --- a/src/Plot_Angle_Alpha.py +++ b/src/Plot_Angle_Alpha.py @@ -173,17 +173,23 @@ alpha=3.0; # # INTERESTING!: -alpha = 3 +# alpha = 3 beta = 10.0 theta= 1/8 +# theta = 0.5 +theta=0.1 + +#TEST +beta = 2.0 +theta = 0.5 gamma = 'infinity' #Elliptic Setting -gamma = '0' #Hyperbolic Settings +# gamma = '0' #Hyperbolic Settings # gamma = 0.5 @@ -206,12 +212,11 @@ xmax = 0.99 xmin = -2.0 xmax = 1.0 -xmin = -5.0 -xmax = 5.0 +# xmin = -5.0 +# xmax = 5.0 + -# theta = 0.5 -theta=0.1 Jumps = True @@ -410,7 +415,7 @@ mpl.rcParams["font.size"] = "9" # width as measured in inkscape width = 6.28 *0.5 -width = 6.28 +# width = 6.28 height = width / 1.618 #setup canvas first @@ -443,7 +448,8 @@ fig = plt.figure() #main # fig.set_size_inches(3.54,3.54) # ax = plt.axes((0.15,0.18,0.8,0.8)) -ax = plt.axes((0.15,0.18,0.6,0.6)) +ax = plt.axes((0.15,0.2,0.75,0.75)) +# ax = plt.axes((0.15,0.18,0.6,0.6)) # ax = plt.axes((0.1,0.1,0.5,0.8)) # ax = plt.axes((0.1,0.1,1,1)) # ax = plt.axes() @@ -465,8 +471,8 @@ ax.xaxis.set_minor_locator(MultipleLocator(0.05)) ax.xaxis.set_major_locator(MultipleLocator(0.5)) ax.xaxis.set_minor_locator(MultipleLocator(0.25)) -ax.xaxis.set_major_locator(MultipleLocator(1.0)) -ax.xaxis.set_minor_locator(MultipleLocator(0.5)) +# ax.xaxis.set_major_locator(MultipleLocator(1.0)) +# ax.xaxis.set_minor_locator(MultipleLocator(0.5)) #---- print data-types print(ax.xaxis.get_major_locator()) @@ -556,7 +562,7 @@ ax.grid(True,which='major',axis='both',alpha=0.3) # --- leave out jumps: # ax.scatter(X_Values, Y_Values) -ax.set_xlabel(r"volume fraction $\theta$") +ax.set_xlabel(r"prestrain ratio $\theta_\rho$") ax.set_ylabel(r"angle $\alpha$") @@ -671,22 +677,37 @@ if Jumps: ax.scatter([transition_point1, transition_point2],[np.pi/2,np.pi/2],s=6, marker='o', cmap=None, norm=None, facecolor = 'black', edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) - ax.text(transition_point1-0.11 , np.pi/2-0.02, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + # ax.text(transition_point1-0.11 , np.pi/2-0.02, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + # ) + # + # ax.text(transition_point2+0.06 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + # ) + + ax.text(transition_point1-0.17 , np.pi/2-0.02, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) ) - ax.text(transition_point2+0.06 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ax.text(transition_point2+0.1 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) ) else: ax.scatter([transition_point1, transition_point2, transition_point3 ],[np.pi/2,np.pi/2,0 ],s=6, marker='o', cmap=None, norm=None, facecolor = 'black', edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) - ax.text(transition_point1-0.11 , np.pi/2-0.02, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + # ax.text(transition_point1-0.11 , np.pi/2-0.02, r"$3$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + # ) + # + # ax.text(transition_point2 + 0.06 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + # ) + # + # ax.text(transition_point3 +0.04 , 0+0.04, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + # ) + + ax.text(transition_point1-0.17 , np.pi/2-0.02, r"$3$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) ) - ax.text(transition_point2 + 0.06 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ax.text(transition_point2 + 0.1 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) ) - ax.text(transition_point3 +0.04 , 0+0.04, r"$3$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ax.text(transition_point3 +0.08 , 0+0.08, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) ) else: diff --git a/src/Plot_Angle_Lemma1.4V3_Transition.py b/src/Plot_Angle_Lemma1.4V3_Transition.py index bdbcef34688e0e6f1fe0a4cd07e9385488925b04..701f8687fc14f80c38628991c433ab19c7f3cc8a 100644 --- a/src/Plot_Angle_Lemma1.4V3_Transition.py +++ b/src/Plot_Angle_Lemma1.4V3_Transition.py @@ -180,6 +180,9 @@ theta= 1/8 +#TEST +beta=2 + gamma = 'infinity' #Elliptic Setting diff --git a/src/Plot_Angle_Lemma1.4V3_Transition_Beta2.py b/src/Plot_Angle_Lemma1.4V3_Transition_Beta2.py new file mode 100644 index 0000000000000000000000000000000000000000..b3ae9bd03e44c3409d89fc9867bcea496413161e --- /dev/null +++ b/src/Plot_Angle_Lemma1.4V3_Transition_Beta2.py @@ -0,0 +1,859 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +from HelperFunctions import * +from ClassifyMin import * + +import matplotlib.ticker as tickers +import matplotlib as mpl +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator +import pandas as pd + +# import tikzplotlib +# # from pylab import * +# from tikzplotlib import save as tikz_save + + +# Needed ? +mpl.use('pdf') + +# from subprocess import Popen, PIPE +#import sys + +###################### makePlot.py ######################### +# Generalized Plot-Script giving the option to define +# quantity of interest and the parameter it depends on +# to create a plot +# +# Input: Define y & x for "x-y plot" as Strings +# - Run the 'Cell-Problem' for the different Parameter-Points +# (alternatively run 'Compute_MuGamma' if quantity of interest +# is q3=muGamma for a significant Speedup) + +########################################################### + + + +# figsize argument takes inputs in inches +# and we have the width of our document in pts. +# To set the figure size we construct a function +# to convert from pts to inches and to determine +# an aesthetic figure height using the golden ratio: +# def set_size(width, fraction=1): +# """Set figure dimensions to avoid scaling in LaTeX. +# +# Parameters +# ---------- +# width: float +# Document textwidth or columnwidth in pts +# fraction: float, optional +# Fraction of the width which you wish the figure to occupy +# +# Returns +# ------- +# fig_dim: tuple +# Dimensions of figure in inches +# """ +# # Width of figure (in pts) +# fig_width_pt = width * fraction +# +# # Convert from pt to inches +# inches_per_pt = 1 / 72.27 +# +# # Golden ratio to set aesthetic figure height +# # https://disq.us/p/2940ij3 +# golden_ratio = (5**.5 - 1) / 2 +# +# # Figure width in inches +# fig_width_in = fig_width_pt * inches_per_pt +# # Figure height in inches +# fig_height_in = fig_width_in * golden_ratio +# +# fig_dim = (fig_width_in, fig_height_in) +# +# return fig_dim +# + + + +def format_func(value, tick_number): + # # find number of multiples of pi/2 + # N = int(np.round(2 * value / np.pi)) + # if N == 0: + # return "0" + # elif N == 1: + # return r"$\pi/2$" + # elif N == 2: + # return r"$\pi$" + # elif N % 2 > 0: + # return r"${0}\pi/2$".format(N) + # else: + # return r"${0}\pi$".format(N // 2) + # find number of multiples of pi/2 + N = int(np.round(4 * value / np.pi)) + if N == 0: + return "0" + elif N == 1: + return r"$\pi/4$" + elif N == 2: + return r"$\pi/2$" + elif N % 2 > 0: + return r"${0}\pi/2$".format(N) + else: + return r"${0}\pi$".format(N // 2) + + + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + + +# TODO +# - Fallunterscheidung (Speedup) falls gesuchter value mu_gamma = q3 +# - Also Add option to plot Minimization Output + + +# ----- Setup Paths ----- +# InputFile = "/inputs/cellsolver.parset" +# OutputFile = "/outputs/output.txt" + +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" + +# path = os.getcwd() +# InputFilePath = os.getcwd()+InputFile +# OutputFilePath = os.getcwd()+OutputFile +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +#--------------------------------------------------------------- + +print('---- Input parameters: -----') +mu1 = 1.0 #10.0 +# lambda1 = 10.0 +rho1 = 1.0 +alpha = 5.0 +beta = 10.0 +# alpha = 2.0 +# beta = 2.0 +theta = 1.0/8.0 #1.0/4.0 + +lambda1 = 0.0 +# gamma = 1.0/4.0 + +# TEST: +alpha=3.0; + + + + +# # INTERESTING!: +# alpha = 3 +beta = 2.0 +# theta= 1/8 + + + + +#TEST +# beta=2 + + + +gamma = 'infinity' #Elliptic Setting +# gamma = '0' #Hyperbolic Setting +# gamma = 0.5 + + +print('mu1: ', mu1) +print('rho1: ', rho1) +print('alpha: ', alpha) +print('beta: ', beta) +print('theta: ', theta) +print('gamma:', gamma) +print('----------------------------') + + + +# --- define Interval of x-va1ues: +xmin = 0.01 +xmax = 0.41 +xmax = 0.99 + + +Jumps = False + + +numPoints = 2000 +numPoints = 100 +X_Values = np.linspace(xmin, xmax, num=numPoints) +print(X_Values) + + +Y_Values = [] + + + + +Angle_alpha0 = [] + +Angle_alphaNeg05 = [] +Angle_alphaNeg055 = [] +Angle_alphaNeg06 = [] +Angle_alphaNeg065 = [] +Angle_alphaNeg07 = [] +Angle_alphaNeg075 = [] +Angle_alphaNeg08 = [] +Angle_alphaNeg085 = [] +Angle_alphaNeg09 = [] +Angle_alphaNeg095 = [] +Angle_alphaNeg1 = [] + + +Angle_alphaNeg0125 = [] +Angle_alphaNeg025 = [] + +Angle_alphaNeg05 = [] +Angle_alphaNeg075 = [] + +Angle_alpha3 = [] + +Angle_alphaNeg0625 = [] +Angle_alphaNeg0875 = [] + + + +for theta in X_Values: + print('Situation of Lemma1.4') + q12 = 0.0 + q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) + q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) + b1 = prestrain_b1(rho1, beta, alpha,theta) + b2 = prestrain_b2(rho1, beta, alpha,theta) + b3 = 0.0 + q3 = GetMuGamma(beta,theta,gamma,mu1,rho1,InputFilePath ,OutputFilePath) + + # G, angle, Type, curvature = classifyMin_ana(alpha,beta,theta, q3, mu1, rho1) + # Y_Values.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.5,beta,theta, q3, mu1, rho1) + Angle_alphaNeg05.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.55,beta,theta, q3, mu1, rho1) + Angle_alphaNeg055.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.6,beta,theta, q3, mu1, rho1) + Angle_alphaNeg06.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.65,beta,theta, q3, mu1, rho1) + Angle_alphaNeg065.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.7,beta,theta, q3, mu1, rho1) + Angle_alphaNeg07.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.75,beta,theta, q3, mu1, rho1) + Angle_alphaNeg075.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.8,beta,theta, q3, mu1, rho1) + Angle_alphaNeg08.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.85,beta,theta, q3, mu1, rho1) + Angle_alphaNeg085.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.9,beta,theta, q3, mu1, rho1) + Angle_alphaNeg09.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.95,beta,theta, q3, mu1, rho1) + Angle_alphaNeg095.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-1.0,beta,theta, q3, mu1, rho1) + Angle_alphaNeg1.append(angle) + + # + # G, angle, Type, curvature = classifyMin_ana(-0.5,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg05 .append(angle) + # G, angle, Type, curvature = classifyMin_ana(-0.25,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg025.append(angle) + # G, angle, Type, curvature = classifyMin_ana(3.0,beta,theta, q3, mu1, rho1) + # Angle_alpha3.append(angle) + # G, angle, Type, curvature = classifyMin_ana(-1.0,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg075.append(angle) + # G, angle, Type, curvature = classifyMin_ana(0,beta,theta, q3, mu1, rho1) + # Angle_alpha0.append(angle) + # # G, angle, Type, curvature = classifyMin_ana(-0.125,beta,theta, q3, mu1, rho1) + # # Angle_alphaNeg0125.append(angle) + # G, angle, Type, curvature = classifyMin_ana(-0.7,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg0125.append(angle) + # + # G, angle, Type, curvature = classifyMin_ana(-0.625,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg0625.append(angle) + # G, angle, Type, curvature = classifyMin_ana(-0.875,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg0875.append(angle) + +# +# +# print("(Output) Values of angle: ", Y_Values) +# +# +# idx = find_nearestIdx(Y_Values, 0) +# print(' Idx of value closest to 0', idx) +# ValueClose = Y_Values[idx] +# print('GammaValue(Idx) with mu_gamma closest to q_3^*', ValueClose) +# +# +# +# # Find Indices where the difference between the next one is larger than epsilon... +# jump_idx = [] +# jump_xValues = [] +# jump_yValues = [] +# tmp = X_Values[0] +# for idx, x in enumerate(X_Values): +# print(idx, x) +# if idx > 0: +# if abs(Y_Values[idx]-Y_Values[idx-1]) > 1: +# print('jump candidate') +# jump_idx.append(idx) +# jump_xValues.append(x) +# jump_yValues.append(Y_Values[idx]) +# +# +# +# +# +# +# +# print("Jump Indices", jump_idx) +# print("Jump X-values:", jump_xValues) +# print("Jump Y-values:", jump_yValues) +# +# y_plotValues = [Y_Values[0]] +# x_plotValues = [X_Values[0]] +# # y_plotValues.extend(jump_yValues) +# for i in jump_idx: +# y_plotValues.extend([Y_Values[i-1], Y_Values[i]]) +# x_plotValues.extend([X_Values[i-1], X_Values[i]]) +# +# +# y_plotValues.append(Y_Values[-1]) +# # x_plotValues = [X_Values[0]] +# # x_plotValues.extend(jump_xValues) +# x_plotValues.append(X_Values[-1]) +# +# +# print("y_plotValues:", y_plotValues) +# print("x_plotValues:", x_plotValues) + + +# Y_Values[np.diff(y) >= 0.5] = np.nan + + +#get values bigger than jump position +# gamma = infty +# x_rest = X_Values[X_Values>x_plotValues[1]] +# Y_Values = np.array(Y_Values) #convert the np array +# y_rest = Y_Values[X_Values>x_plotValues[1]] +# +# +# # gamma = 0 +# x_rest = X_Values[X_Values>x_plotValues[3]] +# Y_Values = np.array(Y_Values) #convert the np array +# y_rest = Y_Values[X_Values>x_plotValues[3]] + +# gamma between +# Y_Values = np.array(Y_Values) #convert the np array +# X_Values = np.array(X_Values) #convert the np array +# +# x_one = X_Values[X_Values>x_plotValues[3]] +# # ax.scatter(X_Values, Y_Values) +# y_rest = Y_Values[X_Values>x_plotValues[3]] +# ax.plot(X_Values[X_Values>0.135], Y_Values[X_Values<0.135]) +# +# +# + + +# y_rest = Y_Values[np.nonzero(X_Values>x_plotValues[1]] +# print('X_Values:', X_Values) +# print('Y_Values:', Y_Values) +# print('x_rest:', x_rest) +# print('y_rest:', y_rest) +# print('np.nonzero(X_Values>x_plotValues[1]', np.nonzero(X_Values>x_plotValues[1]) ) + + + + +# --- Convert to numpy array +Y_Values = np.array(Y_Values) +X_Values = np.array(X_Values) + +Angle_alphaNeg05 = np.array(Angle_alphaNeg05) +Angle_alphaNeg055 = np.array(Angle_alphaNeg055) +Angle_alphaNeg06 = np.array(Angle_alphaNeg06) +Angle_alphaNeg065 = np.array(Angle_alphaNeg065) +Angle_alphaNeg07 = np.array(Angle_alphaNeg07) +Angle_alphaNeg075 = np.array(Angle_alphaNeg075) +Angle_alphaNeg08 = np.array(Angle_alphaNeg08) +Angle_alphaNeg085 = np.array(Angle_alphaNeg085) +Angle_alphaNeg09 = np.array(Angle_alphaNeg09) +Angle_alphaNeg095 = np.array(Angle_alphaNeg095) + + +Angle_alphaNeg1 = np.array(Angle_alphaNeg1) + +Angle_alphaNeg025 = np.array(Angle_alphaNeg025) +Angle_alphaNeg075 = np.array(Angle_alphaNeg075) +Angle_alpha3 = np.array(Angle_alpha3) +Angle_alphaNeg0 = np.array(Angle_alpha0) +Angle_alphaNeg0125 = np.array(Angle_alphaNeg0125) + +Angle_alphaNeg0625 = np.array(Angle_alphaNeg0625) +Angle_alphaNeg0875 = np.array(Angle_alphaNeg0875) +# ---------------- Create Plot ------------------- + +#--- change plot style: SEABORN +# plt.style.use("seaborn-paper") + + +#--- Adjust gobal matplotlib variables +# mpl.rcParams['pdf.fonttype'] = 42 +# mpl.rcParams['ps.fonttype'] = 42 +mpl.rcParams['text.usetex'] = True +mpl.rcParams["font.family"] = "serif" +mpl.rcParams["font.size"] = "9" + + +# plt.rc('font', family='serif', serif='Times') +# plt.rc('font', family='serif') +# # plt.rc('text', usetex=True) #also works... +# plt.rc('xtick', labelsize=8) +# plt.rc('ytick', labelsize=8) +# plt.rc('axes', labelsize=8) + + + + + +#---- Scale Figure apropriately to fit tex-File Width +# width = 452.9679 + +# width as measured in inkscape +width = 6.28 *0.5 +width = 6.28 +height = width / 1.618 + +#setup canvas first +fig = plt.figure() #main +# fig, ax = plt.subplots() +# fig, (ax, ax2) = plt.subplots(ncols=2) +# fig,axes = plt.subplots(nrows=1,ncols=2,figsize=(width,height)) # more than one plot + + +# fig.subplots_adjust(left=.15, bottom=.16, right=.99, top=.97) #TEST + + +# TEST +# mpl.rcParams['figure.figsize'] = (width+0.1,height+0.1) +# fig = plt.figure(figsize=(width+0.1,height+0.1)) + + +# mpl.rcParams['figure.figsize'] = (width,height) +# fig = plt.figure(figsize=(10,6)) # default is [6.4,4.8] 6.4 is the width, 4.8 is the height +# fig = plt.figure(figsize=(width,height)) # default is [6.4,4.8] 6.4 is the width, 4.8 is the height +# fig = plt.figure(figsize=set_size(width)) +# fig = plt.subplots(1, 1, figsize=set_size(width)) + +# --- To create a figure half the width of your document:# +# fig = plt.figure(figsize=set_size(width, fraction=0.5)) + + + +#--- You must select the correct size of the plot in advance +# fig.set_size_inches(3.54,3.54) + +# ax = plt.axes((0.15,0.18,0.8,0.8)) +ax = plt.axes((0.15,0.18,0.6,0.6)) +# ax = plt.axes((0.1,0.1,0.5,0.8)) +# ax = plt.axes((0.1,0.1,1,1)) +# ax = plt.axes() + +# ax.spines['right'].set_visible(False) +# ax.spines['left'].set_visible(False) +# ax.spines['bottom'].set_visible(False) +# ax.spines['top'].set_visible(False) +# ax.tick_params(axis='x',which='major',direction='out',length=10,width=5,color='red',pad=15,labelsize=15,labelcolor='green', +# labelrotation=15) +# ax.tick_params(axis='x',which='major', direction='out',pad=5,labelsize=10) +# ax.tick_params(axis='y',which='major', length=5, width=1, direction='out',pad=5,labelsize=10) +ax.tick_params(axis='x',which='major', direction='out',pad=3) +ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# ax.xaxis.set_major_locator(MultipleLocator(0.05)) +# ax.xaxis.set_minor_locator(MultipleLocator(0.025)) +ax.xaxis.set_major_locator(MultipleLocator(0.1)) +ax.xaxis.set_minor_locator(MultipleLocator(0.05)) + +#---- print data-types +print(ax.xaxis.get_major_locator()) +print(ax.xaxis.get_minor_locator()) +print(ax.xaxis.get_major_formatter()) +print(ax.xaxis.get_minor_formatter()) + +#---- Hide Ticks or Labels +# ax.yaxis.set_major_locator(plt.NullLocator()) +# ax.xaxis.set_major_formatter(plt.NullFormatter()) + +#---- Reducing or Increasing the Number of Ticks +# ax.xaxis.set_major_locator(plt.MaxNLocator(3)) +# ax.yaxis.set_major_locator(plt.MaxNLocator(3)) + + +#----- Fancy Tick Formats +ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 4)) +ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) +ax.yaxis.set_major_formatter(plt.FuncFormatter(format_func)) + + + + + + + +# --- manually change ticks&labels: +# ax.set_xticks([0.2,1]) +# ax.set_xticklabels(['pos1','pos2']) + +# ax.set_yticks([0, np.pi/8, np.pi/4 ]) +# labels = ['$0$',r'$\pi/8$', r'$\pi/4$'] +# ax.set_yticklabels(labels) + +a=ax.yaxis.get_major_locator() +b=ax.yaxis.get_major_formatter() +c = ax.get_xticks() +d = ax.get_xticklabels() +print('xticks:',c) +print('xticklabels:',d) + +ax.grid(True,which='major',axis='both',alpha=0.3) + + + + + + +# plt.figure() + +# f,ax=plt.subplots(1) + +# plt.title(r''+ yName + '-Plot') +# plt.plot(X_Values, Y_Values,linewidth=2, '.k') +# plt.plot(X_Values, Y_Values,'.k',markersize=1) +# plt.plot(X_Values, Y_Values,'.',markersize=0.8) + +# plt.plot(X_Values, Y_Values) + +# ax.plot([[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]]) + + + +# Gamma = '0' +# ax.plot([x_plotValues[0],x_plotValues[1]], [y_plotValues[0],y_plotValues[1]] , 'b') +# +# ax.plot([x_plotValues[1],x_plotValues[3]], [y_plotValues[2],y_plotValues[3]] , 'b') +# +# ax.plot(x_rest, y_rest, 'b') + + +# Gamma between + +# x jump values (gamma 0): [0.13606060606060608, 0.21090909090909093] + +# ax.plot([[0,jump_xValues[0]], [0, 0]] , 'b') +# ax.plot([jump_xValues[0],xmin], [y_plotValues[2],y_plotValues[2]] , 'b') + +# ax.plot([[0,0.13606060606060608], [0, 0]] , 'b') +# ax.plot([[0.13606060606060608,xmin], [(math.pi/2),(math.pi/2)]], 'b') + +# jump_xValues[0] + + + +# --- leave out jumps: +# ax.scatter(X_Values, Y_Values) + +ax.set_xlabel(r"volume fraction $\theta$") +ax.set_ylabel(r"angle $\alpha$") + + +if Jumps: + + # --- leave out jumps: + if gamma == 'infinity': + ax.plot(X_Values[X_Values>=jump_xValues[0]], Y_Values[X_Values>=jump_xValues[0]] , 'royalblue') + ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]], 'royalblue') + + + + # ax.plot(X_Values[X_Values>=jump_xValues[0]], Y_Values[X_Values>=jump_xValues[0]]) + # ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]]) + + + + + # ax.plot(X_Values[X_Values>0.136], Y_Values[X_Values>0.136]) + # ax.plot(X_Values[X_Values<0.135], Y_Values[X_Values<0.135]) + # ax.scatter(X_Values, Y_Values) + # ax.plot(X_Values, Y_Values) + + # plt.plot(x_plotValues, y_plotValues,'.') + # plt.scatter(X_Values, Y_Values, alpha=0.3) + # plt.scatter(X_Values, Y_Values) + # plt.plot(X_Values, Y_Values,'.') + # plt.plot([X_Values[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]]) + # plt.axis([0, 6, 0, 20]) + + # ax.set_xlabel(r"volume fraction $\theta$", size=11) + # ax.set_ylabel(r"angle $\angle$", size=11) + # ax.set_xlabel(r"volume fraction $\theta$") + # # ax.set_ylabel(r"angle $\angle$") + # ax.set_ylabel(r"angle $\alpha$") + # plt.ylabel('$\kappa$') + + # ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$')) + # ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.1)) + + + + + # Plot every other line.. not the jumps... + + if gamma == '0': + tmp = 1 + for idx, x in enumerate(x_plotValues): + if idx > 0 and tmp == 1: + # plt.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]] ) + ax.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]], 'royalblue', zorder=2) + tmp = 0 + else: + tmp = 1 + + # plt.plot([x_plotValues[0],x_plotValues[1]] ,[y_plotValues[0],y_plotValues[1]] ) + # plt.plot([x_plotValues[2],x_plotValues[3]] ,[y_plotValues[2],y_plotValues[3]] ) + # plt.plot([x_plotValues[4],x_plotValues[5]] ,[y_plotValues[4],y_plotValues[5]] ) + # plt.plot([x_plotValues[6],x_plotValues[7]] ,[y_plotValues[6],y_plotValues[7]] ) + + + for x in jump_xValues: + plt.axvline(x,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', linewidth=1, zorder=1) + # plt.axvline(x,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', label=r'$\theta_*$') + + # plt.axvline(x_plotValues[1],ymin=0, ymax= 1, color = 'g',alpha=0.5, linestyle = 'dashed') + + # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') + # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') + # plt.legend() + + + # -- SETUP LEGEND + # ax.legend(prop={'size': 11}) + # ax.legend() + + # ------------------ SAVE FIGURE + # tikzplotlib.save("TesTout.tex") + # plt.close() + # mpl.rcParams.update(mpl.rcParamsDefault) + + # plt.savefig("graph.pdf", + # #This is simple recomendation for publication plots + # dpi=1000, + # # Plot will be occupy a maximum of available space + # bbox_inches='tight', + # ) + # plt.savefig("graph.pdf") + + + + # ---- ADD additional scatter: + # ax.scatter(X_Values,Y_Values,s=1,c='black',zorder=4) + + # Find transition point + lastIdx = len(Y_Values)-1 + + for idx, y in enumerate(Y_Values): + if idx != lastIdx: + if abs(y-0) < 0.01 and abs(Y_Values[idx+1] - 0) > 0.05: + transition_point1 = X_Values[idx+1] + print('transition point1:', transition_point1 ) + if abs(y-0.5*np.pi) < 0.01 and abs(Y_Values[idx+1] -0.5*np.pi)>0.01: + transition_point2 = X_Values[idx] + print('transition point2:', transition_point2 ) + if abs(y-0) > 0.01 and abs(Y_Values[idx+1] - 0) < 0.01: + transition_point3 = X_Values[idx+1] + print('transition point3:', transition_point3 ) + + # Add transition Points: + if gamma == '0': + ax.scatter([transition_point1, transition_point2],[np.pi/2,np.pi/2],s=6, marker='o', cmap=None, norm=None, facecolor = 'black', + edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + + ax.text(transition_point1-0.02 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + ax.text(transition_point2+0.012 , np.pi/2-0.02, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + else: + ax.scatter([transition_point1, transition_point2, transition_point3 ],[np.pi/2,np.pi/2,0 ],s=6, marker='o', cmap=None, norm=None, facecolor = 'black', + edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + + ax.text(transition_point1-0.02 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + ax.text(transition_point2 +0.011 , np.pi/2-0.02, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + ax.text(transition_point3 +0.009 , 0+0.08, r"$3$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + +else: + # ax.scatter(X_Values,Y_Values,s=1, marker='o', cmap=None, norm=None, facecolor = 'blue', + # edgecolor = 'none', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # --------------------------------------------------------------- + # l1 = ax.scatter(X_Values,Angle_alpha0,s=1, marker='o', edgecolor = 'black',cmap=None, norm=None, vmin=None, vmax=None, alpha=0.75, linewidths=None, zorder=4) + # l6 = ax.scatter(X_Values,Angle_alphaNeg1,s=2, marker='s', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=1, label=r"$\theta_\rho = -1.0$") + # l4 = ax.scatter(X_Values,Angle_alphaNeg05,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l3 = ax.scatter(X_Values,Angle_alphaNeg025,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l7 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', facecolor = 'none',edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=5) + # # l4 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', markerfacecolor='red',markeredgecolor='black',markeredgewidth=2, cmap=None, norm=None, vmin=None, vmax=None, alpha=0.5, linewidths=None, zorder=3) + # l5 = ax.scatter(X_Values,Angle_alphaNeg075,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l2 = ax.scatter(X_Values,Angle_alphaNeg0125,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # + # line_labels = [r"$\theta_\rho = -1.0$", r"$\theta_\rho = -0.5$", r"$\theta_\rho = -0.25$", r"$\theta_\rho = 3.0$"] + # ax.set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2, 5*np.pi/8 ]) + # labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$',r'$5\pi/8$'] + # ax.set_yticklabels(labels) + # + # ax.legend(handles=[l1,l2,l3,l4, l5, l6, l7], + # labels= [ r"$\theta_\rho = 0$", r"$\theta_\rho = -0.125$", r"$\theta_\rho = -0.25$", r"$\theta_\rho = -0.5$", r"$\theta_\rho = -0.75$", r"$\theta_\rho = -1.0$", r"$\theta_\rho = 3.0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + # --------------------------------------------------------------- + # l1 = ax.scatter(X_Values,Angle_alphaNeg1,s=2, marker='s', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=1) + # l2 = ax.scatter(X_Values,Angle_alphaNeg0875,s=2, marker='o',cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + # l3 = ax.scatter(X_Values,Angle_alphaNeg075,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l4 = ax.scatter(X_Values,Angle_alphaNeg0625,s=2, marker='o',cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + # l5 = ax.scatter(X_Values,Angle_alphaNeg05,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l6 = ax.scatter(X_Values,Angle_alphaNeg025,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l7 = ax.scatter(X_Values,Angle_alphaNeg0125,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l8 = ax.scatter(X_Values,Angle_alpha0,s=2, marker='s', edgecolor = 'black', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + + l1 = ax.plot(X_Values,Angle_alphaNeg05, color='blue', linewidth=1.5, zorder=3, label=r"$\theta_\rho=0.5$") + l2 = ax.plot(X_Values,Angle_alphaNeg055, linewidth=1.5, linestyle = '--', zorder=3,label=r"$\theta_\rho=0.55$") + l3 = ax.plot(X_Values,Angle_alphaNeg06,color='orangered', linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=0.6$") + l4 = ax.plot(X_Values,Angle_alphaNeg065, linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=0.65$") + l5 = ax.plot(X_Values,Angle_alphaNeg07,color='orange', linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=0.7$") + l6 = ax.plot(X_Values,Angle_alphaNeg075, linewidth=1.5,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=0.75$") + l7 = ax.plot(X_Values,Angle_alphaNeg08, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=0.8$") + l8 = ax.plot(X_Values,Angle_alphaNeg085, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=0.85$") + l9 = ax.plot(X_Values,Angle_alphaNeg09, color='teal',linestyle = '--', linewidth=1.5 , zorder=3, label=r"$\theta_\rho=0.9$") + l10 = ax.plot(X_Values,Angle_alphaNeg095, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=0.95$") + l11 = ax.plot(X_Values,Angle_alphaNeg1, color='red', linewidth=1.5 ,zorder=1, label=r"$\theta_\rho=1.0$") + + # l6 = ax.plot(X_Values,Angle_alphaNeg025,color='lightskyblue', linewidth=1.5,linestyle = '--', zorder=3) + # l7 = ax.plot(X_Values,Angle_alphaNeg0125,color='dodgerblue', linewidth=1.5,linestyle = ':', zorder=5) + # l8 = ax.plot(X_Values,Angle_alpha0, color='blue', linewidth=1.5 ,zorder=1) + + + # l1 = ax.plot(X_Values,Angle_alphaNeg1, color='red', linewidth=1.5, zorder=3, label = 'test') + # l2 = ax.plot(X_Values,Angle_alphaNeg0875,color='orangered', linewidth=1.5 ,linestyle = '--' ,zorder=3) + # l3 = ax.plot(X_Values,Angle_alphaNeg075,color='orange', linewidth=1.5,linestyle = '--' ,zorder=3) + # l4 = ax.plot(X_Values,Angle_alphaNeg0625, linewidth=1.5,linestyle = '--' , zorder=3) + # l5 = ax.plot(X_Values,Angle_alphaNeg05, color='teal',linestyle = '--', linewidth=1.5 , zorder=3) + # l6 = ax.plot(X_Values,Angle_alphaNeg025,color='lightskyblue', linewidth=1.5,linestyle = '--', zorder=3) + # l7 = ax.plot(X_Values,Angle_alphaNeg0125,color='dodgerblue', linewidth=1.5,linestyle = ':', zorder=5) + # l8 = ax.plot(X_Values,Angle_alpha0, color='blue', linewidth=1.5 ,zorder=1) + + ax.legend(handles=[l1[0],l2[0],l3[0],l4[0], l5[0], l6[0], l7[0], l8[0], l9[0], l10[0], l11[0]], + # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + loc='upper left', + bbox_to_anchor=(1,1)) + # + # ax.legend(handles=[l1[0],l2[0],l3[0],l4[0], l5[0], l6[0], l7[0], l8[0]], + # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + # + + + +# ax.plot(X_Values, Y_Values, marker='o', markerfacecolor='orange', markeredgecolor='black', markeredgewidth=1, linewidth=1, zorder=3) + # l7 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', facecolor = 'none',edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=5) + # l4 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', markerfacecolor='red',markeredgecolor='black',markeredgewidth=2, cmap=None, norm=None, vmin=None, vmax=None, alpha=0.5, linewidths=None, zorder=3) + # l5 = ax.scatter(X_Values,Angle_alphaNeg075,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + + + # line_labels = [r"$\theta_\rho = -1.0$",r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = - \frac{3}{4}$", r"$\theta_\rho = - \frac{5}{8}$",r"$\theta_\rho = - 0.5 $" ,r"$\theta_\rho = - 0.25", r"$\theta_\rho = - \frac{1}{8}" , r"$\theta_\rho = 0$"] + ax.set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2, 5*np.pi/8 ]) + labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$',r'$5\pi/8$'] + ax.set_yticklabels(labels) + + # ax.legend(handles=[l1,l2,l3,l4, l5, l6, l7, l8], + # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + + + + + + + + # fig.legend([l1, l2, l3, l4], # The line objects + # labels=line_labels, # The labels for each line + # # loc="upper center", # Position of legend + # loc='upperleft', bbox_to_anchor=(1,1), + # borderaxespad=0.15 # Small spacing around legend box + # # title="Legend Title" # Title for the legend + # ) + + + +fig.set_size_inches(width, height) +fig.savefig('Plot-Angle-Theta.pdf') + + + + +# tikz_save('someplot.tex', figureheight='5cm', figurewidth='9cm') + +# tikz_save('fig.tikz', +# figureheight = '\\figureheight', +# figurewidth = '\\figurewidth') + +# ---------------------------------------- + + +plt.show() +# #--------------------------------------------------------------- diff --git a/src/Plot_Angle_Theta_intermediateGamma.py b/src/Plot_Angle_Theta_intermediateGamma.py new file mode 100644 index 0000000000000000000000000000000000000000..465bb9eb26103eab7e4239d5f100a4f917aaddee --- /dev/null +++ b/src/Plot_Angle_Theta_intermediateGamma.py @@ -0,0 +1,924 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +from HelperFunctions import * +from ClassifyMin import * + +import matplotlib.ticker as tickers +import matplotlib as mpl +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator +import pandas as pd + +# import tikzplotlib +# # from pylab import * +# from tikzplotlib import save as tikz_save + + +# Needed ? +mpl.use('pdf') + +# from subprocess import Popen, PIPE +#import sys + +###################### makePlot.py ######################### +# Generalized Plot-Script giving the option to define +# quantity of interest and the parameter it depends on +# to create a plot +# +# Input: Define y & x for "x-y plot" as Strings +# - Run the 'Cell-Problem' for the different Parameter-Points +# (alternatively run 'Compute_MuGamma' if quantity of interest +# is q3=muGamma for a significant Speedup) + +########################################################### + + + +# figsize argument takes inputs in inches +# and we have the width of our document in pts. +# To set the figure size we construct a function +# to convert from pts to inches and to determine +# an aesthetic figure height using the golden ratio: +# def set_size(width, fraction=1): +# """Set figure dimensions to avoid scaling in LaTeX. +# +# Parameters +# ---------- +# width: float +# Document textwidth or columnwidth in pts +# fraction: float, optional +# Fraction of the width which you wish the figure to occupy +# +# Returns +# ------- +# fig_dim: tuple +# Dimensions of figure in inches +# """ +# # Width of figure (in pts) +# fig_width_pt = width * fraction +# +# # Convert from pt to inches +# inches_per_pt = 1 / 72.27 +# +# # Golden ratio to set aesthetic figure height +# # https://disq.us/p/2940ij3 +# golden_ratio = (5**.5 - 1) / 2 +# +# # Figure width in inches +# fig_width_in = fig_width_pt * inches_per_pt +# # Figure height in inches +# fig_height_in = fig_width_in * golden_ratio +# +# fig_dim = (fig_width_in, fig_height_in) +# +# return fig_dim +# + + + +def format_func(value, tick_number): + # # find number of multiples of pi/2 + # N = int(np.round(2 * value / np.pi)) + # if N == 0: + # return "0" + # elif N == 1: + # return r"$\pi/2$" + # elif N == 2: + # return r"$\pi$" + # elif N % 2 > 0: + # return r"${0}\pi/2$".format(N) + # else: + # return r"${0}\pi$".format(N // 2) + # find number of multiples of pi/2 + N = int(np.round(4 * value / np.pi)) + if N == 0: + return "0" + elif N == 1: + return r"$\pi/4$" + elif N == 2: + return r"$\pi/2$" + elif N % 2 > 0: + return r"${0}\pi/2$".format(N) + else: + return r"${0}\pi$".format(N // 2) + + + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + + +# TODO +# - Fallunterscheidung (Speedup) falls gesuchter value mu_gamma = q3 +# - Also Add option to plot Minimization Output + + +# ----- Setup Paths ----- +# InputFile = "/inputs/cellsolver.parset" +# OutputFile = "/outputs/output.txt" + +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" + +# path = os.getcwd() +# InputFilePath = os.getcwd()+InputFile +# OutputFilePath = os.getcwd()+OutputFile +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +#--------------------------------------------------------------- + +print('---- Input parameters: -----') +mu1 = 1.0 #10.0 +# lambda1 = 10.0 +rho1 = 1.0 +# alpha = 5.0 +# beta = 10.0 +# alpha = 2.0 +# beta = 2.0 +# theta = 1.0/8.0 #1.0/4.0 + +lambda1 = 0.0 +# gamma = 1.0/4.0 + +# TEST: +# alpha=3.0; + + + + +# # INTERESTING!: +# alpha = 3 +beta = 2.0 +# theta= 1/8 + + + + +#TEST +# beta=2 + + + +gamma = 'infinity' #Elliptic Setting +gamma = '0' #Hyperbolic Setting +gamma = 0.00001 +gamma = 100 +gamma = 10000 + +print('mu1: ', mu1) +print('rho1: ', rho1) +# print('alpha: ', alpha) +print('beta: ', beta) +# print('theta: ', theta) +print('gamma:', gamma) +print('----------------------------') + + + +# --- define Interval of x-va1ues: +xmin = 0.01 +# xmax = 0.41 +# xmax = 0.99 +xmin = 0.06 +xmax = 0.94 + + +Jumps = False + + +numPoints = 2000 +numPoints = 11 +X_Values = np.linspace(xmin, xmax, num=numPoints) +print(X_Values) + + + +###Test with theta values that satisfy condition: theta = k*(1/(2^level)) for k=1,2... +# integers = np.linspace(1,30, num=30) +integers = np.linspace(10,60, num=13) +print('integers:',integers) + +Theta_Values = [] + +for i in integers: + # Theta_Values.append(i*(1/32)) + Theta_Values.append(i*(1/64)) + +print('Theta_Values',Theta_Values) + + + + + + + + + + +Y_Values = [] + + + + +Angle_alpha0 = [] + +Angle_alphaNeg05 = [] +Angle_alphaNeg055 = [] +Angle_alphaNeg06 = [] +Angle_alphaNeg065 = [] +Angle_alphaNeg07 = [] +Angle_alphaNeg075 = [] +Angle_alphaNeg08 = [] +Angle_alphaNeg085 = [] +Angle_alphaNeg09 = [] +Angle_alphaNeg095 = [] +Angle_alphaNeg1 = [] + +Angle_alphaNeg3 = [] + + +Angle_alphaNeg0125 = [] +Angle_alphaNeg025 = [] + +Angle_alphaNeg05 = [] +Angle_alphaNeg075 = [] + +Angle_alpha3 = [] + +Angle_alphaNeg0625 = [] +Angle_alphaNeg0875 = [] + + + +# for theta in X_Values: +for theta in Theta_Values: + print('Situation of Lemma1.4') + q12 = 0.0 + q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) + q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) + # b1 = prestrain_b1(rho1, beta, alpha,theta) + # b2 = prestrain_b2(rho1, beta, alpha,theta) + # b3 = 0.0 + q3 = GetMuGamma(beta,theta,gamma,mu1,rho1,InputFilePath ,OutputFilePath) + print('-----------------') + print('theta:', theta) + print('q1=',q1) + print('q2=',q2) + print('q3=',q3) + print('-----------------') + # G, angle, Type, curvature = classifyMin_ana(alpha,beta,theta, q3, mu1, rho1) + # Y_Values.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.5,beta,theta, q3, mu1, rho1) + Angle_alphaNeg05.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.55,beta,theta, q3, mu1, rho1) + Angle_alphaNeg055.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.6,beta,theta, q3, mu1, rho1) + Angle_alphaNeg06.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.65,beta,theta, q3, mu1, rho1) + Angle_alphaNeg065.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.7,beta,theta, q3, mu1, rho1) + Angle_alphaNeg07.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.75,beta,theta, q3, mu1, rho1) + Angle_alphaNeg075.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.8,beta,theta, q3, mu1, rho1) + Angle_alphaNeg08.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.85,beta,theta, q3, mu1, rho1) + Angle_alphaNeg085.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.9,beta,theta, q3, mu1, rho1) + Angle_alphaNeg09.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-0.95,beta,theta, q3, mu1, rho1) + Angle_alphaNeg095.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-1.0,beta,theta, q3, mu1, rho1) + Angle_alphaNeg1.append(angle) + + G, angle, Type, curvature = classifyMin_ana(-3.0,beta,theta, q3, mu1, rho1) + Angle_alphaNeg3.append(angle) + + # + # G, angle, Type, curvature = classifyMin_ana(-0.5,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg05 .append(angle) + # G, angle, Type, curvature = classifyMin_ana(-0.25,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg025.append(angle) + # G, angle, Type, curvature = classifyMin_ana(3.0,beta,theta, q3, mu1, rho1) + # Angle_alpha3.append(angle) + # G, angle, Type, curvature = classifyMin_ana(-1.0,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg075.append(angle) + # G, angle, Type, curvature = classifyMin_ana(0,beta,theta, q3, mu1, rho1) + # Angle_alpha0.append(angle) + # # G, angle, Type, curvature = classifyMin_ana(-0.125,beta,theta, q3, mu1, rho1) + # # Angle_alphaNeg0125.append(angle) + # G, angle, Type, curvature = classifyMin_ana(-0.7,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg0125.append(angle) + # + # G, angle, Type, curvature = classifyMin_ana(-0.625,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg0625.append(angle) + # G, angle, Type, curvature = classifyMin_ana(-0.875,beta,theta, q3, mu1, rho1) + # Angle_alphaNeg0875.append(angle) + +# +# +# print("(Output) Values of angle: ", Y_Values) +# +# +# idx = find_nearestIdx(Y_Values, 0) +# print(' Idx of value closest to 0', idx) +# ValueClose = Y_Values[idx] +# print('GammaValue(Idx) with mu_gamma closest to q_3^*', ValueClose) +# +# +# +# # Find Indices where the difference between the next one is larger than epsilon... +# jump_idx = [] +# jump_xValues = [] +# jump_yValues = [] +# tmp = X_Values[0] +# for idx, x in enumerate(X_Values): +# print(idx, x) +# if idx > 0: +# if abs(Y_Values[idx]-Y_Values[idx-1]) > 1: +# print('jump candidate') +# jump_idx.append(idx) +# jump_xValues.append(x) +# jump_yValues.append(Y_Values[idx]) +# +# +# +# +# +# +# +# print("Jump Indices", jump_idx) +# print("Jump X-values:", jump_xValues) +# print("Jump Y-values:", jump_yValues) +# +# y_plotValues = [Y_Values[0]] +# x_plotValues = [X_Values[0]] +# # y_plotValues.extend(jump_yValues) +# for i in jump_idx: +# y_plotValues.extend([Y_Values[i-1], Y_Values[i]]) +# x_plotValues.extend([X_Values[i-1], X_Values[i]]) +# +# +# y_plotValues.append(Y_Values[-1]) +# # x_plotValues = [X_Values[0]] +# # x_plotValues.extend(jump_xValues) +# x_plotValues.append(X_Values[-1]) +# +# +# print("y_plotValues:", y_plotValues) +# print("x_plotValues:", x_plotValues) + + +# Y_Values[np.diff(y) >= 0.5] = np.nan + + +#get values bigger than jump position +# gamma = infty +# x_rest = X_Values[X_Values>x_plotValues[1]] +# Y_Values = np.array(Y_Values) #convert the np array +# y_rest = Y_Values[X_Values>x_plotValues[1]] +# +# +# # gamma = 0 +# x_rest = X_Values[X_Values>x_plotValues[3]] +# Y_Values = np.array(Y_Values) #convert the np array +# y_rest = Y_Values[X_Values>x_plotValues[3]] + +# gamma between +# Y_Values = np.array(Y_Values) #convert the np array +# X_Values = np.array(X_Values) #convert the np array +# +# x_one = X_Values[X_Values>x_plotValues[3]] +# # ax.scatter(X_Values, Y_Values) +# y_rest = Y_Values[X_Values>x_plotValues[3]] +# ax.plot(X_Values[X_Values>0.135], Y_Values[X_Values<0.135]) +# +# +# + + +# y_rest = Y_Values[np.nonzero(X_Values>x_plotValues[1]] +# print('X_Values:', X_Values) +# print('Y_Values:', Y_Values) +# print('x_rest:', x_rest) +# print('y_rest:', y_rest) +# print('np.nonzero(X_Values>x_plotValues[1]', np.nonzero(X_Values>x_plotValues[1]) ) + + + + +# --- Convert to numpy array +Y_Values = np.array(Y_Values) +X_Values = np.array(X_Values) +Theta_Values = np.array(Theta_Values) + +Angle_alphaNeg05 = np.array(Angle_alphaNeg05) +Angle_alphaNeg055 = np.array(Angle_alphaNeg055) +Angle_alphaNeg06 = np.array(Angle_alphaNeg06) +Angle_alphaNeg065 = np.array(Angle_alphaNeg065) +Angle_alphaNeg07 = np.array(Angle_alphaNeg07) +Angle_alphaNeg075 = np.array(Angle_alphaNeg075) +Angle_alphaNeg08 = np.array(Angle_alphaNeg08) +Angle_alphaNeg085 = np.array(Angle_alphaNeg085) +Angle_alphaNeg09 = np.array(Angle_alphaNeg09) +Angle_alphaNeg095 = np.array(Angle_alphaNeg095) + + +Angle_alphaNeg1 = np.array(Angle_alphaNeg1) +Angle_alphaNeg3 = np.array(Angle_alphaNeg3) + +Angle_alphaNeg025 = np.array(Angle_alphaNeg025) +Angle_alphaNeg075 = np.array(Angle_alphaNeg075) +Angle_alpha3 = np.array(Angle_alpha3) +Angle_alphaNeg0 = np.array(Angle_alpha0) +Angle_alphaNeg0125 = np.array(Angle_alphaNeg0125) + +Angle_alphaNeg0625 = np.array(Angle_alphaNeg0625) +Angle_alphaNeg0875 = np.array(Angle_alphaNeg0875) +# ---------------- Create Plot ------------------- + +#--- change plot style: SEABORN +# plt.style.use("seaborn-paper") + + +#--- Adjust gobal matplotlib variables +# mpl.rcParams['pdf.fonttype'] = 42 +# mpl.rcParams['ps.fonttype'] = 42 +mpl.rcParams['text.usetex'] = True +mpl.rcParams["font.family"] = "serif" +mpl.rcParams["font.size"] = "9" + + +# plt.rc('font', family='serif', serif='Times') +# plt.rc('font', family='serif') +# # plt.rc('text', usetex=True) #also works... +# plt.rc('xtick', labelsize=8) +# plt.rc('ytick', labelsize=8) +# plt.rc('axes', labelsize=8) + + + + + +#---- Scale Figure apropriately to fit tex-File Width +# width = 452.9679 + +# width as measured in inkscape +width = 6.28 *0.5 +width = 6.28 +height = width / 1.618 + +#setup canvas first +fig = plt.figure() #main +# fig, ax = plt.subplots() +# fig, (ax, ax2) = plt.subplots(ncols=2) +# fig,axes = plt.subplots(nrows=1,ncols=2,figsize=(width,height)) # more than one plot + + +# fig.subplots_adjust(left=.15, bottom=.16, right=.99, top=.97) #TEST + + +# TEST +# mpl.rcParams['figure.figsize'] = (width+0.1,height+0.1) +# fig = plt.figure(figsize=(width+0.1,height+0.1)) + + +# mpl.rcParams['figure.figsize'] = (width,height) +# fig = plt.figure(figsize=(10,6)) # default is [6.4,4.8] 6.4 is the width, 4.8 is the height +# fig = plt.figure(figsize=(width,height)) # default is [6.4,4.8] 6.4 is the width, 4.8 is the height +# fig = plt.figure(figsize=set_size(width)) +# fig = plt.subplots(1, 1, figsize=set_size(width)) + +# --- To create a figure half the width of your document:# +# fig = plt.figure(figsize=set_size(width, fraction=0.5)) + + + +#--- You must select the correct size of the plot in advance +# fig.set_size_inches(3.54,3.54) + +# ax = plt.axes((0.15,0.18,0.8,0.8)) +ax = plt.axes((0.15,0.18,0.6,0.6)) +# ax = plt.axes((0.1,0.1,0.5,0.8)) +# ax = plt.axes((0.1,0.1,1,1)) +# ax = plt.axes() + +# ax.spines['right'].set_visible(False) +# ax.spines['left'].set_visible(False) +# ax.spines['bottom'].set_visible(False) +# ax.spines['top'].set_visible(False) +# ax.tick_params(axis='x',which='major',direction='out',length=10,width=5,color='red',pad=15,labelsize=15,labelcolor='green', +# labelrotation=15) +# ax.tick_params(axis='x',which='major', direction='out',pad=5,labelsize=10) +# ax.tick_params(axis='y',which='major', length=5, width=1, direction='out',pad=5,labelsize=10) +ax.tick_params(axis='x',which='major', direction='out',pad=3) +ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# ax.xaxis.set_major_locator(MultipleLocator(0.05)) +# ax.xaxis.set_minor_locator(MultipleLocator(0.025)) +ax.xaxis.set_major_locator(MultipleLocator(0.1)) +ax.xaxis.set_minor_locator(MultipleLocator(0.05)) + +#---- print data-types +print(ax.xaxis.get_major_locator()) +print(ax.xaxis.get_minor_locator()) +print(ax.xaxis.get_major_formatter()) +print(ax.xaxis.get_minor_formatter()) + +#---- Hide Ticks or Labels +# ax.yaxis.set_major_locator(plt.NullLocator()) +# ax.xaxis.set_major_formatter(plt.NullFormatter()) + +#---- Reducing or Increasing the Number of Ticks +# ax.xaxis.set_major_locator(plt.MaxNLocator(3)) +# ax.yaxis.set_major_locator(plt.MaxNLocator(3)) + + +#----- Fancy Tick Formats +ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 4)) +ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) +ax.yaxis.set_major_formatter(plt.FuncFormatter(format_func)) + + + + + + + +# --- manually change ticks&labels: +# ax.set_xticks([0.2,1]) +# ax.set_xticklabels(['pos1','pos2']) + +# ax.set_yticks([0, np.pi/8, np.pi/4 ]) +# labels = ['$0$',r'$\pi/8$', r'$\pi/4$'] +# ax.set_yticklabels(labels) + +a=ax.yaxis.get_major_locator() +b=ax.yaxis.get_major_formatter() +c = ax.get_xticks() +d = ax.get_xticklabels() +print('xticks:',c) +print('xticklabels:',d) + +ax.grid(True,which='major',axis='both',alpha=0.3) + + + + + + +# plt.figure() + +# f,ax=plt.subplots(1) + +# plt.title(r''+ yName + '-Plot') +# plt.plot(X_Values, Y_Values,linewidth=2, '.k') +# plt.plot(X_Values, Y_Values,'.k',markersize=1) +# plt.plot(X_Values, Y_Values,'.',markersize=0.8) + +# plt.plot(X_Values, Y_Values) + +# ax.plot([[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]]) + + + +# Gamma = '0' +# ax.plot([x_plotValues[0],x_plotValues[1]], [y_plotValues[0],y_plotValues[1]] , 'b') +# +# ax.plot([x_plotValues[1],x_plotValues[3]], [y_plotValues[2],y_plotValues[3]] , 'b') +# +# ax.plot(x_rest, y_rest, 'b') + + +# Gamma between + +# x jump values (gamma 0): [0.13606060606060608, 0.21090909090909093] + +# ax.plot([[0,jump_xValues[0]], [0, 0]] , 'b') +# ax.plot([jump_xValues[0],xmin], [y_plotValues[2],y_plotValues[2]] , 'b') + +# ax.plot([[0,0.13606060606060608], [0, 0]] , 'b') +# ax.plot([[0.13606060606060608,xmin], [(math.pi/2),(math.pi/2)]], 'b') + +# jump_xValues[0] + + + +# --- leave out jumps: +# ax.scatter(X_Values, Y_Values) + +ax.set_xlabel(r"volume fraction $\theta$") +ax.set_ylabel(r"angle $\alpha$") + + +if Jumps: + + # --- leave out jumps: + if gamma == 'infinity': + ax.plot(X_Values[X_Values>=jump_xValues[0]], Y_Values[X_Values>=jump_xValues[0]] , 'royalblue') + ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]], 'royalblue') + + + + # ax.plot(X_Values[X_Values>=jump_xValues[0]], Y_Values[X_Values>=jump_xValues[0]]) + # ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]]) + + + + + # ax.plot(X_Values[X_Values>0.136], Y_Values[X_Values>0.136]) + # ax.plot(X_Values[X_Values<0.135], Y_Values[X_Values<0.135]) + # ax.scatter(X_Values, Y_Values) + # ax.plot(X_Values, Y_Values) + + # plt.plot(x_plotValues, y_plotValues,'.') + # plt.scatter(X_Values, Y_Values, alpha=0.3) + # plt.scatter(X_Values, Y_Values) + # plt.plot(X_Values, Y_Values,'.') + # plt.plot([X_Values[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]]) + # plt.axis([0, 6, 0, 20]) + + # ax.set_xlabel(r"volume fraction $\theta$", size=11) + # ax.set_ylabel(r"angle $\angle$", size=11) + # ax.set_xlabel(r"volume fraction $\theta$") + # # ax.set_ylabel(r"angle $\angle$") + # ax.set_ylabel(r"angle $\alpha$") + # plt.ylabel('$\kappa$') + + # ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$')) + # ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.1)) + + + + + # Plot every other line.. not the jumps... + + if gamma == '0': + tmp = 1 + for idx, x in enumerate(x_plotValues): + if idx > 0 and tmp == 1: + # plt.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]] ) + ax.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]], 'royalblue', zorder=2) + tmp = 0 + else: + tmp = 1 + + # plt.plot([x_plotValues[0],x_plotValues[1]] ,[y_plotValues[0],y_plotValues[1]] ) + # plt.plot([x_plotValues[2],x_plotValues[3]] ,[y_plotValues[2],y_plotValues[3]] ) + # plt.plot([x_plotValues[4],x_plotValues[5]] ,[y_plotValues[4],y_plotValues[5]] ) + # plt.plot([x_plotValues[6],x_plotValues[7]] ,[y_plotValues[6],y_plotValues[7]] ) + + + for x in jump_xValues: + plt.axvline(x,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', linewidth=1, zorder=1) + # plt.axvline(x,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', label=r'$\theta_*$') + + # plt.axvline(x_plotValues[1],ymin=0, ymax= 1, color = 'g',alpha=0.5, linestyle = 'dashed') + + # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') + # plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') + # plt.legend() + + + # -- SETUP LEGEND + # ax.legend(prop={'size': 11}) + # ax.legend() + + # ------------------ SAVE FIGURE + # tikzplotlib.save("TesTout.tex") + # plt.close() + # mpl.rcParams.update(mpl.rcParamsDefault) + + # plt.savefig("graph.pdf", + # #This is simple recomendation for publication plots + # dpi=1000, + # # Plot will be occupy a maximum of available space + # bbox_inches='tight', + # ) + # plt.savefig("graph.pdf") + + + + # ---- ADD additional scatter: + # ax.scatter(X_Values,Y_Values,s=1,c='black',zorder=4) + + # Find transition point + lastIdx = len(Y_Values)-1 + + for idx, y in enumerate(Y_Values): + if idx != lastIdx: + if abs(y-0) < 0.01 and abs(Y_Values[idx+1] - 0) > 0.05: + transition_point1 = X_Values[idx+1] + print('transition point1:', transition_point1 ) + if abs(y-0.5*np.pi) < 0.01 and abs(Y_Values[idx+1] -0.5*np.pi)>0.01: + transition_point2 = X_Values[idx] + print('transition point2:', transition_point2 ) + if abs(y-0) > 0.01 and abs(Y_Values[idx+1] - 0) < 0.01: + transition_point3 = X_Values[idx+1] + print('transition point3:', transition_point3 ) + + # Add transition Points: + if gamma == '0': + ax.scatter([transition_point1, transition_point2],[np.pi/2,np.pi/2],s=6, marker='o', cmap=None, norm=None, facecolor = 'black', + edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + + ax.text(transition_point1-0.02 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + ax.text(transition_point2+0.012 , np.pi/2-0.02, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + else: + ax.scatter([transition_point1, transition_point2, transition_point3 ],[np.pi/2,np.pi/2,0 ],s=6, marker='o', cmap=None, norm=None, facecolor = 'black', + edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + + ax.text(transition_point1-0.02 , np.pi/2-0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + ax.text(transition_point2 +0.011 , np.pi/2-0.02, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + ax.text(transition_point3 +0.009 , 0+0.08, r"$3$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + +else: + # ax.scatter(X_Values,Y_Values,s=1, marker='o', cmap=None, norm=None, facecolor = 'blue', + # edgecolor = 'none', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # --------------------------------------------------------------- + # l1 = ax.scatter(X_Values,Angle_alpha0,s=1, marker='o', edgecolor = 'black',cmap=None, norm=None, vmin=None, vmax=None, alpha=0.75, linewidths=None, zorder=4) + # l6 = ax.scatter(X_Values,Angle_alphaNeg1,s=2, marker='s', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=1, label=r"$\theta_\rho = -1.0$") + # l4 = ax.scatter(X_Values,Angle_alphaNeg05,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l3 = ax.scatter(X_Values,Angle_alphaNeg025,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l7 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', facecolor = 'none',edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=5) + # # l4 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', markerfacecolor='red',markeredgecolor='black',markeredgewidth=2, cmap=None, norm=None, vmin=None, vmax=None, alpha=0.5, linewidths=None, zorder=3) + # l5 = ax.scatter(X_Values,Angle_alphaNeg075,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l2 = ax.scatter(X_Values,Angle_alphaNeg0125,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # + # line_labels = [r"$\theta_\rho = -1.0$", r"$\theta_\rho = -0.5$", r"$\theta_\rho = -0.25$", r"$\theta_\rho = 3.0$"] + # ax.set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2, 5*np.pi/8 ]) + # labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$',r'$5\pi/8$'] + # ax.set_yticklabels(labels) + # + # ax.legend(handles=[l1,l2,l3,l4, l5, l6, l7], + # labels= [ r"$\theta_\rho = 0$", r"$\theta_\rho = -0.125$", r"$\theta_\rho = -0.25$", r"$\theta_\rho = -0.5$", r"$\theta_\rho = -0.75$", r"$\theta_\rho = -1.0$", r"$\theta_\rho = 3.0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + # --------------------------------------------------------------- + # l1 = ax.scatter(X_Values,Angle_alphaNeg1,s=2, marker='s', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=1) + # l2 = ax.scatter(X_Values,Angle_alphaNeg0875,s=2, marker='o',cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + # l3 = ax.scatter(X_Values,Angle_alphaNeg075,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l4 = ax.scatter(X_Values,Angle_alphaNeg0625,s=2, marker='o',cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + # l5 = ax.scatter(X_Values,Angle_alphaNeg05,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l6 = ax.scatter(X_Values,Angle_alphaNeg025,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l7 = ax.scatter(X_Values,Angle_alphaNeg0125,s=2, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l8 = ax.scatter(X_Values,Angle_alpha0,s=2, marker='s', edgecolor = 'black', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + + # l1 = ax.plot(X_Values,Angle_alphaNeg05, color='blue', linewidth=1.5, zorder=3, label=r"$\theta_\rho=-0.5$") + # l2 = ax.plot(X_Values,Angle_alphaNeg055, linewidth=1.5, linestyle = '--', zorder=3,label=r"$\theta_\rho=-0.55$") + # l3 = ax.plot(X_Values,Angle_alphaNeg06,color='orangered', linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.6$") + # l4 = ax.plot(X_Values,Angle_alphaNeg065, linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.65$") + # l5 = ax.plot(X_Values,Angle_alphaNeg07,color='orange', linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.7$") + # l6 = ax.plot(X_Values,Angle_alphaNeg075, linewidth=1.5,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.75$") + # l7 = ax.plot(X_Values,Angle_alphaNeg08, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.8$") + # l8 = ax.plot(X_Values,Angle_alphaNeg085, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.85$") + # l9 = ax.plot(X_Values,Angle_alphaNeg09, color='teal',linestyle = '--', linewidth=1.5 , zorder=3, label=r"$\theta_\rho=-0.9$") + # l10 = ax.plot(X_Values,Angle_alphaNeg095, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.95$") + # l11 = ax.plot(X_Values,Angle_alphaNeg1, color='red', linewidth=1.5 ,zorder=1, label=r"$\theta_\rho=-1.0$") + + + # l1 = ax.plot(X_Values,Angle_alphaNeg05, color='blue', linewidth=1.5, zorder=3, label=r"$\theta_\rho=-0.5$") + # # l2 = ax.plot(X_Values,Angle_alphaNeg055, linewidth=1.5, linestyle = '--', zorder=3,label=r"$\theta_\rho=-0.55$") + # l3 = ax.plot(X_Values,Angle_alphaNeg06,color='orangered', linewidth=1.5 ,zorder=3, label=r"$\theta_\rho=-0.6$") + # # l4 = ax.plot(X_Values,Angle_alphaNeg065, linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.65$") + # l5 = ax.plot(X_Values,Angle_alphaNeg07,color='orange', linewidth=1.5 ,zorder=3, label=r"$\theta_\rho=-0.7$") + # # l6 = ax.plot(X_Values,Angle_alphaNeg075, linewidth=1.5,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.75$") + # l7 = ax.plot(X_Values,Angle_alphaNeg08, linewidth=1.5 , zorder=3, label=r"$\theta_\rho=-0.8$") + # # l8 = ax.plot(X_Values,Angle_alphaNeg085, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.85$") + # l9 = ax.plot(X_Values,Angle_alphaNeg09, color='teal', linewidth=1.5 , zorder=3, label=r"$\theta_\rho=-0.9$") + # # l10 = ax.plot(X_Values,Angle_alphaNeg095, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.95$") + # l11 = ax.plot(X_Values,Angle_alphaNeg1, color='red', linewidth=1.5 ,zorder=1, label=r"$\theta_\rho=-1.0$") + # + # l12 = ax.plot(X_Values,Angle_alphaNeg3, color='black', linewidth=1.5 ,zorder=1, label=r"$\theta_\rho=-3.0$") + # + + #TEST + + l1 = ax.plot(Theta_Values,Angle_alphaNeg05, color='blue', linewidth=1.5, zorder=3, label=r"$\theta_\rho=-0.5$") + # l2 = ax.plot(X_Values,Angle_alphaNeg055, linewidth=1.5, linestyle = '--', zorder=3,label=r"$\theta_\rho=-0.55$") + l3 = ax.plot(Theta_Values,Angle_alphaNeg06,color='orangered', linewidth=1.5 ,zorder=3, label=r"$\theta_\rho=-0.6$") + # l4 = ax.plot(X_Values,Angle_alphaNeg065, linewidth=1.5 ,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.65$") + l5 = ax.plot(Theta_Values,Angle_alphaNeg07,color='orange', linewidth=1.5 ,zorder=3, label=r"$\theta_\rho=-0.7$") + # l6 = ax.plot(X_Values,Angle_alphaNeg075, linewidth=1.5,linestyle = '--' ,zorder=3, label=r"$\theta_\rho=-0.75$") + l7 = ax.plot(Theta_Values,Angle_alphaNeg08, linewidth=1.5 , zorder=3, label=r"$\theta_\rho=-0.8$") + # l8 = ax.plot(X_Values,Angle_alphaNeg085, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.85$") + l9 = ax.plot(Theta_Values,Angle_alphaNeg09, color='teal', linewidth=1.5 , zorder=3, label=r"$\theta_\rho=-0.9$") + # l10 = ax.plot(X_Values,Angle_alphaNeg095, linewidth=1.5,linestyle = '--' , zorder=3, label=r"$\theta_\rho=-0.95$") + l11 = ax.plot(Theta_Values,Angle_alphaNeg1, color='red', linewidth=1.5 ,zorder=1, label=r"$\theta_\rho=-1.0$") + + l12 = ax.plot(Theta_Values,Angle_alphaNeg3, color='black', linewidth=1.5 ,zorder=1, label=r"$\theta_\rho=-3.0$") + + + + + # ax.legend(handles=[l1[0],l2[0],l3[0],l4[0], l5[0], l6[0], l7[0], l8[0], l9[0], l10[0], l11[0]], + # # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + + ax.legend(handles=[l1[0],l3[0], l5[0], l7[0], l9[0], l11[0], l12[0]], + # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + loc='upper left', + bbox_to_anchor=(1,1)) + + + +# ax.plot(X_Values, Y_Values, marker='o', markerfacecolor='orange', markeredgecolor='black', markeredgewidth=1, linewidth=1, zorder=3) + # l7 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', facecolor = 'none',edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=5) + # l4 = ax.scatter(X_Values,Angle_alpha3,s=1, marker='o', markerfacecolor='red',markeredgecolor='black',markeredgewidth=2, cmap=None, norm=None, vmin=None, vmax=None, alpha=0.5, linewidths=None, zorder=3) + # l5 = ax.scatter(X_Values,Angle_alphaNeg075,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + + + # line_labels = [r"$\theta_\rho = -1.0$",r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = - \frac{3}{4}$", r"$\theta_\rho = - \frac{5}{8}$",r"$\theta_\rho = - 0.5 $" ,r"$\theta_\rho = - 0.25", r"$\theta_\rho = - \frac{1}{8}" , r"$\theta_\rho = 0$"] + ax.set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2, 5*np.pi/8 ]) + labels = ['$0$',r'$\pi/8$', r'$\pi/4$' ,r'$3\pi/8$' , r'$\pi/2$',r'$5\pi/8$'] + ax.set_yticklabels(labels) + + # ax.legend(handles=[l1,l2,l3,l4, l5, l6, l7, l8], + # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + + # + # ax.legend(handles=[l1,l3, l5, l7, l8], + # labels= [r"$\theta_\rho = -1.0$", r"$\theta_\rho = - \frac{7}{8}$", r"$\theta_\rho = -\frac{3}{4}$" , r"$\theta_\rho = - \frac{5}{8}$", r"$\theta_\rho = - \frac{1}{2} $" , r"$\theta_\rho = - \frac{1}{4}$", r"$\theta_\rho = - \frac{1}{8}$" , r"$\theta_\rho = 0$"], + # loc='upper left', + # bbox_to_anchor=(1,1)) + # + + + + + + # fig.legend([l1, l2, l3, l4], # The line objects + # labels=line_labels, # The labels for each line + # # loc="upper center", # Position of legend + # loc='upperleft', bbox_to_anchor=(1,1), + # borderaxespad=0.15 # Small spacing around legend box + # # title="Legend Title" # Title for the legend + # ) + +pdf_outputName = 'Plot-Angle-Theta_Gamma'+ str(gamma)+ '.pdf' + +fig.set_size_inches(width, height) +# fig.savefig('Plot-Angle-Theta.pdf') +fig.savefig(pdf_outputName) + + + + +# tikz_save('someplot.tex', figureheight='5cm', figurewidth='9cm') + +# tikz_save('fig.tikz', +# figureheight = '\\figureheight', +# figurewidth = '\\figurewidth') + +# ---------------------------------------- + + +plt.show() +# #--------------------------------------------------------------- diff --git a/src/Plot_Curvature_Alpha.py b/src/Plot_Curvature_Alpha.py index e62edb94139c76ccf01c60e5f113b80e8af0f284..862bd66457db80a01885fc446ff29466b036cf6c 100644 --- a/src/Plot_Curvature_Alpha.py +++ b/src/Plot_Curvature_Alpha.py @@ -180,9 +180,15 @@ theta= 1/8 theta = 0.5 +theta = 0.1 -theta = 0.1 +#TEST +beta = 2.0 +theta = 0.5 + +beta=10.0 + gamma = 'infinity' #Elliptic Setting gamma = '0' #Hyperbolic Setting @@ -206,16 +212,23 @@ print('----------------------------') xmin = -2.0 +# xmin = -1.5 xmax = 1.0 -xmin = -5.0 -xmax = 5.0 -Jumps = False +# compare with interpolant between endpoints +# xmin = -0.7014028056112225 +# xmax = 0.70 +compare_interpolant = False +# xmin = -5.0 +# xmax = 5.0 + +Jumps = False +Jumps = True -numPoints = 2000 -# numPoints = 100 +numPoints = 15 +numPoints = 500 X_Values = np.linspace(xmin, xmax, num=numPoints) print(X_Values) @@ -239,7 +252,7 @@ Curvature_alphaNeg5 = [] for alpha in X_Values: - print('Situation of Lemma1.4') + # print('Situation of Lemma1.4') q12 = 0.0 q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) @@ -275,7 +288,9 @@ print(' Idx of value closest to 0', idx) ValueClose = Y_Values[idx] print('GammaValue(Idx) with mu_gamma closest to q_3^*', ValueClose) - +# jumpThreshold = 0.5 +jumpThreshold = 0.05 +# jumpThreshold = 0.01 # Find Indices where the difference between the next one is larger than epsilon... jump_idx = [] @@ -285,7 +300,7 @@ tmp = X_Values[0] for idx, x in enumerate(X_Values): print(idx, x) if idx > 0: - if abs(Y_Values[idx]-Y_Values[idx-1]) > 0.5: + if abs(Y_Values[idx]-Y_Values[idx-1]) > jumpThreshold : print('jump candidate') jump_idx.append(idx) jump_xValues.append(x) @@ -398,7 +413,7 @@ mpl.rcParams["font.size"] = "9" # width as measured in inkscape width = 6.28 *0.5 -width = 6.28 +# width = 6.28 height = width / 1.618 #setup canvas first @@ -431,7 +446,8 @@ fig = plt.figure() #main # fig.set_size_inches(3.54,3.54) # ax = plt.axes((0.15,0.18,0.8,0.8)) -ax = plt.axes((0.15,0.18,0.6,0.6)) +# ax = plt.axes((0.15,0.18,0.6,0.6)) +ax = plt.axes((0.15,0.2,0.75,0.75)) # ax = plt.axes((0.1,0.1,0.5,0.8)) # ax = plt.axes((0.1,0.1,1,1)) # ax = plt.axes() @@ -454,8 +470,8 @@ ax.xaxis.set_minor_locator(MultipleLocator(0.05)) ax.xaxis.set_major_locator(MultipleLocator(0.5)) ax.xaxis.set_minor_locator(MultipleLocator(0.25)) -ax.xaxis.set_major_locator(MultipleLocator(1.0)) -ax.xaxis.set_minor_locator(MultipleLocator(0.5)) + + #---- print data-types print(ax.xaxis.get_major_locator()) @@ -555,28 +571,57 @@ if Jumps: # ax.plot(X_Values[X_Values>=jump_xValues[0]], Y_Values[X_Values>=jump_xValues[0]] , 'royalblue') # ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]], 'royalblue') - # Plot every other line.. not the jumps... + ## Plot every other line.. not the jumps.. + # if gamma == '0': + # tmp = 1 + # for idx, x in enumerate(x_plotValues): + # if idx > 0 and tmp == 1: + # # plt.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]] ) + # ax.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]], 'royalblue', zorder=2) + # tmp = 0 + # else: + # tmp = 1 - if gamma == '0': - tmp = 1 - for idx, x in enumerate(x_plotValues): - if idx > 0 and tmp == 1: - # plt.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]] ) - ax.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]], 'royalblue', zorder=2) - tmp = 0 - else: - tmp = 1 - # plt.plot([x_plotValues[0],x_plotValues[1]] ,[y_plotValues[0],y_plotValues[1]] ) - # plt.plot([x_plotValues[2],x_plotValues[3]] ,[y_plotValues[2],y_plotValues[3]] ) - # plt.plot([x_plotValues[4],x_plotValues[5]] ,[y_plotValues[4],y_plotValues[5]] ) - # plt.plot([x_plotValues[6],x_plotValues[7]] ,[y_plotValues[6],y_plotValues[7]] ) for x in jump_xValues: plt.axvline(x,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', linewidth=1, zorder=1) # plt.axvline(x,ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', label=r'$\theta_*$') + + # print('jump_idx[0]:',jump_idx[0]) + # print('X_Values[jump_idx[0]]',X_Values[jump_idx[0]]) + # print('X_Values[jump_idx[1]]',X_Values[jump_idx[1]]) + # print('Y_Values[jump_idx[0]]',Y_Values[jump_idx[0]]) + # print('Y_Values[jump_idx[1]]',Y_Values[jump_idx[1]]) + + # Better use for-loop!! + + if gamma == '0': + ax.scatter([X_Values[jump_idx[0]], X_Values[jump_idx[1]]],[Y_Values[jump_idx[0]],Y_Values[jump_idx[1]]],s=6, marker='o', cmap=None, norm=None, facecolor = 'black', + edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=5) + + # ax.text(X_Values[jump_idx[0]]+0.05, Y_Values[jump_idx[0]]+0.02, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + # ) + # + # ax.text(X_Values[jump_idx[1]]+0.05, Y_Values[jump_idx[1]]+0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5)) + ax.text(X_Values[jump_idx[0]]+0.075, Y_Values[jump_idx[0]]+0.04, r"$2$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + ax.text(X_Values[jump_idx[1]]+0.075, Y_Values[jump_idx[1]]+0.04, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5)) + + else : + ax.scatter([X_Values[jump_idx[0]]],[Y_Values[jump_idx[0]]],s=6, marker='o', cmap=None, norm=None, facecolor = 'black', + edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=5) + + # ax.text(X_Values[jump_idx[0]]+0.05, Y_Values[jump_idx[0]]+0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + # ) + + ax.text(X_Values[jump_idx[0]]+0.075, Y_Values[jump_idx[0]]+0.04, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) + ) + + # ax.text(X_Values[jump_idx[1]]+0.05, Y_Values[jump_idx[1]]+0.02, r"$1$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5)) # plt.axvline(x_plotValues[1],ymin=0, ymax= 1, color = 'g',alpha=0.5, linestyle = 'dashed') # plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') @@ -607,19 +652,19 @@ if Jumps: # ax.scatter(X_Values,Y_Values,s=1,c='black',zorder=4) # Find transition point - lastIdx = len(Y_Values)-1 - - for idx, y in enumerate(Y_Values): - if idx != lastIdx: - if abs(y-0) < 0.01 and abs(Y_Values[idx+1] - 0) > 0.05: - transition_point1 = X_Values[idx+1] - print('transition point1:', transition_point1 ) - if abs(y-0.5*np.pi) < 0.01 and abs(Y_Values[idx+1] -0.5*np.pi)>0.01: - transition_point2 = X_Values[idx] - print('transition point2:', transition_point2 ) - if abs(y-0) > 0.01 and abs(Y_Values[idx+1] - 0) < 0.01: - transition_point3 = X_Values[idx+1] - print('transition point3:', transition_point3 ) + # lastIdx = len(Y_Values)-1 + # + # for idx, y in enumerate(Y_Values): + # if idx != lastIdx: + # if abs(y-0) < 0.01 and abs(Y_Values[idx+1] - 0) > 0.05: + # transition_point1 = X_Values[idx+1] + # print('transition point1:', transition_point1 ) + # if abs(y-0.5*np.pi) < 0.01 and abs(Y_Values[idx+1] -0.5*np.pi)>0.01: + # transition_point2 = X_Values[idx] + # print('transition point2:', transition_point2 ) + # if abs(y-0) > 0.01 and abs(Y_Values[idx+1] - 0) < 0.01: + # transition_point3 = X_Values[idx+1] + # print('transition point3:', transition_point3 ) # Add transition Points if gamma == '0': @@ -630,9 +675,13 @@ if Jumps: plt.axvline(jump_xValues[0],ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', linewidth=1) - ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]], 'royalblue') - ax.plot(X_Values[X_Values>jump_xValues[0]], Y_Values[X_Values>jump_xValues[0]], 'royalblue') + # ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]], 'royalblue') + # ax.plot(X_Values[X_Values>jump_xValues[0]], Y_Values[X_Values>jump_xValues[0]], 'royalblue') + # l1 = ax.scatter(X_Values,Y_Values,s=1, marker='o', edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + l1 = ax.scatter(X_Values,Y_Values,s=0.1, marker='o', edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + # l1 = ax.plot(X_Values,Y_Values,s=1, marker='o', edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + # l1 = ax.plot(X_Values,Y_Values, color='forestgreen', linewidth=1.5, zorder=3, label = 'test') # plt.axvline(jump_xValues[0],ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', linewidth=1) # # ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]], 'royalblue') @@ -648,11 +697,14 @@ if Jumps: # ax.text(transition_point2+0.012 , jump_yValues[1]+0.02, r"$5$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) # ) + else : plt.axvline(jump_xValues[0],ymin=0, ymax= 1, color = 'orange',alpha=0.5, linestyle = 'dashed', linewidth=1) - ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]], 'royalblue') - ax.plot(X_Values[X_Values>jump_xValues[0]], Y_Values[X_Values>jump_xValues[0]], 'royalblue') + # ax.plot(X_Values[X_Values<jump_xValues[0]], Y_Values[X_Values<jump_xValues[0]], 'royalblue') + # ax.plot(X_Values[X_Values>jump_xValues[0]], Y_Values[X_Values>jump_xValues[0]], 'royalblue') + # l1 = ax.scatter(X_Values,Y_Values,s=1, marker='o', edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + l1 = ax.scatter(X_Values,Y_Values,s=0.1, marker='o', edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) # idx1 = find_nearestIdx(X_Values, transition_point1) # idx2 = find_nearestIdx(X_Values, transition_point2) # print('idx1', idx1) @@ -663,15 +715,17 @@ if Jumps: # print('Y_TP2', Y_TP2) + + # ax.scatter([transition_point1, transition_point2],[Y_TP1, Y_TP2],s=6, marker='o', cmap=None, norm=None, facecolor = 'black', # edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) # ax.text(transition_point1-0.02 , Y_TP1-0.02, r"$6$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5) # ax.text(transition_point2+0.015 , Y_TP2+0.020, r"$7$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5)) - ax.scatter(jump_xValues,jump_yValues,s=6, marker='o', cmap=None, norm=None, facecolor = 'black', - edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) - ax.text(jump_xValues[0]+0.05 , jump_yValues[0]+0.02, r"$6$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5)) + # ax.scatter(jump_xValues,jump_yValues,s=6, marker='o', cmap=None, norm=None, facecolor = 'black', + # edgecolor = 'black', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # ax.text(jump_xValues[0]+0.05 , jump_yValues[0]+0.02, r"$6$", size=6, bbox=dict(boxstyle="circle",facecolor='white', alpha=1.0, pad=0.1, linewidth=0.5)) else: @@ -716,9 +770,15 @@ else: - # l1 = ax.plot(X_Values,Y_Values, color='red', linewidth=1.5, zorder=3, label = 'test') - l1 = ax.scatter(X_Values,Y_Values,s=1, marker='o', edgecolor = 'red', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + # l1 = ax.plot(X_Values,Y_Values, color='forestgreen', linewidth=1.5, zorder=3, label = 'test') + l1 = ax.scatter(X_Values,Y_Values,s=1, marker='o', edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + + + # l1 = ax.scatter(X_Values,Y_Values,s=6, marker='o', edgecolor = 'forestgreen', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=4) + #compare with interpolant between endpoints + if compare_interpolant: + ax.plot([X_Values[0],X_Values[-1]],[Y_Values[0],Y_Values[-1]]) fig.set_size_inches(width, height) diff --git a/src/Plot_Curvature_Lemma1.4V3.py b/src/Plot_Curvature_Lemma1.4V3.py index 171664aca8a2b163898d37f75f4ec84c44315c84..d21c3eb4212c8f63941458f4165730aee9244eb0 100644 --- a/src/Plot_Curvature_Lemma1.4V3.py +++ b/src/Plot_Curvature_Lemma1.4V3.py @@ -173,12 +173,13 @@ alpha=3.0; # # INTERESTING!: -alpha = 3 +# alpha = 3 beta = 10.0 -theta= 1/8 - +# theta= 1/8 +#Test +# beta = 2.0 @@ -206,8 +207,8 @@ xmax = 0.99 Jumps = False -numPoints = 2000 -numPoints = 100 +numPoints = 400 +# numPoints = 100 X_Values = np.linspace(xmin, xmax, num=numPoints) print(X_Values) @@ -530,7 +531,7 @@ ax.grid(True,which='major',axis='both',alpha=0.3) # ax.scatter(X_Values, Y_Values) ax.set_xlabel(r"volume fraction $\theta$") -ax.set_ylabel(r"Curvature $\alpha$") +ax.set_ylabel(r"Curvature $\kappa$") if Jumps: @@ -635,18 +636,25 @@ if Jumps: else: # ax.scatter(X_Values,Y_Values,s=1, marker='o', cmap=None, norm=None, facecolor = 'blue', - # edgecolor = 'none', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) - l1 = ax.scatter(X_Values,Curvature_alphaNeg5,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=3) - l2 = ax.scatter(X_Values,Curvature_alphaNeg1,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3, label=r"$\theta_\rho = -1.0$") - l3 = ax.scatter(X_Values,Curvature_alphaNeg075,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) - l4 = ax.scatter(X_Values,Curvature_alphaNeg05,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) - l5 = ax.scatter(X_Values,Curvature_alphaNeg025,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) - l6 = ax.scatter(X_Values,Curvature_alphaNeg0125,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) - l7 = ax.scatter(X_Values,Curvature_alpha0,s=1, marker='o', edgecolor = 'black',cmap=None, norm=None, vmin=None, vmax=None, alpha=0.75, linewidths=None, zorder=4) - l8 = ax.scatter(X_Values,Curvature_alpha3,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=4) - # l4 = ax.scatter(X_Values,Curvature_alpha3,s=1, marker='o', markerfacecolor='red',markeredgecolor='black',markeredgewidth=2, cmap=None, norm=None, vmin=None, vmax=None, alpha=0.5, linewidths=None, zorder=3) - - + # # edgecolor = 'none', vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l1 = ax.scatter(X_Values,Curvature_alphaNeg5,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=3) + # l2 = ax.scatter(X_Values,Curvature_alphaNeg1,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3, label=r"$\theta_\rho = -1.0$") + # l3 = ax.scatter(X_Values,Curvature_alphaNeg075,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l4 = ax.scatter(X_Values,Curvature_alphaNeg05,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l5 = ax.scatter(X_Values,Curvature_alphaNeg025,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l6 = ax.scatter(X_Values,Curvature_alphaNeg0125,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + # l7 = ax.scatter(X_Values,Curvature_alpha0,s=1, marker='o', edgecolor = 'black',cmap=None, norm=None, vmin=None, vmax=None, alpha=0.75, linewidths=None, zorder=4) + # l8 = ax.scatter(X_Values,Curvature_alpha3,s=1, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=4) + # # # l4 = ax.scatter(X_Values,Curvature_alpha3,s=1, marker='o', markerfacecolor='red',markeredgecolor='black',markeredgewidth=2, cmap=None, norm=None, vmin=None, vmax=None, alpha=0.5, linewidths=None, zorder=3) + + l1 = ax.scatter(X_Values,Curvature_alphaNeg5,s=0.25, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=3) + l2 = ax.scatter(X_Values,Curvature_alphaNeg1,s=0.25, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3, label=r"$\theta_\rho = -1.0$") + l3 = ax.scatter(X_Values,Curvature_alphaNeg075,s=0.25, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + l4 = ax.scatter(X_Values,Curvature_alphaNeg05,s=0.25, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + l5 = ax.scatter(X_Values,Curvature_alphaNeg025,s=0.25, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + l6 = ax.scatter(X_Values,Curvature_alphaNeg0125,s=0.25, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, zorder=3) + l7 = ax.scatter(X_Values,Curvature_alpha0,s=0.25, color = 'black',cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=4) + l8 = ax.scatter(X_Values,Curvature_alpha3,s=0.25, marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, zorder=4) # line_labels = [r"$\theta_\rho = -1.0$", r"$\theta_\rho = -0.5$", r"$\theta_\rho = -0.25$", r"$\theta_\rho = 3.0$"] # ax.set_yticks([0, np.pi/8, np.pi/4, 3*np.pi/8 , np.pi/2, 5*np.pi/8 ]) @@ -655,11 +663,22 @@ else: # ax.set_yticks([1.570786327, np.pi/2 ]) # labels = [r'$\pi/2-0.0005 $' , r'$\pi/2$'] # ax.set_yticklabels(labels) - ax.legend(handles=[l1,l2,l3,l4, l5, l6, l7, l8], + lgnd = ax.legend(handles=[l1,l2,l3,l4, l5, l6, l7, l8], labels= [r"$\theta_\rho = -5.0$", r"$\theta_\rho = -1.0$",r"$\theta_\rho = -0.75$", r"$\theta_\rho = -0.5$", r"$\theta_\rho = -0.25$", r"$\theta_\rho = -0.125$", r"$\theta_\rho = 0$", r"$\theta_\rho = 3.0$" ], loc='upper left', + # fontsize=10, + # scatterpoints=1, bbox_to_anchor=(1,1)) + lgnd.legendHandles[0]._sizes = [10] + lgnd.legendHandles[1]._sizes = [10] + lgnd.legendHandles[2]._sizes = [10] + lgnd.legendHandles[3]._sizes = [10] + lgnd.legendHandles[4]._sizes = [10] + lgnd.legendHandles[5]._sizes = [10] + lgnd.legendHandles[6]._sizes = [10] + lgnd.legendHandles[7]._sizes = [10] + # fig.legend([l1, l2, l3, l4], # The line objects # labels=line_labels, # The labels for each line # # loc="upper center", # Position of legend diff --git a/src/Plot_MinVec_v2.py b/src/Plot_MinVec_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..8fc808395b76261877748d5baccaf5568a642f66 --- /dev/null +++ b/src/Plot_MinVec_v2.py @@ -0,0 +1,581 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +from HelperFunctions import * +from ClassifyMinVec import * +import matplotlib.cm as cm +from matplotlib.colors import Normalize + +import matplotlib.ticker as ticker +# from subprocess import Popen, PIPE +#import sys + +###################### makePlot.py ######################### +# Generalized Plot-Script giving the option to define +# quantity of interest and the parameter it depends on +# to create a plot +# +# Input: Define y & x for "x-y plot" as Strings +# - Run the 'Cell-Problem' for the different Parameter-Points +# (alternatively run 'Compute_MuGamma' if quantity of interest +# is q3=muGamma for a significant Speedup) + +########################################################### + +def format_func(value, tick_number): + # find number of multiples of pi/2 + N = int(np.round(2 * value / np.pi)) + if N == 0: + return "0" + elif N == 1: + return r"$\pi/2$" + elif N == 2: + return r"$\pi$" + elif N % 2 > 0: + return r"${0}\pi/2$".format(N) + else: + return r"${0}\pi$".format(N // 2) + + + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + + +# TODO +# - Fallunterscheidung (Speedup) falls gesuchter value mu_gamma = q3 +# - Also Add option to plot Minimization Output + + +# ----- Setup Paths ----- +InputFile = "/inputs/cellsolver.parset" +OutputFile = "/outputs/output.txt" +# path = os.getcwd() +# InputFilePath = os.getcwd()+InputFile +# OutputFilePath = os.getcwd()+OutputFile +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +#--------------------------------------------------------------- + +print('---- Input parameters: -----') +# mu1 = 10.0 +# # lambda1 = 10.0 +rho1 = 1.0 +# alpha = 5.0 +# beta = 10.0 +# theta = 1.0/4.0 + + +mu1 = 10.0 +# lambda1 = 10.0 +# rho1 = 10.0 +alpha = 5.0 +# beta = 2.0 +beta = 10.0 +theta = 1.0/4.0 + +theta = 1.0/2.0 +# theta = 1.0/12.0 + + +lambda1 = 0.0 +gamma = 1.0/4.0 + +gamma = 'infinity' +# gamma = '0' + + +print('mu1: ', mu1) +print('rho1: ', rho1) +print('alpha: ', alpha) +print('beta: ', beta) +print('theta: ', theta) +print('gamma:', gamma) +print('----------------------------') + + +# TODO? : Ask User for Input ... +# function = input("Enter value you want to plot (y-value):\n") +# print(f'You entered {function}') +# parameter = input("Enter Parameter this value depends on (x-value) :\n") +# print(f'You entered {parameter}') + +# Add Option to change NumberOfElements used for computation of Cell-Problem + + +# --- Define Quantity of interest: +# Options: 'q1', 'q2', 'q3', 'q12' ,'q21', 'q31', 'q13' , 'q23', 'q32' , 'b1', 'b2' ,'b3' +# TODO: EXTRA (MInimization Output) 'Minimizer (norm?)' 'angle', 'type', 'curvature' +# yName = 'q12' +# # yName = 'b1' +# yName = 'q3' +yName = 'angle' +yName = 'curvature' +yName = 'MinVec' + +# --- Define Parameter this function/quantity depends on: +# Options: mu1 ,lambda1, rho1 , alpha, beta, theta, gamma +# xName = 'theta' +# xName = 'gamma' +# xName = 'lambda1' +xName = 'theta' +# xName = 'alpha' + + +# --- define Interval of x-values: +xmin = 0 +xmax = 30 + +# xmin = 0.245 +# xmax = 0.99 +# +# +# xmin = 0.14 +# xmax = 0.19 + +# xmin = 0.01 +# xmax = 3.0 + +xmin = 0.125 +xmax = 0.250 + +xmin = 0.05 +xmax = 0.3 + +xmin = 0.15 +xmax = 0.3 + +xmin = 0.193 +xmax = 0.24 + +xmin=0.05 +xmax=0.4 + +numPoints =100 +X_Values = np.linspace(xmin, xmax, num=numPoints) +print('X_values:', X_Values) + + +Y_Values = [] +Angle_Values = [] + + +other = False + + + +for theta in X_Values: +# for alpha in X_Values: + + print('Situation of Lemma1.4') + q12 = 0.0 + q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) + q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) + b1 = prestrain_b1(rho1, beta, alpha,theta) + b2 = prestrain_b2(rho1, beta, alpha,theta) + b3 = 0.0 + if gamma == '0': + q3 = q2 + if gamma == 'infinity': + q3 = q1 + + if yName == 'q1': # TODO: Better use dictionary?... + print('q1 used') + Y_Values.append(q1) + elif yName =='q2': + print('q2 used') + Y_Values.append(q2) + elif yName =='q3': + print('q3 used') + Y_Values.append(q3) + elif yName =='q12': + print('q12 used') + Y_Values.append(q12) + elif yName =='b1': + print('b1 used') + Y_Values.append(b1) + elif yName =='b2': + print('b2 used') + Y_Values.append(b2) + elif yName =='b3': + print('b3 used') + Y_Values.append(b3) + elif yName == 'angle' or yName =='type' or yName =='curvature' or yName =='MinVec': + G, angle, Type, curvature = classifyMin_ana(alpha,beta,theta, q3, mu1, rho1) + if yName =='angle': + print('angle used') + Y_Values.append(angle) + if yName =='type': + print('angle used') + Y_Values.append(type) + if yName =='curvature': + print('angle used') + Y_Values.append(curvature) + if yName =='MinVec': + print('Minvec used') + Y_Values.append(G) + Angle_Values.append(angle) + + +print("(Output) Values of " + yName + ": ", Y_Values) + + +# idx = find_nearestIdx(Y_Values, 0) +# print(' Idx of value closest to 0', idx) +# ValueClose = Y_Values[idx] +# print('GammaValue(Idx) with mu_gamma closest to q_3^*', ValueClose) +# +# +# +# # Find Indices where the difference between the next one is larger than epsilon... +# jump_idx = [] +# jump_xValues = [] +# jump_yValues = [] +# tmp = X_Values[0] +# for idx, x in enumerate(X_Values): +# print(idx, x) +# if idx > 0: +# if abs(Y_Values[idx]-Y_Values[idx-1]) > 1: +# print('jump candidate') +# jump_idx.append(idx) +# jump_xValues.append(x) +# jump_yValues.append(Y_Values[idx]) +# + + + + +# +# +# print("Jump Indices", jump_idx) +# print("Jump X-values:", jump_xValues) +# print("Jump Y-values:", jump_yValues) +# +# y_plotValues = [Y_Values[0]] +# x_plotValues = [X_Values[0]] +# # y_plotValues.extend(jump_yValues) +# for i in jump_idx: +# y_plotValues.extend([Y_Values[i-1], Y_Values[i]]) +# x_plotValues.extend([X_Values[i-1], X_Values[i]]) +# +# +# y_plotValues.append(Y_Values[-1]) +# # x_plotValues = [X_Values[0]] +# # x_plotValues.extend(jump_xValues) +# x_plotValues.append(X_Values[-1]) +# +# +# print("y_plotValues:", y_plotValues) +# print("x_plotValues:", x_plotValues) +# # Y_Values[np.diff(y) >= 0.5] = np.nan + +# +# #get values bigger than jump position +# x_rest = X_Values[X_Values>x_plotValues[1]] +# +# Y_Values = np.array(Y_Values) #convert the np array +# +# y_rest = Y_Values[X_Values>x_plotValues[1]] +# # y_rest = Y_Values[np.nonzero(X_Values>x_plotValues[1]] +# print('X_Values:', X_Values) +# print('Y_Values:', Y_Values) +# print('x_rest:', x_rest) +# print('y_rest:', y_rest) +# print('np.nonzero(X_Values>x_plotValues[1]', np.nonzero(X_Values>x_plotValues[1]) ) + + +print('X_values:', X_Values) +print('Y_values:', Y_Values) + + + +# ---------------- Create Plot ------------------- +plt.figure() + +f,ax=plt.subplots(1) + +# plt.title(r''+ yName + '-Plot') +# plt.plot(X_Values, Y_Values,linewidth=2, '.k') +# plt.plot(X_Values, Y_Values,'.k',markersize=1) +# plt.plot(X_Values, Y_Values,'.',markersize=0.8) + +# plt.plot(X_Values, Y_Values) + +# ax.plot([[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]]) +# ax.plot([x_plotValues[0],x_plotValues[1]], [y_plotValues[0],y_plotValues[1]] , 'b') +# ax.plot(x_rest, y_rest, 'b') + + #Define jump +JumpVal = 0.19 +X_Values = np.array(X_Values) +Y_Values = np.array(Y_Values) +Angle_Values = np.array(Angle_Values) +X_one = X_Values[X_Values<0.19] +Y_one = Y_Values[X_Values<0.19] +Angle_one=Angle_Values[X_Values<0.19] +X_two = X_Values[X_Values>=0.19] +Y_two = Y_Values[X_Values>=0.19] +Angle_two=Angle_Values[X_Values>=0.19] + +# X_Values = X_two +# Y_Values = Y_two +# Angle_Values = Angle_two +print('X_one:', X_one) + + +X_Values = np.asarray(X_Values, dtype=float) + +color=['r','b','g'] +cmap = cm.get_cmap(name='rainbow') +Y_two = np.asarray(Y_two, dtype=float) +Angle_Values = np.asarray(Angle_Values, dtype=float) +Angle_two = np.asarray(Angle_two, dtype=float) +X_two = np.asarray(X_two, dtype=float) + +Y_one = np.asarray(Y_one, dtype=float) +Angle_one = np.asarray(Angle_one, dtype=float) +X_one = np.asarray(X_one, dtype=float) + + + +print('X_one:', X_one) +print('Y_one:', Y_one) +print('Angle_one:', Angle_one) + +print('X_two:', X_two) +print('Y_two:', Y_two) +print('Angle_two:', Angle_two) + +# print('X_Values:', X_Values) +# print('Y_arr:', Y_arr) +# +# +# print('Angle_two:', Angle_two) + + + + +# Or = np.zeros_like(Y_arr) +# Or_tmp = np.ones_like(X_Values) + +# Or = np.concatenate(([X_Values],[Or_tmp]) ,axis=1) +# Or = np.array([X_Values,Or_tmp]) + +# print('np.transpose(X_Values)', np.transpose(X_Values)) +# print('X_Values.shape', X_Values.shape[0] ) +# print('reshape X_Values', X_Values.reshape(X_Values.shape[0],1).shape) +# +# print('ones.', np.ones((5,1),dtype=float)) + + + + + +# Or = np.hstack([np.transpose(X_Values),np.transpose(Or_tmp)]) +# Or = np.hstack((X_Values,np.ones((X_Values.shape[0],1), dtype=X_Values.dtype))) +X_two= X_two.reshape(X_two.shape[0],1) +X_one= X_one.reshape(X_one.shape[0],1) + +Or_one = np.hstack((X_one,np.zeros((X_one.shape[0],1),dtype=float))) +Or = np.hstack((X_two,np.zeros((X_two.shape[0],1),dtype=float))) +print('Or:', Or) +print('Or_one:', Or_one) +# ----------------------------------------------------------------------------- + +#normalize +sum_of_rows = Y_two.sum(axis=1) +Y_twoN = Y_two / sum_of_rows[:,np.newaxis] +# Y_arrN = Y_arr / np.sqrt(np.sum(Y_arr**2)) +print('normalized Y_twoN:', Y_twoN) + +sum_of_rows_one = Y_one.sum(axis=1) +Y_oneN = Y_one / sum_of_rows_one[:,np.newaxis] +print('normalized Y_one:', Y_oneN) + +plt.grid(b=True, which='major') + + +# plt.quiver([Or[:,0], Or[:,1]] , Y_arrN[:,0], Y_arrN[:,1]) +print(Or[:,1]) +print(Or[:,0]) +print(Y_twoN[:,0]) + + + +print('Or_one[:,1]',Or_one[:,1]) +print(Or_one[:,0]) +print(Y_oneN[:,0]) + + +print('Angle_values', Angle_Values) +norm = Normalize() +norm.autoscale(Angle_Values) #here full array needed?! +# norm.autoscale(Angle_one) + +colormap = cm.RdBu + + + + + + + +# Plot only every second one +skip = (slice(None,None,2)) +# skip = (slice(None,None,2)) + +# Q = ax.quiver(Or[:,0][skip], Or[:,1][skip] , Y_arrN[:,0][skip], Y_arrN[:,1][skip], color = colormap(norm(Angle_arr)), angles='xy', scale=5, units='xy', alpha=0.8, +# headwidth=2) +Q_one = ax.quiver(Or_one[:,0][skip], Or_one[:,1][skip] , Y_one[:,0][skip], Y_one[:,1][skip], color = colormap(norm(Angle_Values)), angles='xy', scale=5, units='xy', alpha=0.8, +headwidth=2) + +Q = ax.quiver(Or[:,0], Or[:,1] , Y_twoN[:,0], Y_twoN[:,1], color = colormap(norm(Angle_Values)), angles='xy', scale=8, units='xy', alpha=0.8, +headwidth=2) + +# f.colorbar(Q,extend='max') +# ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], scale=5, units='xy') +# ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], Angle_arr, angles='xy', scale=5, units='xy') +# ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_arr)), angles='xy', scale=15, units='xy') +# ax.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], color = colormap(norm(Angle_arr)), angles='xy', scale=5, units='xy', alpha=0.8, +# headwidth=2) + + +ax.scatter(Or[:,0], Or[:,1], c='black', s=10) +ax.scatter(Or_one[:,0], Or_one[:,1], c='black', s=10) +# ax.set_aspect('equal') +# ax.set_aspect('auto') +# ax.axis([0.1,0.4 , -0.1, 0.75]) +# plt.quiver(Or[:,0], Or[:,1] , Y_arrN[:,0], Y_arrN[:,1], scale=1) + +# ax.set_xlim((0.1, X_Values[:,0].max())) +# ax.set_ylim((-0.1, Y_arrN[:,1].max())) + + +ax.set_xlim((0.1, X_two[:,0].max()+0.2)) +ax.set_ylim((-0.1, 0.2 )) +ax.set(aspect=1, title='Quiver Plot') +# ax.tick_params(labelleft = False) + + +plt.show() +# plt.quiver(Or , Y_arrN[:,0], Y_arrN[:,1]) + + + +if other: + for i, y in enumerate(Y_Values): + maxes = 1.1*np.amax(abs(Y_Values[i]), axis = 0) + tmp = Y_Values[i] + print('tmp:', tmp) + + tmp_normalized = tmp / np.sqrt(np.sum(tmp**2)) + print('tmp_normalized:', tmp_normalized) + # origin = np.array([[0, 0, 0],[0, 0, 0]]) # origin point + origin = np.array([X_Values[i], 1]) + # origin = np.array([0,0]) + print('origin:', origin) + plt.scatter(origin[0],origin[1]) + # plt.plot(origin, 'ok') + # plt.axis('equal') + # plt.axis('auto') + plt.xlim([-0.1, 0.4]) + plt.ylim([0, 4]) + # plt.xlim([-maxes[0], maxes[0]]) + # plt.ylim([-maxes[1], maxes[1]]) + # plt.quiver(*origin, tmp[0], tmp[1], headlength=4) + # plt.axes().arrow(*origin, tmp[0], tmp[1],head_width=0.05, head_length = 0.1, color = color[1]) + # plt.arrow(*origin, tmp[0], tmp[1],head_width=0.05, head_length = 0.1, color = color[1]) + # plt.arrow(*origin, tmp_normalized[0], tmp_normalized[1], color = color[1]) + # plt.arrow(*origin, tmp_normalized[0], tmp_normalized[1], head_width=0.05, head_length = 0.1, color = color[1]) + plt.arrow(*origin, tmp_normalized[0], tmp_normalized[1], head_width=0.05, head_length = 0.1, color = cmap(i)) + plt.grid(b=True, which='major') + # plt.quiver(*origin, test[0], test[1], color=['r','b','g'], scale=21) + # plt.quiver(*origin, Y_Values[0][:,0], Y_Values[0][:,1], color=['r','b','g'], scale=21) + # plt.quiver(*origin, Y_Values[:,0], V[:,1], color=['r','b','g'], scale=21) + # plt.quiver(*origin, Y_Values[:,0], V[:,1], color=['r','b','g'], scale=21) + + + + + + plt.show() + # ax.plot(X_Values, Y_Values) + # ax.scatter(X_Values, Y_Values) + # plt.plot(x_plotValues, y_plotValues,'.') + # plt.scatter(X_Values, Y_Values, alpha=0.3) + # plt.scatter(X_Values, Y_Values) + # plt.plot(X_Values, Y_Values,'.') + # plt.plot([X_Values[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]]) + # plt.axis([0, 6, 0, 20]) + + plt.xlabel(xName) + # plt.ylabel(yName) + + plt.ylabel('$\kappa$') + + # ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$')) + # ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.1)) + + + + + ax.grid(True) + +# # if angle PLOT : +# ax.yaxis.set_major_locator(plt.MultipleLocator(np.pi / 2)) +# ax.yaxis.set_minor_locator(plt.MultipleLocator(np.pi / 12)) +# +# ax.yaxis.set_major_formatter(plt.FuncFormatter(format_func)) +# +# # Plot every other line.. not the jumps... +# tmp = 1 +# for idx, x in enumerate(x_plotValues): +# if idx > 0 and tmp == 1: +# # plt.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]] ) +# ax.plot([x_plotValues[idx-1],x_plotValues[idx]] ,[y_plotValues[idx-1],y_plotValues[idx]] ,'b') +# tmp = 0 +# else: +# tmp = 1 + +# plt.plot([x_plotValues[0],x_plotValues[1]] ,[y_plotValues[0],y_plotValues[1]] ) +# plt.plot([x_plotValues[2],x_plotValues[3]] ,[y_plotValues[2],y_plotValues[3]] ) +# plt.plot([x_plotValues[4],x_plotValues[5]] ,[y_plotValues[4],y_plotValues[5]] ) +# plt.plot([x_plotValues[6],x_plotValues[7]] ,[y_plotValues[6],y_plotValues[7]] ) + +# +# for x in jump_xValues: +# plt.axvline(x,ymin=0, ymax= 1, color = 'g',alpha=0.5, linestyle = 'dashed') + +# plt.axvline(x_plotValues[1],ymin=0, ymax= 1, color = 'g',alpha=0.5, linestyle = 'dashed') + +# plt.axhline(y = 1.90476, color = 'b', linestyle = ':', label='$q_1$') +# plt.axhline(y = 2.08333, color = 'r', linestyle = 'dashed', label='$q_2$') +# plt.legend() +# plt.show() +# #--------------------------------------------------------------- diff --git a/src/Plot_Prestrain_Lemma1.4.py b/src/Plot_Prestrain_Lemma1.4.py index 839cbe0b3f82ad72831fe4fae53bcef2b9da86c8..6adc9961efbda66491ea357b8dffdc574ccc9acc 100644 --- a/src/Plot_Prestrain_Lemma1.4.py +++ b/src/Plot_Prestrain_Lemma1.4.py @@ -65,7 +65,10 @@ mu1 = 1.0 # lambda1 = 10.0 rho1 = 1.0 alpha = 2.0 -beta = 5.0 + +# beta = 5.0 +beta = 2.0 #TEST + theta = 1.0/4.0 lambda1 = 0.0 @@ -90,7 +93,7 @@ xmin = 0.0 xmax = 1.0 -numPoints = 20 +numPoints = 200 Theta_Values = np.linspace(xmin, xmax, num=numPoints) print('Theta_Values:', Theta_Values) @@ -105,13 +108,21 @@ b1_Vec = np.vectorize(prestrain_b1) b2_Vec = np.vectorize(prestrain_b2) Theta_Values = np.array(Theta_Values) + +B1_Values_alpha0 = b1_Vec(rho1, beta, 0.0,Theta_Values) +B1_Values_alphaNeg2 = b1_Vec(rho1, beta, -2.0,Theta_Values) B1_Values_alphaNeg1 = b1_Vec(rho1, beta, -1.0,Theta_Values) B1_Values_alphaNeg10 = b1_Vec(rho1, beta, -10.0,Theta_Values) +B1_Values_alpha1= b1_Vec(rho1, beta, 1.0 ,Theta_Values) B1_Values_alpha2= b1_Vec(rho1, beta, 2.0 ,Theta_Values) B1_Values_alpha10= b1_Vec(rho1, beta, 10.0 ,Theta_Values) # B2_Values = b2_Vec(rho1, beta, alpha,Theta_Values) + +B2_Values_alpha0 = b2_Vec(rho1, beta, 0.0,Theta_Values) +B2_Values_alphaNeg2 = b2_Vec(rho1, beta, -2.0,Theta_Values) B2_Values_alphaNeg1 = b2_Vec(rho1, beta, -1.0,Theta_Values) B2_Values_alphaNeg10 = b2_Vec(rho1, beta, -10.0,Theta_Values) +B2_Values_alpha1= b2_Vec(rho1, beta, 1.0 ,Theta_Values) B2_Values_alpha2= b2_Vec(rho1, beta, 2.0 ,Theta_Values) B2_Values_alpha10= b2_Vec(rho1, beta, 10.0 ,Theta_Values) @@ -123,10 +134,16 @@ B2_Values_alpha10= b2_Vec(rho1, beta, 10.0 ,Theta_Values) # --- Convert to numpy array # B1_Values = np.array(B1_Values) # B2_Values = np.array(B2_Values) +B1_Values_alpha0 = np.array(B1_Values_alpha0) +B1_Values_alphaNeg2 = np.array(B1_Values_alphaNeg2) +B1_Values_alpha1 = np.array(B1_Values_alpha1) B1_Values_alphaNeg1 = np.array(B1_Values_alphaNeg1) B1_Values_alphaNeg10 = np.array(B1_Values_alphaNeg10) B1_Values_alpha2 = np.array(B1_Values_alpha2) B1_Values_alpha10 = np.array(B1_Values_alpha10) +B2_Values_alpha0 = np.array(B2_Values_alpha0) +B2_Values_alphaNeg2 = np.array(B2_Values_alphaNeg2) +B2_Values_alpha1 = np.array(B2_Values_alpha1) B2_Values_alphaNeg1 = np.array(B2_Values_alphaNeg1) B2_Values_alphaNeg10 = np.array(B2_Values_alphaNeg10) B2_Values_alpha2 = np.array(B2_Values_alpha2) @@ -217,21 +234,28 @@ ax[1].grid(True,which='major',axis='both',alpha=0.3) # ax.plot(Theta_Values,B1_Values , 'royalblue') # ax.plot(Theta_Values,B2_Values , 'royalblue') -l1 = ax[0].plot(Theta_Values,B1_Values_alphaNeg1 , label=r"$\theta_\rho = -1.0$") -l2 = ax[0].plot(Theta_Values,B1_Values_alphaNeg10 , label=r"$\theta_\rho = -10.0$") -l3 = ax[0].plot(Theta_Values,B1_Values_alpha2 , label=r"$\theta_\rho = 2.0$") -l4 = ax[0].plot(Theta_Values,B1_Values_alpha10 , label=r"$\theta_\rho = 10.0$") +l1 = ax[0].plot(Theta_Values,B1_Values_alphaNeg10 , label=r"$\theta_\rho = -10.0$") +l2 = ax[0].plot(Theta_Values,B1_Values_alphaNeg2 , label=r"$\theta_\rho = -2.0$") +l3 = ax[0].plot(Theta_Values,B1_Values_alphaNeg1 , label=r"$\theta_\rho = -1.0$") +l4 = ax[0].plot(Theta_Values,B1_Values_alpha0 , label=r"$\theta_\rho = 0.0$") +l5 = ax[0].plot(Theta_Values,B1_Values_alpha1 , label=r"$\theta_\rho = 1.0$") +l6 = ax[0].plot(Theta_Values,B1_Values_alpha2 , label=r"$\theta_\rho = 2.0$") +l7 = ax[0].plot(Theta_Values,B1_Values_alpha10 , label=r"$\theta_\rho = 10.0$") + ax[0].set_xlabel(r"volume fraction $\theta$") ax[0].set_ylabel(r"prestrain $b_1$") # Labels to use in the legend for each line -line_labels = [r"$\theta_\rho = -1.0$", r"$\theta_\rho = -10.0$", r"$\theta_\rho = 2.0$", r"$\theta_\rho = 10.0$"] +line_labels = [r"$\theta_\rho = -10.0$",r"$\theta_\rho = -2.0$",r"$\theta_\rho = -1.0$",r"$\theta_\rho = 0.0$" ,r"$\theta_\rho = 1.0$", r"$\theta_\rho = 2.0$", r"$\theta_\rho = 10.0$"] - -ax[1].plot(Theta_Values,B2_Values_alphaNeg1 , label=r"$\theta_\rho = -1.0$") ax[1].plot(Theta_Values,B2_Values_alphaNeg10 , label=r"$\theta_\rho = -10.0$") +ax[1].plot(Theta_Values,B2_Values_alphaNeg2 , label=r"$\theta_\rho = -2.0$") +ax[1].plot(Theta_Values,B2_Values_alphaNeg1 , label=r"$\theta_\rho = -1.0$") +ax[1].plot(Theta_Values,B2_Values_alpha0 , label=r"$\theta_\rho = 0.0$") +ax[1].plot(Theta_Values,B2_Values_alpha1 , label=r"$\theta_\rho = 1.0$") ax[1].plot(Theta_Values,B2_Values_alpha2 , label=r"$\theta_\rho = 2.0$") ax[1].plot(Theta_Values,B2_Values_alpha10 , label=r"$\theta_\rho = 10.0$") + ax[1].set_xlabel(r"volume fraction $\theta$") ax[1].set_ylabel(r"prestrain $b_2$") @@ -327,7 +351,7 @@ plt.tight_layout() fig.legend([l1, l2, l3, l4], # The line objects labels=line_labels, # The labels for each line loc="center right", # Position of legend - borderaxespad=0.15 # Small spacing around legend box + borderaxespad=0.15, # Small spacing around legend box # title="Legend Title" # Title for the legend ) diff --git a/src/Plot_Prestrain_Lemma1.4_Betas.py b/src/Plot_Prestrain_Lemma1.4_Betas.py new file mode 100644 index 0000000000000000000000000000000000000000..10564f7da5e5f6d0ad0c669ba746bd50cd8bc4cd --- /dev/null +++ b/src/Plot_Prestrain_Lemma1.4_Betas.py @@ -0,0 +1,389 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +from HelperFunctions import * +from ClassifyMin import * + +import matplotlib.ticker as tickers +import matplotlib as mpl +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator +import pandas as pd + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + + +# TODO +# - Fallunterscheidung (Speedup) falls gesuchter value mu_gamma = q3 +# - Also Add option to plot Minimization Output + + +# ----- Setup Paths ----- +# InputFile = "/inputs/cellsolver.parset" +# OutputFile = "/outputs/output.txt" + +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" + +# path = os.getcwd() +# InputFilePath = os.getcwd()+InputFile +# OutputFilePath = os.getcwd()+OutputFile +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +#--------------------------------------------------------------- + +print('---- Input parameters: -----') + +mu1 = 1.0 +# mu1 = 10.0 +# lambda1 = 10.0 +rho1 = 1.0 +alpha = 2.0 + +# beta = 5.0 +beta = 2.0 #TEST + +theta = 1.0/4.0 + +lambda1 = 0.0 +# gamma = 1.0/4.0 + +gamma = 'infinity' #Elliptic Setting +# gamma = '0' #Hyperbolic Setting +# gamma = 0.5 + + +print('mu1: ', mu1) +print('rho1: ', rho1) +print('alpha: ', alpha) +print('beta: ', beta) +print('theta: ', theta) +print('gamma:', gamma) +print('----------------------------') + + +# --- define Interval of x-va1ues: +xmin = 0.0 +xmax = 1.0 + + +numPoints = 1000 +Theta_Values = np.linspace(xmin, xmax, num=numPoints) +print('Theta_Values:', Theta_Values) + + +B1_Values = [] +B2_Values = [] + +b1 = prestrain_b1(rho1, beta, alpha,theta) +b2 = prestrain_b2(rho1, beta, alpha,theta) + +b1_Vec = np.vectorize(prestrain_b1) +b2_Vec = np.vectorize(prestrain_b2) + +Theta_Values = np.array(Theta_Values) +B1_Values_alphaNeg1 = b1_Vec(rho1, beta, -1.0,Theta_Values) +B1_Values_alphaNeg10 = b1_Vec(rho1, beta, -10.0,Theta_Values) +B1_Values_alpha2= b1_Vec(rho1, beta, 2.0 ,Theta_Values) +B1_Values_alpha10= b1_Vec(rho1, beta, 10.0 ,Theta_Values) +# B2_Values = b2_Vec(rho1, beta, alpha,Theta_Values) +B2_Values_alphaNeg1 = b2_Vec(rho1, beta, -1.0,Theta_Values) +B2_Values_alphaNeg10 = b2_Vec(rho1, beta, -10.0,Theta_Values) +B2_Values_alpha2= b2_Vec(rho1, beta, 2.0 ,Theta_Values) +B2_Values_alpha10= b2_Vec(rho1, beta, 10.0 ,Theta_Values) + + +B1_Values_beta05 = b1_Vec(rho1, 0.5, alpha ,Theta_Values) +B1_Values_beta1 = b1_Vec(rho1, 1.0, alpha ,Theta_Values) +B1_Values_beta2 = b1_Vec(rho1, 2.0, alpha ,Theta_Values) +B1_Values_beta10 = b1_Vec(rho1, 10, alpha ,Theta_Values) +# --- + +B2_Values_beta01 = b2_Vec(rho1, 0.1, alpha ,Theta_Values) +B2_Values_beta05 = b2_Vec(rho1, 0.5, alpha ,Theta_Values) +B2_Values_beta1 = b2_Vec(rho1, 1.0, alpha ,Theta_Values) +B2_Values_beta2 = b2_Vec(rho1, 2.0, alpha ,Theta_Values) +B2_Values_beta10 = b2_Vec(rho1, 10, alpha ,Theta_Values) + + +# print('B1_Values:', B1_Values) +# print('B2_Values:', B2_Values) + + + +# --- Convert to numpy array +# B1_Values = np.array(B1_Values) +# B2_Values = np.array(B2_Values) +B1_Values_alphaNeg1 = np.array(B1_Values_alphaNeg1) +B1_Values_alphaNeg10 = np.array(B1_Values_alphaNeg10) +B1_Values_alpha2 = np.array(B1_Values_alpha2) +B1_Values_alpha10 = np.array(B1_Values_alpha10) +B2_Values_alphaNeg1 = np.array(B2_Values_alphaNeg1) +B2_Values_alphaNeg10 = np.array(B2_Values_alphaNeg10) +B2_Values_alpha2 = np.array(B2_Values_alpha2) +B2_Values_alpha10 = np.array(B2_Values_alpha10) + + + +B1_Values_beta05= np.array(B1_Values_beta05) +B1_Values_beta1 = np.array(B1_Values_beta1 ) +B1_Values_beta2 = np.array(B1_Values_beta2 ) +B1_Values_beta10 = np.array(B1_Values_beta10 ) +B2_Values_beta01 = np.array(B2_Values_beta01) +B2_Values_beta05 = np.array(B2_Values_beta05) +B2_Values_beta1 = np.array(B2_Values_beta1) +B2_Values_beta2 = np.array(B2_Values_beta2 ) +B2_Values_beta10 = np.array(B2_Values_beta10) +# ---------------- Create Plot ------------------- + +#--- change plot style: SEABORN +# plt.style.use("seaborn-paper") + + +#--- Adjust gobal matplotlib variables +# mpl.rcParams['pdf.fonttype'] = 42 +# mpl.rcParams['ps.fonttype'] = 42 +mpl.rcParams['text.usetex'] = True +mpl.rcParams["font.family"] = "serif" +mpl.rcParams["font.size"] = "9" +# mpl.rcParams['axes.grid'] = True + +# plt.rc('font', family='serif', serif='Times') +# plt.rc('font', family='serif') +# # plt.rc('text', usetex=True) #also works... +# plt.rc('xtick', labelsize=8) +# plt.rc('ytick', labelsize=8) +# plt.rc('axes', labelsize=8) + + + + + +#---- Scale Figure apropriately to fit tex-File Width +# width = 452.9679 + +# width as measured in inkscape +width = 6.28 *0.5 +# width = 6.28 + +height = width / 1.618 +# height = width / 2.5 +#setup canvas first +fig = plt.figure() #main +# fig, ax = plt.subplots() +# fig, (ax, ax2) = plt.subplots(ncols=2) + +# fig,ax = plt.subplots(nrows=1,ncols=2,figsize=(width,height)) # more than one plot +# fig,ax = plt.subplots(nrows=1,ncols=1,figsize=(width,height)) # more than one plot +# fig,ax = plt.subplots(nrows=1,ncols=1,figsize=(width,height)) # more than one plot +# --- set overall Title +# fig.suptitle('Example of a Single Legend Shared Across Multiple Subplots') + +# fig.subplots_adjust(left=.15, bottom=.16, right=.99, top=.97) #TEST + + +# TEST +# mpl.rcParams['figure.figsize'] = (width+0.1,height+0.1) +# fig = plt.figure(figsize=(width+0.1,height+0.1)) + + +# mpl.rcParams['figure.figsize'] = (width,height) +# fig = plt.figure(figsize=(10,6)) # default is [6.4,4.8] 6.4 is the width, 4.8 is the height +# fig = plt.figure(figsize=(width,height)) # default is [6.4,4.8] 6.4 is the width, 4.8 is the height +# fig = plt.figure(figsize=set_size(width)) +# fig = plt.subplots(1, 1, figsize=set_size(width)) + +# --- To create a figure half the width of your document:# +# fig = plt.figure(figsize=set_size(width, fraction=0.5)) + + + +#--- You must select the correct size of the plot in advance +# fig.set_size_inches(3.54,3.54) + + +# ---- TODO ?: +# ax[0] = plt.axes((0.15,0.18,0.8,0.8)) + + +# ax.tick_params(axis='x',which='major', direction='out',pad=3) +# ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +# ax.xaxis.set_major_locator(MultipleLocator(0.1)) +# ax.xaxis.set_minor_locator(MultipleLocator(0.05)) +# a=ax.yaxis.get_major_locator() +# b=ax.yaxis.get_major_formatter() +# c = ax.get_xticks() +# d = ax.get_xticklabels() +# print('xticks:',c) +# print('xticklabels:',d) + + +ax = plt.axes((0.15,0.18,0.8,0.8)) +# ax = plt.axes((0.1,0.1,0.5,0.5)) +ax.grid(True,which='major',axis='both',alpha=0.3) +# ax[0].grid(True,which='major',axis='both',alpha=0.3) +# ax[1].grid(True,which='major',axis='both',alpha=0.3) +# ax.plot(Theta_Values,B1_Values , 'royalblue') +# ax.plot(Theta_Values,B2_Values , 'royalblue') + +# l1 = ax[0].plot(Theta_Values,B1_Values_beta05 , label=r"$\theta_\mu = 0.5$") +# l2 = ax[0].plot(Theta_Values,B1_Values_beta1 , label=r"$\theta_\mu = 1.0$") +# l3 = ax[0].plot(Theta_Values,B1_Values_beta2 , label=r"$\theta_\mu = 2.0$") +# l4 = ax[0].plot(Theta_Values,B1_Values_beta10 , label=r"$\theta_\mu = 10.0$") +# ax[0].set_xlabel(r"volume fraction $\theta$") +# ax[0].set_ylabel(r"prestrain $b_1$") + +# Labels to use in the legend for each line +# line_labels = [r"$\theta_\rho = -1.0$", r"$\theta_\rho = -10.0$", r"$\theta_\rho = 2.0$", r"$\theta_\rho = 10.0$"] +# line_labels = [r"$\theta_\mu = 0.5$", r"$\theta_\mu = 1.0$", r"$\theta_\mu = 2.0$", r"$\theta_\mu = 10.0$"] + +# ax[1].plot(Theta_Values,B2_Values_alphaNeg1 , label=r"$\theta_\rho = -1.0$") +# ax[1].plot(Theta_Values,B2_Values_alphaNeg10 , label=r"$\theta_\rho = -10.0$") +# ax[1].plot(Theta_Values,B2_Values_alpha2 , label=r"$\theta_\rho = 2.0$") +# ax[1].plot(Theta_Values,B2_Values_alpha10 , label=r"$\theta_\rho = 10.0$") + + +# --------------- +# ax[1].plot(Theta_Values,B2_Values_beta05 , label=r"$\theta_\mu = 0.5$") +# ax[1].plot(Theta_Values,B2_Values_beta1 , label=r"$\theta_\mu = 1.0$") +# ax[1].plot(Theta_Values,B2_Values_beta2 , label=r"$\theta_\mu = 2.0$") +# ax[1].plot(Theta_Values,B2_Values_beta10 , label=r"$\theta_\mu = 10.0$") +# ax[1].set_xlabel(r"volume fraction $\theta$") +# ax[1].set_ylabel(r"prestrain $b_2$") + + +l1 = ax.plot(Theta_Values,B2_Values_beta01 , label=r"$\theta_\mu = 0.1$") +l2 = ax.plot(Theta_Values,B2_Values_beta05 , label=r"$\theta_\mu = 0.5$") +l3 = ax.plot(Theta_Values,B2_Values_beta1 , label=r"$\theta_\mu = 1.0$") +l4 = ax.plot(Theta_Values,B2_Values_beta2 , label=r"$\theta_\mu = 2.0$") +l5 = ax.plot(Theta_Values,B2_Values_beta10 , label=r"$\theta_\mu = 10.0$") +ax.set_xlabel(r"volume fraction $\theta$") +ax.set_ylabel(r"prestrain $b_2$") +line_labels = [r"$\theta_\mu = 0.1$",r"$\theta_\mu = 0.5$", r"$\theta_\mu = 1.0$", r"$\theta_\mu = 2.0$", r"$\theta_\mu = 10.0$"] + + +# plt.tight_layout() + + +# plt.subplots_adjust(wspace=0.4, hspace=0) + + +# ax.plot(X_Values[X_Values>0.136], Y_Values[X_Values>0.136]) +# ax.plot(X_Values[X_Values<0.135], Y_Values[X_Values<0.135]) +# ax.scatter(X_Values, Y_Values) +# ax.plot(X_Values, Y_Values) + +# plt.plot(x_plotValues, y_plotValues,'.') +# plt.scatter(X_Values, Y_Values, alpha=0.3) +# plt.scatter(X_Values, Y_Values) +# plt.plot(X_Values, Y_Values,'.') +# plt.plot([X_Values[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]]) +# plt.axis([0, 6, 0, 20]) + +# ax.set_xlabel(r"volume fraction $\theta$", size=11) +# ax.set_ylabel(r"angle $\angle$", size=11) + + +# plt.ylabel('$\kappa$') + +# ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$')) +# ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.1)) + + + + + +# -- SETUP LEGEND +# ax.legend(prop={'size': 11}) +# ax[0].legend() +# ax[1].legend( +# loc='upper left', +# bbox_to_anchor=(1,1)) + +# Create the legend +# handles, labels = ax.get_legend_handles_labels() + +# fig.legend([l1, l2, l3, l4], # The line objects +# labels=line_labels, # The labels for each line +# loc="upper right", # Position of legend +# borderaxespad=0.15, # Small spacing around legend box +# # title="Legend Title" # Title for the legend +# bbox_to_anchor=(0.95,0.98) +# ) + +# fig.legend([l1, l2, l3, l4], # The line objects +# labels=line_labels, # The labels for each line +# loc="upper left", # Position of legend +# borderaxespad=0.1, +# # title="Legend Title" # Title for the legend +# bbox_to_anchor=(0.8,0.7) +# ) + +lg = ax.legend(bbox_to_anchor=(1.0, 0.75), loc='upper left') +# ax.tight_layout() + +# Adjust the scaling factor to fit your legend text completely outside the plot +# (smaller value results in more space being made for the legend) +plt.subplots_adjust(right=0.8) +plt.tight_layout() + +# ------------------ SAVE FIGURE +# tikzplotlib.save("TesTout.tex") +# plt.close() +# mpl.rcParams.update(mpl.rcParamsDefault) + +# plt.savefig("graph.pdf", +# #This is simple recomendation for publication plots +# dpi=1000, +# # Plot will be occupy a maximum of available space +# bbox_inches='tight', +# ) +# plt.savefig("graph.pdf") + + + + +fig.set_size_inches(width, height) +fig.savefig('Plot-Prestrain-Theta_AlphaFix.pdf',dpi=300,bbox_extra_artists=(lg,), + bbox_inches='tight') + + + + +# tikz_save('someplot.tex', figureheight='5cm', figurewidth='9cm') + +# tikz_save('fig.tikz', +# figureheight = '\\figureheight', +# figurewidth = '\\figurewidth') + +# ---------------------------------------- + + +plt.show() +# #--------------------------------------------------------------- diff --git a/src/Plot_Prestrain_Lemma1.4_SubPlots.py b/src/Plot_Prestrain_Lemma1.4_SubPlots.py new file mode 100644 index 0000000000000000000000000000000000000000..efd86c3dc9461385902827558dd7eb2c08dd7827 --- /dev/null +++ b/src/Plot_Prestrain_Lemma1.4_SubPlots.py @@ -0,0 +1,417 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +from HelperFunctions import * +from ClassifyMin import * + +import matplotlib.ticker as tickers +import matplotlib as mpl +from matplotlib.ticker import MultipleLocator,FormatStrFormatter,MaxNLocator +import pandas as pd + + + +def find_nearest(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return array[idx] + + +def find_nearestIdx(array, value): + array = np.asarray(array) + idx = (np.abs(array - value)).argmin() + return idx + + + +# TODO +# - Fallunterscheidung (Speedup) falls gesuchter value mu_gamma = q3 +# - Also Add option to plot Minimization Output + + +# ----- Setup Paths ----- +# InputFile = "/inputs/cellsolver.parset" +# OutputFile = "/outputs/output.txt" + +InputFile = "/inputs/computeMuGamma.parset" +OutputFile = "/outputs/outputMuGamma.txt" + +# path = os.getcwd() +# InputFilePath = os.getcwd()+InputFile +# OutputFilePath = os.getcwd()+OutputFile +# --------- Run from src folder: +path_parent = os.path.dirname(os.getcwd()) +os.chdir(path_parent) +path = os.getcwd() +print(path) +InputFilePath = os.getcwd()+InputFile +OutputFilePath = os.getcwd()+OutputFile +print("InputFilepath: ", InputFilePath) +print("OutputFilepath: ", OutputFilePath) +print("Path: ", path) + +#--------------------------------------------------------------- + +print('---- Input parameters: -----') + +mu1 = 10.0 +# mu1 = 10.0 +# lambda1 = 10.0 +rho1 = 1.0 +alpha = 2.0 +beta = 5.0 +theta = 1.0/4.0 + +lambda1 = 0.0 +# gamma = 1.0/4.0 + +gamma = 'infinity' #Elliptic Setting +# gamma = '0' #Hyperbolic Setting +# gamma = 0.5 + + +print('mu1: ', mu1) +print('rho1: ', rho1) +print('alpha: ', alpha) +print('beta: ', beta) +print('theta: ', theta) +print('gamma:', gamma) +print('----------------------------') + + +# --- define Interval of x-va1ues: +xmin = 0.0 +xmax = 1.0 + + +numPoints = 20 +Theta_Values = np.linspace(xmin, xmax, num=numPoints) +print('Theta_Values:', Theta_Values) + + +B1_Values = [] +B2_Values = [] + +b1 = prestrain_b1(rho1, beta, alpha,theta) +b2 = prestrain_b2(rho1, beta, alpha,theta) + +b1_Vec = np.vectorize(prestrain_b1) +b2_Vec = np.vectorize(prestrain_b2) + +Theta_Values = np.array(Theta_Values) +B1_Values_alphaNeg1 = b1_Vec(rho1, beta, -1.0,Theta_Values) +B1_Values_alphaNeg10 = b1_Vec(rho1, beta, -10.0,Theta_Values) +B1_Values_alpha2= b1_Vec(rho1, beta, 2.0 ,Theta_Values) +B1_Values_alpha10= b1_Vec(rho1, beta, 10.0 ,Theta_Values) +# B2_Values = b2_Vec(rho1, beta, alpha,Theta_Values) +B2_Values_alphaNeg1 = b2_Vec(rho1, beta, -1.0,Theta_Values) +B2_Values_alphaNeg10 = b2_Vec(rho1, beta, -10.0,Theta_Values) +B2_Values_alpha2= b2_Vec(rho1, beta, 2.0 ,Theta_Values) +B2_Values_alpha10= b2_Vec(rho1, beta, 10.0 ,Theta_Values) + + +B1_Values_beta05 = b1_Vec(rho1, 0.5, alpha ,Theta_Values) +B1_Values_beta1 = b1_Vec(rho1, 1.0, alpha ,Theta_Values) +B1_Values_beta2 = b1_Vec(rho1, 2.0, alpha ,Theta_Values) +B1_Values_beta10 = b1_Vec(rho1, 10, alpha ,Theta_Values) +# --- +B2_Values_beta05 = b2_Vec(rho1, 0.5, alpha ,Theta_Values) +B2_Values_beta1 = b2_Vec(rho1, 1.0, alpha ,Theta_Values) +B2_Values_beta2 = b2_Vec(rho1, 2.0, alpha ,Theta_Values) +B2_Values_beta10 = b2_Vec(rho1, 10, alpha ,Theta_Values) + + +# print('B1_Values:', B1_Values) +# print('B2_Values:', B2_Values) + + + +# --- Convert to numpy array +# B1_Values = np.array(B1_Values) +# B2_Values = np.array(B2_Values) +B1_Values_alphaNeg1 = np.array(B1_Values_alphaNeg1) +B1_Values_alphaNeg10 = np.array(B1_Values_alphaNeg10) +B1_Values_alpha2 = np.array(B1_Values_alpha2) +B1_Values_alpha10 = np.array(B1_Values_alpha10) +B2_Values_alphaNeg1 = np.array(B2_Values_alphaNeg1) +B2_Values_alphaNeg10 = np.array(B2_Values_alphaNeg10) +B2_Values_alpha2 = np.array(B2_Values_alpha2) +B2_Values_alpha10 = np.array(B2_Values_alpha10) + + + +B1_Values_beta05= np.array(B1_Values_beta05) +B1_Values_beta1 = np.array(B1_Values_beta1 ) +B1_Values_beta2 = np.array(B1_Values_beta2 ) +B1_Values_beta10 = np.array(B1_Values_beta10 ) +B2_Values_beta05 = np.array(B2_Values_beta05) +B2_Values_beta1 = np.array(B2_Values_beta1) +B2_Values_beta2 = np.array(B2_Values_beta2 ) +B2_Values_beta10 = np.array(B2_Values_beta10) +# ---------------- Create Plot ------------------- + +#--- change plot style: SEABORN +# plt.style.use("seaborn-paper") + + +#--- Adjust gobal matplotlib variables +# mpl.rcParams['pdf.fonttype'] = 42 +# mpl.rcParams['ps.fonttype'] = 42 +mpl.rcParams['text.usetex'] = True +mpl.rcParams["font.family"] = "serif" +mpl.rcParams["font.size"] = "9" +# mpl.rcParams['axes.grid'] = True + +# plt.rc('font', family='serif', serif='Times') +# plt.rc('font', family='serif') +# # plt.rc('text', usetex=True) #also works... +# plt.rc('xtick', labelsize=8) +# plt.rc('ytick', labelsize=8) +# plt.rc('axes', labelsize=8) + + + + + +#---- Scale Figure apropriately to fit tex-File Width +# width = 452.9679 + +# width as measured in inkscape +# width = 6.28 *0.5 +width = 6.28 + +height = width / 1.618 +# height = width / 2.5 +#setup canvas first +fig = plt.figure() #main +# fig, ax = plt.subplots() +# fig, (ax, ax2) = plt.subplots(ncols=2) +# fig,ax = plt.subplots(nrows=2,ncols=2,figsize=(width,height)) # more than one plot +fig,ax = plt.subplots(nrows=2,ncols=2, figsize=(width,height)) # more than one plot + +# --- set overall Title +# fig.suptitle('Example of a Single Legend Shared Across Multiple Subplots') +# fig.supxlabel(r'common') +# fig.supylabel(r'common') +# fig.subplots_adjust(left=.15, bottom=.16, right=.99, top=.97) #TEST + + +# TEST +# mpl.rcParams['figure.figsize'] = (width+0.1,height+0.1) +# fig = plt.figure(figsize=(width+0.1,height+0.1)) + + +# mpl.rcParams['figure.figsize'] = (width,height) +# fig = plt.figure(figsize=(10,6)) # default is [6.4,4.8] 6.4 is the width, 4.8 is the height +# fig = plt.figure(figsize=(width,height)) # default is [6.4,4.8] 6.4 is the width, 4.8 is the height +# fig = plt.figure(figsize=set_size(width)) +# fig = plt.subplots(1, 1, figsize=set_size(width)) + +# --- To create a figure half the width of your document:# +# fig = plt.figure(figsize=set_size(width, fraction=0.5)) + + + +#--- You must select the correct size of the plot in advance +# fig.set_size_inches(3.54,3.54) + + +# ---- TODO ?: +# ax[0] = plt.axes((0.15,0.18,0.8,0.8)) + + +ax[0][0].tick_params(axis='x',which='major', direction='out',pad=3) +ax[0][0].tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) +ax[0][0].xaxis.set_major_locator(MultipleLocator(0.25)) +ax[0][0].xaxis.set_minor_locator(MultipleLocator(0.125)) +ax[0][0].yaxis.set_major_locator(MultipleLocator(25)) +# ax[0][0].yaxis.set_minor_locator(MultipleLocator(12.5)) +# a=ax.yaxis.get_major_locator() +# b=ax.yaxis.get_major_formatter() +# c = ax.get_xticks() +# d = ax.get_xticklabels() +# print('xticks:',c) +# print('xticklabels:',d) + +ax[0][0].grid(True,which='major',axis='both',alpha=0.3) +ax[0][1].grid(True,which='major',axis='both',alpha=0.3) +ax[1][0].grid(True,which='major',axis='both',alpha=0.3) +ax[1][1].grid(True,which='major',axis='both',alpha=0.3) +# ax.plot(Theta_Values,B1_Values , 'royalblue') +# ax.plot(Theta_Values,B2_Values , 'royalblue') + +l1 = ax[0][0].plot(Theta_Values,B1_Values_alphaNeg1 , label=r"$\theta_\rho = -1.0$") +l2 = ax[0][0].plot(Theta_Values,B1_Values_alphaNeg10 , label=r"$\theta_\rho = -10.0$") +l3 = ax[0][0].plot(Theta_Values,B1_Values_alpha2 , label=r"$\theta_\rho = 2.0$") +l4 = ax[0][0].plot(Theta_Values,B1_Values_alpha10 , label=r"$\theta_\rho = 10.0$") +ax[0][0].set_xlabel(r"volume fraction $\theta$") +ax[0][0].set_ylabel(r"prestrain $b_1$") +# l1 = ax[0].plot(Theta_Values,B1_Values_beta05 , label=r"$\theta_\mu = -1.0$") +# l2 = ax[0].plot(Theta_Values,B1_Values_beta1 , label=r"$\theta_\mu = -10.0$") +# l3 = ax[0].plot(Theta_Values,B1_Values_beta2 , label=r"$\theta_\mu = 2.0$") +# l4 = ax[0].plot(Theta_Values,B1_Values_beta10 , label=r"$\theta_\mu = 10.0$") +l5 = ax[1][0].plot(Theta_Values,B1_Values_beta05 , label=r"$\theta_\mu = -1.0$") +l6 = ax[1][0].plot(Theta_Values,B1_Values_beta1 , label=r"$\theta_\mu = -10.0$") +l7 = ax[1][0].plot(Theta_Values,B1_Values_beta2 , label=r"$\theta_\mu = 2.0$") +l8 = ax[1][0].plot(Theta_Values,B1_Values_beta10 , label=r"$\theta_\mu = 10.0$") +ax[1][0].set_xlabel(r"volume fraction $\theta$") +ax[1][0].set_ylabel(r"prestrain $b_1$") + +# Labels to use in the legend for each line +# line_labels = [r"$\theta_\rho = -1.0$", r"$\theta_\rho = -10.0$", r"$\theta_\rho = 2.0$", r"$\theta_\rho = 10.0$"] +line_labels = [r"$\theta_\rho = -1.0$", r"$\theta_\rho = -10.0$", r"$\theta_\rho = 2.0$", r"$\theta_\rho = 10.0$", +r"$\theta_\mu = -1.0$", r"$\theta_\mu = -10.0$", r"$\theta_\mu = 2.0$",r"$\theta_\mu = 10.0$" ] + +ax[0][1].plot(Theta_Values,B2_Values_alphaNeg1 , label=r"$\theta_\rho = -1.0$") +ax[0][1].plot(Theta_Values,B2_Values_alphaNeg10 , label=r"$\theta_\rho = -10.0$") +ax[0][1].plot(Theta_Values,B2_Values_alpha2 , label=r"$\theta_\rho = 2.0$") +ax[0][1].plot(Theta_Values,B2_Values_alpha10 , label=r"$\theta_\rho = 10.0$") +ax[0][1].set_xlabel(r"volume fraction $\theta$") +ax[0][1].set_ylabel(r"prestrain $b_2$") +# --------------- +ax[1][1].plot(Theta_Values,B2_Values_beta05 , label=r"$\theta_\mu = -1.0$") +ax[1][1].plot(Theta_Values,B2_Values_beta1 , label=r"$\theta_\mu = -10.0$") +ax[1][1].plot(Theta_Values,B2_Values_beta2 , label=r"$\theta_\mu = 2.0$") +ax[1][1].plot(Theta_Values,B2_Values_beta10 , label=r"$\theta_\mu = 10.0$") +ax[1][1].set_xlabel(r"volume fraction $\theta$") +ax[1][1].set_ylabel(r"prestrain $b_2$") + +plt.subplots_adjust(wspace=0.2, hspace=0) +plt.tight_layout() +# ax.plot(Theta_Values,B2_Values_alphaNeg1 ) +# ax.plot(Theta_Values,B2_Values_alphaNeg10 ) +# ax.plot(Theta_Values,B2_Values_alpha2 ) +# ax.plot(Theta_Values,B2_Values_alpha10 ) + + +# plt.figure() + +# f,ax=plt.subplots(1) + +# plt.title(r''+ yName + '-Plot') +# plt.plot(X_Values, Y_Values,linewidth=2, '.k') +# plt.plot(X_Values, Y_Values,'.k',markersize=1) +# plt.plot(X_Values, Y_Values,'.',markersize=0.8) + +# plt.plot(X_Values, Y_Values) + +# ax.plot([[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]]) + + + +# Gamma = '0' +# ax.plot([x_plotValues[0],x_plotValues[1]], [y_plotValues[0],y_plotValues[1]] , 'b') +# +# ax.plot([x_plotValues[1],x_plotValues[3]], [y_plotValues[2],y_plotValues[3]] , 'b') +# +# ax.plot(x_rest, y_rest, 'b') + + +# Gamma between + +# x jump values (gamma 0): [0.13606060606060608, 0.21090909090909093] + +# ax.plot([[0,jump_xValues[0]], [0, 0]] , 'b') +# ax.plot([jump_xValues[0],xmin], [y_plotValues[2],y_plotValues[2]] , 'b') + +# ax.plot([[0,0.13606060606060608], [0, 0]] , 'b') +# ax.plot([[0.13606060606060608,xmin], [(math.pi/2),(math.pi/2)]], 'b') + +# jump_xValues[0] + + + +# --- leave out jumps: +# ax.scatter(X_Values, Y_Values) + + + + + + + +# ax.plot(X_Values[X_Values>0.136], Y_Values[X_Values>0.136]) +# ax.plot(X_Values[X_Values<0.135], Y_Values[X_Values<0.135]) +# ax.scatter(X_Values, Y_Values) +# ax.plot(X_Values, Y_Values) + +# plt.plot(x_plotValues, y_plotValues,'.') +# plt.scatter(X_Values, Y_Values, alpha=0.3) +# plt.scatter(X_Values, Y_Values) +# plt.plot(X_Values, Y_Values,'.') +# plt.plot([X_Values[0],X_Values[-1]], [Y_Values[0],Y_Values[-1]]) +# plt.axis([0, 6, 0, 20]) + +# ax.set_xlabel(r"volume fraction $\theta$", size=11) +# ax.set_ylabel(r"angle $\angle$", size=11) + + +# plt.ylabel('$\kappa$') + +# ax.yaxis.set_major_formatter(ticker.FormatStrFormatter('%g $\pi$')) +# ax.yaxis.set_major_locator(ticker.MultipleLocator(base=0.1)) + + + + + +# -- SETUP LEGEND +# ax.legend(prop={'size': 11}) +# ax[0].legend() +# ax[1].legend( +# loc='upper left', +# bbox_to_anchor=(1,1)) + +# Create the legend +# handles, labels = ax.get_legend_handles_labels() + +fig.legend([l1, l2, l3, l4, l5, l6 ,l7 ,l8], # The line objects + labels=line_labels, # The labels for each line + loc="center right", # Position of legend + borderaxespad=0.15 # Small spacing around legend box + # title="Legend Title" # Title for the legend + ) + +# Adjust the scaling factor to fit your legend text completely outside the plot +# (smaller value results in more space being made for the legend) +plt.subplots_adjust(right=0.8) + +# ------------------ SAVE FIGURE +# tikzplotlib.save("TesTout.tex") +# plt.close() +# mpl.rcParams.update(mpl.rcParamsDefault) + +# plt.savefig("graph.pdf", +# #This is simple recomendation for publication plots +# dpi=1000, +# # Plot will be occupy a maximum of available space +# bbox_inches='tight', +# ) +# plt.savefig("graph.pdf") + + + + +fig.set_size_inches(width, height) +fig.savefig('Plot-Prestrain-Theta.pdf') + + + + +# tikz_save('someplot.tex', figureheight='5cm', figurewidth='9cm') + +# tikz_save('fig.tikz', +# figureheight = '\\figureheight', +# figurewidth = '\\figurewidth') + +# ---------------------------------------- + + +plt.show() +# #--------------------------------------------------------------- diff --git a/src/Plot_elasticQuantities.py b/src/Plot_elasticQuantities.py index c9aa66c31a74b8c2c662399a2d9ae04569a9ec9d..9e9f8462a41cd16c141227d45d49b187c61fc9c6 100644 --- a/src/Plot_elasticQuantities.py +++ b/src/Plot_elasticQuantities.py @@ -123,11 +123,15 @@ Theta_Values = np.array(Theta_Values) # B2_Values_alpha2= b2_Vec(rho1, beta, 2.0 ,Theta_Values) # B2_Values_alpha10= b2_Vec(rho1, beta, 10.0 ,Theta_Values) +Q1_Values_beta05 = (1.0/6.0)*harmonicMeanVec(mu1, 0.5, Theta_Values) + Q1_Values_beta1 = (1.0/6.0)*harmonicMeanVec(mu1, 1.0, Theta_Values) Q1_Values_beta2 = (1.0/6.0)*harmonicMeanVec(mu1, 2.0, Theta_Values) Q1_Values_beta5 = (1.0/6.0)*harmonicMeanVec(mu1, 5.0, Theta_Values) Q1_Values_beta10 = (1.0/6.0)*harmonicMeanVec(mu1, 10.0, Theta_Values) +Q2_Values_beta05 = (1.0/6.0)*arithmeticMeanVec(mu1, 0.5, Theta_Values) + Q2_Values_beta1 = (1.0/6.0)*arithmeticMeanVec(mu1, 1.0, Theta_Values) Q2_Values_beta2 = (1.0/6.0)*arithmeticMeanVec(mu1, 2.0, Theta_Values) Q2_Values_beta5 = (1.0/6.0)*arithmeticMeanVec(mu1, 5.0, Theta_Values) @@ -138,11 +142,15 @@ print("Q1_Values_beta1 ", Q1_Values_beta1 ) # --- Convert to numpy array # B1_Values = np.array(B1_Values) # B2_Values = np.array(B2_Values) +Q1_Values_beta05 = np.array(Q1_Values_beta05 ) + Q1_Values_beta1 = np.array(Q1_Values_beta1 ) Q1_Values_beta2 = np.array(Q1_Values_beta2 ) Q1_Values_beta5 = np.array(Q1_Values_beta5 ) Q1_Values_beta10 = np.array(Q1_Values_beta10 ) +Q2_Values_beta05 = np.array(Q2_Values_beta05 ) + Q2_Values_beta1 = np.array(Q2_Values_beta1 ) Q2_Values_beta2 = np.array(Q2_Values_beta2 ) Q2_Values_beta5 = np.array(Q2_Values_beta5 ) @@ -235,18 +243,20 @@ ax[2].grid(True,which='major',axis='both',alpha=0.3) # ax.plot(Theta_Values,B1_Values , 'royalblue') # ax.plot(Theta_Values,B2_Values , 'royalblue') -l1 = ax[0].plot(Theta_Values,Q1_Values_beta1 , label=r"$\theta_\mu = 1.0$") -l2 = ax[0].plot(Theta_Values,Q1_Values_beta2 , label=r"$\theta_\mu = 2.0$") -l3 = ax[0].plot(Theta_Values,Q1_Values_beta5 , label=r"$\theta_\mu = 5.0$") -l4 = ax[0].plot(Theta_Values,Q1_Values_beta10 , label=r"$\theta_\mu = 10.0$") +l1 = ax[0].plot(Theta_Values,Q1_Values_beta05 , label=r"$\theta_\mu = 0.5$") +l2 = ax[0].plot(Theta_Values,Q1_Values_beta1 , label=r"$\theta_\mu = 1.0$") +l3 = ax[0].plot(Theta_Values,Q1_Values_beta2 , label=r"$\theta_\mu = 2.0$") +l4 = ax[0].plot(Theta_Values,Q1_Values_beta5 , label=r"$\theta_\mu = 5.0$") +l5 = ax[0].plot(Theta_Values,Q1_Values_beta10 , label=r"$\theta_\mu = 10.0$") ax[0].set_xlabel(r"volume fraction $\theta$") ax[0].set_ylabel(r" $q_1$") ax[0].xaxis.set_major_locator(MultipleLocator(0.25)) # Labels to use in the legend for each line -line_labels = [r"$\theta_\mu = 1.0$", r"$\theta_\mu = 2.0$", r"$\theta_\mu = 5.0$", r"$\theta_\mu = 10.0$"] - +# line_labels = [r"$\theta_\mu = 1.0$", r"$\theta_\mu = 2.0$", r"$\theta_\mu = 5.0$", r"$\theta_\mu = 10.0$"] +line_labels = [r"$\theta_\mu = 0.5$",r"$\theta_\mu = 1.0$", r"$\theta_\mu = 2.0$", r"$\theta_\mu = 5.0$", r"$\theta_\mu = 10.0$"] +ax[1].plot(Theta_Values,Q2_Values_beta05 , label=r"$\theta_\rho = 0.5$") ax[1].plot(Theta_Values,Q2_Values_beta1 , label=r"$\theta_\rho = 1.0$") ax[1].plot(Theta_Values,Q2_Values_beta2 , label=r"$\theta_\rho = 2.0$") ax[1].plot(Theta_Values,Q2_Values_beta5 , label=r"$\theta_\rho = 5.0$") @@ -258,6 +268,8 @@ ax[1].xaxis.set_major_locator(MultipleLocator(0.25)) # ax[1].xaxis.set_minor_locator(MultipleLocator(0.05)) +ax[2].plot(Theta_Values,Q1_Values_beta05/Q2_Values_beta05 , label=r"$\theta_\rho = 0.5$",zorder=5) + ax[2].plot(Theta_Values,Q1_Values_beta1/Q2_Values_beta1 , label=r"$\theta_\rho = 1.0$") ax[2].plot(Theta_Values,Q1_Values_beta2/Q2_Values_beta2 , label=r"$\theta_\rho = 2.0$") ax[2].plot(Theta_Values,Q1_Values_beta5/Q2_Values_beta5 , label=r"$\theta_\rho = 5.0$") @@ -276,10 +288,15 @@ plt.tight_layout() +# fig.legend([l1, l2, l3, l4], # The line objects +# labels=line_labels, # The labels for each line +# loc="center right", # Position of legend +# borderaxespad=0.15 # Small spacing around legend box +# # title="Legend Title" # Title for the legend +# ) - -fig.legend([l1, l2, l3, l4], # The line objects +fig.legend([l1, l2, l3, l4,l5], # The line objects labels=line_labels, # The labels for each line loc="center right", # Position of legend borderaxespad=0.15 # Small spacing around legend box diff --git a/src/TestAngle.py b/src/TestAngle.py new file mode 100644 index 0000000000000000000000000000000000000000..77641b3ae1365dedd762d2dea75b11f051d8c2a9 --- /dev/null +++ b/src/TestAngle.py @@ -0,0 +1,32 @@ +import numpy as np +import matplotlib.pyplot as plt +import sympy as sym +import math +import os +import subprocess +import fileinput +import re +import matlab.engine +import sys + + + +e_1 = [1,0] +e_2 = [0,1] +e_3 = [-1,1] +e_4 = [1,-1] +e_5 = [-1,-1] + + + +print("e_1:", e_1) +print("e_2:", e_2) +print("e_3:", e_3) +print("e_2:", e_4) +print("e_3:", e_5) +print("math.atan2(e_1[1], e_1[0]):", math.atan2(e_1[1], e_1[0])) + +print("math.atan2(e_2[1], e_2[0]):", math.atan2(e_2[1], e_2[0])) +print("math.atan2(e_3[1], e_3[0]):", math.atan2(e_3[1], e_3[0])) +print("math.atan2(e_4[1], e_4[0]):", math.atan2(e_4[1], e_4[0])) +print("math.atan2(e_5[1], e_5[0]):", math.atan2(e_5[1], e_5[0])) diff --git a/src/plot-q3-gamma.py b/src/plot-q3-gamma.py index 0cd0425a7c0bc6266b3574daf4fa01d91e1de275..b3141be159114a6c925f500f318b63e7db6923b2 100644 --- a/src/plot-q3-gamma.py +++ b/src/plot-q3-gamma.py @@ -57,26 +57,33 @@ rho1 = 1.0 # alpha = 2.8 alpha = 2.0 beta = 2.0 -# theta = 1.0/4.0 -theta = 1.0/8.0 +# beta = 10.0 +theta = 1.0/4.0 +# theta = 1.0/8.0 # lambda1 = 0.0 -gamma = 1.0/4.0 +# gamma = 1.0/4.0 # gamma = 'infinity' + +#TEST +# theta = 0.1 + + print('mu1: ', mu1) print('rho1: ', rho1) print('alpha: ', alpha) print('beta: ', beta) print('theta: ', theta) -print('gamma:', gamma) +# print('gamma:', gamma) print('----------------------------') yName = 'q3' xName = 'gamma' # --- Define Interval of x-values: xmin = 0.01 +# xmin = 1.0 xmax = 3.0 -numPoints = 15 +numPoints = 10 X_Values = np.linspace(xmin, xmax, num=numPoints) print(X_Values) Y_Values = [] @@ -84,10 +91,16 @@ Y_Values = [] q1 = (1.0/6.0)*harmonicMean(mu1, beta, theta) q2 = (1.0/6.0)*arithmeticMean(mu1, beta, theta) +print('q1=', q1) +print('q2=',q2) + for x in X_Values: # fist replace old parameters in parset # SetParametersCellProblem(alpha,beta,theta,gamma,mu1,rho1,lambda1,InputFilePath) - SetParametersComputeMuGamma(beta,theta,gamma,mu1,rho1, InputFilePath) + + + # SetParametersComputeMuGamma(beta,theta,gamma,mu1,rho1, InputFilePath) + SetParametersComputeMuGamma(beta,theta,x,mu1,rho1, InputFilePath) # replace the sought after x value in the parset with open(path+"/inputs/computeMuGamma.parset", 'r') as file: @@ -107,6 +120,8 @@ for x in X_Values: s = re.findall(r"[-+]?\d*\.\d+|\d+", tmp) Y_Values.append(float(s[0])) + print('Error(q3-q1):', float(s[0])-q1) + # ------------end of for-loop ----------------- print("(Output) Values of " + yName + ": ", Y_Values) # ----------------end of if-statement ------------- @@ -135,6 +150,7 @@ ax.tick_params(axis='x',which='major', direction='out',pad=3) ax.tick_params(axis='y',which='major', length=3, width=1, direction='out',pad=3) ax.xaxis.set_major_locator(MultipleLocator(0.5)) ax.xaxis.set_minor_locator(MultipleLocator(0.25)) + # ax.plot(X_Values, Y_Values) ax.plot(X_Values, Y_Values, # data diff --git a/src/plot_ElasticRatio.py b/src/plot_Elastic_and_PrestrainRatio.py similarity index 88% rename from src/plot_ElasticRatio.py rename to src/plot_Elastic_and_PrestrainRatio.py index 1da41871db5a2da9f64bb8f628d0c9abc7d92ae6..6604a58eecb3b5b462e96810ed7f50592fe8c418 100644 --- a/src/plot_ElasticRatio.py +++ b/src/plot_Elastic_and_PrestrainRatio.py @@ -46,7 +46,7 @@ theta = 1.0/4.0 #set gamma either to 1. '0' 2. 'infinity' or 3. a numerical positive value gamma = '0' -# gamma = 'infinity' +gamma = 'infinity' # gamma = 0.5 # gamma = 0.25 # gamma = 1.0 @@ -85,7 +85,7 @@ print('type of gamma:', type(gamma)) # # # # Gamma_Values = ['0', 'infinity'] Gamma_Values = ['infinity'] -Gamma_Values = ['0'] +# Gamma_Values = ['0'] print('(Input) Gamma_Values:', Gamma_Values) for gamma in Gamma_Values: @@ -125,7 +125,7 @@ for gamma in Gamma_Values: # SamplePoints_3D = 400 # Number of sample points in each direction # SamplePoints_2D = 7500 # Number of sample points in each direction SamplePoints_2D = 4000 # 4000 # Number of sample points in each direction - SamplePoints_2D = 10 # 4000 # Number of sample points in each direction + SamplePoints_2D = 500 # 4000 # Number of sample points in each direction # if make_3D_PhaseDiagram: # alphas_ = np.linspace(-20, 20, SamplePoints_3D) @@ -167,18 +167,21 @@ for gamma in Gamma_Values: # alphas_ = np.linspace(-20, 20, SamplePoints_2D) # alphas_ = np.linspace(0, 1, SamplePoints_2D) thetas_ = np.linspace(0.01,0.99,SamplePoints_2D) - alphas_ = np.linspace(-5, 5, SamplePoints_2D) + # alphas_ = np.linspace(-5, 5, SamplePoints_2D) # alphas_ = np.linspace(-5, 15, SamplePoints_2D) # thetas_ = np.linspace(0.05,0.25,SamplePoints_2D) - betas_ = 10.0 - # alphas_ = -0.5 - # betas_ = np.linspace(1.01,10.01,SamplePoints_3D) #TEST !!!!! For Beta <1 weird tings happen... + # betas_ = 10.0 + alphas_ = -0.5 + betas_ = np.linspace(1.01,10.01,SamplePoints_3D) #TEST !!!!! For Beta <1 weird tings happen... alphas, betas, thetas = np.meshgrid(alphas_, betas_, thetas_, indexing='ij') harmonicMeanVec = np.vectorize(harmonicMean) arithmeticMeanVec = np.vectorize(arithmeticMean) + prestrain_b1Vec = np.vectorize(prestrain_b1) + prestrain_b2Vec = np.vectorize(prestrain_b2) + # # q1 = (1.0/6.0)*harmonicMean(mu_1, beta, theta) # q2 = (1.0/6.0)*arithmeticMean(mu_1, beta, theta) @@ -189,6 +192,9 @@ for gamma in Gamma_Values: q1 = harmonicMeanVec(mu1, betas, thetas) q2 = arithmeticMeanVec(mu1, betas, thetas) + b1 = prestrain_b1Vec(rho1, betas, alphas, thetas) + b2 = prestrain_b2Vec(rho1, betas, alphas, thetas) + # G, angles, Tq1 = harmonicMeanVec(mu1, betas, thetas)ypes, curvature = classifyMin_anaVec(alphas,betas,thetas, muGammas, mu1, rho1) # Sets q12 to zero!!! # print('size of G:', G.shape) # print('G:', G) @@ -199,6 +205,7 @@ for gamma in Gamma_Values: # VTKOutputName = + path + "./PhaseDiagram2DNEW" elasticRatio = q1/q2 + prestrainRatio = b1/b2 print('type( q1) :', type(q1)) @@ -208,7 +215,20 @@ for gamma in Gamma_Values: GammaString = str(gamma) VTKOutputName = "outputs/ElasticRatio" #+ "Gamma_" + GammaString - gridToVTK(VTKOutputName , alphas, betas, thetas, pointData = {'elasticRatio': elasticRatio} ) + + + classifyMin_anaVec = np.vectorize(classifyMin_ana) + GetMuGammaVec = np.vectorize(GetMuGamma) + muGammas = GetMuGammaVec(betas,thetas,gamma,mu1,rho1,InputFilePath ,OutputFilePath ) + G, angles, Types, curvature = classifyMin_anaVec(alphas,betas,thetas, muGammas, mu1, rho1) # Sets q12 to zero!!! + + + + + + + + gridToVTK(VTKOutputName , alphas, betas, thetas, pointData = {'elasticRatio': elasticRatio, 'prestrainRatio': prestrainRatio, 'Type': Types, 'angles': angles, 'curvature': curvature} ) print('Written to VTK-File:', VTKOutputName )