pencil.calc.accuracy

Functions

twonorm_accuracy(simulations[, field, strip, ...])

Assessment of accuracy of simulation:

order_accuracy([simulations, nstrips, twonorm_arr, ...])

Compute an estimate of the order of accuracy, using two-norms where

twonorm_array(simulations, nstrips[, field, var_file, ...])

Compute twonorm_accuracy along the selected direction, for a number of 'strips'.

twonorm(u1, u2, dx)

Compute the two-norm error of two spatial vectors u1 and u2.

maxerror(u1, u2)

Find the larges error between values from u1 and u2 (for the

twonorm_accuracy2D(simulations[, field, var_file, ...])

Assessment of accuracy of simulation:

twonorm_accuracy1D(simulations[, field, strip, ...])

Assessment of accuracy of simulation:

Module Contents

pencil.calc.accuracy.twonorm_accuracy(simulations, field='ux', strip=0, var_file='ogvar.dat', direction='x', noerr=True, quiet=True)

Assessment of accuracy of simulation: Computes the two-norm error of all available simulation, where the simulation with the maximum amount of grid points is used as the correct/reference solution. E.g., for runs with grid points assessment of accuracy of x-component of velocity along the y-direction, for runs with grid points nxgrid = n, 2n, 4n, 8n, compute

|| u_n - u_0 || = dy sumlimits_{n=0}^n (sqrt(u_n(x_n)-u_0(x_8n)))

for all runs (except for the 8n case, used as reference).

Requires that the runs have matching grids, that is, grid refined by a factor of 2m, and grids adjusted so that the grid point overlap (needs ofset if periodic BC is used).

call signature:

twonorm_accuracy(simulations)

Keyword arguments:

simulations

array of simulation names to be included in the computations

field

variable used in accuracy assessment

strip:

index for strip along coordinate

var_file:

name of varfile to read from each sim

direction:

compute two-norm along ‘x’ or ‘y’ direction

noerr:

set to false if you want to return an array of maximum error along strip, in addition to the two-norm

Returns

array of two-norms where the larges array is used as base

pencil.calc.accuracy.order_accuracy(simulations=[], nstrips=0, twonorm_arr=[], field='ux', var_file='ogvar.dat', direction='x')

Compute an estimate of the order of accuracy, using two-norms where the finest grid is used as reference solution u_0. Return array of orders of accuracy, where each order p is for computation along one strip.

p = log(||u(Delta x) - u_0|| / ||u(Delta x/2) - u_0||)/log(2)

Keyword arguments:

simulations

array of simulation names to be included in the computations

nstrips

number of strips to include in twonorm_array twonorm is computed along each strip, and the strips must coencide on the each grid used in such a grid refinement study

twonorm_arr

array of computed two-normes, if these are available if empty, routine will compute these

field

variable used in accuracy assessment

varfile:

name of varfile to read from each sim

direction:

compute two-norm along ‘x’ or ‘y’ direction

pencil.calc.accuracy.twonorm_array(simulations, nstrips, field='ux', var_file='ogvar.dat', direction='x')

Compute twonorm_accuracy along the selected direction, for a number of ‘strips’. See twonorm_accuracy for details.

call signature:

twonorm_array(simulations,nstrips)

Keyword arguments:

simulations

array of simulation names to be included in the computations

nstrips

number of strips to include in twonorm_array twonorm is computed along each strip, and the strips must coencide on the each grid used in such a grid refinement study

field

variable used in accuracy assessment

varfile:

name of varfile to read from each sim

direction:

compute two-norm along ‘x’ or ‘y’ direction

pencil.calc.accuracy.twonorm(u1, u2, dx)

Compute the two-norm error of two spatial vectors u1 and u2. The distance between grid points used in calculation is dx.

pencil.calc.accuracy.maxerror(u1, u2)

Find the larges error between values from u1 and u2 (for the same indices).

pencil.calc.accuracy.twonorm_accuracy2D(simulations, field='ur', var_file='ogvar.dat', noerr=True, quiet=True)

Assessment of accuracy of simulation: Computes the two-norm error of all available simulation, where the simulation with the maximum amount of grid points is used as the correct/reference solution. E.g., for runs with grid points assessment of accuracy of x-component of velocity along the y-direction, for runs with grid points nxgrid = n, 2n, 4n, 8n, compute

|| u_n - u_0 || = dy sumlimits_{n=0}^n (sqrt(u_n(x_n)-u_0(x_8n)))

for all runs (except for the 8n case, used as reference).

Requires that the runs have matching grids, that is, grid refined by a factor of 2m, and grids adjusted so that the grid point overlap (needs ofset if periodic BC is used).

call signature:

twonorm_accuracy(simulations)

Keyword arguments:

simulations

array of simulation names to be included in the computations

field

variable used in accuracy assessment

varfile:

name of varfile to read from each sim

noerr:

set to false if you want to return an array of maximum error along strip, in addition to the two-norm

Returns

array of two-norms where the larges array is used as base

pencil.calc.accuracy.twonorm_accuracy1D(simulations, field='ur', strip=1, direction='r', varfile='ogvar.dat', noerr=True, quiet=True)

Assessment of accuracy of simulation: Computes the two-norm error of all available simulation, where the simulation with the maximum amount of grid points is used as the correct/reference solution. E.g., for runs with grid points assessment of accuracy of x-component of velocity along the y-direction, for runs with grid points nxgrid = n, 2n, 4n, 8n, compute

|| u_n - u_0 || = dy sumlimits_{n=0}^n (sqrt(u_n(x_n)-u_0(x_8n)))

for all runs (except for the 8n case, used as reference).

Requires that the runs have matching grids, that is, grid refined by a factor of 2m, and grids adjusted so that the grid point overlap (needs ofset if periodic BC is used).

call signature:

twonorm_accuracy(simulations)

Keyword arguments:

simulations

array of simulation names to be included in the computations

field

variable used in accuracy assessment

varfile:

name of varfile to read from each sim

noerr:

set to false if you want to return an array of maximum error along strip, in addition to the two-norm

Returns

array of two-norms where the larges array is used as base