% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/simLife.R
\name{woehler}
\alias{woehler}
\title{Woehler experiment}
\usage{
woehler(S, CL, param, opt, stress, cl = NULL,
  parallel.option = getOption("parallel.option", "lapply"))
}
\arguments{
\item{S}{non-overlapping object system}

\item{CL}{predefined clustered regions of objects, see \code{\link{simFracture}}}

\item{param}{parameter list for random generation of individual failure times}

\item{opt}{control parameters, see \code{\link{simTimes}}}

\item{stress}{list of stress levels}

\item{cl}{optional, parallel cluster object (see \code{\link[snow]{makeCluster}})}

\item{parallel.option}{optional, if \code{parallel.option=mclapply} the function \code{\link[parallel]{mclapply}}
is used, otherwise the function \code{lapply}.}
}
\value{
matrix of failure times, first colunm corresponds to the times
						   and the second to the stress level
}
\description{
Simulate a Woehler experiment
}
\details{
As done in a real life scenario the Woehler diagram measures the applied stress amplitude versus load cycles.
For each given stress level the function is intended to be an all-in-one wrapper function for fatigue
lifetime model simulations for different stress levels which returns a matrix of failure times where 
each row corresponds to one stress level. The Woehler experiments can be simulated in parallel based
on using the package \code{snow} possibly together with \code{Rmpi} for an \code{MPI} cluster object.
}
\examples{
\dontrun{

## For use with parallel package
# library("parallel")
# options(mc.cores=detectCores())
# options(parallel.option="mclapply")

# primary particles and secondary phase (ferrit) 
# which is already clustered and densified 
data(AL2MC_20p_k10_F2p_S)	

# simulation parameters 
opt <- list("vickers"=107,"distTol"=0.5,
			"inAreafactor"=1.56, "outAreafactor"=1.43, 
			"pointsConvHull"=10, "scale"=1e+06,"pl"=0)

# lifetimes parameters
par <- list("P"=c(0.01,10^12,10,105,-13,0.05),
			"F"=c(0.01,10^12,10,98,-12,0.05))
	
nsim <- 15
stress <- as.list(seq(from=90,to=140,by=10))

## For use of SOCKS or MPI cluster do the following
# library("snow")
# cl <- makeCluster(6)
## or	
# cl <- makeSOCKcluster(6)
# clusterEvalQ(cl,library("simLife"))

cl <- NULL	
# the following code may take some time
W <- woehler(S, CL=NULL, par, opt, stress=rep(stress,each=nsim))

woehlerDiagram(W, yrange=c(65,145), cl=cl)

## do not forget to stop cluster if used 
# stopCluster(cl)
	
}
}
\author{
Markus Baaske
}

