underworld.function.analytic module

This module provides a suite of models which satisfy the Stokes system of equations.

All models are considered across a unit square (or cube) domain, and utilise (unless otherwise stated) free-slip conditions on all boundaries.

Each model object provides a set of Underworld Functions for description of physical quantities such as velocity, pressure and viscosity.

For numerical validation in Underworld, we construct a Stokes system with appropriate domain and boundary conditions. Viscosity and body forces are set directly using corresponding Functions provided by the solution object. Generated numerical solution for velocity and pressure (or derivated quantities) may then be compared with exact solutions provided by solution objects.

Module Summary

classes:

underworld.function.analytic.SolDB3d SolDB2d and solDB3d from:
underworld.function.analytic.SolM
underworld.function.analytic.SolH Density step profile in (x,y).
underworld.function.analytic.SolCx Viscosity step profile in x, trigonometric density profile.
underworld.function.analytic.SolB Trigonometric/hyperbolic body forcing.
underworld.function.analytic.SolC Discontinuous body forcing.
underworld.function.analytic.SolDA Columnar density profile in x, and viscosity step in z.
underworld.function.analytic.SolA Trigonometric body forcing.
underworld.function.analytic.SolKz The boundary conditions are free-slip everywhere on a unit domain.
underworld.function.analytic.SolDB2d SolDB2d and solDB3d from:
underworld.function.analytic.SolKx The boundary conditions are free-slip everywhere on a unit domain.
underworld.function.analytic.SolNL SolNL requires tighter solver tolerances and/or a direct solve for best results.

Module Details

classes:

class underworld.function.analytic.SolDB3d(Beta=4.0, *args, **kwargs)[source]

Bases: underworld.function.analytic._SolBaseFixedBc

SolDB2d and solDB3d from:

Dohrmann, C.R., Bochev, P.B., A stabilized finite element method for the Stokes problem based on polynomial pressure projections, Int. J. Numer. Meth. Fluids 46, 183-201 (2004).

class underworld.function.analytic.SolM(eta_0=1.0, n_x=1, n_z=1, r=1.5, *args, **kwargs)[source]

Bases: underworld.function.analytic._SolBaseFreeSlipBc

class underworld.function.analytic.SolH(sigma_0=1.0, x_c=0.5, y_c=0.5, eta_0=1.0, nmodes=30, *args, **kwargs)[source]

Bases: underworld.function.analytic._SolBaseFreeSlipBc

Density step profile in (x,y). Constant viscosity.

Parameters:
  • sigma_0 (float) – Perturbation strength factor.
  • x_c (float) – Step position (in x).
  • y_c (float) – Step position (in y).
  • eta_0 (float) – Viscosity.
  • nmodes (int) – Number of Fourier modes used when evaluating analytic solution.
class underworld.function.analytic.SolCx(n_x=1, eta_A=1.0, eta_B=100000.0, x_c=0.75, *args, **kwargs)[source]

Bases: underworld.function.analytic._SolBaseFreeSlipBc

Viscosity step profile in x, trigonometric density profile.

Parameters:
  • n_x (unsigned) – Wavenumber parameter (in x).
  • eta_A (float) – Viscosity of region A.
  • eta_B (float) – Viscosity of region B.
  • eta_c (float) – Viscosity step location.
class underworld.function.analytic.SolB(sigma_0=1.0, n_x=1, n_z=1.5, eta_0=1.0, *args, **kwargs)[source]

Bases: underworld.function.analytic._SolBaseFreeSlipBc

Trigonometric/hyperbolic body forcing. Isoviscous.

Parameters:
  • sigma_0 (float) – Perturbation strength factor.
  • n_x (int) – Wavenumber parameter (in x).
  • n_z (float) – Wavenumber parameter (in z).
  • eta_0 (float) – Viscosity.
class underworld.function.analytic.SolC(sigma_0=1.0, x_c=0.5, eta_0=1.0, nmodes=200, *args, **kwargs)[source]

Bases: underworld.function.analytic._SolBaseFreeSlipBc

Discontinuous body forcing. Isoviscous.

Parameters:
  • sigma_0 (float) – Perturbation strength factor.
  • x_c (float) – Perturbation step location.
  • eta_0 (float) – Viscosity.
  • nmodes (int) – Number of Fourier modes used when evaluating analytic solution.

Notes

This solution is quiet slow to evaluate due to large number of Fourier terms required. Number of terms is hard code in solC.c.

class underworld.function.analytic.SolDA(sigma_0=1.0, x_c=0.375, x_w=0.25, eta_A=1.0, eta_B=10.0, z_c=0.75, nmodes=200, *args, **kwargs)[source]

Bases: underworld.function.analytic._SolBaseFreeSlipBc

Columnar density profile in x, and viscosity step in z.

Parameters:
  • sigma_0 (float) – Perturbation strength factor.
  • x_c (float) – Centre of column.
  • x_w (float) – Width of column.
  • eta_A (float) – Viscosity of region A.
  • eta_B (float) – Viscosity of region B.
  • z_c (float) – Viscosity step location.
  • nmodes (int) – Number of Fourier modes used when evaluating analytic solution.
class underworld.function.analytic.SolA(sigma_0=1.0, n_x=1, n_z=1.0, eta_0=1.0, *args, **kwargs)[source]

Bases: underworld.function.analytic._SolBaseFreeSlipBc

Trigonometric body forcing. Isoviscous.

Parameters:
  • sigma_0 (float) – Perturbation strength factor.
  • n_x (int) – Wavenumber parameter (in x).
  • n_z (float) – Wavenumber parameter (in z).
  • eta_0 (float) – Viscosity.
class underworld.function.analytic.SolKz(sigma_0=1.0, n_x=1, n_z=1.0, B=1.1512925465, *args, **kwargs)[source]

Bases: underworld.function.analytic._SolBaseFreeSlipBc

The boundary conditions are free-slip everywhere on a unit domain. The viscosity varies exponentially in the z direction and is given by \(\eta = \exp (2 B z)\). The flow is driven by the following density perturbation:

Parameters:
  • sigma_0 (float) – Perturbation strength factor.
  • n_x (int) – Wavenumber parameter (in x).
  • n_z (float) – Wavenumber parameter (in z).
  • B (float) – Viscosity parameter.
class underworld.function.analytic.SolDB2d(*args, **kwargs)[source]

Bases: underworld.function.analytic._SolBaseFixedBc

SolDB2d and solDB3d from:

Dohrmann, C.R., Bochev, P.B., A stabilized finite element method for the Stokes problem based on polynomial pressure projections, Int. J. Numer. Meth. Fluids 46, 183-201 (2004).

Check get_bcs() for BC setup.

class underworld.function.analytic.SolKx(sigma_0=1.0, n_x=1, n_z=1.0, B=1.1512925465, *args, **kwargs)[source]

Bases: underworld.function.analytic._SolBaseFreeSlipBc

The boundary conditions are free-slip everywhere on a unit domain. The viscosity varies exponentially in the x direction and is given by \(\eta = \exp (2 B x)\). The flow is driven by the following density perturbation:

Parameters:
  • sigma_0 (float) – Perturbation strength factor.
  • n_x (int) – Wavenumber parameter (in x).
  • n_z (float) – Wavenumber parameter (in z).
  • B (float) – Viscosity parameter.
class underworld.function.analytic.SolNL(eta_0=1.0, n_z=1, r=1.5, *args, **kwargs)[source]

Bases: underworld.function.analytic._SolBase

SolNL requires tighter solver tolerances and/or a direct solve for best results. Need to check in with Caesar Dandenonensis as to the origins of this solution.

Check get_bcs() for BC setup.

get_bcs(velVar)[source]

( Fixed,Fixed ) conditions left/right. ( Free, Fixed ) conditions top/bottom.

All fixed DOFs set to analytic soln values.

Parameters:velVar (underworld.mesh.MeshVariable) – The velocity variable is required to construct the BC object.
Returns:The BC object. It should be passed in to the system being constructed.
Return type:underworld.conditions.SystemCondition