# NOT RUN {
## Load a particle system
## and simulate its defect accumulation
## primary reinforcement (fibres) and secondary phase (ferrit)
data(AL2MC_15p_k10_F2p_S) # loading SF
## locally clustered spatial domains
data(AL2MC_15p_k10_F2p_CL) # loading CLF
## the box is stored together with the geometry system
box <- attr(SF,"box")
## generate individual failure times
opt <- list("vickers"=107,"distTol"=1,"Tmax"=10^11,
"inAreafactor"=1.56, "outAreafactor"=1.43,
"pointsConvHull"=10, "scale"=1e+06,"pl"=0)
par <- list("P"=c(0.01,10,0.5,80,-15,2),
"F"=c(0,0,0,105,-12,1),
"const"=list("Em"=68.9,"Ef"=400,"nc"=28.2,"nu"=0.33,
"pf"=0.138,"nE"=NULL,"sigref"=276,"Vref"=5891))
# stress amplitude applied
stress <- 120
## generate individual (particles') failure times
CLT <- simTimes(SF,par,vickers=opt$vickers,stress=stress)
T <- unlist(sapply(CLT,`[[`,"T"))
V <- unlist(sapply(CLT,`[[`,"V"))
U <- unlist(sapply(CLT,`[[`,"U"))
## show estimated densities
showDensity(list("Delamination"=log10(V),"Crack"=log10(U),"Time"=log10(T)),xlim=c(-2,15))
## run accumulation
RET <- simDefect(stress,SF,CLT,opt)
#### alternatively run
#SIM <- simFracture(stress,S,opt,par,last.defect=FALSE,CL=CL)
#SIM$cl_info
####
## some simple analysis
LR <- RET[[length(RET)]]
isInCluster <- any(unlist(lapply(CLF,function(x,y)
any(y$id %in% x$id) , y=LR)))
cat("Broken cluster: ", isInCluster,"\t Ferrit: ",
any("F" %in% LR$label),"\t Acc.size",length(LR$id),"\n")
## select only clusters of size larger than 'msize'
msize <- 1
id <- sapply(RET,function(x) ifelse(length(x$id)>msize,TRUE,FALSE))
cat("Number of defect projections in last cluster: ",length(RET[[length(RET)]]$id),"\n")
## draw all accumulation paths until failure
dev.new()
L <- plotDefectAcc(RET,last.path=FALSE)
## plot last
## get particle id numbers of last cluster
# qid <- LR$id
# cylinders3d(SF[qid],box=box, col=c("#0000FF","#00FF00","#FF0000","#FF00FF"))
## drawing only last cluster leading to failure
# drawDefectProjections(SF,list(LR))
# }
Run the code above in your browser using DataLab