proteus.AnalyticalSolutions module

Classes representing analytical solutions of differential and partial differential equations.

Inheritance diagram of proteus.AnalyticalSolutions

class proteus.AnalyticalSolutions.AS_base[source]

Bases: object

The base class for general analytical solutions, u(x,y,z,t)

For basic error calculations only the uOfXT() member need be overridden. The vectorized member functions such as getUOfXT() are provided for future optimizations but are implemented in AS_base in a simple, inefficient way.

uOfXT(X, T)[source]

Return the solution at a 3D point, X, and a time, T

duOfXT(X, T)[source]

Return the gradient of the solution at a 3D point, X, and a time, T

rOfUX(u, x)[source]

Return the reaction term for the (manufactured) solution at a 3D point, X, and a time, T

drOfUX(u, x)[source]

Return the derivative of the reaction term for the (manufactured) solution at a 3D point, X, and a time, T

advectiveFluxOfX(x)[source]

Return the advective flux at a 3D point, X

diffusiveFluxOfX(x)[source]

Return the diffusive flux at a 3D point, X

totalFluxOfX(x)[source]

Return the total flux at a 3D point, X

getUOfXT(X, T, U)[source]

Set the solution, U, at an array of 3D points, X, and a time, T

getDUOfXT(X, T, DU)[source]

Set the gradient of the solution, DU, at an array of 3D points, X, and a time, T

getROfUX(X, T, R)[source]

Set the reaction term, R, at an array of 3D points, X, and a time, T

getDROfUX(X, T, DR)[source]

Set the derivative of the reaction term, DR, at an array of 3D points, X, and a time, T

getAdvectiveFluxOfXT(X, T, F)[source]

Set the advective flux, F, at an array of 3D points, X, and a time, T

getDiffusiveFluxOfX(X, T, F)[source]

Set the diffusive flux, F, at an array of 3D points, X, and a time, T

getTotalFluxOfX(X, T, F)[source]

Set the total flux, F, at an array of 3D points, X, and a time, T

p_to_v(func, X, T, funcValVec)[source]

Calculate a point-wise function over and array of points.

class proteus.AnalyticalSolutions.DAE_base[source]

Bases: proteus.AnalyticalSolutions.AS_base

The base class for differential-algebraic equation solutions

To use this class override uOfT()

uOfXT(X, T)[source]

Return the solution at a 3D point, X, and a time, T

uOfT(T)[source]
class proteus.AnalyticalSolutions.NonlinearDAE(a, p)[source]

Bases: proteus.AnalyticalSolutions.DAE_base

The exact solution of the simple nonlinear DAE

Set the coefficients a and p

uOfT(t)[source]
fOfUT(u, t)[source]
class proteus.AnalyticalSolutions.SteadyState[source]

Bases: proteus.AnalyticalSolutions.AS_base

Based class for steady-state solutions u(x)

Override uOfX() to define steady state solutions.

uOfX(X)[source]
uOfXT(X, T=None)[source]

Return the solution at a 3D point, X, and a time, T

class proteus.AnalyticalSolutions.LinearAD_SteadyState(b=1.0, a=0.5)[source]

Bases: proteus.AnalyticalSolutions.SteadyState

The solution of the steady linear advection-diffusion equation

The boundary value problem is

uOfX(X)[source]
class proteus.AnalyticalSolutions.NonlinearAD_SteadyState(b=1.0, q=2, a=0.5, r=1)[source]

Bases: proteus.AnalyticalSolutions.LinearAD_SteadyState

The solution of a steady nonlinear advection-diffusion equation

The boundary value problem is

Currently \(q=1,r=2\), and \(r=2,q=1\) are implemented

uOfX(X)[source]
class proteus.AnalyticalSolutions.LinearADR_Sine(b=array([1., 0., 0.]), a=array([[0.01, 0., 0.], [0., 0.01, 0.], [0., 0., 0.01]]), c=1.0, omega=array([6.28318531, 0., 0.]), omega0=0.0)[source]

Bases: proteus.AnalyticalSolutions.SteadyState

An exact solution and source term for

\[\nabla \cdot (\mathbf{b} u - \mathbf{a} \nabla u) + c u + d = 0\]

The solution and source are

\begin{eqnarray} u(x) &=& \sin[\mathbf{\omega} \cdot \mathbf{x} + \omega_0) ] = \sin(Ax - b) \\ r(u,x) &=& - ((\mathbf{a} \mathbf{\omega}) \cdot \mathbf{\omega}) u \\ & & - (\mathbf{b} \cdot \omega) \cos(Ax - b) \\ &=& c u + D \cos(Ax - b) \\ &=& cu + d \end{eqnarray}

also returns the advective, diffusive, and total flux at a point.

Set the coefficients a,b,c,omega, and omega0

uOfX(x)[source]
duOfX(x)[source]
rOfUX(u, x)[source]

Return the reaction term for the (manufactured) solution at a 3D point, X, and a time, T

drOfUX(u, x)[source]

Return the derivative of the reaction term for the (manufactured) solution at a 3D point, X, and a time, T

advectiveFluxOfX(x)[source]

Return the advective flux at a 3D point, X

diffusiveFluxOfX(x)[source]

Return the diffusive flux at a 3D point, X

totalFluxOfX(x)[source]

Return the total flux at a 3D point, X

class proteus.AnalyticalSolutions.PoissonsEquation(K=10.0, nd=3)[source]

Bases: proteus.AnalyticalSolutions.SteadyState

Manufactured solution of Poisson’s equation

\[- \Delta u - f = 0\]

where u and f are given by

\begin{eqnarray} u &=& K x(1-x)y(1-y)z(1-z)e^{x^2 + y^2 + z^2} \\ f &=& -K\{[y(1-y)z(1-z)][4x^3 - 4x^2 + 6x - 2]+ \\ &&[x(1-x)z(1-z)][4y^3 - 4y^2 + 6y - 2]+ \\ &&[x(1-x)y(1-y)][4z^3 - 4z^2 + 6z - 2]\}e^{x^2 + y^2 + z^2} \end{eqnarray}
uOfX(X)[source]
rOfUX(u, X)[source]

Return the reaction term for the (manufactured) solution at a 3D point, X, and a time, T

drOfUX(u, x)[source]

Return the derivative of the reaction term for the (manufactured) solution at a 3D point, X, and a time, T

class proteus.AnalyticalSolutions.LinearAD_DiracIC(n=1.0, b=array([1., 0., 0.]), a=0.01, tStart=0.0, u0=0.1, x0=array([0., 0., 0.]))[source]

Bases: proteus.AnalyticalSolutions.AS_base

The exact solution of

\[u_t + \nabla \cdot (b u - a \nabla u) = 0\]

on an infinite domain with dirac initial data

\[u0 = \int u0 \delta(x - x0)\]

also returns advective, diffusive, and total flux

uOfXT(x, T)[source]

Return the solution at a 3D point, X, and a time, T

duOfXT(x, T)[source]

Return the gradient of the solution at a 3D point, X, and a time, T

advectiveFluxOfXT(x, T)[source]
diffusiveFluxOfXT(x, T)[source]
totalFluxOfXT(x, T)[source]
class proteus.AnalyticalSolutions.LinearADR_Decay_DiracIC(n=1.0, b=array([1., 0., 0.]), a=0.01, c=1.0, tStart=0.0, u0=0.1, x0=array([0., 0., 0.]))[source]

Bases: proteus.AnalyticalSolutions.LinearAD_DiracIC

The exact solution of

\[u_t + \nabla \cdot (bu - a \nabla u) + cu= 0\]

on an infinite domain with Dirac initial data. Also returns the fluxes (by inheritance).

uOfXT(x, T)[source]

Return the solution at a 3D point, X, and a time, T

rOfUXT(u, x, T)[source]
drOfUXT(u, x, T)[source]
class proteus.AnalyticalSolutions.NonlinearADR_Decay_DiracIC(n=1.0, b=array([1., 0., 0.]), a=0.01, c=1.0, d=2.0, tStart=0.0, u0=0.1, x0=array([0., 0., 0.]))[source]

Bases: proteus.AnalyticalSolutions.LinearADR_Decay_DiracIC

The approximate analytical solution of

\[u_t + \nabla \cdot (bu - a \nabla u) + cu^d= 0\]

on an infinite domain with Dirac initial data. Also returns the fluxes (by inheritance).

uOfXT(x, T)[source]

Return the solution at a 3D point, X, and a time, T

rOfUXT(u, x, T)[source]
drOfUXT(u, x, T)[source]
class proteus.AnalyticalSolutions.PlaneCouetteFlow_u(plateSeperation=1.0, upperPlateVelocity=0.01, origin=[0.0, 0.0, 0.0])[source]

Bases: proteus.AnalyticalSolutions.SteadyState

The exact solution for the u component of velocity in plane Couette Flow

PlaneCouetteFlow_u()[source]
uOfX(x)[source]
class proteus.AnalyticalSolutions.PlaneCouetteFlow_v(plateSeperation=1.0, upperPlateVelocity=0.01, origin=[0.0, 0.0, 0.0])[source]

Bases: proteus.AnalyticalSolutions.SteadyState

The exact solution for the v component of velocity in plane Couette Flow

uOfX(x)[source]
class proteus.AnalyticalSolutions.PlaneCouetteFlow_p(plateSeperation=1.0, upperPlateVelocity=0.01, origin=[0.0, 0.0, 0.0])[source]

Bases: proteus.AnalyticalSolutions.SteadyState

The exact solution for the v component of velocity in plane Couette Flow

uOfX(x)[source]
class proteus.AnalyticalSolutions.PlanePoiseuilleFlow_u(plateSeperation=1.0, mu=1.0, grad_p=1.0, q=0.0, origin=[0.0, 0.0, 0.0])[source]

Bases: proteus.AnalyticalSolutions.SteadyState

PlanePoiseuilleFlow_u()[source]
uOfX(x)[source]
class proteus.AnalyticalSolutions.PlanePoiseuilleFlow_v(plateSeperation=1.0, mu=1.0, grad_p=1.0, q=0.0, origin=[0.0, 0.0, 0.0])[source]

Bases: proteus.AnalyticalSolutions.SteadyState

The exact solution for the v component of velocity in plane Poiseuille Flow

uOfX(x)[source]
class proteus.AnalyticalSolutions.PlanePoiseuilleFlow_p(plateSeperation=1.0, mu=1.0, grad_p=1.0, q=0.0, origin=[0.0, 0.0, 0.0])[source]

Bases: proteus.AnalyticalSolutions.SteadyState

The exact solution for the v component of velocity in plane Poiseuille Flow

uOfX(x)[source]
class proteus.AnalyticalSolutions.Buckley_Leverett_RiemannSoln(coefficients, uLeft=1.0, uRight=0.0, t0=0.0, x0=0.0, T=0.5, ftol=1e-08, useShallowCopyCoef=True)[source]

Bases: proteus.AnalyticalSolutions.AS_base

uOfXT(x, t)[source]

Return the solution at a 3D point, X, and a time, T

uOfX(x)[source]
generateAplot(xLeft, xRight, nnx, t, filename='Buckley_Leverett_ex.dat')[source]

save exact solution to a file

class proteus.AnalyticalSolutions.PlaneBase(plane_theta=0.0, plane_phi=1.5707963267948966, v_theta=1.5707963267948966, v_phi=None, v_norm=1.0, mu=1.0, grad_p=1.0, L=[1.0, 1.0, 1.0])[source]

Bases: proteus.AnalyticalSolutions.SteadyState

The exact solution for the u component of velocity in plane Poiseuille Flow

Z(x)[source]
X(x)[source]
U(x)[source]
class proteus.AnalyticalSolutions.PlanePoiseuilleFlow_u2(plane_theta=0.0, plane_phi=1.5707963267948966, v_theta=1.5707963267948966, v_phi=None, v_norm=1.0, mu=1.0, grad_p=1.0, L=[1.0, 1.0, 1.0])[source]

Bases: proteus.AnalyticalSolutions.PlaneBase

The exact solution for the u component of velocity in plane Poiseuille Flow

uOfX(x)[source]
class proteus.AnalyticalSolutions.PlanePoiseuilleFlow_v2(plane_theta=0.0, plane_phi=1.5707963267948966, v_theta=1.5707963267948966, v_phi=None, v_norm=1.0, mu=1.0, grad_p=1.0, L=[1.0, 1.0, 1.0])[source]

Bases: proteus.AnalyticalSolutions.PlaneBase

The exact solution for the v component of velocity in plane Poiseuille Flow

uOfX(x)[source]
class proteus.AnalyticalSolutions.PlanePoiseuilleFlow_w2(plane_theta=0.0, plane_phi=1.5707963267948966, v_theta=1.5707963267948966, v_phi=None, v_norm=1.0, mu=1.0, grad_p=1.0, L=[1.0, 1.0, 1.0])[source]

Bases: proteus.AnalyticalSolutions.PlaneBase

The exact solution for the v component of velocity in plane Poiseuille Flow

uOfX(x)[source]
class proteus.AnalyticalSolutions.PlanePoiseuilleFlow_p2(plane_theta=0.0, plane_phi=1.5707963267948966, v_theta=1.5707963267948966, v_phi=None, v_norm=1.0, mu=1.0, grad_p=1.0, L=[1.0, 1.0, 1.0])[source]

Bases: proteus.AnalyticalSolutions.PlaneBase

The exact solution for the v component of velocity in plane Poiseuille Flow

uOfX(x)[source]
class proteus.AnalyticalSolutions.VortexDecay_u(n=2, Re=100.0)[source]

Bases: proteus.AnalyticalSolutions.AS_base

The exact solution for the u component of velocity in the vortex decay problem

uOfXT(x, t)[source]

Return the solution at a 3D point, X, and a time, T

class proteus.AnalyticalSolutions.VortexDecay_v(n=2, Re=100.0)[source]

Bases: proteus.AnalyticalSolutions.AS_base

The exact solution for the u component of velocity in the vortex decay problem

uOfXT(x, t)[source]

Return the solution at a 3D point, X, and a time, T

class proteus.AnalyticalSolutions.VortexDecay_p(n=2, Re=100.0)[source]

Bases: proteus.AnalyticalSolutions.AS_base

The exact solution for the u component of velocity in the vortex decay problem

uOfXT(x, t)[source]

Return the solution at a 3D point, X, and a time, T