当前位置: 首页>>代码示例>>Golang>>正文


Golang CteStressPstrain.CheckDispl方法代码示例

本文整理汇总了Golang中github.com/cpmech/gofem/ana.CteStressPstrain.CheckDispl方法的典型用法代码示例。如果您正苦于以下问题:Golang CteStressPstrain.CheckDispl方法的具体用法?Golang CteStressPstrain.CheckDispl怎么用?Golang CteStressPstrain.CheckDispl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cpmech/gofem/ana.CteStressPstrain的用法示例。


在下文中一共展示了CteStressPstrain.CheckDispl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Test_out02

func Test_out02(tst *testing.T) {

	// finalise analysis process and catch errors
	defer func() {
		if err := recover(); err != nil {
			tst.Fail()
			io.PfRed("ERROR: %v\n", err)
		}
	}()

	// test title
	//verbose()
	chk.PrintTitle("out02")

	// start simulation
	processing := fem.NewFEM("data/twoqua4.sim", "", true, true, false, false, chk.Verbose, 0)

	// run simulation
	err := processing.Run()
	if err != nil {
		tst.Errorf("Run failed:\n%v", err)
		return
	}

	// start post-processing
	Start("data/twoqua4.sim", 0, 0)

	// get second ip coordinates
	xip := Ipoints[1].X
	io.Pfcyan("xip = %v\n", xip)

	// define points
	Define("A", N{-1})
	Define("ips", Along{{xip[0], 0}, {xip[0], 1}})

	// load results
	LoadResults(nil)

	// solution
	var sol ana.CteStressPstrain
	sol.Init(fun.Prms{
		&fun.Prm{N: "qnH", V: -50},
		&fun.Prm{N: "qnV", V: -100},
	})

	// check displacements
	tolu := 1e-15
	x := GetCoords("A")
	ux := GetRes("ux", "A", 0)
	uy := GetRes("uy", "A", 0)
	io.Pforan("ux=%v uy=%v\n", ux, uy)
	for j, t := range Times {
		io.Pfyel("t=%g\n", t)
		sol.CheckDispl(tst, t, []float64{ux[j], uy[j]}, x, tolu)
	}
}
开发者ID:PaddySchmidt,项目名称:gofem,代码行数:56,代码来源:t_out_test.go

示例2: Test_nurbs02

func Test_nurbs02(tst *testing.T) {

	//verbose()
	chk.PrintTitle("nurbs02. square with initial stress. run")

	// fem
	analysis := NewFEM("data/nurbs02.sim", "", true, false, false, false, chk.Verbose, 0)

	// run simulation
	err := analysis.Run()
	if err != nil {
		tst.Errorf("Run failed\n%v", err)
		return
	}

	// domain
	dom := analysis.Domains[0]

	e := dom.Elems[0].(*ElemU)
	io.PfYel("fex = %v\n", e.fex)
	io.PfYel("fey = %v\n", e.fey)
	la.PrintMat("K", e.K, "%10.2f", false)

	// solution
	var sol ana.CteStressPstrain
	sol.Init(fun.Prms{
		&fun.Prm{N: "qnH0", V: -20},
		&fun.Prm{N: "qnV0", V: -20},
		&fun.Prm{N: "qnH", V: -50},
		&fun.Prm{N: "qnV", V: -100},
	})

	// check displacements
	t := dom.Sol.T
	tolu := 1e-16
	for _, n := range dom.Nodes {
		eqx := n.GetEq("ux")
		eqy := n.GetEq("uy")
		u := []float64{dom.Sol.Y[eqx], dom.Sol.Y[eqy]}
		io.Pfyel("u = %v\n", u)
		sol.CheckDispl(tst, t, u, n.Vert.C, tolu)
	}

	// check stresses
	tols := 1e-13
	for idx, ip := range e.IpsElem {
		x := e.Cell.Shp.IpRealCoords(e.X, ip)
		σ := e.States[idx].Sig
		io.Pforan("σ = %v\n", σ)
		sol.CheckStress(tst, t, σ, x, tols)
	}
}
开发者ID:PaddySchmidt,项目名称:gofem,代码行数:52,代码来源:t_nurbs_test.go

示例3: Test_nurbs03

func Test_nurbs03(tst *testing.T) {

	//verbose()
	chk.PrintTitle("nurbs03. ini stress free square")

	// fem
	analysis := NewFEM("data/nurbs03.sim", "", true, false, false, false, chk.Verbose, 0)

	// run simulation
	err := analysis.Run()
	if err != nil {
		tst.Errorf("Run failed\n%v", err)
		return
	}

	// domain
	dom := analysis.Domains[0]

	// element
	e := dom.Elems[0].(*ElemU)
	io.PfYel("fex = %v\n", e.fex)
	io.PfYel("fey = %v\n", e.fey)
	la.PrintMat("K", e.K, "%10.2f", false)

	// solution
	var sol ana.CteStressPstrain
	sol.Init(fun.Prms{
		&fun.Prm{N: "qnH", V: -50},
		&fun.Prm{N: "qnV", V: -100},
	})

	// check displacements
	t := dom.Sol.T
	tolu := 1e-16
	for _, n := range dom.Nodes {
		eqx := n.GetEq("ux")
		eqy := n.GetEq("uy")
		u := []float64{dom.Sol.Y[eqx], dom.Sol.Y[eqy]}
		io.Pfyel("u = %v\n", u)
		sol.CheckDispl(tst, t, u, n.Vert.C, tolu)
	}
}
开发者ID:PaddySchmidt,项目名称:gofem,代码行数:42,代码来源:t_nurbs_test.go

示例4: Test_contact01b

func Test_contact01b(tst *testing.T) {

	//verbose()
	chk.PrintTitle("contact01b")

	// start simulation
	analysis := NewFEM("data/contact01.sim", "", true, true, false, false, chk.Verbose, 0)

	// for debugging Kb
	//if true {
	if false {
		u_DebugKb(analysis, &testKb{
			tst: tst, eid: 3, tol: 1e-7, verb: chk.Verbose,
			ni: -1, nj: -1, itmin: 1, itmax: 1, tmin: 0.2, tmax: -1,
		})
	}

	// run simulation
	err := analysis.Run()
	if err != nil {
		io.PfRed("Run failed:\n%v", err)
		tst.Errorf("Run failed:\n%v", err)
		return
	}

	// check
	//if true {
	if false {

		// domain
		dom := analysis.Domains[0]

		// solution
		var sol ana.CteStressPstrain
		sol.Init(fun.Prms{
			&fun.Prm{N: "qnH", V: 0},
			&fun.Prm{N: "qnV", V: -100},
		})

		// check displacements
		t := dom.Sol.T
		tolu := 1e-16
		for _, n := range dom.Nodes {
			eqx := n.GetEq("ux")
			eqy := n.GetEq("uy")
			u := []float64{dom.Sol.Y[eqx], dom.Sol.Y[eqy]}
			io.Pfgreen("u = %v\n", u)
			sol.CheckDispl(tst, t, u, n.Vert.C, tolu)
		}

		// check stresses
		e := dom.Elems[3].(*ElemU)
		tols := 1e-13
		for idx, ip := range e.IpsElem {
			x := e.Cell.Shp.IpRealCoords(e.X, ip)
			σ := e.States[idx].Sig
			io.Pforan("σ = %v\n", σ)
			sol.CheckStress(tst, t, σ, x, tols)
		}
	}
}
开发者ID:PaddySchmidt,项目名称:gofem,代码行数:61,代码来源:t_contact_test.go

示例5: Test_sigini02

func Test_sigini02(tst *testing.T) {

	//verbose()
	chk.PrintTitle("sigini02")

	// start simulation
	if !Start("data/sigini02.sim", true, chk.Verbose) {
		tst.Errorf("test failed\n")
		return
	}
	defer End()

	// run simulation
	if !Run() {
		tst.Errorf("test failed\n")
		return
	}

	// allocate domain
	distr := false
	d := NewDomain(Global.Sim.Regions[0], distr)
	if !d.SetStage(0, Global.Sim.Stages[0], distr) {
		tst.Errorf("SetStage failed\n")
		return
	}

	// read results
	sum := ReadSum(Global.Dirout, Global.Fnkey)
	io.Pforan("sum = %+v\n", sum)
	ntout := len(sum.OutTimes)
	d.In(sum, ntout-1, true)

	// solution
	var sol ana.CteStressPstrain
	sol.Init(fun.Prms{
		&fun.Prm{N: "qnH0", V: -20},
		&fun.Prm{N: "qnV0", V: -20},
		&fun.Prm{N: "qnH", V: -50},
		&fun.Prm{N: "qnV", V: -100},
	})

	// check displacements
	t := d.Sol.T
	tolu := 1e-16
	for _, n := range d.Nodes {
		eqx := n.GetEq("ux")
		eqy := n.GetEq("uy")
		u := []float64{d.Sol.Y[eqx], d.Sol.Y[eqy]}
		sol.CheckDispl(tst, t, u, n.Vert.C, tolu)
	}

	// check stresses
	e := d.Elems[0].(*ElemU)
	tols := 1e-13
	for idx, ip := range e.IpsElem {
		x := e.Shp.IpRealCoords(e.X, ip)
		σ := e.States[idx].Sig
		io.Pforan("σ = %v\n", σ)
		sol.CheckStress(tst, t, σ, x, tols)
	}
}
开发者ID:PatrickSchm,项目名称:gofem,代码行数:61,代码来源:t_u_test.go

示例6: Test_out01


//.........这里部分代码省略.........
	chk.IntAssert(len(Ipkeys), 4)
	for key, ips := range Ipkey2ips {
		chk.Ints(tst, io.Sf("%s : ips", key), ips, utl.IntRange(4))
	}

	// load results
	LoadResults(nil)

	// check points
	nlabels := []string{"A", "B", "C", "D"}
	for _, l := range nlabels {
		if _, ok := Results[l]; !ok {
			chk.Panic("1: %q alias in Entities is not available", l)
		}
	}
	plabels := []string{"a", "b", "c", "d"}
	for _, l := range plabels {
		if _, ok := Results[l]; !ok {
			chk.Panic("2: %q alias in Entities is not available", l)
		}
	}
	if _, ok := Results["right side"]; !ok {
		chk.Panic("3: %q alias in Entities is not available", "right side")
	}

	// check u-keys
	ukeys := []string{"ux", "uy"}
	for _, l := range nlabels {
		for _, p := range Results[l] {
			//io.Pfyel("p = %v\n", p)
			if p == nil {
				chk.Panic("1: p is nil")
			}
			for _, key := range ukeys {
				if _, ok := p.Vals[key]; !ok {
					chk.Panic("%s is not available in point", key)
				}
			}
		}
	}

	// check s-keys
	skeys := fem.StressKeys(Dom.Sim.Ndim)
	for _, l := range plabels {
		for _, p := range Results[l] {
			//io.Pfgreen("q = %v\n", p)
			if p == nil {
				chk.Panic("2: p is nil")
			}
			for _, key := range skeys {
				if _, ok := p.Vals[key]; !ok {
					chk.Panic("%s is not available in point", key)
				}
			}
		}
	}

	// check GetRes
	uxC := GetRes("ux", "C", 0)
	uxR := GetRes("ux", "right side", -1)
	io.Pforan("uxC = %v\n", uxC)
	io.Pforan("uxR = %v\n", uxR)
	chk.IntAssert(len(uxC), 2)
	idx := len(uxC) - 1
	chk.Vector(tst, "uxR", 1e-17, uxR, []float64{uxC[idx], uxC[idx]})

	// solution
	var sol ana.CteStressPstrain
	sol.Init(fun.Prms{
		&fun.Prm{N: "qnH", V: -50},
		&fun.Prm{N: "qnV", V: -100},
	})

	// check displacements
	tolu := 1e-15
	for _, l := range nlabels {
		x := GetCoords(l)
		ux := GetRes("ux", l, 0)
		uy := GetRes("uy", l, 0)
		io.Pforan("ux=%v uy=%v\n", ux, uy)
		for j, t := range Times {
			io.Pfyel("t=%g\n", t)
			sol.CheckDispl(tst, t, []float64{ux[j], uy[j]}, x, tolu)
		}
	}

	// check stresses
	tolσ := 1e-14
	for _, l := range plabels {
		x := GetCoords(l)
		sx := GetRes("sx", l, 0)
		sy := GetRes("sy", l, 0)
		sz := GetRes("sz", l, 0)
		sxy := GetRes("sxy", l, 0)
		for j, t := range Times {
			io.Pfyel("t=%g\n", t)
			sol.CheckStress(tst, t, []float64{sx[j], sy[j], sz[j], sxy[j]}, x, tolσ)
		}
	}
}
开发者ID:PaddySchmidt,项目名称:gofem,代码行数:101,代码来源:t_out_test.go


注:本文中的github.com/cpmech/gofem/ana.CteStressPstrain.CheckDispl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。