Skip to content
Snippets Groups Projects
Commit a7fb74b5 authored by Neukamm, Stefan's avatar Neukamm, Stefan
Browse files

beispiel

parent 9e0aa2f0
No related branches found
No related tags found
No related merge requests found
......@@ -6,9 +6,16 @@ import math
# x[1] : y2-component
# x[2] : x3-component
def f(x):
theta=0.5
factor=.9
theta=0.25
factor=1
# --- replace with your definition of indicatorFunction:
#
# if ((abs(x[0]) < theta/2) and x[2]<0):
# return 1 #Phase1
# else :
# return 0 #Phase3
#
if ((abs(x[0]) < theta/2) and x[2]<-1/2+theta):
return 1 #Phase1
elif ((abs(x[1]) < factor*theta/2) and x[2]>1/2-factor*theta):
......@@ -18,10 +25,10 @@ def f(x):
def b1(x):
return [[1, 4, 5], [-5, 8, 9], [-5, 8, 0]]
return [[1, 0, 0], [0,1,0], [0,0,1]]
def b2(x):
return [[9, 1, 9], [1, 9, 1], [1, 1, 9]]
return [[1, 0, 0], [0,1,0], [0,0,1]]
def b3(x):
return [[0,0,0], [0, 0, 0], [0, 8, 0]]
return [[0, 0, 0], [0,0,0], [0,0,0]]
......@@ -27,7 +27,7 @@ cellDomain=1
## {start,finish} computes on all grid from 2^(start) to 2^finish refinement
#----------------------------------------------------
numLevels=4 4
numLevels=2 4
#numLevels = 1 1 # computes all levels from first to second entry
#numLevels = 2 2 # computes all levels from first to second entry
#numLevels = 1 3 # computes all levels from first to second entry
......@@ -64,9 +64,9 @@ lambda1=1.0
# better: pass material parameters as a vector
mu=80 60 20
lambda=80 25 10
rho=1.0 0
mu=80 80 60
lambda=80 80 25
#rho=1.0 0
# ---volume fraction (default value = 1.0/4.0)
......@@ -96,8 +96,8 @@ material_prestrain_imp= "material_neukamm" #(Python-indicator-function with sa
# --- (Optional output) write Material / prestrain / Corrector functions to .vtk-Files (default=false):
write_materialFunctions = true
write_prestrainFunctions = true # VTK norm of B ,
#write_materialFunctions = true
#write_prestrainFunctions = true # VTK norm of B ,
#write_VTK = true
......
......@@ -7,6 +7,7 @@ Created on Wed Jul 6 13:17:28 2022
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from helper_functions import *
......@@ -50,11 +51,12 @@ elif case==-1: # Read from outputs
QFilePath = os.path.dirname(os.getcwd()) + '/outputs/QMatrix.txt'
BFilePath = os.path.dirname(os.getcwd())+ '/outputs/BMatrix.txt'
Q, B = ReadEffectiveQuantities(QFilePath,BFilePath)
Q=0.5*(np.transpose(Q)+Q) # symmetrize
B=np.transpose([B])
#
#
length=2
length=80
N=200
h=length/N
E=np.zeros([N,N])
......@@ -62,11 +64,9 @@ X=np.zeros([N,N])
Y=np.zeros([N,N])
for i in range(0,N):
for j in range(0,N):
x=(i-N/2)*h
y=(j-N/2)*h
X[i,j]=(i-N/2)*h
Y[i,j]=(j-N/2)*h
K=xytokappaalpha(x,y)
K=xytokappaalpha(X[i,j],Y[i,j])
E[i,j]=energy(K[0],K[1],Q,B)
fig = plt.figure(figsize=(7,6))
......@@ -75,7 +75,7 @@ ax.set_aspect(1)
ax.set_xticks([-length/4,0,length/4])
ax.set_yticks([])
#pcm = plt.pcolor(X,Y,E, norm=colors.LogNorm(vmin=E.min(), vmax=E.max()), cmap='winter', shading='auto')
pcm = plt.pcolor(X,Y,E, norm=colors.PowerNorm(gamma=0.3), cmap='winter', shading='auto')
pcm = plt.pcolor(X,Y,E, norm=colors.PowerNorm(gamma=0.25), cmap='brg')
plt.colorbar(pcm, extend='max')
#plt.imshow(np.log(E-np.min(E)+0.0001)) # normalize to min = 0 and log scale to emphasize energy landscape
# TODO: Beschriftung der Axen sollte von [-h*N/2, h*N/2] sein!
......
......@@ -3,10 +3,7 @@
#set(CMAKE_BUILD_TYPE Debug)#
set(programs Cell-Problem
Cell-Problem_muGamma
Compute_MuGamma
)
set(programs Cell-Problem)
foreach(_program ${programs})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment