Euler2D

package
v0.0.0-...-88f8085 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Density FlowFunction = iota
	XMomentum
	YMomentum
	Energy
	Mach                 // 4
	StaticPressure       // 5
	DynamicPressure      // 6
	PressureCoefficient  // 7
	SoundSpeed           // 8
	Velocity             // 9
	XVelocity            // 10
	YVelocity            // 11
	Enthalpy             // 12
	Entropy              //13
	ShockFunction        = 100
	EpsilonDissipation   = 101
	EpsilonDissipationC0 = 102
	XGradientDensity     = 200
	XGradientXMomentum   = 201
	XGradientYMomentum   = 202
	XGradientEnergy      = 203
	YGradientDensity     = 300
	YGradientXMomentum   = 301
	YGradientYMomentum   = 302
	YGradientEnergy      = 303
)

Variables

View Source
var (
	LimiterNames = map[string]LimiterType{
		"barthjesperson":  BarthJesperson,
		"barth jesperson": BarthJesperson,
		"perssonC0":       PerssonC0,
		"persson C0":      PerssonC0,
	}
	LimiterNamesRev = map[LimiterType]string{
		BarthJesperson: "BarthJesperson",
		PerssonC0:      "Persson, C0 viscosity",
	}
)
View Source
var (
	FluxNames = map[string]FluxType{
		"average": FLUX_Average,
		"lax":     FLUX_LaxFriedrichs,
		"roe":     FLUX_Roe,
		"roe-er":  FLUX_RoeER,
	}
	FluxPrintNames = []string{"Average", "Lax Friedrichs", "Roe", "Roe-ER"}
)
View Source
var (
	InitNames = map[string]InitType{
		"freestream": FREESTREAM,
		"ivortex":    IVORTEX,
		"shocktube":  SHOCKTUBE,
	}
	InitPrintNames = []string{"Freestream", "Inviscid Vortex Analytic Solution", "Shock Tube"}
)

Functions

This section is empty.

Types

type ChartState

type ChartState struct {
	// contains filtered or unexported fields
}

type ContinuityLevel

type ContinuityLevel uint8
const (
	No ContinuityLevel = iota
	C0
	C1
)

type EdgeKeySlice

type EdgeKeySlice []types.EdgeKey

func (EdgeKeySlice) Len

func (p EdgeKeySlice) Len() int

func (EdgeKeySlice) Less

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

func (EdgeKeySlice) Sort

func (p EdgeKeySlice) Sort()

Sort is a convenience method.

func (EdgeKeySlice) Swap

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

type EdgeKeySliceSortLeft

type EdgeKeySliceSortLeft EdgeKeySlice

func (EdgeKeySliceSortLeft) Len

func (p EdgeKeySliceSortLeft) Len() int

func (EdgeKeySliceSortLeft) Less

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

func (EdgeKeySliceSortLeft) Sort

func (p EdgeKeySliceSortLeft) Sort()

func (EdgeKeySliceSortLeft) Swap

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

type EdgeValueStorage

type EdgeValueStorage struct {
	Fluxes       [][4]utils.Matrix
	StorageIndex map[types.EdgeKey]int // Index into normal flux storage using edge key
	PMap         *PartitionMap
	Nedge        int
}

func (*EdgeValueStorage) GetEdgeValues

func (nf *EdgeValueStorage) GetEdgeValues(valType ValueType, myThread, kLocal, varNum, localEdgeNumber int, dfr *DG2D.DFR2D) (EdgeValues []float64, sign int)

func (*EdgeValueStorage) PutEdgeValues

func (nf *EdgeValueStorage) PutEdgeValues(en types.EdgeKey, valType ValueType, EdgeValues [][4]float64)

type Euler

type Euler struct {
	// Input parameters
	MeshFile           string
	CFL, FinalTime     float64
	FSFar, FSIn, FSOut *FreeStream

	FluxCalcAlgo      FluxType
	Case              InitType
	AnalyticSolution  ExactState
	FluxCalcMock      func(rho, rhoU, rhoV, E float64) (Fx, Fy [4]float64) // For testing
	SortedEdgeKeys    []EdgeKeySlice                                       // Buckets, one for each parallel partition
	Partitions        *PartitionMap                                        // mapping of elements into bins for parallelism
	LocalTimeStepping bool
	MaxIterations     int
	// Below are partitioned by K (elements) in the first slice
	Q                    [][4]utils.Matrix // Sharded solution variables, stored at solution point locations, Np_solution x K
	SolutionX, SolutionY []utils.Matrix
	ShockFinder          *ModeAliasShockFinder
	Limiter              *SolutionLimiter
	Dissipation          *ScalarDissipation
	// Edge number mapped quantities, i.e. Face Normal Flux
	EdgeStore *EdgeValueStorage
	ShockTube *sod_shock_tube.SODShockTube
	// contains filtered or unexported fields
}

In the DFR scheme, we have two sets of points:

  • Solution points (inside element)
  • Flux Points (on element faces)

The flux element operates on both sets of points, the solution element only operates on the internal solution points

func NewEuler

func NewEuler(ip *InputParameters, meshFile string, ProcLimit int, plotMesh, verbose, profile bool) (c *Euler)

func (*Euler) AvgFlux

func (c *Euler) AvgFlux(kL, kR, KmaxL, KmaxR, shiftL, shiftR int,
	Q_FaceL, Q_FaceR [4]utils.Matrix, normal [2]float64, normalFlux [][4]float64)

func (*Euler) CalculateEdgeFlux

func (c *Euler) CalculateEdgeFlux(Time float64, CalculateDT bool, Jdet, DT []utils.Matrix, Q_Face [][4]utils.Matrix,
	Flux_Face [][2][4]utils.Matrix, edgeKeys EdgeKeySlice, EdgeQ1, EdgeQ2 [][4]float64) (waveSpeedMax float64)

func (*Euler) CalculateFlux

func (c *Euler) CalculateFlux(QQ [4]utils.Matrix, ind int) (Fx, Fy [4]float64)

func (*Euler) CalculateFluxTransformed

func (c *Euler) CalculateFluxTransformed(k, Kmax, i int, Jdet, Jinv utils.Matrix, Q [4]utils.Matrix) (Fr, Fs [4]float64)

func (*Euler) CalculateLocalDT

func (c *Euler) CalculateLocalDT(DT utils.Matrix)

func (*Euler) CheckIfFinished

func (c *Euler) CheckIfFinished(Time, FinalTime float64, steps int) (finished bool)

func (*Euler) FarBC

func (c *Euler) FarBC(FS *FreeStream, k, Kmax, ishift int, Q_Face [4]utils.Matrix, normal [2]float64)

func (*Euler) FluxCalcBase

func (c *Euler) FluxCalcBase(rho, rhoU, rhoV, E float64) (Fx, Fy [4]float64)

func (*Euler) FluxJacobianCalc

func (c *Euler) FluxJacobianCalc(rho, rhoU, rhoV, E float64) (Fx, Gy [16]float64)

func (*Euler) FluxJacobianTransformed

func (c *Euler) FluxJacobianTransformed(k, Kmax, i int, Jdet, Jinv utils.Matrix, Q [4]utils.Matrix) (Fr, Gs [16]float64)

func (*Euler) GetFaceNormal

func (c *Euler) GetFaceNormal(kGlobal, edgeNumber int) (normal [2]float64)

func (*Euler) GetPlotField

func (c *Euler) GetPlotField(Q [4]utils.Matrix, plotField FlowFunction) (field utils.Matrix)

func (*Euler) GetSolutionGradient

func (c *Euler) GetSolutionGradient(myThread, varNum int, Q [4]utils.Matrix, GradX, GradY, DR, DS utils.Matrix)

func (*Euler) GetSolutionGradientUsingRTElement

func (c *Euler) GetSolutionGradientUsingRTElement(myThread, varNum int, Q [4]utils.Matrix, GradX, GradY, DOFX, DOFY utils.Matrix)

func (*Euler) IVortexBC

func (c *Euler) IVortexBC(Time float64, k, Kmax, ishift int, Q_Face [4]utils.Matrix, normal [2]float64)

func (*Euler) InitializeFS

func (c *Euler) InitializeFS(Kmax int) (Q [4]utils.Matrix)

func (*Euler) InitializeIVortex

func (c *Euler) InitializeIVortex(X, Y utils.Matrix) (iv *isentropic_vortex.IVortex, Q [4]utils.Matrix)

func (*Euler) InitializeSolution

func (c *Euler) InitializeSolution(verbose bool)

func (*Euler) InterpolateSolutionToEdges

func (c *Euler) InterpolateSolutionToEdges(Q, Q_Face [4]utils.Matrix, Flux, Flux_Face [2][4]utils.Matrix)

func (*Euler) LaxFlux

func (c *Euler) LaxFlux(kL, kR, KmaxL, KmaxR, shiftL, shiftR int,
	Q_FaceL, Q_FaceR [4]utils.Matrix, normal [2]float64, normalFlux [][4]float64)

func (*Euler) LaxFlux2

func (c *Euler) LaxFlux2(kL, kR, KmaxL, KmaxR, shiftL, shiftR int,
	Q_FaceL, Q_FaceR [4]utils.Matrix, Flux_FaceL, Flux_FaceR [2][4]utils.Matrix,
	normal [2]float64, normalFlux [][4]float64)

func (*Euler) NewEdgeStorage

func (c *Euler) NewEdgeStorage() (nf *EdgeValueStorage)

func (*Euler) NewRungeKuttaSSP

func (c *Euler) NewRungeKuttaSSP() (rk *RungeKutta4SSP)

func (*Euler) PartitionEdges

func (c *Euler) PartitionEdges()

func (*Euler) PartitionEdgesByK

func (c *Euler) PartitionEdgesByK()

func (*Euler) PlotFS

func (c *Euler) PlotFS(width, height int,
	fminP, fmaxP *float64, fmin, fmax float64,
	scale float64, translate [2]float32, ltO ...chart2d.LineType)

func (*Euler) PlotQ

func (c *Euler) PlotQ(pm *PlotMeta, width, height int)

func (*Euler) PrintFinal

func (c *Euler) PrintFinal(elapsed time.Duration, steps int)

func (*Euler) PrintInitialization

func (c *Euler) PrintInitialization(FinalTime float64)

func (*Euler) PrintUpdate

func (c *Euler) PrintUpdate(Time, dt float64, steps int, Q, Residual [][4]utils.Matrix, plotQ bool, pm *PlotMeta,
	printMem bool, limitedPoints []int)

func (*Euler) RHSInternalPoints

func (c *Euler) RHSInternalPoints(Kmax int, Jdet utils.Matrix, F_RT_DOF, RHSQ [4]utils.Matrix)

func (*Euler) RecombineShardsK

func (c *Euler) RecombineShardsK(pA []utils.Matrix) (A utils.Matrix)

func (*Euler) RecombineShardsKBy4

func (c *Euler) RecombineShardsKBy4(pA [][4]utils.Matrix) (A [4]utils.Matrix)

func (*Euler) RiemannBC

func (c *Euler) RiemannBC(FS *FreeStream, k, Kmax, i int, QQ [4][]float64, QInf [4]float64, normal [2]float64) (Q [4]float64)

func (*Euler) RoeERFlux

func (c *Euler) RoeERFlux(kL, kR, KmaxL, KmaxR, shiftL, shiftR int,
	Q_FaceL, Q_FaceR [4]utils.Matrix, normal [2]float64, normalFlux [][4]float64)

func (*Euler) RoeFlux

func (c *Euler) RoeFlux(kL, kR, KmaxL, KmaxR, shiftL, shiftR int,
	Q_FaceL, Q_FaceR [4]utils.Matrix, normal [2]float64, normalFlux [][4]float64)

func (*Euler) RoeFlux2

func (c *Euler) RoeFlux2(kL, kR, KmaxL, KmaxR, shiftL, shiftR int,
	Q_FaceL, Q_FaceR [4]utils.Matrix, Flux_FaceL, Flux_FaceR [2][4]utils.Matrix,
	normal [2]float64, normalFlux [][4]float64)

func (*Euler) SetParallelDegree

func (c *Euler) SetParallelDegree(ProcLimit, Kmax int)

func (*Euler) SetRTFluxInternal

func (c *Euler) SetRTFluxInternal(Kmax int, Jdet, Jinv utils.Matrix, F_RT_DOF, Q [4]utils.Matrix)

func (*Euler) SetRTFluxOnEdges

func (c *Euler) SetRTFluxOnEdges(myThread, Kmax int, F_RT_DOF [4]utils.Matrix)

func (*Euler) ShardByK

func (c *Euler) ShardByK(A utils.Matrix) (pA []utils.Matrix)

func (*Euler) ShardByKTranspose

func (c *Euler) ShardByKTranspose(A utils.Matrix) (pA []utils.Matrix)

func (*Euler) Solve

func (c *Euler) Solve(pm *PlotMeta)

func (*Euler) StoreGradientEdgeFlux

func (c *Euler) StoreGradientEdgeFlux(edgeKeys EdgeKeySlice, EdgeQ1 [][4]float64)

func (*Euler) WallBC

func (c *Euler) WallBC(k, Kmax int, Q_Face [4]utils.Matrix, ishift int, normal [2]float64, normalFlux [][4]float64)

type ExactState

type ExactState interface {
	GetStateC(t, x, y float64) (rho, rhoU, rhoV, E float64)
	GetDivergence(t, x, y float64) (div [4]float64)
}

type FlowFunction

type FlowFunction uint16

func (FlowFunction) String

func (pm FlowFunction) String() string

type FluxType

type FluxType uint
const (
	FLUX_Average FluxType = iota
	FLUX_LaxFriedrichs
	FLUX_Roe
	FLUX_RoeER
)

func NewFluxType

func NewFluxType(label string) (ft FluxType)

func (FluxType) Print

func (ft FluxType) Print() (txt string)

type FreeStream

type FreeStream struct {
	Gamma             float64
	Qinf              [4]float64
	Pinf, QQinf, Cinf float64
	Alpha             float64
	Minf              float64
}

func NewFreeStream

func NewFreeStream(Minf, Gamma, Alpha float64) (fs *FreeStream)

func NewFreestreamFromQinf

func NewFreestreamFromQinf(gamma float64, qq [4]float64) (fs *FreeStream)

func (*FreeStream) GetFlowFunction

func (fs *FreeStream) GetFlowFunction(Q [4]utils.Matrix, ind int, pf FlowFunction) (f float64)

func (*FreeStream) GetFlowFunctionBase

func (fs *FreeStream) GetFlowFunctionBase(rho, rhoU, rhoV, E float64, pf FlowFunction) (f float64)

func (*FreeStream) GetFlowFunctionQQ

func (fs *FreeStream) GetFlowFunctionQQ(Q [4]float64, pf FlowFunction) (f float64)

func (*FreeStream) Print

func (fs *FreeStream) Print() string

type InitType

type InitType uint
const (
	FREESTREAM InitType = iota
	IVORTEX
	SHOCKTUBE
)

func NewInitType

func NewInitType(label string) (it InitType)

func (InitType) Print

func (it InitType) Print() (txt string)

type InputParameters

type InputParameters struct {
	Title             string                                `yaml:"Title"`
	CFL               float64                               `yaml:"CFL"`
	FluxType          string                                `yaml:"FluxType"`
	InitType          string                                `yaml:"InitType"`
	PolynomialOrder   int                                   `yaml:"PolynomialOrder"`
	FinalTime         float64                               `yaml:"FinalTime"`
	Minf              float64                               `yaml:"Minf"`
	Gamma             float64                               `yaml:"Gamma"`
	Alpha             float64                               `yaml:"Alpha"`
	BCs               map[string]map[int]map[string]float64 `yaml:"BCs"` // First key is BC name/type, second is parameter name
	LocalTimeStepping bool                                  `yaml:"LocalTimeStep"`
	MaxIterations     int                                   `yaml:"MaxIterations"`
	ImplicitSolver    bool                                  `yaml:"ImplicitSolver"`
	Limiter           string                                `yaml:"Limiter"`
	Kappa             float64                               `yaml:"Kappa"`
}

Parameters obtained from the YAML input file

func (*InputParameters) Parse

func (ip *InputParameters) Parse(data []byte) error

func (*InputParameters) Print

func (ip *InputParameters) Print()

type LimiterType

type LimiterType uint8
const (
	None LimiterType = iota
	BarthJesperson
	PerssonC0
)

func NewLimiterType

func NewLimiterType(label string) (lt LimiterType)

func (LimiterType) Print

func (lt LimiterType) Print() (txt string)

type ModeAliasShockFinder

type ModeAliasShockFinder struct {
	Element *DG2D.LagrangeElement2D
	Clipper utils.Matrix // Matrix used to clip the topmost mode from the solution polynomial, used in shockfinder
	Np      int

	Kappa float64
	// contains filtered or unexported fields
}

func NewAliasShockFinder

func NewAliasShockFinder(element *DG2D.LagrangeElement2D, Kappa float64) (sf *ModeAliasShockFinder)

func (*ModeAliasShockFinder) ElementHasShock

func (sf *ModeAliasShockFinder) ElementHasShock(q []float64) (i bool)

func (*ModeAliasShockFinder) ShockIndicator

func (sf *ModeAliasShockFinder) ShockIndicator(q []float64) (sigma float64)

type PartitionMap

type PartitionMap struct {
	MaxIndex       int // MaxIndex is partitioned into ParallelDegree partitions
	ParallelDegree int
	Partitions     [][2]int // Beginning and end index of partitions
}

func NewPartitionMap

func NewPartitionMap(ParallelDegree, maxIndex int) (pm *PartitionMap)

func (*PartitionMap) GetBucket

func (pm *PartitionMap) GetBucket(kDim int) (bucketNum, min, max int)

func (*PartitionMap) GetBucketDimension

func (pm *PartitionMap) GetBucketDimension(bn int) (kMax int)

func (*PartitionMap) GetBucketRange

func (pm *PartitionMap) GetBucketRange(bucketNum int) (kMin, kMax int)

func (*PartitionMap) GetGlobalK

func (pm *PartitionMap) GetGlobalK(kLocal, bn int) (kGlobal int)

func (*PartitionMap) GetLocalK

func (pm *PartitionMap) GetLocalK(baseK int) (k, Kmax, bn int)

func (*PartitionMap) Split1D

func (pm *PartitionMap) Split1D(threadNum int) (bucket [2]int)

type PlotMeta

type PlotMeta struct {
	Plot                   bool
	Scale                  float64
	TranslateX, TranslateY float64
	Field                  FlowFunction
	FieldMinP, FieldMaxP   *float64 // nil if no forced min, max
	FrameTime              time.Duration
	StepsBeforePlot        int
	LineType               chart2d.LineType
}

type RungeKutta4SSP

type RungeKutta4SSP struct {
	Jdet, Jinv           []utils.Matrix       // Sharded mesh Jacobian and inverse transform
	RHSQ, Q_Face         [][4]utils.Matrix    // State used for matrix multiplies within the time step algorithm
	Flux_Face            [][2][4]utils.Matrix // Flux interpolated to edges from interior
	Q1, Q2, Q3, Q4       [][4]utils.Matrix    // Intermediate solution state
	Flux                 [][2][4]utils.Matrix // Flux at solution points, used for interpolation to edges
	Residual             [][4]utils.Matrix    // Used for reporting, aliased to Q1
	F_RT_DOF             [][4]utils.Matrix    // Normal flux used for divergence
	DT                   []utils.Matrix       // Local time step storage
	MaxWaveSpeed         []float64            // Shard max wavespeed
	GlobalDT, Time       float64
	StepCount            int
	Kmax                 []int          // Local element count (dimension: Kmax[ParallelDegree])
	NpInt, Nedge, NpFlux int            // Number of points in solution, edge and flux total
	EdgeQ1, EdgeQ2       [][][4]float64 // Sharded local working memory, dimensions Nedge
	LimitedPoints        []int          // Sharded number of limited points
}

func (*RungeKutta4SSP) Step

func (rk *RungeKutta4SSP) Step(c *Euler)

func (*RungeKutta4SSP) StepWorker

func (rk *RungeKutta4SSP) StepWorker(c *Euler, myThread int, wg *sync.WaitGroup, currentStep int, initDT bool)

type ScalarDissipation

type ScalarDissipation struct {
	VtoE                       []VertexToElement // Sharded vertex to element map, [2] is [vertID, ElementID_Sharded]
	EtoV                       []utils.Matrix    // Sharded Element to Vertex map, Kx3
	Epsilon                    []utils.Matrix    // Sharded Np x Kmax, Interpolated from element vertices
	EpsilonScalar              [][]float64       // Sharded scalar value of dissipation, one per element
	DissDOF, DissDOF2, DissDiv []utils.Matrix    // Sharded NpFlux x Kmax, DOF for Gradient calculation using RT
	DissX, DissY               [][4]utils.Matrix // Sharded NpFlux x Kmax, X and Y derivative of dissipation field
	EpsVertex                  []float64         // NVerts x 1, Aggregated (Max) of epsilon surrounding each vertex, Not sharded
	PMap                       *PartitionMap     // Partition map for the solution shards in K
	U, UClipped                []utils.Matrix    // Sharded scratch areas for assembly and testing of solution values
	Clipper                    utils.Matrix      // Matrix used to clip the topmost mode from the solution polynomial, used in shockfinder

	S0, Kappa           float64
	BaryCentricCoords   utils.Matrix // A thruple(lam0,lam1,lam2) for interpolation for each interior point, Npx3
	VertexEpsilonValues []utils.Matrix
	// contains filtered or unexported fields
}

func NewScalarDissipation

func NewScalarDissipation(kappa float64, dfr *DG2D.DFR2D, pm *PartitionMap) (sd *ScalarDissipation)

func (*ScalarDissipation) AddDissipation

func (sd *ScalarDissipation) AddDissipation(c *Euler, cont ContinuityLevel, myThread int, Jinv, Jdet utils.Matrix, Q, RHSQ [4]utils.Matrix)

func (*ScalarDissipation) CalculateElementViscosity

func (sd *ScalarDissipation) CalculateElementViscosity(myThread int, Qall [][4]utils.Matrix)

func (*ScalarDissipation) CalculateEpsilonGradient

func (sd *ScalarDissipation) CalculateEpsilonGradient(c *Euler, cont ContinuityLevel, myThread int, Q [4]utils.Matrix)

func (*ScalarDissipation) GetC0EpsilonPlotField

func (sd *ScalarDissipation) GetC0EpsilonPlotField(c *Euler) (fld utils.Matrix)

func (*ScalarDissipation) GetScalarEpsilonPlotField

func (sd *ScalarDissipation) GetScalarEpsilonPlotField(c *Euler) (fld utils.Matrix)

type SolutionLimiter

type SolutionLimiter struct {
	Element     *DG2D.LagrangeElement2D
	Tris        *DG2D.Triangulation
	Partitions  *PartitionMap
	ShockFinder []*ModeAliasShockFinder // Sharded
	UElement    []utils.Matrix          // Sharded scratch areas for assembly and testing of solution values
	FS          *FreeStream
	// contains filtered or unexported fields
}

func NewSolutionLimiter

func NewSolutionLimiter(t LimiterType, kappa float64, dfr *DG2D.DFR2D, pm *PartitionMap, fs *FreeStream) (bjl *SolutionLimiter)

func (*SolutionLimiter) LimitSolution

func (bjl *SolutionLimiter) LimitSolution(myThread int, Qall, Residual [][4]utils.Matrix) (points int)

type ValueType

type ValueType uint8
const (
	NumericalFluxForEuler ValueType = iota
	QFluxForGradient
	GradientFluxForLaplacian
)

type VertexToElement

type VertexToElement [][3]int32 // Vertex id is the first int32, element ID is the next, threadID third

func NewVertexToElement

func NewVertexToElement(EtoV utils.Matrix) (VtoE VertexToElement)

func (VertexToElement) Len

func (ve VertexToElement) Len() int

func (VertexToElement) Less

func (ve VertexToElement) Less(i, j int) bool

func (VertexToElement) Shard

func (ve VertexToElement) Shard(pm *PartitionMap) (veSharded []VertexToElement)

func (VertexToElement) Sort

func (ve VertexToElement) Sort()

func (VertexToElement) Swap

func (ve VertexToElement) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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