Example #1
0
// ContD computes D = dσ_new/dε_new continuous
func (o *VonMises) ContD(D [][]float64, s *State) (err error) {

	// elastic part
	err = o.SmallElasticity.CalcD(D, s)
	if err != nil {
		return
	}

	// only elastic
	if !s.Loading {
		return
	}

	// elastoplastic
	σ := s.Sig
	d1 := 3.0*o.G + o.H
	a4 := 6.0 * o.G * o.G / d1
	sno, _, _ := tsr.M_devσ(o.ten, σ) // ten := dev(σ)
	for i := 0; i < o.Nsig; i++ {
		for j := 0; j < o.Nsig; j++ {
			D[i][j] -= a4 * o.ten[i] * o.ten[j] / (sno * sno)
		}
	}
	return
}
Example #2
0
// ContD computes D = dσ_new/dε_new continuous
func (o *DruckerPrager) ContD(D [][]float64, s *State) (err error) {

	// elastic part
	err = o.SmallElasticity.CalcD(D, s)
	if err != nil {
		return
	}

	// only elastic
	if !s.Loading {
		return
	}

	// elastoplastic
	σ := s.Sig
	d1 := o.K*o.Mb*o.M + 3.0*o.G + o.H
	a1 := o.K * o.K * o.Mb * o.M / d1
	a2 := tsr.SQ6 * o.K * o.G * o.Mb / d1
	a3 := tsr.SQ6 * o.K * o.G * o.M / d1
	a4 := 6.0 * o.G * o.G / d1
	sno, _, _ := tsr.M_devσ(o.ten, σ) // ten := dev(σ)
	for i := 0; i < o.Nsig; i++ {
		for j := 0; j < o.Nsig; j++ {
			D[i][j] -= a1*tsr.Im[i]*tsr.Im[j] +
				a2*tsr.Im[i]*o.ten[j]/sno +
				a3*o.ten[i]*tsr.Im[j]/sno +
				a4*o.ten[i]*o.ten[j]/(sno*sno)
		}
	}
	return
}
Example #3
0
// CalcEps0 computes initial strains from stresses (s.Sig)
//  Note: initial strains are elastic strains => εe_ini := ε0
func (o *HyperElast1) CalcEps0(s *State) {
	s0 := make([]float64, o.Nsig)
	s0no, p0, q0 := tsr.M_devσ(s0, s.Sig)
	ev0 := -p0 / o.K0
	ed0 := q0 / (3.0 * o.G0)
	if !o.le {
		var nls num.NlSolver
		nls.Init(2, func(fx, x []float64) error { // ev=x[0], ed=x[1]
			εv, εd := x[0], x[1]
			p, q := o.Calc_pq(εv, εd)
			fx[0] = p - p0
			fx[1] = q - q0
			return nil
		}, nil, func(J [][]float64, x []float64) (err error) {
			εv, εd := x[0], x[1]
			pv := o.pa * math.Exp(-o.a*εv)
			Dvv := o.a * (1.0 + 1.5*o.a*o.κb*εd*εd) * pv
			Dvd := -3.0 * o.a * o.κb * εd * pv
			Ddd := 3.0 * (o.G0 + o.κb*pv)
			J[0][0] = -Dvv
			J[0][1] = -Dvd
			J[1][0] = Dvd
			J[1][1] = Ddd
			return nil
		}, true, false, map[string]float64{"lSearch": 0})
		x := []float64{ev0, ed0}
		nls.SetTols(1e-10, 1e-10, 1e-14, num.EPS)
		//nls.ChkConv = false
		//nls.CheckJ(x, 1e-6, true, false)
		silent := true
		err := nls.Solve(x, silent)
		if err != nil {
			chk.Panic("HyperElast1: CalcEps0: non-linear solver failed:\n%v", err)
		}
		ev0, ed0 = x[0], x[1]
	}
	if s0no > 0 {
		for i := 0; i < o.Nsig; i++ {
			s.EpsE[i] = ev0*tsr.Im[i]/3.0 + tsr.SQ3by2*ed0*(s0[i]/s0no)
		}
		return
	}
	for i := 0; i < o.Nsig; i++ {
		s.EpsE[i] = ev0 * tsr.Im[i] / 3.0
	}
}