sim

package
v0.0.0-...-a7e685e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2017 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package sim provides utilities to simulate fusion processes happening in a supernova.

A typical use case would look like:

var w io.Writer
engine := sim.Engine{
	NumIters:   *nIters,
	NumCarbons: *nCarbons,
	Seed:       *seed,
}
err = engine.Run(w)

Index

Constants

This section is empty.

Variables

View Source
var (
	// Population is the default list of nuclei we want to study.
	Population = []Nucleus{
		{A: 12, Z: 6},
		{A: 16, Z: 8},
		{A: 24, Z: 12},
		{A: 28, Z: 14},
		{A: 32, Z: 16},
		{A: 36, Z: 18},
		{A: 40, Z: 20},
		{A: 44, Z: 22},
		{A: 48, Z: 24},
		{A: 52, Z: 26},
		{A: 56, Z: 28},
	}

	// HeaderCSV identifies the start of meta-data
	HeaderCSV = []byte("# snfusion-gen=")
)

Functions

This section is empty.

Types

type Engine

type Engine struct {
	NumIters   int
	NumCarbons float64

	Seed       int64
	Population []Nucleus
	// contains filtered or unexported fields
}

Engine controls the time evolution of an SN-Fusion simulation.

func (*Engine) Run

func (e *Engine) Run(w io.Writer) error

Run runs the whole simulation and writes data (as well as metadata) into w. The data is written as a CSV file with '#' comments and ';' separators.

func (*Engine) SetLogger

func (e *Engine) SetLogger(msg *log.Logger)

SetLogger setups the logging output of the simulation engine.

type Nuclei

type Nuclei []Nucleus

Nuclei is a slice of nuclei, sortable by increasing mass number.

func (Nuclei) Len

func (p Nuclei) Len() int

func (Nuclei) Less

func (p Nuclei) Less(i, j int) bool

func (Nuclei) Swap

func (p Nuclei) Swap(i, j int)

type Nucleus

type Nucleus struct {
	A int // mass number
	Z int // atomic number
}

Nucleus models a standard model nucleus. It holds the mass number A and the atomic number Z of this nucleus.

func Fuse

func Fuse(n1, n2 Nucleus) (Nucleus, bool)

Fuse returns the product of the fusion of two nuclei n1 and n2, or false if the fusion is not physically possible.

func (Nucleus) N

func (n Nucleus) N() int

N returns the number of nucleons

func (Nucleus) String

func (n Nucleus) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL