From 0736032b93998976f4cd3821acf99e9a2fa19458 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..444b2c133dc12c1e9e08d2a9c3bb855756d7c47c
GIT binary patch
literal 1172
zcmbVK&1%~~5Z;w!MYiMEX`xM^lwMuhiYC|46q=Soz!;K3*^3dHtt@OyVs;HNB)1;>
zB6*6uLeDxCdh#pu)EQYx94I7om-%IOznyRPOQ+Kkw61=1V<hi42kXnB;5~`4q(Fe2
z3dPo$%F|WsD5uK1%B`%YJaEDLE>r^=$_HO<0PVz40r}0^Z;{`I0GgEFgch`^z5|=k
zA-e@z&?Vaic_R9~B_WGJUzYM^EZMJ@OP1vWiTO$j<b?$1!Z{b<?h5eE<x?>c_=@7j
zdJN8qpq#Uo8`d@cx!e&G4~Nh=p<74<Jz-;z(Dk%_9xnL>$f{2Lx>_<v*U{mn=)0vn
zD;svKZB+W-qS)q$4L-)|&v7`;XF8lrqqzx>w3*nv2#@BOetoKqO|v8f4rXbLxv@Bp
z?HqNOXgXvu)h3)pR%04X-xP~-JIx@CBSQEz&tjYAS(`A-7AYY;+Amh(@NmVF=~B(q
z<QDTHjh91C9<bUab%$MUk>6Xf`-~hQZox@h(&SZ^yu?k2rAv2!e0N1m)#jx{pA$EI
zW0S(NS0FWsQJRg4ab)z{kCZh`ppdvt`v2d6T{^zP>)m)2{6CTRK2y;(@}q|!OYW9>
zzhk-kzB9OO93KL{f4m0%nEZaP^k}YQwNotYIL}5DV0t#n3yl$v)hIu<i$a^y$xZ2+
zg{da0{2|k5RC`6|h-=jD^%ogN7}2-UXllCay1jeq_UgL*d+PS9nIY4M+{W6tZ<!Ac
gW;x8K`W=5M^PE&5>+J_mJl~T+i^L=81a9E|1#TVsLjV8(

literal 0
HcmV?d00001

diff --git a/materials/__pycache__/material_neukamm.cpython-38.pyc b/materials/__pycache__/material_neukamm.cpython-38.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f077d3db1ae6d8c15bcd7f2a1addeacdd7531020
GIT binary patch
literal 821
zcmbVK&2G~`5T4z&6DLrvfK;iyp`aE6y`mP0o})?u3FU%}XX`|c<7(EHKuT|Y2c98M
z!7Fgi38|;NLQnnHO^GXUK#VoN-q~-yu|MtX^a=9grkB15h^~Fo7LDXR)E&Suv6|7C
zShKmJvEqP3c+DN|!W)jb2OqE+(V)LZ2Mtr@-9`+&*AGzl8HUxRVtuI>#O671uuxAa
zCpkbKwsY1aLQS`7XPYyfg?dJLAZHwoa0`@x-W_JR9`fsC?I#d#Hl^P`*PhmWcCw^_
zS*dU1u$tH^8F$W;v?@ig4r<KJD4vvsjq_PjyZF?)yeco^(|T?XKU!B!=UL1?DW<8E
zu97;fYO!%<(NxLQy0}OxE7N55Wp3*{DT-GY-&g8<9{}zN45<Lm{+(*+qViyEe)bUB
ztZf$oV`;221B<Bfh%%Fb{?ZJ^(`y(v^DmY7?kyqdAYJLNZ(hPXf0&f`|KR^oB|`fh
zLhn!1Y;c41_7LTJtVjQXr930>d*D68fgWzj$=~6QUbo;LBOZjS0H0yfY_}mRehTsL
bTASI99K9<_u4nexZ{K-((O%S#Ok{2Wxvhu*

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
zcmbVK&1%~~5Z+zMieksHb7>POrB|1>qRBNhg{GwtFovX1_F{x)D+}9_m|a5*$*oV)
zTb`n?(6dg3p8N_ubw*ZN=akT0=9?d8cXqznPu*@?&^r6pOOUKz>})PY&RY`e2ta_G
z3C&u~<i*-oTGeq+d$snp4<7hmg>FGh2N38jpq(lmlD*y7ZL&KM!ZyWspbZ_$@4^mr
zN$<ig^hozWo{K?$MU};HAS?Mik!&~1BhB)T#C|3Kc`ZR*t1AKCfdKzXJ{D7fFUW6g
z`k>AQ#neV@)Z_$La$ih+96{@xZXpr$gsovp*VFoOvf>vYLlgS>eZ?HzdM7tx;8pTc
zx7@_ISO;I?#1)7wKF08S6ite`iKer7VWU%Hr>-cY(?xDxUKs1LJdJ>zd6r;d9WD~L
zKog~g4mr$>jpng4n8mZPqx@Ipvf9gX$dZ`Kd|2d(%Zj{1h3qbYkUs5aYf%_dWW}86
z?aUSqi!w`ABMu%j91z^0nET{M*Azb?1BhTysYggwt;tHgl&HG#hRAo<?9{#9NDMge
zw|U$mx9XQjFUL5`$K@op=Jk7uT4qs5>=FL|8?Z~q*Y&vl`zjxPq@>%*{fAVR+%5Hf
zM|1ZBHT>5&KBV~3*+%g_vIqUjr{PZYez|m$A|I23+2yz>4aPiHtAoTXOJgfl*vhj@
zTTfI6Bc{>n&YI3K=jemme=>?OroUs*Hgq?6hxg<iHhD+)<Q>&BL#7Y8jSbT4!Phen
hkLLv}X66llDf^Tll+6ypM}FYTuubBVbVD!n{s3HQ`s)Ay

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
zcmZWozi-n(6u$G>soN$+Kp<4=f|Ml^)QANMML=l>Sh5tBP*g=e%XJ(7=$$PQ$(dl_
z&uGW~OP-LJx-m2Hy{pqW<*fJad*}1J``-KfxzpKT7=MmBe&1&7HwDdMA$SMVLpaGK
zpRzHRmJ~nO*pjw%Fbmm|YnW~6%5}_++>o1?Te2-XnAapfWP`11WMCto(^L<_4s0K$
zci<$?*#$4zCBLvP*#h@immz~S3b6&_*V}=ptRx#d6Qw4z@p`T%iOy0TT=9zUT`@&T
z|9<gK(m3$WrjtT@2Z27z)66?4lHmELK<7~sdXj=T@>QyHRrq<K0xt~kQLdsud)X{M
zNt5Gvg7DjMngwc-M`@yWvsoqdEJneYrV25x*5Lo+Ca`F@^#Mw-+cpMd0l|8-Du7`<
zaJ;fdii&b=9Hll?6eYSr#7wo|DhI6nzy(~~VH4Pgt&H0{P@}1$l3!9ktkE^S8d!>s
z8M~1Tl03?1jboN)Ssx`OUmVl{_6>0W8g!v`*gi}vIEiB<55?U%6mu&F_3!+Eef=;O
zxA^tkzQxbxPHB}WNohL_o*C=_@shl~4MDtOf(_aE@chMjzqC*~aZ@_g#_`aB15Jd%
zprxow6@OoeJkBZ}Rs6K#XAPF7n08!D^DVkPea`rf)uxB<a`hPT3Rx-(nIU@waF^sF
zULpIkLAF1)Yf_*BQiiHgLrojRYFdgerS8EE979Fjr-cXP9+K;lGo4ztOYBLxjdg8)
zZob3Yc=}xRu(m>ldPvGORDJ^BTIk!2OuNenQf)-IZkL6^>?I*%fBm+Wbt7u-1#ax6
zXqlIydT%HWnIc^qS`g?X!qmpQJRMDKdx|#;Wj+BOxML?N;%sJ=ZT?I}>Qy9L(@s+e
eMSB|=m*sPZaVm>x@P__EBM4WxHcYsiuKN$#=-&kZ

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