MATLAB/Octave API#

This page documents the API of the MOLE MATLAB/Octave module. Functions are organized by category.

Differential Operators#

Gradient Operators#

grad(k, m, dx, dc, nc)#

PURPOSE#

This gradient operator computes the vector of partial derivatives, indicating the direction of maximum rate of increase and the steepest slope of a scalar field.

SYNTAX#

G = grad(k, m, dx)
G = grad(k, m, dx, dc, nc)

DESCRIPTION#

Returns a one-dimensional mimetic gradient operator depending on whether
or not the operator will contain a periodic boundary condition type
a0 U + b0 dU/dn = g,

               k : Order of accuracy
               m : Number of cells
              dx : Step size
   (optional) dc : a0 (2x1 vector for left and right vertices, resp.)
   (optional) nc : b0 (2x1 vector for left and right vertices, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

gradNonPeriodic() Returns a m+1 by m+2 one-dimensional mimetic gradient operator

gradPeriodic() Returns a m by m+2 one-dimensional mimetic gradient operator when the boundary condition is periodic

This function is called by:

gradNonUniform() Returns a m+1 by m+2 one-dimensional non-uniform mimetic gradient operator

lap() Returns a one-dimensional mimetic Laplacian operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

mixedBC() Constructs a 1D mimetic mixed boundary conditions operator

addScalarBC1Dlhs() This functions uses geometry and boundary type conditions to create modifications of matrix A associated to each of the boundary faces.

weightsP() Returns the m+1 weights of P

grad3DCurv() Returns a 3D curvilinear mimetic gradient

mimeticB() Returns a m+2 by m+1 one-dimensional mimetic boundary operator

robinBC() Returns a m+2 by m+2 one-dimensional mimetic boundary operator that imposes a boundary condition of Robin’s type

grad2D(k, m, dx, n, dy, dc, nc)#

PURPOSE#

Returns a two-dimensional mimetic gradient operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

SYNTAX#

G = grad2D(k, m, dx, n, dy)
G = grad2D(k, m, dx, n, dy, dc, nc)

DESCRIPTION#

            k : Order of accuracy
            m : Number of cells
           dx : Step size
            n : Number of cells along y-axis
           dy : Step size along y-axis
(optional) dc : a0 (4x1 vector for left, right, bottom, top boundaries, resp.)
(optional) nc : b0 (4x1 vector for left, right, bottom, top boundaries, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

gradNonPeriodic() Returns a m+1 by m+2 one-dimensional mimetic gradient operator

gradPeriodic() Returns a m by m+2 one-dimensional mimetic gradient operator when the boundary condition is periodic

gradNonPeriodic2D() Returns a two-dimensional mimetic gradient operator

This function is called by:

lap2D() Returns a two-dimensional mimetic Laplacian operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

grad2DCurv() Returns a 2D curvilinear mimetic gradient

grad2DCurv(k, X, Y)#

PURPOSE#

Returns a 2D curvilinear mimetic gradient

SYNTAX#

G = grad2DCurv(k, X, Y)

DESCRIPTION#

CROSS-REFERENCE INFORMATION#

This function calls:

GI2()

grad2D() Returns a two-dimensional mimetic gradient operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

jacobian2D()

grad2DNonUniform(k, xticks, yticks)#

PURPOSE#

Returns a two-dimensional non-uniform mimetic gradient operator

SYNTAX#

G = grad2DNonUniform(k, xticks, yticks)

DESCRIPTION#

(including the boundaries!)

               k : Order of accuracy
          xticks : Centers' ticks (x-axis)
          yticks : Centers' ticks (y-axis)

CROSS-REFERENCE INFORMATION#

This function calls:

gradNonUniform() Returns a m+1 by m+2 one-dimensional non-uniform mimetic gradient operator

grad3D(k, m, dx, n, dy, o, dz, dc, nc)#

PURPOSE#

Returns a three-dimensional mimetic gradient operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

SYNTAX#

G = grad3D(k, m, dx, n, dy, o, dz)
G = grad3D(k, m, dx, n, dy, o, dz, dc, nc)

DESCRIPTION#

            k : Order of accuracy
            m : Number of cells
           dx : Step size
            n : Number of cells along y-axis
           dy : Step size along y-axis
            o : Number of cells along z-axis
           dz : Step size along z-axis
(optional) dc : a0 (6x1 vector for left, right, bottom, top, front, back boundary types, resp.)
(optional) nc : b0 (6x1 vector for left, right, bottom, top, front, back boundary types, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

gradNonPeriodic() Returns a m+1 by m+2 one-dimensional mimetic gradient operator

gradNonPeriodic3D() Returns a three-dimensional mimetic gradient operator

gradPeriodic() Returns a m by m+2 one-dimensional mimetic gradient operator when the boundary condition is periodic

This function is called by:

grad3DCurv() Returns a 3D curvilinear mimetic gradient

lap3D() Returns a three-dimensional mimetic Laplacian operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

grad3DCurv(k, X, Y, Z)#

PURPOSE#

Returns a 3D curvilinear mimetic gradient

SYNTAX#

G = grad3DCurv(k, X, Y, Z)

DESCRIPTION#

CROSS-REFERENCE INFORMATION#

This function calls:

grad() This gradient operator computes the vector of partial derivatives, indicating the direction of maximum rate of increase and the steepest slope of a scalar field.

grad3D() Returns a three-dimensional mimetic gradient operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

jacobian3D()

GI13()

grad3DNonUniform(k, xticks, yticks, zticks)#

PURPOSE#

Returns a three-dimensional non-uniform mimetic gradient operator

SYNTAX#

G = grad3DNonUniform(k, xticks, yticks, zticks)

DESCRIPTION#

(including the boundaries!)

               k : Order of accuracy
          xticks : Centers' ticks (x-axis)
          yticks : Centers' ticks (y-axis)
          zticks : Centers' ticks (z-axis)

CROSS-REFERENCE INFORMATION#

This function calls:

gradNonUniform() Returns a m+1 by m+2 one-dimensional non-uniform mimetic gradient operator

gradNonUniform(k, ticks)#

PURPOSE#

Returns a m+1 by m+2 one-dimensional non-uniform mimetic gradient operator

SYNTAX#

G = gradNonUniform(k, ticks)

DESCRIPTION#

(including the boundaries!)

               k : Order of accuracy
           ticks : Centers' ticks e.g. [0 0.5 1 3 5 7 8 9 9.5 10]

CROSS-REFERENCE INFORMATION#

This function calls:

grad() This gradient operator computes the vector of partial derivatives, indicating the direction of maximum rate of increase and the steepest slope of a scalar field.

This function is called by:

grad2DNonUniform() Returns a two-dimensional non-uniform mimetic gradient operator

grad3DNonUniform() Returns a three-dimensional non-uniform mimetic gradient operator

Divergence Operators#

div(k, m, dx, dc, nc)#

PURPOSE#

Returns a one-dimensional mimetic divergence operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

SYNTAX#

D = div(k, m, dx)
D = div(k, m, dx, dc, nc)

DESCRIPTION#

            k : Order of accuracy
            m : Number of cells
           dx : Step size
(optional) dc : a0 (2x1 vector for left and right vertices, resp.)
(optional) nc : b0 (2x1 vector for left and right vertices, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

divNonPeriodic() Returns a m+2 by m+1 one-dimensional mimetic divergence operator

divPeriodic() Returns a m+2 by m one-dimensional mimetic divergence operator when the boundary condition is periodic

This function is called by:

lap() Returns a one-dimensional mimetic Laplacian operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

weightsQ() Returns the m+2 weights of Q

div3DCurv() Returns a 3D curvilinear mimetic divergence

curl2D() Returns a two-dimensional mimetic curl operator

divNonUniform() Returns a m+2 by m+1 one-dimensional non-uniform mimetic divergence operator

mimeticB() Returns a m+2 by m+1 one-dimensional mimetic boundary operator

div2D(k, m, dx, n, dy, dc, nc)#

PURPOSE#

Returns a two-dimensional mimetic divergence operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

SYNTAX#

D = div2D(k, m, dx, n, dy)
D = div2D(k, m, dx, n, dy, dc, nc)

DESCRIPTION#

            k : Order of accuracy
            m : Number of cells
           dx : Step size
            n : Number of cells along y-axis
           dy : Step size along y-axis
(optional) dc : a0 (4x1 vector for left, right, bottom, top boundaries, resp.)
(optional) nc : b0 (4x1 vector for left, right, bottom, top boundaries, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

divNonPeriodic2D() Returns a two-dimensional mimetic divergence operator

divNonPeriodic() Returns a m+2 by m+1 one-dimensional mimetic divergence operator

divPeriodic() Returns a m+2 by m one-dimensional mimetic divergence operator when the boundary condition is periodic

This function is called by:

lap2D() Returns a two-dimensional mimetic Laplacian operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

div2DCurv() Returns a 2D curvilinear mimetic divergence

div2DCurv(k, X, Y)#

PURPOSE#

Returns a 2D curvilinear mimetic divergence

SYNTAX#

D = div2DCurv(k, X, Y)

DESCRIPTION#

CROSS-REFERENCE INFORMATION#

This function calls:

div2D() Returns a two-dimensional mimetic divergence operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

DI2()

jacobian2D()

div2DNonUniform(k, xticks, yticks)#

PURPOSE#

Returns a two-dimensional non-uniform mimetic divergence operator

SYNTAX#

D = div2DNonUniform(k, xticks, yticks)

DESCRIPTION#

     k : Order of accuracy
xticks : Edges' ticks (x-axis)
yticks : Edges' ticks (y-axis)

CROSS-REFERENCE INFORMATION#

This function calls:

divNonUniform() Returns a m+2 by m+1 one-dimensional non-uniform mimetic divergence operator

div3D(k, m, dx, n, dy, o, dz, dc, nc)#

PURPOSE#

Returns a three-dimensional mimetic divergence operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

SYNTAX#

D = div3D(k, m, dx, n, dy, o, dz)
D = div3D(k, m, dx, n, dy, o, dz, dc, nc)

DESCRIPTION#

            k : Order of accuracy
            m : Number of cells
           dx : Step size
            n : Number of cells along y-axis
           dy : Step size along y-axis
            o : Number of cells along z-axis
           dz : Step size along z-axis
(optional) dc : a0 (6x1 vector for left, right, bottom, top, front, back boundary types, resp.)
(optional) nc : b0 (6x1 vector for left, right, bottom, top, front, back boundary types, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

divNonPeriodic() Returns a m+2 by m+1 one-dimensional mimetic divergence operator

divNonPeriodic3D() Returns a three-dimensional mimetic divergence operator

divPeriodic() Returns a m+2 by m one-dimensional mimetic divergence operator when the boundary condition is periodic

This function is called by:

div3DCurv() Returns a 3D curvilinear mimetic divergence

lap3D() Returns a three-dimensional mimetic Laplacian operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

div3DCurv(k, X, Y, Z)#

PURPOSE#

Returns a 3D curvilinear mimetic divergence

SYNTAX#

D = div3DCurv(k, X, Y, Z)

DESCRIPTION#

CROSS-REFERENCE INFORMATION#

This function calls:

div() Returns a one-dimensional mimetic divergence operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

DI3()

div3D() Returns a three-dimensional mimetic divergence operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

jacobian3D()

div3DNonUniform(k, xticks, yticks, zticks)#

PURPOSE#

Returns a three-dimensional non-uniform mimetic divergence operator

SYNTAX#

D = div3DNonUniform(k, xticks, yticks, zticks)

DESCRIPTION#

     k : Order of accuracy
xticks : Edges' ticks (x-axis)
yticks : Edges' ticks (y-axis)
zticks : Edges' ticks (z-axis)

CROSS-REFERENCE INFORMATION#

This function calls:

divNonUniform() Returns a m+2 by m+1 one-dimensional non-uniform mimetic divergence operator

divNonUniform(k, ticks)#

PURPOSE#

Returns a m+2 by m+1 one-dimensional non-uniform mimetic divergence operator

SYNTAX#

D = divNonUniform(k, ticks)

DESCRIPTION#

    k : Order of accuracy
ticks : Edges' ticks e.g. [0 0.1 0.15 0.2 0.3 0.4 0.45]

CROSS-REFERENCE INFORMATION#

This function calls:

div() Returns a one-dimensional mimetic divergence operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

This function is called by:

div2DNonUniform() Returns a two-dimensional non-uniform mimetic divergence operator

div3DNonUniform() Returns a three-dimensional non-uniform mimetic divergence operator

Curl Operators#

curl2D(k, m, dx, n, dy)#

PURPOSE#

Returns a two-dimensional mimetic curl operator

SYNTAX#

C = curl2D(k, m, dx, n, dy)

DESCRIPTION#

output
The 1st component is computed at horizontal faces
(tangential vertical derivative)
The 2nd component is computed at vertical faces
(tangential horizontal derivative)
The third component or (scalar) curl is computed
at the cell centers (normal to the plane)
input

      Parameters : Parameter description not provided
               C : 2D curl operator with 3 components.
               k : Order of accuracy
               m : Number of cells along x-axis
              dx : Step size along x-axis
               n : Number of cells along y-axis
              dy : Step size along y-axis

CROSS-REFERENCE INFORMATION#

This function calls:

div() Returns a one-dimensional mimetic divergence operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

Laplacian Operators#

lap(k, m, dx, dc, nc)#

PURPOSE#

Returns a one-dimensional mimetic Laplacian operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

SYNTAX#

L = lap(k, m, dx)
L = lap(k, m, dx, dc, nc)

DESCRIPTION#

            k : Order of accuracy
            m : Number of cells
           dx : Step size
(optional) dc : a0 (2x1 vector for left and right vertices, resp.)
(optional) nc : b0 (2x1 vector for left and right vertices, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

grad() This gradient operator computes the vector of partial derivatives, indicating the direction of maximum rate of increase and the steepest slope of a scalar field.

lapNonPeriodic() Returns a m+2 by m+2 one-dimensional mimetic laplacian operator

div() Returns a one-dimensional mimetic divergence operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

lap2D(k, m, dx, n, dy, dc, nc)#

PURPOSE#

Returns a two-dimensional mimetic Laplacian operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

SYNTAX#

L = lap2D(k, m, dx, n, dy)
L = lap2D(k, m, dx, n, dy, dc, nc)

DESCRIPTION#

            k : Order of accuracy
            m : Number of cells along x-axis
           dx : Step size along x-axis
            n : Number of cells along y-axis
           dy : Step size along y-axis
(optional) dc : a0 (4x1 vector for left, right, bottom, top boundaries, resp.)
(optional) nc : b0 (4x1 vector for left, right, bottom, top boundaries, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

div2D() Returns a two-dimensional mimetic divergence operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

grad2D() Returns a two-dimensional mimetic gradient operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

lapNonPeriodic2D() Returns a two-dimensional mimetic laplacian operator

lap3D(k, m, dx, n, dy, o, dz, dc, nc)#

PURPOSE#

Returns a three-dimensional mimetic Laplacian operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

SYNTAX#

L = lap3D(k, m, dx, n, dy, o, dz)
L = lap3D(k, m, dx, n, dy, o, dz, dc, nc)

DESCRIPTION#

            k : Order of accuracy
            m : Number of cells along x-axis
           dx : Step size along x-axis
            n : Number of cells along y-axis
           dy : Step size along y-axis
            o : Number of cells along z-axis
           dz : Step size along z-axis
(optional) dc : a0 (6x1 vector for left, right, bottom, top, front, back boundary types, resp.)
(optional) nc : b0 (6x1 vector for left, right, bottom, top, front, back boundary types, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

lapNonPeriodic3D() Returns a three-dimensional mimetic laplacian operator

grad3D() Returns a three-dimensional mimetic gradient operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

div3D() Returns a three-dimensional mimetic divergence operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

Interpolation Functions#

Node to Center Interpolation#

interpolNodesToCenters1D(k, m)#

PURPOSE#

interpolation operator from nodal coordinates to staggered centers

SYNTAX#

I = interpolNodesToCenters1D(k, m)

DESCRIPTION#

nodal logical coordinates are [1:1:m]
centers logical coordinates [1,1.5:m-0.5,m]

m is the number of cells in the logical x-axis : param m is the number of cells in the logical x-axis:

CROSS-REFERENCE INFORMATION#

This function calls:

interpolFacesToCentersG1D() 1D interpolation from faces to centers

interpolNodesToCenters2D(k, m, n, dc, nc)#

PURPOSE#

interpolation operator from nodal coordinates to staggered centers

SYNTAX#

I = interpolNodesToCenters2D(k, m, n)

DESCRIPTION#

nodal logical coordinates are [1:1:m]x[1:1:n]
centers logical coordinates [1,1.5:m-0.5,m]x[1,1.5:n-0.5,n]

m is the number of cells in the logical x-axis : param m is the number of cells in the logical x-axis:
n is the number of cells in the logical y-axis : param n is the number of cells in the logical y-axis:

CROSS-REFERENCE INFORMATION#

This function calls:

interpolFacesToCentersG1DPeriodic() 1D interpolation from faces to centers when the boundary condition is periodic

interpolFacesToCentersG1D() 1D interpolation from faces to centers

interpolNodesToCenters3D(k, m, n, o, dc, nc)#

PURPOSE#

interpolation operator from nodal coordinates to staggered centers

SYNTAX#

I = interpolNodesToCenters3D(k, m, n, o)

DESCRIPTION#

nodal logical coordinates are [1:1:m]x[1:1:n]x[1:1:o]
centers logical coordinates [1,1.5:m-0.5,m]x[1,1.5:n-0.5,n]x[1,1.5:o-0.5,o]

m is the number of cells in the logical x-axis : param m is the number of cells in the logical x-axis:
n is the number of cells in the logical y-axis : param n is the number of cells in the logical y-axis:
o is the number of cells in the logical z-axis : param o is the number of cells in the logical z-axis:

CROSS-REFERENCE INFORMATION#

This function calls:

interpolFacesToCentersG1DPeriodic() 1D interpolation from faces to centers when the boundary condition is periodic

interpolFacesToCentersG1D() 1D interpolation from faces to centers

Center to Node Interpolation#

interpolCentersToNodes1D(k, m)#

PURPOSE#

interpolation operator from nodal coordinates to staggered centers

SYNTAX#

I = interpolCentersToNodes1D(k, m)

DESCRIPTION#

nodal logical coordinates are [1:1:m]
centers logical coordinates [1,1.5:m-0.5,m]

               m : Number of cells in the logical x-axis

CROSS-REFERENCE INFORMATION#

This function calls:

interpolCentersToFacesD1D() 1D interpolation from centers to faces. logical centers are [1 1.5 2.5 … m-1.5 m-0.5 m]

interpolCentersToNodes2D(k, m, n, dc, nc)#

PURPOSE#

interpolation operator from staggered to nodes

SYNTAX#

I = interpolCentersToNodes2D(k, m, n)

DESCRIPTION#

nodal logical coordinates are [1:1:m]x[1:1:n]
centers logical coordinates [1,1.5:m-0.5,m]x[1,1.5:n-0.5,n]

               m : Number of cells in the logical x-axis
               n : Number of cells in the logical y-axis

CROSS-REFERENCE INFORMATION#

This function calls:

interpolCentersToFacesD1D() 1D interpolation from centers to faces. logical centers are [1 1.5 2.5 … m-1.5 m-0.5 m]

interpolCentersToFacesD1DPeriodic() 1D interpolation from centers to faces. when the boundary condition is periodic logical centers are [1 1.5 2.5 … m-1.5 m-0.5]

interpolCentersToNodes3D(k, m, n, o, dc, nc)#

PURPOSE#

interpolation operator from staggered to nodes

SYNTAX#

I = interpolCentersToNodes3D(k, m, n, o)

DESCRIPTION#

nodal logical coordinates are [1:1:m]x[1:1:n]x[1:1:o]
centers logical coordinates [1,1.5:m-0.5,m]x[1,1.5:n-0.5,n]x[1,1.5:o-0.5,o]

               m : Number of cells in the logical x-axis
               n : Number of cells in the logical y-axis
               o : Number of cells in the logical z-axis

CROSS-REFERENCE INFORMATION#

This function calls:

interpolCentersToFacesD1D() 1D interpolation from centers to faces. logical centers are [1 1.5 2.5 … m-1.5 m-0.5 m]

interpolCentersToFacesD1DPeriodic() 1D interpolation from centers to faces. when the boundary condition is periodic logical centers are [1 1.5 2.5 … m-1.5 m-0.5]

Face Interpolation#

interpolFacesToCentersG1D(k, m)#

PURPOSE#

1D interpolation from faces to centers

SYNTAX#

I = interpolFacesToCentersG1D(k, m)

DESCRIPTION#

centers logical coordinates [1,1.5:m-0.5,m]

               m : Number of cells in the logical x-axis

CROSS-REFERENCE INFORMATION#

This function is called by:

interpolNodesToCenters3D() interpolation operator from nodal coordinates to staggered centers

interpolNodesToCenters1D() interpolation operator from nodal coordinates to staggered centers

interpolFacesToCentersG2D() 2D interpolation from faces to centers

interpolNodesToCenters2D() interpolation operator from nodal coordinates to staggered centers

interpolFacesToCentersG3D() 3D interpolation from faces to centers

interpolFacesToCentersG2D(k, m, n, dc, nc)#

PURPOSE#

2D interpolation from faces to centers

SYNTAX#

I = interpolFacesToCentersG2D(k, m, n)

DESCRIPTION#

centers logical coordinates [1,1.5:m-0.5,m]x[1,1.5:n-0.5,n]

               m : Number of cells in the logical x-axis
               n : Number of cells in the logical y-axis

CROSS-REFERENCE INFORMATION#

This function calls:

interpolFacesToCentersG1DPeriodic() 1D interpolation from faces to centers when the boundary condition is periodic

interpolFacesToCentersG1D() 1D interpolation from faces to centers

interpolFacesToCentersG3D(k, m, n, o, dc, nc)#

PURPOSE#

3D interpolation from faces to centers

SYNTAX#

I = interpolFacesToCentersG3D(k, m, n, o)

DESCRIPTION#

centers logical coordinates [1,1.5:m-0.5,m]x[1,1.5:n-0.5,n]x[1,1.5:o-0.5,o]

               m : Number of cells in the logical x-axis
               n : Number of cells in the logical y-axis
               o : Number of cells in the logical z-axis

CROSS-REFERENCE INFORMATION#

This function calls:

interpolFacesToCentersG1DPeriodic() 1D interpolation from faces to centers when the boundary condition is periodic

interpolFacesToCentersG1D() 1D interpolation from faces to centers

General Interpolation#

interpol(m, c)#

PURPOSE#

Returns a m+1 by m+2 one-dimensional interpolator of 2nd-order

SYNTAX#

I = interpol(m, c)

DESCRIPTION#

m : Number of cells
c : Left interpolation coeff.

CROSS-REFERENCE INFORMATION#

This function is called by:

interpol3D() Returns a three-dimensional interpolator of 2nd-order

interpol2D() Returns a two-dimensional interpolator of 2nd-order

interpol2D(m, n, c1, c2)#

PURPOSE#

Returns a two-dimensional interpolator of 2nd-order

SYNTAX#

I = interpol2D(m, n, c1, c2)

DESCRIPTION#

 m : Number of cells along x-axis
 n : Number of cells along y-axis
c1 : Left interpolation coeff.
c2 : Bottom interpolation coeff.

CROSS-REFERENCE INFORMATION#

This function calls:

interpol() Returns a m+1 by m+2 one-dimensional interpolator of 2nd-order

interpol3D(m, n, o, c1, c2, c3)#

PURPOSE#

Returns a three-dimensional interpolator of 2nd-order

SYNTAX#

I = interpol3D(m, n, o, c1, c2, c3)

DESCRIPTION#

 m : Number of cells along x-axis
 n : Number of cells along y-axis
 o : Number of cells along z-axis
c1 : Left interpolation coeff.
c2 : Bottom interpolation coeff.
c3 : Front interpolation coeff.

CROSS-REFERENCE INFORMATION#

This function calls:

interpol() Returns a m+1 by m+2 one-dimensional interpolator of 2nd-order

interpolD(m, c)#

PURPOSE#

Returns a m+2 by m+1 one-dimensional interpolator of 2nd-order

SYNTAX#

I = interpolD(m, c)

DESCRIPTION#

m : Number of cells
c : Left interpolation coeff.

CROSS-REFERENCE INFORMATION#

This function is called by:

interpolD2D() Returns a two-dimensional interpolator of 2nd-order

interpolD3D() Returns a three-dimensional interpolator of 2nd-order

interpolD2D(m, n, c1, c2)#

PURPOSE#

Returns a two-dimensional interpolator of 2nd-order

SYNTAX#

I = interpolD2D(m, n, c1, c2)

DESCRIPTION#

 m : Number of cells along x-axis
 n : Number of cells along y-axis
c1 : Left interpolation coeff.
c2 : Bottom interpolation coeff.

CROSS-REFERENCE INFORMATION#

This function calls:

interpolD() Returns a m+2 by m+1 one-dimensional interpolator of 2nd-order

interpolD3D(m, n, o, c1, c2, c3)#

PURPOSE#

Returns a three-dimensional interpolator of 2nd-order

SYNTAX#

I = interpolD3D(m, n, o, c1, c2, c3)

DESCRIPTION#

 m : Number of cells along x-axis
 n : Number of cells along y-axis
 o : Number of cells along z-axis
c1 : Left interpolation coeff.
c2 : Bottom interpolation coeff.
c3 : Front interpolation coeff.

CROSS-REFERENCE INFORMATION#

This function calls:

interpolD() Returns a m+2 by m+1 one-dimensional interpolator of 2nd-order

Boundary Conditions#

General Boundary Conditions#

addScalarBC1D(A, b, k, m, dx, dc, nc, v)#

PURPOSE#

Separates cases non-periodic and periodic for dealing with boundary data

SYNTAX#

[A, b] = addScalarBC1D(A, b, k, m, dx, dc, nc, v)

DESCRIPTION#

output
input

      Parameters : Parameter description not provided
              A0 : Linear operator with boundary conditions added
              b0 : Right hand side with boundary conditions added
               A : Linear operator without boundary conditions added
               b : Right hand side without boundary conditions added
               k : Order of accuracy
               m : Number of cells
              dx : Step size
              dc : a0 (2x1 vector for left and right vertices, resp.)
              nc : b0 (2x1 vector for left and right vertices, resp.)
               v : g (2x1 vector for left and right vertices, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

addScalarBC1Drhs() This function uses the non-periodic boundary condition type of each vertex and the rhs b values associated to left, and right vertices to modify the rhs vector b.

addScalarBC1Dlhs() This functions uses geometry and boundary type conditions to create modifications of matrix A associated to each of the boundary faces.

addScalarBC1Dlhs(k, m, dx, dc, nc)#

PURPOSE#

This functions uses geometry and boundary type conditions to create modifications of matrix A associated to each of the boundary faces.

SYNTAX#

[Al, Ar] = addScalarBC1Dlhs(k, m, dx, dc, nc)

DESCRIPTION#

output
input

      Parameters : Parameter description not provided
              Al : modification of matrix A due to left boundary condition
              Ar : modification of matrix A due to right boundary condition
               k : Order of accuracy
               m : Number of cells
              dx : Step size
              dc : Dirichlet coefficient (2x1 vector for left and right vertices, resp.)
              nc : Neumann coefficient (2x1 vector for left and right vertices, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

grad() This gradient operator computes the vector of partial derivatives, indicating the direction of maximum rate of increase and the steepest slope of a scalar field.

This function is called by:

addScalarBC3Dlhs() This functions uses geometry and boundary type conditions to create modifications of matrix A associated to each of the boundary faces.

addScalarBC2Dlhs() This functions uses geometry and boundary type conditions to create modifications of matrix A associated to each of the boundary edges.

addScalarBC1D() Separates cases non-periodic and periodic for dealing with boundary data

addScalarBC1Drhs(b, v, vec)#

PURPOSE#

This function uses the non-periodic boundary condition type of each vertex and the rhs b values associated to left, and right vertices to modify the rhs vector b.

SYNTAX#

b = addScalarBC1Drhs(b, v, vec)

DESCRIPTION#

output
input

      Parameters : Parameter description not provided
               b : Right hand side with boundary conditions added
               b : Right hand side without boundary conditions added
               v : value (2x1 vector for left and right vertices, resp.)
             vec : vector with indices of rhs associated to bc

CROSS-REFERENCE INFORMATION#

This function is called by:

addScalarBC1D() Separates cases non-periodic and periodic for dealing with boundary data

addScalarBC2D(A, b, k, m, dx, n, dy, dc, nc, v)#

PURPOSE#

This function assumes that the unknown u, which represents the discrete solution the continuous second-order 2D PDE operator L U = f, with continuous boundary condition a0 U + b0 dU/dn = g, are given at the 2D cell centers and boundary face centers. Furthermore, all discrete calculations are performed at the 2D cell centers and boundary face centers.

SYNTAX#

[A, b] = addScalarBC2D(A, b, k, m, dx, n, dy, dc, nc, v)

DESCRIPTION#

The function receives as input quantities associated to the discrete
analog of the continuous problem given by the squared linear system
A u = b
where A is the discrete analog of L and b is the discrete analog of g,
both constructed by the user without boundary conditions.
The function output is the modified square linear system
A u = b
where both A and b include boundary condition information.
The boundary condition is always one of the following forms:
For Dirichlet set: a0 not equal zero and b0 = 0.
For Neumann set  : a0 = 0 and b0 not equal zero.
For Robin set    : both a0 and b0 not equal zero.
For Periodic set : both a0 = 0 and b0 = 0.
For periodic bc, it is assumed that not only u but also du/dn are the same
in both extremes of the domain since a second-order PDE is assumed.
Periodic boundary conditions can be applied along some axes and
non-periodic to some others.
For consistence with the way boundary operators are calculated to avoid
overwriting of the values v, the left and right boundary conditions are
assumed to be column vectors of (m+2)*n components, and the bottom and
top faces are assumed to be vectors of (m+2)*(n+2) components.
The order of these components is as follows:
For left and right edges, the ordering is the one given by columns vectors
where x increases. For bottom and top faces, the ordering is the one given
by columns vectors where y increases.
The code assumes the following assertions:
assert(k >= 2, 'k >= 2');
assert(mod(k, 2) == 0, 'k % 2 = 0');
assert(m >= 2*k+1, ['m >= ' num2str(2*k+1) ' for k = ' num2str(k)]);
output
input

      Parameters : Parameter description not provided
               A : Linear operator with boundary conditions added
               b : Right hand side with boundary conditions added
               A : Linear operator without boundary conditions added
               b : Right hand side without boundary conditions added
               k : Order of accuracy
               m : Number of horizontal cells
              dx : Step size horizontal cells
               n : Number of vertical cells
              dy : Step size of vertical cells
              dc : a0 (4x1 vector for left, right, bottom, top boundaries, resp.)
              nc : b0 (4x1 vector for left, right, bottom, top boundaries, resp.)
               v : g (4x1 vector of arrays for left, right, bottom, top boundaries, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

addScalarBC2Dlhs() This functions uses geometry and boundary type conditions to create modifications of matrix A associated to each of the boundary edges.

addScalarBC2Drhs() function b = addBC2Drhs(b, m, n, dc, nc, v, vec) This function uses the boundary condition type of each face and the rhs b indices and values associated to left, right, bottom, top, front, back faces to modify the rhs vector b.

addScalarBC2Dlhs(k, m, dx, n, dy, dc, nc)#

PURPOSE#

This functions uses geometry and boundary type conditions to create modifications of matrix A associated to each of the boundary edges.

SYNTAX#

[Abcl,Abcr,Abcb,Abct] = addScalarBC2Dlhs(k, m, dx, n, dy, dc, nc)

DESCRIPTION#

output
input

      Parameters : Parameter description not provided
            Abcl : Matrix coefficients associated to boundary conditions for left edge
            Abcr : Matrix coefficients associated to boundary conditions for right edge
            Abcb : Matrix coefficients associated to boundary conditions for bottom edge
            Abct : Matrix coefficients associated to boundary conditions for top edge
               k : Order of accuracy
               m : Number of the horizontal cells
              dx : Step size
               n : Number of the vertical cells
              dy : Horizontal cell size
              dc : a0 (4x1 vector for left, right, bottom, top boundaries, resp.)
              nc : b0 (4x1 vector for left, right, bottom, top boundaries resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

addScalarBC1Dlhs() This functions uses geometry and boundary type conditions to create modifications of matrix A associated to each of the boundary faces.

This function is called by:

addScalarBC2D() This function assumes that the unknown u, which represents the discrete solution the continuous second-order 2D PDE operator L U = f, with continuous boundary condition a0 U + b0 dU/dn = g, are given at the 2D cell centers and boundary face centers. Furthermore, all discrete calculations are performed at the 2D cell centers and boundary face centers.

addScalarBC2Drhs(b, dc, nc, v, rl, rr, rb, rt)#

PURPOSE#

function b = addBC2Drhs(b, m, n, dc, nc, v, vec) This function uses the boundary condition type of each face and the rhs b indices and values associated to left, right, bottom, top, front, back faces to modify the rhs vector b.

SYNTAX#

b = addScalarBC2Drhs(b, dc, nc, v, rl, rr, rb, rt)

DESCRIPTION#

output
input

      Parameters : Parameter description not provided
               b : Right hand side with boundary conditions added
               b : Right hand side without boundary conditions added
              dc : a0 (4x1 vector for left, right, bottom, top boundary types, resp.)
              nc : b0 (4x1 vector for left, right, bottom, top boundary types, resp.)
               v : g (4x1 vector of arrays for left, right, bottom, top boundaries, resp.)
              rl : indices of rhs left indices
              rr : indices of rhs right indices
              rb : indices of rhs bottom indices
              rt : indices of rhs top indices
             vec : vector with indices of rhs associated to bc

CROSS-REFERENCE INFORMATION#

This function is called by:

addScalarBC2D() This function assumes that the unknown u, which represents the discrete solution the continuous second-order 2D PDE operator L U = f, with continuous boundary condition a0 U + b0 dU/dn = g, are given at the 2D cell centers and boundary face centers. Furthermore, all discrete calculations are performed at the 2D cell centers and boundary face centers.

addScalarBC3D(A, b, k, m, dx, n, dy, o, dz, dc, nc, v)#

PURPOSE#

This function assumes that the unknown u, which represents the discrete solution the continuous second-order 3D PDE operator L U = f, with continuous boundary condition a0 U + b0 dU/dn = g, are given at the 3D cell centers and boundary face centers. Furthermore, all discrete calculations are performed at the 3D cell centers and boundary face centers.

SYNTAX#

[A, b] = addScalarBC3D(A, b, k, m, dx, n, dy, o, dz, dc, nc, v)

DESCRIPTION#

The function receives as input quantities associated to the discrete
analog of the continuous problem given by the squared linear system
A u = b
where A is the discrete analog of L and b is the discrete analog of g,
both constructed by the user without boundary conditions.
The function output is the modified square linear system
A u = b
where both A and b include boundary condition information.
The boundary condition is always one of the following forms:
For Dirichlet set: a0 not equal zero and b0 = 0.
For Neumann set  : a0 = 0 and b0 not equal zero.
For Robin set    : both a0 and b0 not equal zero.
For Periodic set : both a0 = 0 and b0 = 0.
For periodic bc, it is assumed that not only u but also du/dn are the same
in both extremes of the domain since a second-order PDE is assumed.
Periodic boundary conditions can be applied along some axes and
non-periodic to some others.
For consistence with the way boundary operators are calculated to avoid
overwriting of the values v, the left and right boundary conditions are
assumed to be column vectors of n*o components, the bottom and top
boundary conditions are assumed to be column vectors of (m+2)*o
components, and the front and back faces are assumed to be vectors of
(m+2)*(n+2) components.
The order of these components is as follows:
For left and right faces, the ordering is the one by columns of the
matrix where y increase along rows, and z increase along columns.
For bottom and top faces, the ordering is the one by columns of the
matrix where x increase along rows, and z increase along columns.
For front and back faces, the ordering is the one by columns of the
matrix where x increase along rows, and y increase along columns.
The code assumes the following assertions:
assert(k >= 2, 'k >= 2');
assert(mod(k, 2) == 0, 'k % 2 = 0');
assert(m >= 2*k+1, ['m >= ' num2str(2*k+1) ' for k = ' num2str(k)]);
output
input

      Parameters : Parameter description not provided
               A : Linear operator with boundary conditions added
               b : Right hand side with boundary conditions added
               A : Linear operator without boundary conditions added
               b : Right hand side without boundary conditions added
               k : Order of accuracy
               m : Number of horizontal cells
              dx : Step size of horizontal
               n : Number of vertical cells
              dy : Step size of vertical cells
               o : Number of depth cells
              dz : Step size of depth cells
              dc : a0 (6x1 vector for left, right, bottom, top, front, back boundary types, resp.)
              nc : b0 (6x1 vector for left, right, bottom, top, front, back boundary types, resp.)
               v : g (6x1 vector of arrays for left, right, bottom, top, front, back boundaries, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

addScalarBC3Dlhs() This functions uses geometry and boundary type conditions to create modifications of matrix A associated to each of the boundary faces.

addScalarBC3Drhs() This function uses the boundary condition type of each face and the rhs b indices and values associated to left, right, bottom, top, front, back faces to modify the rhs vector b.

addScalarBC3Dlhs(k, m, dx, n, dy, o, dz, dc, nc)#

PURPOSE#

This functions uses geometry and boundary type conditions to create modifications of matrix A associated to each of the boundary faces.

SYNTAX#

[Abcl,Abcr,Abcb,Abct,Abcf,Abcz] = addScalarBC3Dlhs(k, m, dx, n, dy, o, dz, dc, nc)

DESCRIPTION#

output
input

      Parameters : Parameter description not provided
            Abcl : Matrix coefficients associated to boundary conditions for left face
            Abcr : Matrix coefficients associated to boundary conditions for right face
            Abcb : Matrix coefficients associated to boundary conditions for bottom face
            Abct : Matrix coefficients associated to boundary conditions for top face
            Abcf : Matrix coefficients associated to boundary conditions for front face
            Abcz : Matrix coefficients associated to boundary conditions for back face
               k : Order of accuracy
               m : Number of the horizontal cells
              dx : Step size
               n : Number of the vertical cells
              dy : Horizonttal cell size
               o : Number of the depth cells
              dz : Depth cell size
              dc : a0 (6x1 vector for left, right, bottom, top, front, back boundary types, resp.)
              nc : b0 (6x1 vector for left, right, bottom, top, front, back boundary types, resp.)

CROSS-REFERENCE INFORMATION#

This function calls:

addScalarBC1Dlhs() This functions uses geometry and boundary type conditions to create modifications of matrix A associated to each of the boundary faces.

This function is called by:

addScalarBC3D() This function assumes that the unknown u, which represents the discrete solution the continuous second-order 3D PDE operator L U = f, with continuous boundary condition a0 U + b0 dU/dn = g, are given at the 3D cell centers and boundary face centers. Furthermore, all discrete calculations are performed at the 3D cell centers and boundary face centers.

addScalarBC3Drhs(b, dc, nc, v, rl, rr, rb, rt, rf, rz)#

PURPOSE#

This function uses the boundary condition type of each face and the rhs b indices and values associated to left, right, bottom, top, front, back faces to modify the rhs vector b.

SYNTAX#

b = addScalarBC3Drhs(b, dc, nc, v, rl, rr, rb, rt, rf, rz)

DESCRIPTION#

output
input

      Parameters : Parameter description not provided
               b : Right hand side with boundary conditions added
               b : Right hand side without boundary conditions added
              dc : a0 (6x1 vector for left, right, bottom, top, front, back boundary types, resp.)
              nc : b0 (6x1 vector for left, right, bottom, top, front, back boundary types, resp.)
               v : g (6x1 vector of arrays for left, right, bottom, top, front, back boundaries, resp.)
              rl : indices of rhs left indices
              rr : indices of rhs right indices
              rb : indices of rhs bottom indices
              rt : indices of rhs top indices
              rf : indices of rhs front indices
              rz : indices of rhs back indices

CROSS-REFERENCE INFORMATION#

This function is called by:

addScalarBC3D() This function assumes that the unknown u, which represents the discrete solution the continuous second-order 3D PDE operator L U = f, with continuous boundary condition a0 U + b0 dU/dn = g, are given at the 3D cell centers and boundary face centers. Furthermore, all discrete calculations are performed at the 3D cell centers and boundary face centers.

Neumann Boundary Conditions#

neumann2DCurv(G, m, n, b)#

PURPOSE#

Returns a 2D curvilinear Neumann BC operator

SYNTAX#

N = neumann2DCurv(G, m, n, b)

DESCRIPTION#

G : Curvilinear gradient
b : Neumann coeff.

CROSS-REFERENCE INFORMATION#

No cross-reference information found. This typically means this function neither calls nor is called by other functions in the codebase.

neumann3DCurv(G, m, n, o, b)#

PURPOSE#

Returns a 3D curvilinear Neumann BC operator

SYNTAX#

N = neumann3DCurv(G, m, n, o, b)

DESCRIPTION#

G : Curvilinear gradient
b : Neumann coeff.

CROSS-REFERENCE INFORMATION#

No cross-reference information found. This typically means this function neither calls nor is called by other functions in the codebase.

Robin Boundary Conditions#

robinBC(k, m, dx, a, b)#

PURPOSE#

Returns a m+2 by m+2 one-dimensional mimetic boundary operator that imposes a boundary condition of Robin’s type

SYNTAX#

BC = robinBC(k, m, dx, a, b)

DESCRIPTION#

 k : Order of accuracy
 m : Number of cells
dx : Step size
 a : Dirichlet Coefficient
 b : Neumann Coefficient

CROSS-REFERENCE INFORMATION#

This function calls:

grad() This gradient operator computes the vector of partial derivatives, indicating the direction of maximum rate of increase and the steepest slope of a scalar field.

This function is called by:

robinBC2D() Returns a two-dimensional mimetic boundary operator that imposes a boundary condition of Robin’s type

robinBC3D() Returns a three-dimensional mimetic boundary operator that imposes a boundary condition of Robin’s type

robinBC2D(k, m, dx, n, dy, a, b)#

PURPOSE#

Returns a two-dimensional mimetic boundary operator that imposes a boundary condition of Robin’s type

SYNTAX#

BC = robinBC2D(k, m, dx, n, dy, a, b)

DESCRIPTION#

 k : Order of accuracy
 m : Number of cells along x-axis
dx : Step size along x-axis
 n : Number of cells along y-axis
dy : Step size along y-axis
 a : Dirichlet Coefficient
 b : Neumann Coefficient

CROSS-REFERENCE INFORMATION#

This function calls:

robinBC() Returns a m+2 by m+2 one-dimensional mimetic boundary operator that imposes a boundary condition of Robin’s type

robinBC3D(k, m, dx, n, dy, o, dz, a, b)#

PURPOSE#

Returns a three-dimensional mimetic boundary operator that imposes a boundary condition of Robin’s type

SYNTAX#

BC = robinBC3D(k, m, dx, n, dy, o, dz, a, b)

DESCRIPTION#

 k : Order of accuracy
 m : Number of cells along x-axis
dx : Step size along x-axis
 n : Number of cells along y-axis
dy : Step size along y-axis
 o : Number of cells along z-axis
dz : Step size along z-axis
 a : Dirichlet Coefficient
 b : Neumann Coefficient

CROSS-REFERENCE INFORMATION#

This function calls:

robinBC() Returns a m+2 by m+2 one-dimensional mimetic boundary operator that imposes a boundary condition of Robin’s type

Mixed Boundary Conditions#

mixedBC(k, m, dx, left, coeffs_left, right, coeffs_right)#

PURPOSE#

Constructs a 1D mimetic mixed boundary conditions operator

SYNTAX#

BC = mixedBC(k, m, dx, left, coeffs_left, right, coeffs_right)

DESCRIPTION#

           k : Order of accuracy
           m : Number of cells
          dx : Step size
        left : Type of boundary condition at the left boundary ('Dirichlet', 'Neumann', 'Robin')
 coeffs_left : Coefficients for the left boundary condition (a, b for Robin, otherwise coeff. for Dirichlet or Neumann)
       right : Type of boundary condition at the right boundary ('Dirichlet', 'Neumann', 'Robin')
coeffs_right : Coefficients for the right boundary condition (a, b for Robin, otherwise coeff. for Dirichlet or Neumann)

CROSS-REFERENCE INFORMATION#

This function calls:

grad() This gradient operator computes the vector of partial derivatives, indicating the direction of maximum rate of increase and the steepest slope of a scalar field.

This function is called by:

mixedBC2D() Constructs a 2D mimetic mixed boundary conditions operator

mixedBC3D() Constructs a 3D mimetic mixed boundary conditions operator

mixedBC2D(k, m, dx, n, dy, left, coeffs_left, right, coeffs_right, bottom, coeffs_bottom, top, coeffs_top)#

PURPOSE#

Constructs a 2D mimetic mixed boundary conditions operator

SYNTAX#

BC = mixedBC2D(k, m, dx, n, dy, left, coeffs_left, right, coeffs_right, bottom, coeffs_bottom, top, coeffs_top)

DESCRIPTION#

            k : Order of accuracy
            m : Number of cells in x-direction
           dx : Step size in x-direction
            n : Number of cells in y-direction
           dy : Step size in y-direction
         left : Type of boundary condition at the left boundary ('Dirichlet', 'Neumann', 'Robin')
  coeffs_left : Coefficients for the left boundary condition (a, b for Robin, otherwise coeff. for Dirichlet or Neumann)
        right : Type of boundary condition at the right boundary ('Dirichlet', 'Neumann', 'Robin')
 coeffs_right : Coefficients for the right boundary condition (a, b for Robin, otherwise coeff. for Dirichlet or Neumann)
       bottom : Type of boundary condition at the bottom boundary ('Dirichlet', 'Neumann', 'Robin')
coeffs_bottom : Coefficients for the bottom boundary condition (a, b for Robin, otherwise coeff. for Dirichlet or Neumann)
          top : Type of boundary condition at the top boundary ('Dirichlet', 'Neumann', 'Robin')
   coeffs_top : Coefficients for the top boundary condition (a, b for Robin, otherwise coeff. for Dirichlet or Neumann)

CROSS-REFERENCE INFORMATION#

This function calls:

mixedBC() Constructs a 1D mimetic mixed boundary conditions operator

mixedBC3D(k, m, dx, n, dy, o, dz, left, coeffs_left, right, coeffs_right, bottom, coeffs_bottom, top, coeffs_top, front, coeffs_front, back, coeffs_back)#

PURPOSE#

Constructs a 3D mimetic mixed boundary conditions operator

SYNTAX#

BC = mixedBC3D(k, m, dx, n, dy, o, dz, left, coeffs_left, right, coeffs_right, bottom, coeffs_bottom, top, coeffs_top, front, coeffs_front, back, coeffs_back)

DESCRIPTION#

            k : Order of accuracy
            m : Number of cells in x-direction
           dx : Step size in x-direction
            n : Number of cells in y-direction
           dy : Step size in y-direction
            o : Number of cells in z-direction
           dz : Step size in z-direction
         left : Type of boundary condition at the left boundary ('Dirichlet', 'Neumann', 'Robin')
  coeffs_left : Coefficients for the left boundary condition (a, b for Robin, otherwise coeff. for Dirichlet or Neumann)
        right : Type of boundary condition at the right boundary ('Dirichlet', 'Neumann', 'Robin')
 coeffs_right : Coefficients for the right boundary condition (a, b for Robin, otherwise coeff. for Dirichlet or Neumann)
       bottom : Type of boundary condition at the bottom boundary ('Dirichlet', 'Neumann', 'Robin')
coeffs_bottom : Coefficients for the bottom boundary condition (a, b for Robin, otherwise coeff. for Dirichlet or Neumann)
          top : Type of boundary condition at the top boundary ('Dirichlet', 'Neumann', 'Robin')
   coeffs_top : Coefficients for the top boundary condition (a, b for Robin, otherwise coeff. for Dirichlet or Neumann)
        front : Type of boundary condition at the front boundary ('Dirichlet', 'Neumann', 'Robin')
 coeffs_front : Coefficients for the front boundary condition (a, b for Robin, otherwise coeff. for Dirichlet or Neumann)
         back : Type of boundary condition at the back boundary ('Dirichlet', 'Neumann', 'Robin')
  coeffs_back : Coefficients for the back boundary condition (a, b for Robin, otherwise coeff. for Dirichlet or Neumann)

CROSS-REFERENCE INFORMATION#

This function calls:

mixedBC() Constructs a 1D mimetic mixed boundary conditions operator

Grid Generation and Transformation#

Grid Generation#

gridGen(method, grid_name, m, n, plot_grid, varargin)#

PURPOSE#

Returns X and Y which are both m by n matrices that contains the physical coordinates

SYNTAX#

[X, Y] = gridGen(method, grid_name, m, n, plot_grid, varargin)

DESCRIPTION#

grid_name : String with the name of the grid folder
        m : Number of nodes along the horizontal axis
        n : Number of nodes along the vertical axis
plot_grid : If true -> plot the grid
 varargin : Maximum number of iterations (Required for TTM)

CROSS-REFERENCE INFORMATION#

This function calls:

ttm() Returns X and Y which are both m by n matrices that contains the physical coordinates

tfi() Returns X and Y which are both m by n matrices that contains the physical coordinates

tfi(grid_name, m, n, plot_grid)#

PURPOSE#

Returns X and Y which are both m by n matrices that contains the physical coordinates

SYNTAX#

[X, Y] = tfi(grid_name, m, n, plot_grid)

DESCRIPTION#

grid_name : String with the name of the grid folder
        m : Number of nodes along the horizontal axis
        n : Number of nodes along the vertical axis
plot_grid : If defined -> grid will be plotted

CROSS-REFERENCE INFORMATION#

This function is called by:

gridGen() Returns X and Y which are both m by n matrices that contains the physical coordinates

Jacobian Calculation#

jacobian2D(k, X, Y)#

PURPOSE#

SYNTAX#

[J, Xe, Xn, Ye, Yn] = jacobian2D(k, X, Y)

DESCRIPTION#

Xe : dx/de metric
Xn : dx/dn metric
Ye : dy/de metric
Yn : dy/dn metric
 k : Order of accuracy
 X : x-coordinates (physical) of meshgrid
 Y : y-coordinates (physical) of meshgrid

CROSS-REFERENCE INFORMATION#

This function calls:

nodal2D() Returns a two-dimensional operator that approximates the first-order derivatives on a uniform nodal grid

This function is called by:

div2DCurv() Returns a 2D curvilinear mimetic divergence

grad2DCurv() Returns a 2D curvilinear mimetic gradient

nodal2DCurv()

jacobian3D(k, X, Y, Z)#

PURPOSE#

SYNTAX#

[J, Xe, Xn, Xc, Ye, Yn, Yc, Ze, Zn, Zc] = jacobian3D(k, X, Y, Z)

DESCRIPTION#

Xe : dx/de metric
Xn : dx/dn metric
Xc : dx/dc metric
Ye : dy/de metric
Yn : dy/dn metric
Yc : dy/dc metric
Ze : dz/de metric
Zn : dz/dn metric
Zc : dz/dc metric
 k : Order of accuracy
 X : x-coordinates (physical) of meshgrid
 Y : y-coordinates (physical) of meshgrid
 Z : z-coordinates (physical) of meshgrid

CROSS-REFERENCE INFORMATION#

This function calls:

nodal3D() Returns a three-dimensional operator that approximates the first-order derivatives on a uniform nodal grid

This function is called by:

nodal3DCurv()

div3DCurv() Returns a 3D curvilinear mimetic divergence

grad3DCurv() Returns a 3D curvilinear mimetic gradient

Nodal Operators#

nodal(k, m, dx)#

PURPOSE#

Returns a m+1 by m+1 one-dimensional operator that approximates the first-order derivatives on a uniform nodal grid

SYNTAX#

N = nodal(k, m, dx)

DESCRIPTION#

 k : Order of accuracy
 m : Number of nodes
dx : Step size

CROSS-REFERENCE INFORMATION#

This function is called by:

nodal3D() Returns a three-dimensional operator that approximates the first-order derivatives on a uniform nodal grid

nodal2D() Returns a two-dimensional operator that approximates the first-order derivatives on a uniform nodal grid

nodal2D(k, m, dx, n, dy)#

PURPOSE#

Returns a two-dimensional operator that approximates the first-order derivatives on a uniform nodal grid

SYNTAX#

N = nodal2D(k, m, dx, n, dy)

DESCRIPTION#

 k : Order of accuracy
 m : Number of nodes along x-axis
dx : Step size along x-axis
 n : Number of nodes along y-axis
dy : Step size along y-axis

CROSS-REFERENCE INFORMATION#

This function calls:

nodal() Returns a m+1 by m+1 one-dimensional operator that approximates the first-order derivatives on a uniform nodal grid

This function is called by:

jacobian2D()

nodal2DCurv()

nodal2DCurv(k, X, Y)#

PURPOSE#

SYNTAX#

[Nx, Ny] = nodal2DCurv(k, X, Y)

DESCRIPTION#

CROSS-REFERENCE INFORMATION#

This function calls:

nodal2D() Returns a two-dimensional operator that approximates the first-order derivatives on a uniform nodal grid

jacobian2D()

nodal3D(k, m, dx, n, dy, o, dz)#

PURPOSE#

Returns a three-dimensional operator that approximates the first-order derivatives on a uniform nodal grid

SYNTAX#

N = nodal3D(k, m, dx, n, dy, o, dz)

DESCRIPTION#

 k : Order of accuracy
 m : Number of nodes along x-axis
dx : Step size along x-axis
 n : Number of nodes along y-axis
dy : Step size along y-axis
 o : Number of nodes along z-axis
dz : Step size along z-axis

CROSS-REFERENCE INFORMATION#

This function calls:

nodal() Returns a m+1 by m+1 one-dimensional operator that approximates the first-order derivatives on a uniform nodal grid

This function is called by:

nodal3DCurv()

jacobian3D()

nodal3DCurv(k, X, Y, Z)#

PURPOSE#

SYNTAX#

[Nx, Ny, Nz] = nodal3DCurv(k, X, Y, Z)

DESCRIPTION#

CROSS-REFERENCE INFORMATION#

This function calls:

nodal3D() Returns a three-dimensional operator that approximates the first-order derivatives on a uniform nodal grid

jacobian3D()

sidedNodal(m, dx, type)#

PURPOSE#

Returns a m+1 by m+1 one-dimensional sided approximation for uniformly spaced data points. This function is handy for advective terms.

SYNTAX#

S = sidedNodal(m, dx, type)

DESCRIPTION#

   m : Number of cells
  dx : Step size
type : 'backward', 'forward' or 'centered'

CROSS-REFERENCE INFORMATION#

No cross-reference information found. This typically means this function neither calls nor is called by other functions in the codebase.

Mimetic Weights#

weightsP(k, m, dx)#

PURPOSE#

Returns the m+1 weights of P

SYNTAX#

P = weightsP(k, m, dx)

DESCRIPTION#

 k : Order of accuracy
 m : Number of cells
dx : Step size

CROSS-REFERENCE INFORMATION#

This function calls:

grad() This gradient operator computes the vector of partial derivatives, indicating the direction of maximum rate of increase and the steepest slope of a scalar field.

This function is called by:

weightsP2D() Returns the 2mn+m+n weights of P in 2-D

generateWeights() Generates a comma-delimited file for weights used by MOLE library Note: These weights are generated assuming dx = 1.0. To use them they should be multiplied by dx for the problem being computed.

mimeticB() Returns a m+2 by m+1 one-dimensional mimetic boundary operator

weightsP2D(k, m, dx, n, dy)#

PURPOSE#

Returns the 2mn+m+n weights of P in 2-D

SYNTAX#

P = weightsP2D(k, m, dx, n, dy)

DESCRIPTION#

 k : Order of accuracy
 m : Number of cells along x-axis
dx : Step size along x-axis
 n : Number of cells along y-axis
dy : Step size along y-axis

CROSS-REFERENCE INFORMATION#

This function calls:

weightsP() Returns the m+1 weights of P

weightsQ(k, m, dx)#

PURPOSE#

Returns the m+2 weights of Q

SYNTAX#

Q = weightsQ(k, m, dx)

DESCRIPTION#

 k : Order of accuracy
 m : Number of cells
dx : Step size

CROSS-REFERENCE INFORMATION#

This function calls:

div() Returns a one-dimensional mimetic divergence operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

This function is called by:

generateWeights() Generates a comma-delimited file for weights used by MOLE library Note: These weights are generated assuming dx = 1.0. To use them they should be multiplied by dx for the problem being computed.

mimeticB() Returns a m+2 by m+1 one-dimensional mimetic boundary operator

weightsQ2D(m, n, d)#

PURPOSE#

Returns the (m+2)(n+2) weights of Q in 2-D Only works for 2nd-order 2-D Mimetic divergence operator

SYNTAX#

Q = weightsQ2D(m, n, d)

DESCRIPTION#

m : Number of cells along x-axis
n : Number of cells along y-axis
d : Step size (assuming d = dx = dy)

CROSS-REFERENCE INFORMATION#

No cross-reference information found. This typically means this function neither calls nor is called by other functions in the codebase.

Utility Functions#

amean(X)#

PURPOSE#

Returns the arithmetic mean for every two pairs in a column vector And, Y(1) = X(1), Y(end) = X(end)

SYNTAX#

Y = amean(X)

DESCRIPTION#

X : Column vector

CROSS-REFERENCE INFORMATION#

No cross-reference information found. This typically means this function neither calls nor is called by other functions in the codebase.

hmean(X)#

PURPOSE#

Returns the harmonic mean for every two pairs in a column vector And, Y(1) = X(1), Y(end) = X(end)

SYNTAX#

Y = hmean(X)

DESCRIPTION#

X : Column vector

CROSS-REFERENCE INFORMATION#

No cross-reference information found. This typically means this function neither calls nor is called by other functions in the codebase.

rk4(func, tspan, dt, y0)#

PURPOSE#

Explicit Runge-Kutta 4th-order method

SYNTAX#

[t, y] = rk4(func, tspan, dt, y0)

DESCRIPTION#

Returns : t (evaluation points) and y (solutions) of the specified ODE
   func : Function handler
  tspan : [t0 tf]
     dt : Step size
     y0 : Initial conditions

CROSS-REFERENCE INFORMATION#

No cross-reference information found. This typically means this function neither calls nor is called by other functions in the codebase.

ttm(grid_name, m, n, iters, plot_grid)#

PURPOSE#

Returns X and Y which are both m by n matrices that contains the physical coordinates

SYNTAX#

[X, Y] = ttm(grid_name, m, n, iters, plot_grid)

DESCRIPTION#

grid_name : String with the name of the grid folder
        m : Number of nodes along the horizontal axis
        n : Number of nodes along the vertical axis
plot_grid : If defined -> grid will be plotted

CROSS-REFERENCE INFORMATION#

This function is called by:

gridGen() Returns X and Y which are both m by n matrices that contains the physical coordinates

boundaryIdx2D(m, n)#

PURPOSE#

Returns the indices of the nodes that lie on the boundary of a 2D nodal grid

SYNTAX#

idx = boundaryIdx2D(m, n)

DESCRIPTION#

m : Number of nodes along x-axis
n : Number of nodes along y-axis

CROSS-REFERENCE INFORMATION#

No cross-reference information found. This typically means this function neither calls nor is called by other functions in the codebase.

DI2(m, n, type)#

PURPOSE#

SYNTAX#

I = DI2(m, n, type)

DESCRIPTION#

CROSS-REFERENCE INFORMATION#

This function is called by:

div2DCurv() Returns a 2D curvilinear mimetic divergence

DI3(m, n, o, type)#

PURPOSE#

SYNTAX#

I = DI3(m, n, o, type)

DESCRIPTION#

CROSS-REFERENCE INFORMATION#

This function is called by:

div3DCurv() Returns a 3D curvilinear mimetic divergence

GI1(M, m, n, type)#

PURPOSE#

SYNTAX#

I = GI1(M, m, n, type)

DESCRIPTION#

CROSS-REFERENCE INFORMATION#

No cross-reference information found. This typically means this function neither calls nor is called by other functions in the codebase.

GI13(M, m, n, o, type)#

PURPOSE#

SYNTAX#

I = GI13(M, m, n, o, type)

DESCRIPTION#

CROSS-REFERENCE INFORMATION#

This function is called by:

grad3DCurv() Returns a 3D curvilinear mimetic gradient

GI2(M, m, n, type)#

PURPOSE#

SYNTAX#

I = GI2(M, m, n, type)

DESCRIPTION#

CROSS-REFERENCE INFORMATION#

This function is called by:

grad2DCurv() Returns a 2D curvilinear mimetic gradient

mimeticB(k, m)#

PURPOSE#

Returns a m+2 by m+1 one-dimensional mimetic boundary operator

SYNTAX#

B = mimeticB(k, m)

DESCRIPTION#

k : Order of accuracy
m : Number of cells

CROSS-REFERENCE INFORMATION#

This function calls:

weightsP() Returns the m+1 weights of P

grad() This gradient operator computes the vector of partial derivatives, indicating the direction of maximum rate of increase and the steepest slope of a scalar field.

weightsQ() Returns the m+2 weights of Q

div() Returns a one-dimensional mimetic divergence operator depending on whether or not the operator will contain a periodic boundary condition type a0 U + b0 dU/dn = g,

tensorGrad2D(K, G)#

PURPOSE#

Returns a two-dimensional flux operator

SYNTAX#

KG = tensorGrad2D(K, G)

DESCRIPTION#

K : Tensor (e.g. diffusion tensor)
G : 2D mimetic gradient operator

CROSS-REFERENCE INFORMATION#

No cross-reference information found. This typically means this function neither calls nor is called by other functions in the codebase.