From 50bddafa3b5aaec1df3a317f2aab32adb20a3410 Mon Sep 17 00:00:00 2001 From: Klaus <klaus.boehnlein@tu-dresden.de> Date: Wed, 31 Aug 2022 20:05:27 +0200 Subject: [PATCH] rename geometries-folder to materials --- materials/__pycache__/material.cpython-38.pyc | Bin 0 -> 1172 bytes .../material_neukamm.cpython-38.pyc | Bin 0 -> 821 bytes .../__pycache__/material_test.cpython-38.pyc | Bin 0 -> 1177 bytes .../python_matrix_operations.cpython-38.pyc | Bin 0 -> 1332 bytes .../two_phase_material.cpython-38.pyc | Bin .../two_phase_material_1.cpython-38.pyc | Bin .../two_phase_material_2.cpython-38.pyc | Bin .../two_phase_material_3.cpython-38.pyc | Bin materials/material_backup.py | 251 ++++++++++++++++++ {geometries => materials}/material_neukamm.py | 0 .../material.py => materials/material_test.py | 4 +- .../python_matrix_operations.py | 0 .../two_phase_material_1.py | 0 .../two_phase_material_2.py | 0 .../two_phase_material_3.py | 0 15 files changed, 253 insertions(+), 2 deletions(-) create mode 100644 materials/__pycache__/material.cpython-38.pyc create mode 100644 materials/__pycache__/material_neukamm.cpython-38.pyc create mode 100644 materials/__pycache__/material_test.cpython-38.pyc create mode 100644 materials/__pycache__/python_matrix_operations.cpython-38.pyc rename {geometries => materials}/__pycache__/two_phase_material.cpython-38.pyc (100%) rename {geometries => materials}/__pycache__/two_phase_material_1.cpython-38.pyc (100%) rename {geometries => materials}/__pycache__/two_phase_material_2.cpython-38.pyc (100%) rename {geometries => materials}/__pycache__/two_phase_material_3.cpython-38.pyc (100%) create mode 100644 materials/material_backup.py rename {geometries => materials}/material_neukamm.py (100%) rename geometries/material.py => materials/material_test.py (96%) rename {geometries => materials}/python_matrix_operations.py (100%) rename {geometries => materials}/two_phase_material_1.py (100%) rename {geometries => materials}/two_phase_material_2.py (100%) rename {geometries => materials}/two_phase_material_3.py (100%) diff --git a/materials/__pycache__/material.cpython-38.pyc b/materials/__pycache__/material.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..444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cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f077d3db1ae6d8c15bcd7f2a1addeacdd7531020 GIT binary patch literal 821 zcmWIL<>g{vU|^X3i!)iBg@NHQh=Yuo7#J8F7#J9ebr={JQW#Pga~Pr+QkYVhTNt7k zQ&>`1TNt94QrJ@1TNt94Q#evMTNt8PQW%37G`U`a%<)TR1W{1T%)r0^!p<NQBS0oH z)-t9r)iTvEq%cb|q_EU5iZf(06zSA3q_86MQ<#DoY8X<Oki-I@YS?NRB^a_<iULwt zgBenogBem7f*CZ~{n8<JUa)@&azPP@fC@d>{}SXa7|(tsgC_GW#)>G`l8n@n#3;73 z#N?9vq9PUs1_m(kD_B1xKQ~oBJ14QUSl=bJIJ+djK;NY_FI6`rwYVfRFI_(c#L3M} zF3K-1DJo4aDJ@FXPfyLyO)V+POfA;WO)N<*%1q3O&r2=MPRz~KE2zB1n5F;<1wN27 z8Ce)v7!@Fxsfe9{fdM7hKyGJcU|;|Tn+!PEQkYVh(wS43QW&8$Qwn1`b2@V{!%Akq zB9QmMJ_fsgC1VjtH<%3}*cccXZZRbpYJpq;Qp~_u1WE_w+gii{3#}qfI13ztP`iwD zk?i6o#)pg`AEhvYU^+911o1&W)MWBQcn*hk#s)~%@h~tjXtLg7$xSTD0EaHvvqd0R n6oKR*fdY0dm;gJO!zMRBr8Fni4ix&uAn$R=b8vAmb1(w{xvhu* literal 0 HcmV?d00001 diff --git a/materials/__pycache__/material_test.cpython-38.pyc b/materials/__pycache__/material_test.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1dfcaeea6e9e18505d515bf97694734c7d04784c GIT binary patch literal 1177 zcmWIL<>g{vU|{fG#GhQm#lY|w#6iYP3=9ko3=9m#B@7G<DGVu$ISf%Cnkk1d1Vl6D zFhwze#hIg+!8A)0OA2!eOAA93YYJ-=TMAngdkT9Bdpc7TM+#dMCzQ>V!WPAy!jZz6 z&J@Ly!j;0^!Vtxq!jr<=!Vtxm!k5C|!Vtxu!Whh;Dew~H9zRXSTZ~%Cj371?GczzS zfUq;jc@ZGzG1fAsFx4{EFr+X`GNiE7Fp4u|GZg96Fr=^|^HZ3D8EP0(n2^K*plaA^ z7$q38S&9NuSc4f-n1dNo7=jrz+5OTXc3!Z5335RZh=2+`*#8m~MlhcJN(N2lTZ|P^ ztR)$#C5cgNX^F`t`9(#n3=9ll;#YuvMt*Lpes)e`X|cXbYH@Z+eu2JAX<n*sNNRCO zW?s5}3W$@NnOu}#TvAk;TvA$;s-K>kpPO1zl$lzrpPN{cT9lcX6JL^AT%uP{c}p-e zFC{ZMu_V99tu!yWBr`vc8x$mbAU89zFtRWzKrmAg2Ll7cOHi0aab_0hmlWj}WG251 z014WF2uTJ829zKM`4i-Fa1hIYgE)mLg(;mmg(-y*N;9P}rZcBA2Q#c>_A3IJ4GtZ! zUso~~vBCTe7ARt8U|_f<P*9XwTvC*nnHOJ>kyxB+=n8T!C=?kOi})#WLlH0BK9Khz zmV$hM-DV>XB%1|@v6&I%+Z09+OlJm>AU??VnoNEOj~5YRxv@8r<$??h44MMBSaK6f zGNL33DoZl*^Wt+8ONufp;`0kqixNT6S{%ieTvAz(T6~KszxWn&ab+<$Mx)pQK*3lX z#SID0c#xVXNmx1wNGwXsO)W_+DuxC(RGkq4bw*Hi#st(EgX63S6nsS>Zy*IaBIG%2 ra`RJ4b5iX<Nvc?mfq{X85enHj#8}u^7&*9D7&%y27&&-3m^qjMTxt62 literal 0 HcmV?d00001 diff --git a/materials/__pycache__/python_matrix_operations.cpython-38.pyc b/materials/__pycache__/python_matrix_operations.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9aaa3d38b1a8b5256d89828869ca69253aec7e9f GIT binary patch literal 1332 zcmWIL<>g{vU|{$V!<($a!octt#6iYP3=9ko3=9m#HVh05DGVu$ISf&ZDNHHMEeugi zDJ&_hEeui2DQqe1EeugCDI6)BEeuhtDO@SsEeug?DLg5>EeuiYDU87kntU%o=K3Ww zf+#2ku~``y7@R>i$bf8MEMZu{Si`W8aRJjp1{hnML4+ZgL6gZZ9is1ny(aT5ro4hE z*2JQs#L6hnlA^@C;)49*)Rm047#&wK6oCx=6|J9<pPQ<mos(EvtnZRqoL!P%pzl(e zm#Q0*T3nKum#&`z;^bx~7v&e16qP2IloqAxr>ExUrj`_CrWWfLRF-7q=f&qHmK0@H z#OD{J7A2Ns=I0gb6;$40F0RaF0XZ8KLJW*W><kPH7=B}h`Avm^fuV*Wg;5fWYZy|P zB*9o5B+4wwkism<AkGlXu#&~E2oxwU!34-?uvdye20>ULpB1q&FfiO=Eh$P&PUS#y z12@PGkRU>kAg$o=1w}L{L{k_Sg5rb8?<Gh|lc@+~O%z9FN@`w7W=SQIH3++yJX1i1 z7lV{CFc$HGECREk_JAD33G-|bI3iORQy9~kK_oJr&Rok>!jQt$%;>@p>ru-LXIs^> zz}Y&rtTjwE%#sW>EUXNY3^fd3Hmf8<4Py<6WRYYLVK8T4X0Tx>v?(+wRH<PKW?0D# z3A!R41_p+ejJH^e67$kiHQ9<lv2=^k=@xTIZow_a%v+3Ew-~dLd<k;<EtcHUoDx1z zSc0@OFv>9TfFPqDW04rTXF<UN!r)MiA=a}-NS;-xWr2E%1?(xXS3xNN=4~4Wn74{R zjw<43U|`T>1$(7Pkb!}rNC-p-g9s520dfw+OJLtHJEo*af;<C?a|T8kMjl2UMis^) zadfYM;t-T_!CvVAC(;^5STYp>g*=4E1PbvQ2B;h}h?mX`=7SP4BZv>@A=HB8kkx_` zIzlaohfoXRLDi-+2Qw6b(lyvenoLEaATNTV5i9^9!2V<{21T19$fqEmFfbNLfC7pm ziZ!n^x1bW7vcWmC2$Xuk$rc=);D7+Dg&2kwd>l5p`6;D2sdk`TSPV)K9LyXn9LyZd I9NZin0NUu^1poj5 literal 0 HcmV?d00001 diff --git a/geometries/__pycache__/two_phase_material.cpython-38.pyc b/materials/__pycache__/two_phase_material.cpython-38.pyc similarity index 100% rename from geometries/__pycache__/two_phase_material.cpython-38.pyc rename to materials/__pycache__/two_phase_material.cpython-38.pyc diff --git a/geometries/__pycache__/two_phase_material_1.cpython-38.pyc b/materials/__pycache__/two_phase_material_1.cpython-38.pyc similarity index 100% rename from geometries/__pycache__/two_phase_material_1.cpython-38.pyc rename to materials/__pycache__/two_phase_material_1.cpython-38.pyc diff --git a/geometries/__pycache__/two_phase_material_2.cpython-38.pyc b/materials/__pycache__/two_phase_material_2.cpython-38.pyc similarity index 100% rename from geometries/__pycache__/two_phase_material_2.cpython-38.pyc rename to materials/__pycache__/two_phase_material_2.cpython-38.pyc diff --git a/geometries/__pycache__/two_phase_material_3.cpython-38.pyc b/materials/__pycache__/two_phase_material_3.cpython-38.pyc similarity index 100% rename from geometries/__pycache__/two_phase_material_3.cpython-38.pyc rename to materials/__pycache__/two_phase_material_3.cpython-38.pyc diff --git a/materials/material_backup.py b/materials/material_backup.py new file mode 100644 index 00000000..141ccab4 --- /dev/null +++ b/materials/material_backup.py @@ -0,0 +1,251 @@ +import math +from python_matrix_operations import * +import ctypes +import os +import sys + + +Phases=3 + +mu_ = [80, 80, 60] +lambda_ = [80, 80, 25] + + +phase1_type="isotropic" +materialParameters_phase1 = [80, 80] + +phase2_type="isotropic" +materialParameters_phase2 = [80, 80] + +phase3_type="isotropic" +materialParameters_phase3 = [60, 25] + + +# print('mu_:', mu_) +# A = [[1, 5, 0], [5,1,0], [5,0,1]] +# +# print("sym(A):", sym(A)) + + +# dir_path = os.path.dirname(os.path.realpath("/home/klaus/Desktop/Dune-Testing/dune-microstructure/dune/microstructure/matrix_operations.hh")) +# handle = ctypes.CDLL(dir_path) +# +# handle.create2Darray.argtypes = [ctypes.c_int, ctypes.c_double, ctypes.c_double] +# +# def create2Darray(nside, mx, my): +# return handle.create2Darray(nside, mx, my) + + +#Indicator function that determines both phases +# x[0] : y1-component +# x[1] : y2-component +# x[2] : x3-component +# --- replace with your definition of indicatorFunction: +############### +# Wood +############### +# def f(x): +# theta=0.25 +# # mu_ = [3, 5, 6] +# # lambda_ = [9, 7, 8] +# # mu_ = 3 5 6 +# # lambda_ = 9 7 8 + +# if ((abs(x[0]) < theta/2) and x[2]<0.25): +# return [mu_[0], lambda_[0]] #latewood +# # return 5 #latewood +# elif ((abs(x[0]) > theta/2) and x[2]<0.25): +# return [mu_[1], lambda_[1]] #latewood +# # return 2 +# else : +# return [mu_[2],lambda_[2]] #latewood #Phase3 +# # return 1 + +def indicatorFunction(x): + theta=0.25 + factor=1 + if (x[0] <-1/2+theta and x[2]<-1/2+theta): + return 1 #Phase1 + elif (x[1]< -1/2+theta and x[2]>1/2-theta): + return 2 #Phase2 + else : + return 0 #Phase3 + + +def L1(G): + return 2.0 * mu_[0] * sym(G) + lambda_[0] * trace(sym(G)) * Id() #Phase1 + +def L2(G): + return 2.0 * mu_[0] * sym(G) + lambda_[0] * trace(sym(G)) * Id() #Phase1 + +def L3(G): + return 2.0 * mu_[0] * sym(G) + lambda_[0] * trace(sym(G)) * Id() #Phase1 + + +# TEST + +# def L1(G): +# return Add(smult(2.0 * mu_[0], sym(G)),smult(lambda_[0] ,smult(trace(sym(G)),Id()) )) #Phase1 + +# def L2(G): +# return Add(smult(2.0 * mu_[1], sym(G)),smult(lambda_[1] ,smult(trace(sym(G)),Id()) )) #Phase1 + +# def L3(G): +# return Add(smult(2.0 * mu_[2], sym(G)),smult(lambda_[2] ,smult(trace(sym(G)),Id()) )) #Phase1 + + +#Workaround +def muValue(x): + return mu_ + +def lambdaValue(x): + return lambda_ + + + + + +############### +# Cross +############### +# def f(x): +# theta=0.25 +# factor=1 +# if (x[0] <-1/2+theta and x[2]<-1/2+theta): +# return 1 #Phase1 +# elif (x[1]< -1/2+theta and x[2]>1/2-theta): +# return 2 #Phase2 +# else : +# return 0 #Phase3 + + + + + +# def f(x): +# # --- replace with your definition of indicatorFunction: +# if (abs(x[0]) > 0.25): +# return 1 #Phase1 +# else : +# return 0 #Phase2 + +def b1(x): + return [[1, 0, 0], [0,1,0], [0,0,1]] + +def b2(x): + return [[1, 0, 0], [0,1,0], [0,0,1]] + +def b3(x): + return [[0, 0, 0], [0,0,0], [0,0,0]] + +# mu=80 80 60 + +# lambda=80 80 25 + + +# --- elasticity tensor +# def L(G,x): +# def L(G): +# # input: symmetric matrix G, position x +# # output: symmetric matrix LG +# return [[1, 1, 1], [1, 1, 1],[1, 1, 1]] + + + + + + + + + +# --- elasticity tensor +def L(G,x): + # input: symmetric matrix G, position x + # output: symmetric matrix LG + theta=0.25 + if (x[0] <-1/2+theta and x[2]<-1/2+theta): + return 2.0 * mu_[0] * sym(G) + lambda_[0] * trace(sym(G)) * Id() #Phase1 + elif (x[1]< -1/2+theta and x[2]>1/2-theta): + return 2.0 * mu_[1] * sym(G) + lambda_[1] * trace(sym(G)) * Id() #Phase2 + else : + return 2.0 * mu_[2] * sym(G) + lambda_[2] * trace(sym(G)) * Id() #Phase3 +# # # 2.0 * mu * sym(E1) + lambda * trace(sym(E1)) * Id(); + + +# def L(G,x): +# # input: symmetric matrix G, position x +# # output: symmetric matrix LG +# theta=0.25 +# if (x[0] <-1/2+theta and x[2]<-1/2+theta): +# # return 2.0 * mu_[0] * sym(G) + lambda_[0] * trace(sym(G)) * Id() #Phase1 +# return Add(smult(2.0 * mu_[0], sym(G)),smult(lambda_[0] ,smult(trace(sym(G)),Id()) )) +# elif (x[1]< -1/2+theta and x[2]>1/2-theta): +# return Add(smult(2.0 * mu_[0], sym(G)),smult(lambda_[0] ,smult(trace(sym(G)),Id()) )) #Phase2 +# else : +# return Add(smult(2.0 * mu_[0], sym(G)),smult(lambda_[0] ,smult(trace(sym(G)),Id()) )) #Phase3 +# # return [[0, 0, 0], [0,0,0], [0,0,0]] #Phase3 + + +##TEST +# def L(G,x): +# # input: symmetric matrix G, position x +# # output: symmetric matrix LG +# theta=0.25 +# if (x[0] <-1/2+theta and x[2]<-1/2+theta): +# return [[1, 1, 1], [1, 1, 1],[1, 1, 1]] +# elif (x[1]< -1/2+theta and x[2]>1/2-theta): +# return [[x[0], 1, x[0]], [1, 1, 1],[x[0], x[0], x[0]]] +# else : +# return [[0, x[2], x[2]], [0,x[2],0], [0,0,0]] + + +##TEST +# def L(G,x): +# # input: symmetric matrix G, position x +# # output: symmetric matrix LG +# theta=0.25 +# if (x[0] <-1/2+theta and x[2]<-1/2+theta): +# return sym([[1, 1, 1], [1, 1, 1],[1, 1, 1]]) +# elif (x[1]< -1/2+theta and x[2]>1/2-theta): +# return sym([[x[0], 1, x[0]], [1, 1, 1],[x[0], x[0], x[0]]]) +# else : +# return sym([[0, x[2], x[2]], [0,x[2],0], [0,0,0]]) + + + +# # small speedup.. +# def L(G,x): +# # input: symmetric matrix G, position x +# # output: symmetric matrix LG +# theta=0.25 +# if (x[0] <-1/2+theta and x[2]<-1/2+theta): +# return mu_[0] * (np.array(G).transpose() + np.array(G)) + lambda_[0] * (G[0][0] + G[1][1] + G[2][2]) * np.identity(3) #Phase1 +# elif (x[1]< -1/2+theta and x[2]>1/2-theta): +# return mu_[1] * (np.array(G).transpose() + np.array(G)) + lambda_[1] * (G[0][0] + G[1][1] + G[2][2]) * np.identity(3) #Phase2 +# else : +# return mu_[2] * (np.array(G).transpose() + np.array(G)) + lambda_[2] * (G[0][0] + G[1][1] + G[2][2]) * np.identity(3) #Phase3 +# # 2.0 * mu * sym(E1) + lambda * trace(sym(E1)) * Id(); + + + + + + +# def H(G,x): +# # input: symmetric matrix G, position x +# # output: symmetric matrix LG +# if (abs(x[0]) > 0.25): +# return [[1, 1, 1], [1, 1, 1],[1, 1, 1]] +# else: +# return [[0, 0, 0], [0,0,0], [0,0,0]] + + +def H(G,x): + # input: symmetric matrix G, position x + # output: symmetric matrix LG + if (abs(x[0]) > 0.25): + return [[1, 1, 1], [1, 1, 1],[1, 1, 1]] + else: + return [[0, 0, 0], [0,0,0], [0,0,0]] + +# 2.0 * mu * sym(E1) + lambda * trace(sym(E1)) * Id(); diff --git a/geometries/material_neukamm.py b/materials/material_neukamm.py similarity index 100% rename from geometries/material_neukamm.py rename to materials/material_neukamm.py diff --git a/geometries/material.py b/materials/material_test.py similarity index 96% rename from geometries/material.py rename to materials/material_test.py index b2756eb6..fed02ba5 100644 --- a/geometries/material.py +++ b/materials/material_test.py @@ -50,7 +50,6 @@ materialParameters_phase1 = [80, 80] phase2_type="isotropic" materialParameters_phase2 = [80, 80] - #- PHASE 3 phase3_type="isotropic" materialParameters_phase3 = [60, 25] @@ -65,7 +64,8 @@ materialParameters_phase3 = [60, 25] # [0.0, 0.0, 0.0, 0.0 , 0.0, 1.0]]) -# define prestrain function for each phase +#--- define prestrain function for each phase +# (also works with non-constant values) def prestrain_phase1(x): return [[1, 0, 0], [0,1,0], [0,0,1]] diff --git a/geometries/python_matrix_operations.py b/materials/python_matrix_operations.py similarity index 100% rename from geometries/python_matrix_operations.py rename to materials/python_matrix_operations.py diff --git a/geometries/two_phase_material_1.py b/materials/two_phase_material_1.py similarity index 100% rename from geometries/two_phase_material_1.py rename to materials/two_phase_material_1.py diff --git a/geometries/two_phase_material_2.py b/materials/two_phase_material_2.py similarity index 100% rename from geometries/two_phase_material_2.py rename to materials/two_phase_material_2.py diff --git a/geometries/two_phase_material_3.py b/materials/two_phase_material_3.py similarity index 100% rename from geometries/two_phase_material_3.py rename to materials/two_phase_material_3.py -- GitLab