Skip to content
Snippets Groups Projects
parametrized_laminate.py 1.85 KiB
import math
from python_matrix_operations import *
import ctypes
import os
import sys
#---------------------------------------------------------------


#--- define indicator function
def indicatorFunction(x):
    theta=0.25
    factor=1
    if (abs(x[0]) < (theta/2) and x[2] < 0 ):
        return 1    #Phase1
    elif (abs(x[0]) > (theta/2) and x[2] > 0 ):
        return 2    #Phase2
    elif (abs(x[0]) < (theta/2) and x[2] > 0 ):
        return 3    #Phase3
    else :
        return 4    #Phase4


########### Options for material phases: #################################
#     1. "isotropic"     2. "orthotropic"      3. "transversely_isotropic"   4. "general_anisotropic"
#########################################################################
## Notation - Parameter input :
# isotropic (Lame parameters) : [mu , lambda]
#         orthotropic         : [E1,E2,E3,G12,G23,G31,nu12,nu13,nu23]   # see https://en.wikipedia.org/wiki/Poisson%27s_ratio with x=1,y=2,z=3
# transversely_isotropic      : [E1,E2,G12,nu12,nu23]
# general_anisotropic         : full compliance matrix C
######################################################################

# --- Number of material phases
Phases=4

#--- Define different material phases:

#- PHASE 1
phase1_type="isotropic"
materialParameters_phase1 = [2.0, 0]   

#- PHASE 2
phase2_type="isotropic"
materialParameters_phase2 = [1.0, 0]   

#- PHASE 3
phase3_type="isotropic"
materialParameters_phase3 = [2.0, 0]

#- PHASE 4
phase4_type="isotropic"
materialParameters_phase4 = [1.0, 0]


#--- define prestrain function for each phase
# (also works with non-constant values)
def prestrain_phase1(x):
    return [[2, 0, 0], [0,2,0], [0,0,2]]

def prestrain_phase2(x):
    return [[1, 0, 0], [0,1,0], [0,0,1]]

def prestrain_phase3(x):
    return [[0, 0, 0], [0,0,0], [0,0,0]]

def prestrain_phase4(x):
    return [[0, 0, 0], [0,0,0], [0,0,0]]