API Reference

API of module janus.fft

This module is a Python wrapper around the FFTW library. The core of the wrapper is located in the two submodules janus.fft.serial and janus.fft.parallel, which should be imported explicitely.

Planner flags

From the FFTW manual (Sec. Planner Flags)

All of the planner routines in FFTW accept an integer flags argument, which is a bitwise OR (‘|’) of zero or more of the flag constants defined below. These flags control the rigor (and time) of the planning process, and can also impose (or lift) restrictions on the type of transform algorithm that is employed.

Only the names of the flags are reproduced below. The reader should refer to the FFTW manual for a complete description.

Planning-rigor flags

janus.fft.FFTW_ESTIMATE

Use simple heuristic to pick a plan.

janus.fft.FFTW_MEASURE

More accurate selection of a plan (default planning option).

janus.fft.FFTW_PATIENT

Even more accurate selection of a plan.

janus.fft.FFTW_EXHAUSTIVE

Even more accurate selection of a plan.

janus.fft.FFTW_WISDOM_ONLY

Should be used only to check whether wisdom is available.

Algorithm-restriction flags

These flags are exposed for future extensions of the module. They are not used for the time being.

janus.fft.FFTW_DESTROY_INPUT

Unused.

janus.fft.FFTW_PRESERVE_INPUT

Unused.

janus.fft.FFTW_UNALIGNED

Unused.

API of module janus.fft.serial

This module is a Python wrapper around the serial version of FFTW.

janus.fft.serial.create_real(shape, flags=FFTW_MEASURE)

Return a new FFT object to compute real-to-complex transforms.

Parameters
  • shape (tuple) – the global shape of the input data.

  • flags (int) – “or” combination of Planner flags.

API of module janus.fft.parallel

API of module janus.material

API of module janus.material.elastic.linear.isotropic

This module defines isotropic, linear elastic materials.

Materials defined in this module can operate on physical space of dimension 2 or 3; all functions and methods defined in this module refer to this dimension as dim, which is therefore not documented in detail below:

  • dim == 2: plane strain elasticity,

  • dim == 3: classical 3D elasticity.

To create a plane stress material with shear modulus g and Poisson ratio nu, a plane strain material should be created, with same shear modulus g, and fictitious Poisson ratio nu/(1+nu).

class janus.material.elastic.linear.isotropic.IsotropicLinearElasticMaterial

Bases: object

Isotropic, linear and elastic materials.

New instances are created as follows:

IsotropicLinearElasticMaterial(g, nu, dim)

where g is the shear modulus (float), nu the Poisson ratio (float) and dim the dimension of the physical space (ìnt, default: 3).

green_operator(self)

Return a new Green operator for this material.

The returned Green operator is the periodic Green operator for strains, which is given in Fourier space.

dim

Dimension of the physical space (int, read-only).

g

Shear modulus (float, read-only).

k

Bulk modulus (float, read-only).

nu

Poisson ratio (float, read-only).

class janus.material.elastic.linear.isotropic._GreenOperatorForStrains

Bases: janus.green.AbstractGreenOperator

Periodic Green operator for strains.

Instances of this class are associated to isotropic, linear elastic materials.

This class factorizes code common to the 2D and 3D implementations.

New instances are created as follows:

_GreenOperatorForStrains(mat)

where mat is the reference material (IsotropicLinearElasticMaterial).

mat

Reference material (IsotropicLinearElasticMaterial).

class janus.material.elastic.linear.isotropic._GreenOperatorForStrains2D

Bases: janus.material.elastic.linear.isotropic._GreenOperatorForStrains

2D periodic Green operator for strains.

This is the Green operator associated to a IsotropicLinearElasticMaterial (with dim == 2).

class janus.material.elastic.linear.isotropic._GreenOperatorForStrains3D

Bases: janus.material.elastic.linear.isotropic._GreenOperatorForStrains

3D periodic Green operator for strains.

This is the Green operator associated to a IsotropicLinearElasticMaterial (with dim == 3).

janus.material.elastic.linear.isotropic.create(g, nu, dim=3)

Create a new isotropic, linear and elastic material.

Returns a new instance of IsotropicLinearElasticMaterial with shear modulus g and Poisson ratio nu.

janus.material.elastic.linear.isotropic.poisson_from_bulk_and_shear_moduli(double k, double g, int dim=3) → double

Compute the Poisson ratio from the bulk and shear moduli.

No checks are performed on the positivity of the bulk modulus k and shear modulus g, or on the validity of the returned Poisson ratio (which should lie between -1 and 1/2).