Example #1
0
func main() {

	// filename
	filename, fnkey := io.ArgToFilename(0, "rjoint01", ".sim", true)

	// results
	out.Start(filename, 0, 0)
	out.Define("p0", out.P{{-3, 0}}) // -3=tag, first ip
	out.Define("p1", out.P{{-3, 1}}) // -3=tag, second ip
	out.Define("p2", out.P{{-3, 2}}) // -3=tag, third ip
	out.LoadResults(nil)
	mtau0 := out.GetRes("tau", "p0", -1)
	mtau1 := out.GetRes("tau", "p1", -1)
	mtau2 := out.GetRes("tau", "p2", -1)
	for i := 0; i < len(out.Times); i++ {
		mtau0[i] *= -1
		mtau1[i] *= -1
		mtau2[i] *= -1
	}

	// plot FEM results
	out.Plot("ompb", mtau0, "p0", plt.Fmt{C: "r", Ls: "-", M: "."}, -1)
	out.Plot("ompb", mtau1, "p1", plt.Fmt{C: "g", Ls: "-", M: "."}, -1)
	out.Plot("ompb", mtau2, "p2", plt.Fmt{C: "b", Ls: "-", M: "."}, -1)
	out.Csplot.Ylbl = "$-\\tau$"

	// save
	plt.SetForPng(0.8, 400, 200)
	out.Draw("/tmp", fnkey+".png", false, nil)
}
Example #2
0
func main() {

	// finalise analysis process and catch errors
	defer out.End()

	// input data
	simfn := "a-coarse-elast-d2-q9"
	flag.Parse()
	if len(flag.Args()) > 0 {
		simfn = flag.Arg(0)
	}
	if io.FnExt(simfn) == "" {
		simfn += ".sim"
	}

	// start analysis process
	out.Start(simfn, 0, 0)

	// define entities
	out.Define("a", out.P{{18, 8}})

	// load results
	out.LoadResults(nil)

	nf_a := out.GetRes("nf", "a", -1)
	pl_a := out.GetRes("pl", "a", -1)
	pc_a := make([]float64, len(pl_a))
	for i, _ := range pl_a {
		pc_a[i] = -pl_a[i]
	}

	out.Splot("LRM")
	_, d, _ := io.ReadTable("lrm.dat")
	plt.Plot(d["pc"], d["sl"], "'c-',lw=2")

	out.Plot(pc_a, "sl", "a", plt.Fmt{M: "o"}, -1)
	out.Csplot.Xlbl = "$p_c$"

	out.Splot("porosity")
	out.Plot("t", nf_a, "a", plt.Fmt{M: "+"}, -1)
	out.Csplot.Ylbl = "$n_f$"

	// show
	out.Draw("", "", true, nil)
}
Example #3
0
func main() {

	// finalise analysis process and catch errors
	defer out.End()

	// input data
	simfn := "d2-simple-flux"
	flag.Parse()
	if len(flag.Args()) > 0 {
		simfn = flag.Arg(0)
	}
	if io.FnExt(simfn) == "" {
		simfn += ".sim"
	}

	// start analysis process
	out.Extrap = []string{"nwlx", "nwly"}
	out.Start(simfn, 0, 0)

	// define entities
	out.Define("top-middle", out.At{5, 3})
	out.Define("section-A", out.N{-1})
	out.Define("section-B", out.Along{{0, 0}, {10, 0}})

	// load results
	out.LoadResults(nil)

	// compute water discharge along section-A
	nwlx_TM := out.GetRes("ex_nwlx", "top-middle", -1)
	Q := out.Integrate("ex_nwlx", "section-A", "y", -1)
	io.PfYel("Q = %g m³/s [answer: 0.0003]\n", Q)

	// plot
	kt := len(out.Times) - 1
	out.Splot("")
	out.Plot("pl", "y", "section-A", plt.Fmt{L: "t=0"}, 0)
	out.Plot("pl", "y", "section-A", plt.Fmt{L: io.Sf("t=%g", out.Times[kt])}, kt)
	out.Splot("")
	out.Plot("x", "pl", "section-B", plt.Fmt{L: "t=0"}, 0)
	out.Plot("x", "pl", "section-B", plt.Fmt{L: io.Sf("t=%g", out.Times[kt])}, kt)
	out.Splot("")
	out.Plot("t", nwlx_TM, "top-middle", plt.Fmt{}, -1)
	out.Csplot.Ylbl = "$n_{\\ell}\\cdot w_{\\ell x}$"

	// show
	if true {
		out.Draw("", "", true, func(i, j, nplots int) {
			if i == 2 && j == 1 {
				plt.Plot([]float64{0, 10}, []float64{10, 9}, "'k--'")
			}
		})
	}
}
Example #4
0
func main() {

	// filename
	filename, fnkey := io.ArgToFilename(0, "a-coarse-elast-d2-q9", ".sim", true)

	// start analysis process
	out.Start(filename, 0, 0)

	// define entities
	out.Define("a", out.P{{18, 8}})

	// load results
	out.LoadResults(nil)

	nf_a := out.GetRes("nf", "a", -1)
	pl_a := out.GetRes("pl", "a", -1)
	pc_a := make([]float64, len(pl_a))
	for i, _ := range pl_a {
		pc_a[i] = -pl_a[i]
	}

	out.Splot("LRM")
	_, d, _ := io.ReadTable("lrm.dat")
	plt.Plot(d["pc"], d["sl"], "'c-',lw=2")

	out.Plot(pc_a, "sl", "a", plt.Fmt{M: "o"}, -1)
	out.Csplot.Xlbl = "$p_c$"

	out.Splot("porosity")
	out.Plot("t", nf_a, "a", plt.Fmt{M: "+"}, -1)
	out.Csplot.Ylbl = "$n_f$"

	// show
	plt.SetForPng(1.2, 500, 200)
	out.Draw("/tmp", "up_indentation2d_unsat_lrm_"+fnkey+".png", false, nil)
}
Example #5
0
func main() {

	// filename
	filename, fnkey := io.ArgToFilename(0, "d2-simple-flux", ".sim", true)

	// start analysis process
	out.Extrap = []string{"nwlx", "nwly"}
	out.Start(filename, 0, 0)

	// define entities
	out.Define("top-middle", out.At{5, 3})
	out.Define("section-A", out.N{-1})
	out.Define("section-B", out.Along{{0, 0}, {10, 0}})

	// load results
	out.LoadResults(nil)

	// compute water discharge along section-A
	nwlx_TM := out.GetRes("ex_nwlx", "top-middle", -1)
	Q := out.Integrate("ex_nwlx", "section-A", "y", -1)
	io.PfYel("Q = %g m³/s [answer: 0.0003]\n", Q)

	// plot
	kt := len(out.Times) - 1
	out.Splot("")
	out.Plot("pl", "y", "section-A", plt.Fmt{L: "t=0"}, 0)
	out.Plot("pl", "y", "section-A", plt.Fmt{L: io.Sf("t=%g", out.Times[kt])}, kt)
	out.Splot("")
	out.Plot("x", "pl", "section-B", plt.Fmt{L: "t=0"}, 0)
	out.Plot("x", "pl", "section-B", plt.Fmt{L: io.Sf("t=%g", out.Times[kt])}, kt)
	out.Splot("")
	out.Plot("t", nwlx_TM, "top-middle", plt.Fmt{}, -1)
	out.Csplot.Ylbl = "$n_{\\ell}\\cdot w_{\\ell x}$"

	// save
	plt.SetForPng(1.5, 400, 200)
	out.Draw("/tmp", "seep_simple_flux_"+fnkey+".png", false, func(i, j, nplots int) {
		if i == 2 && j == 1 {
			plt.Plot([]float64{0, 10}, []float64{10, 9}, "'k--'")
		}
	})
}