api.discretization#

Functions#

change_dtype(V, dtype)

Given a FemSpace V, change its underlying vector_space (i.e. the space of its coefficients) so that it matches the required data type.

discretize(a, *args, **kwargs)

discretize_derham(derham, domain_h, *[, ...])

Create a discrete De Rham sequence from a symbolic one.

discretize_domain(domain, *[, filename, ...])

discretize_space(V, domain_h, *[, degree, ...])

This function creates the discretized space starting from the symbolic space.

get_max_degree(*spaces)

Get the maximum polynomial degree across several finite element spaces, along each logical (parametric) coordinate.

get_max_degree_of_one_space(Vh)

Get the maximum polynomial degree of a finite element space, along each logical (parametric) coordinate.

reduce_space_degrees(V, Vh, *[, basis, sequence])

This function takes a tensor FEM space Vh and reduces some degrees in order to obtain a tensor FEM space Wh that matches the symbolic space V in a certain sequence of spaces.

Details#

discretize(a, *args, **kwargs)[source]#
discretize_derham(derham, domain_h, *, get_H1vec_space=False, **kwargs)[source]#

Create a discrete De Rham sequence from a symbolic one.

This function creates the discrete spaces from the symbolic ones, and then creates a DiscreteDerham object from them.

Parameters:
derhamsympde.topology.space.Derham

The symbolic Derham sequence.

domain_hGeometry

Discrete domain where the spaces will be discretized.

get_H1vec_spacebool, default=False

True to also get the “Hvec” space discretizing (H1)^n vector fields.

**kwargsdict

Optional parameters for the space discretization.

Returns:
DiscreteDerham

The discrete De Rham sequence containing the discrete spaces, differential operators and projectors.

See also

discretize_space
reduce_space_degrees(V, Vh, *, basis='B', sequence='DR')[source]#

This function takes a tensor FEM space Vh and reduces some degrees in order to obtain a tensor FEM space Wh that matches the symbolic space V in a certain sequence of spaces. Where the degree is reduced, Wh employs either a B-spline or an M-spline basis.

For example let [p1, p2, p3] indicate the degrees and [r1, r2, r3] indicate the interior multiplicites in each direction of the space Vh before reduction. The degrees and multiplicities of the reduced spaces are specified as follows:

With the ‘DR’ sequence in 3D, all multiplicies are [r1, r2, r3] and we have

‘H1’ : degree = [p1, p2, p3] ‘Hcurl’: degree = [[p1-1, p2, p3], [p1, p2-1, p3], [p1, p2, p3-1]] ‘Hdiv’ : degree = [[p1, p2-1, p3-1], [p1-1, p2, p3-1], [p1-1, p2-1, p3]] ‘L2’ : degree = [p1-1, p2-1, p3-1]

With the ‘TH’ sequence in 2D we have:

‘H1’ : degree = [[p1, p2], [p1, p2]], multiplicity = [[r1, r2], [r1, r2]] ‘L2’ : degree = [p1-1, p2-1], multiplicity = [r1-1, r2-1]

With the ‘RT’ sequence in 2D we have: ‘H1’ : degree = [[p1, p2-1], [p1-1, p2]], multiplicity = [[r1,r2], [r1,r2]] ‘L2’ : degree = [p1-1, p2-1], multiplicity = [r1, r2]

With the ‘N’ sequence in 2D we have: ‘H1’ : degree = [[p1, p2], [p1, p2]], multiplicity = [[r1,r2+1], [r1+1,r2]] ‘L2’ : degree = [p1-1, p2-1], multiplicity = [r1, r2]

For more details see:

[1] : A. Buffa, J. Rivas, G. Sangalli, and R.G. Vazquez. Isogeometric Discrete Differential Forms in Three Dimensions. SIAM J. Numer. Anal., 49:818-844, 2011. DOI:10.1137/100786708. (Section 4.1)

[2] : A. Buffa, C. de Falco, and G. Sangalli. IsoGeometric Analysis: Stable elements for the 2D Stokes equation. Int. J. Numer. Meth. Fluids, 65:1407-1422, 2011. DOI:10.1002/fld.2337. (Section 3)

[3] : A. Bressan, and G. Sangalli. Isogeometric discretizations of the Stokes problem: stability analysis by the macroelement technique. IMA J. Numer. Anal., 33(2):629-651, 2013. DOI:10.1093/imanum/drr056.

Parameters:
VFunctionSpace

The symbolic space.

VhTensorFemSpace

The tensor product FEM space.

basis: str

The basis function of the reduced spaces, it can be either ‘B’ for B-spline basis or ‘M’ for M-spline basis.

sequence: str
The sequence used to reduce the space. The available choices are:

‘DR’: for the de Rham sequence, as described in [1], ‘TH’: for Taylor-Hood elements, as described in [2].

Not implemented yet:

‘N’ : for Nedelec elements, as described in [2], ‘RT’: for Raviart-Thomas elements, as described in [2].

Returns:
WhTensorFemSpace, VectorFemSpace

The reduced space.

discretize_space(V, domain_h, *, degree=None, multiplicity=None, knots=None, basis='B', sequence='DR')[source]#

This function creates the discretized space starting from the symbolic space.

Parameters:
V<FunctionSpace>

The symbolic space.

domain_h<Geometry>

The discretized domain.

degreelist | dict

The degree of the h1 space in each direction.

multiplicity: list | dict

The multiplicity of knots for the h1 space in each direction.

knots: list | dict

The knots sequence of the h1 space in each direction.

basis: str

The type of basis function can be ‘B’ for B-splines or ‘M’ for M-splines.

sequence: str
The sequence used to reduce the space. The available choices are:

‘DR’: for the de Rham sequence, as described in [1], ‘TH’: for Taylor-Hood elements, as described in [2].

Not implemented yet:

‘N’ : for Nedelec elements, as described in [2], ‘RT’: for Raviart-Thomas elements, as described in [2].

For more details see:

[1] : A. Buffa, J. Rivas, G. Sangalli, and R.G. Vazquez. Isogeometric Discrete Differential Forms in Three Dimensions. SIAM J. Numer. Anal., 49:818-844, 2011. DOI:10.1137/100786708. (Section 4.1)

[2] : A. Buffa, C. de Falco, and G. Sangalli. IsoGeometric Analysis: Stable elements for the 2D Stokes equation. Int. J. Numer. Meth. Fluids, 65:1407-1422, 2011. DOI:10.1002/fld.2337. (Section 3)

[3] : A. Bressan, and G. Sangalli. Isogeometric discretizations of the Stokes problem: stability analysis by the macroelement technique. IMA J. Numer. Anal., 33(2):629-651, 2013. DOI:10.1093/imanum/drr056.

Returns:
Vh<FemSpace>

The discrete FEM space.

discretize_domain(domain, *, filename=None, ncells=None, periodic=None, comm=None, mpi_dims_mask=None)[source]#