Field#
A FieldContainer with pre-defined fields is created with:
|
A field container is created with a list of one or more fields.
|
A container for fields which holds a list or a tuple of |
Available kinds of fields:
|
A Field on points of a |
|
An axisymmetric |
|
A plane strain |
|
A dual field on points of a |
Detailed API Reference
- class felupe.FieldContainer(fields, take=None, **kwargs)[source]#
A container for fields which holds a list or a tuple of
Fieldinstances.- Parameters:
fields (list or tuple of
Field, :class:``~felupe.FieldAxisymmetric`, :class:``~felupe.FieldPlaneStrain` orFieldContainer) – List with fields. The region is linked to the first field.take (list of int, optional) – Take custom fields by field indices, used for
extract(). If None, the fields are used in their original list item order. Default is None.**kwargs (dict, optional) – Extra class attributes for the field container.
- evaluate#
Methods to evaluate the deformation gradient and strain measures, see
EvaluateFieldContainerfor details on the provided methods.
- slots#
The indices of the fields of a top-level field container, which belong to the fields of this field container, e.g. set by
merge(). If None, the fields belong to the first fields of the top-level field container (in the same order). Default is None.
Examples
>>> import felupe as fem >>> >>> mesh = fem.Cube(n=3) >>> region = fem.RegionHexahedron(mesh) >>> region_dual = fem.RegionConstantHexahedron(mesh.dual(points_per_cell=1)) >>> displacement = fem.Field(region, dim=3) >>> pressure = fem.Field(region_dual) >>> field = fem.FieldContainer([displacement, pressure]) >>> field <felupe FieldContainer object> Number of fields: 2 Dimension of fields: Field: 3 Field: 1
A new
FieldContaineris also created by one of the logical-and combinations of aField,FieldAxisymmetric,FieldPlaneStrainorFieldContainer.>>> displacement & pressure <felupe FieldContainer object> Number of fields: 2 Dimension of fields: Field: 3 Field: 1
>>> volume_ratio = fem.Field(region_dual) >>> field & volume_ratio # displacement & pressure & volume_ratio <felupe FieldContainer object> Number of fields: 3 Dimension of fields: Field: 3 Field: 1 Field: 1
See also
felupe.FieldField on points of a
Regionwith dimensiondimand initial pointvalues.felupe.FieldAxisymmetricAn axisymmetric
Fieldon points of a two dimensionalRegionwith dimensiondim(default is 2) and initial pointvalues(default is 0).felupe.FieldPlaneStrainA plane strain
Fieldon points of a two dimensionalRegionwith dimensiondim(default is 2) and initial pointvalues(default is 0).
- checkpoint()[source]#
Return a checkpoint of the field container.
- Returns:
A dict with a copy of the field container
"field"and, if available, a copy of the top-level field container"field.x0".- Return type:
Notes
The field containers, their fields and the values of the fields are copied. The regions, meshes, mesh containers and indices of the fields are not copied, i.e. they are shared with the field container. These are not modified during the evaluation of a job. Changes of the region or the mesh after a checkpoint is created (e.g. by
merge()) are also visible in the copied field container of the checkpoint, but they do not affectrestore(), which only restores the values of the fields. The copied field container of the checkpoint holds the copied top-level field container"field.x0"as attributex0.See also
felupe.FieldContainer.restoreRestore a checkpoint of a field container inplace.
- extract(grad=True, sym=False, add_identity=True, dtype=None, out=None, order='C')[source]#
Generalized extraction method which evaluates either the gradient or the field values at the integration points of all cells in the region. Optionally, the symmetric part of the gradient is evaluated and/or the identity matrix is added to the gradient.
- Parameters:
grad (bool or list of bool, optional) – Flag(s) for gradient evaluation(s). A boolean value is applied on the first field only and all other fields are extracted with
grad=False. To enable or disable gradients per-field, use a list of boolean values instead (default is True).sym (bool, optional) – Flag for symmetric part if the gradient is evaluated (default is False).
add_identity (bool or list of bool, optional) – Flag(s) for the addition of the identity matrix if the gradient is evaluated. A boolean value is applied on the first gradient only and all other gradients are extracted with
add_identity=False. To enable or disable the addition of the identity matrix on gradients per-field, use a list of boolean values instead (default is True).dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order (str or list of str, optional) – Controls the memory layout of the outputs. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
(Symmetric) gradient or interpolated field values evaluated at the integration points of each cell in the region.
- Return type:
tuple of ndarray
Notes
If the gradient is not requested, the interpolation method returns the field values evaluated at the numeric integration points
qfor each cellcin the region (so-called trailing axes).\[u_{i(qc)} = \hat{u}_{ai}\ h_{a(qc)}\]On the other hand, the gradient method returns the gradient of the field values w.r.t. the undeformed mesh point coordinates, evaluated at the integration points of all cells in the region.
\[\left( \frac{\partial u_i}{\partial X_J} \right)_{(qc)} = \hat{u}_{ai} \left( \frac{\partial h_a}{\partial X_J} \right)_{(qc)}\]See also
felupe.Field.interpolateInterpolate field values located at mesh-points to the quadrature points in the region.
felupe.Field.gradGradient as partial derivative of field values w.r.t. undeformed coordinates.
- imshow(*args, ax=None, dpi=None, **kwargs)[source]#
Take a screenshot of the first field of the container, show the image data in a figure and return the ax.
- link(other_field=None)[source]#
Link value array of other field.
- Parameters:
other_field (FieldContainer or None, optional) – The other field container (default is None). If None, all fields are linked to the first field. If the field container has
slotsand the other field container has noslots(e.g. a top-level field container), the fields are linked to the fields of the other field container, given by theslots. Otherwise, the fields are linked 1-to-1 by their position.
- merge(decimals=None, **kwargs)[source]#
Merge all fields and return a list of field containers as well as the top-level field container.
- Parameters:
decimals (int or None, optional) – Precision decimals for merging duplicated mesh points. Default is None.
**kwargs (dict, optional) – Additional keyword arguments for
MeshContainer.
- Returns:
The top-level field container, to be used as the
x0-argument inevaluate()and for the creation of boundary conditions. The given field containers are modified & reloaded in-place, along with a new attributex0that points to this top-level field container.- Return type:
Notes
Mixed field containers, e.g.
FieldsMixed, are supported, seemerge()for details.Examples
>>> import felupe as fem >>> >>> mesh1 = fem.Rectangle(n=3) >>> displacement1 = fem.FieldAxisymmetric(fem.RegionQuad(mesh1), dim=2) >>> field1 = fem.FieldContainer([displacement1]) >>> >>> mesh2 = fem.Rectangle(a=(1, 0), b=(2, 1), n=3) >>> displacement2 = fem.FieldAxisymmetric(fem.RegionQuad(mesh2), dim=2) >>> field2 = fem.FieldContainer([displacement2]) >>> >>> x0 = (field1 & field2).merge() >>> >>> umat = fem.NeoHookeCompressible(mu=1, lmbda=2) >>> solid1 = fem.SolidBody(umat, field1) >>> solid2 = fem.SolidBody(umat, field2) >>> >>> boundaries = fem.dof.uniaxial(x0, clamped=True) >>> >>> step = fem.Step(items=[solid1, solid2], boundaries=boundaries) >>> job = fem.Job(steps=[step]).evaluate()
- plot(*args, project=None, **kwargs)[source]#
Plot the first field of the container.
See also
felupe.Scene.plotPlot method of a scene.
felupe.projectProject given values at quadrature-points to mesh-points.
felupe.topointsShift given values at quadrature-points to mesh-points.
- reload(fields=None)[source]#
Reload the Field Container with new fields.
- Parameters:
fields (list) – List of fields.
- restore(checkpoint)[source]#
Restore a checkpoint inplace.
- Parameters:
checkpoint (dict) – A dict with checkpoint arrays / objects.
See also
felupe.FieldContainer.checkpointReturn a checkpoint of the field container.
- revolve(n=11, phi=180)[source]#
Return a revolved field container.
- Parameters:
- Returns:
The revolved field container.
- Return type:
Examples
First, create an axisymmetric field.
>>> import felupe as fem >>> >>> region = fem.RegionQuad(mesh=fem.Rectangle(n=6)) >>> field = fem.FieldContainer([fem.FieldAxisymmetric(region, dim=2)]) >>> field.plot().show()
The first field of the field container is now revolved around the x-axis.
>>> new_field = field.revolve(n=11, phi=180) >>> new_field.plot().show()
See also
SolidBody.revolveReturn a revolved solid body
SolidBodyNearlyIncompressible.revolveReturn a revolved solid body
- screenshot(*args, filename='field.png', transparent_background=None, scale=None, **kwargs)[source]#
Take a screenshot of the first field of the container.
See also
pyvista.Plotter.screenshotTake a screenshot of a PyVista plotter.
- view(point_data=None, cell_data=None, cell_type=None, project=None)[source]#
View the field with optional given dicts of point- and cell-data items.
- Parameters:
point_data (dict or None, optional) – Additional point-data dict (default is None).
cell_data (dict or None, optional) – Additional cell-data dict (default is None).
cell_type (pyvista.CellType or None, optional) – Cell-type of PyVista (default is None).
project (callable or None, optional) – Project internal cell-data at quadrature-points to mesh-points (default is None).
- Returns:
A object which provides visualization methods for
felupe.FieldContainer.- Return type:
felupe.ViewField
See also
felupe.ViewFieldVisualization methods for
felupe.FieldContainer.felupe.projectProject given values at quadrature-points to mesh-points.
felupe.topointsShift given values at quadrature-points to mesh-points.
- class felupe.field.EvaluateFieldContainer(field)[source]#
Methods to evaluate the deformation gradient and strain measures of a field container.
- Parameters:
field (FieldContainer) – A container for fields.
Examples
>>> import felupe as fem >>> >>> mesh = fem.Rectangle(n=4) >>> region = fem.RegionQuad(mesh) >>> field = fem.FieldContainer([fem.FieldPlaneStrain(region, dim=2)]) >>> >>> evaluate = fem.field.EvaluateFieldContainer(field) >>> F = evaluate.deformation_gradient() >>> >>> F.shape # (3, 3, nquadraturepoints, ncells) (3, 3, 4, 9)
>>> F[..., 0, 0] # deformation gradient of first cell, first quadrature point array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])
See also
felupe.FieldContainerA container which holds one or multiple (mixed) fields.
- deformation_gradient()[source]#
Return the Deformation gradient tensor.
(1)#\[ \begin{align}\begin{aligned}\boldsymbol{F} &= \frac{\partial \boldsymbol{x}}{\partial \boldsymbol{X}}\\\boldsymbol{F} &= \sum_\alpha \lambda_\alpha \ \boldsymbol{n}_\alpha \otimes \boldsymbol{N}_\alpha\end{aligned}\end{align} \]
- green_lagrange_strain(tensor=True, asvoigt=False, n=0)[source]#
Return the Green-Lagrange Lagrangian strain tensor or its principal values.
(2)#\[\boldsymbol{E} = \sum_\alpha \frac{1}{2} \left( \lambda_\alpha^2 - 1 \right) \ \boldsymbol{N}_\alpha \otimes \boldsymbol{N}_\alpha\]- Parameters:
tensor (bool, optional) – Assemble and return the strain tensor if True or return its principal values only if False. Default is True.
asvoigt (bool, optional) – Return the symmetric strain tensor in reduced vector storage (default is False).
n (int, optional) – The index of the displacement field (default is 0).
- Returns:
The strain tensor or its principal values.
- Return type:
ndarray of shape (N, N, …) tensor, (N * (N + 1) / 2, …) asvoigt or (N, …) princ. values
See also
math.strainCompute a Lagrangian strain tensor.
math.strain_stretch_1dCompute the Seth-Hill strains.
- log_strain(tensor=True, asvoigt=False, n=0)[source]#
Return the logarithmic Lagrangian strain tensor or its principal values.
(3)#\[\boldsymbol{E} = \sum_\alpha \ln(\lambda_\alpha) \ \boldsymbol{N}_\alpha \otimes \boldsymbol{N}_\alpha\]- Parameters:
tensor (bool, optional) – Assemble and return the strain tensor if True or return its principal values only if False. Default is True.
asvoigt (bool, optional) – Return the symmetric strain tensor in reduced vector storage (default is False).
n (int, optional) – The index of the displacement field (default is 0).
- Returns:
The strain tensor or its principal values.
- Return type:
ndarray of shape (N, N, …) tensor, (N!, …) asvoigt or (N, …) princ. values
See also
math.strain_stretch_1dCompute the Seth-Hill strains.
math.strainCompute a Lagrangian strain tensor.
- right_cauchy_green_deformation()[source]#
Return the right Cauchy-Green deformation tensor.
\[ \begin{align}\begin{aligned}:label:right-cauchy-green-deformation-tensor\\\boldsymbol{F} &= \frac{\partial \boldsymbol{x}}{\partial \boldsymbol{X}}\\\boldsymbol{C} &= \boldsymbol{F}^T \boldsymbol{F}\\\boldsymbol{C} &= \sum_\alpha \lambda^2_\alpha \ \boldsymbol{N}_\alpha \otimes \boldsymbol{N}_\alpha\end{aligned}\end{align} \]
- strain(fun=<function strain_stretch_1d>, tensor=True, asvoigt=False, n=0, **kwargs)[source]#
Return the Lagrangian strain tensor or its principal values.
(4)#\[\boldsymbol{E} = \sum_\alpha f_\alpha \left( \lambda_\alpha \right) \ \boldsymbol{N}_\alpha \otimes \boldsymbol{N}_\alpha\]By default, the Seth-Hill strain-stretch relation with a strain exponent of zero is used, see Eq. (5).
(5)#\[\boldsymbol{E} = \sum_\alpha \frac{1}{k} \left( \lambda_\alpha^k - 1 \right) \ \boldsymbol{N}_\alpha \otimes \boldsymbol{N}_\alpha\]- Parameters:
fun (callable, optional) – A callable for the one-dimensional strain-stretch relation. Its Signature must be
lambda stretch, **kwargs: strain(default is the log. strain,strain_stretch_1d()withk=0).tensor (bool, optional) – Assemble and return the strain tensor if True or return its principal values only if False. Default is True.
asvoigt (bool, optional) – Return the symmetric strain tensor in reduced vector storage (default is False).
n (int, optional) – The index of the displacement field (default is 0).
**kwargs (dict, optional) – Optional keyword-arguments are passed to the 1d strain-stretch relation.
- Returns:
The strain tensor or its principal values.
- Return type:
ndarray of shape (N, N, …) tensor, (N!, …) asvoigt or (N, …) princ. values
See also
math.strainCompute a Lagrangian strain tensor.
math.strain_stretch_1dCompute the Seth-Hill strains.
- class felupe.Field(region, dim=1, values=0.0, dtype=None, **kwargs)[source]#
A Field on points of a
Regionwith dimensiondimand initial pointvalues.- Parameters:
region (Region) – The region on which the field will be created.
dim (int, optional) – The dimension of the field (default is 1).
values (float or array) – A single value for all components of the field or an array of shape (region.mesh.npoints, dim). Default is 0.0.
dtype (data-type or None, optional) – Data-type of the array containing the field values.
**kwargs (dict, optional) – Extra class attributes for the field.
Notes
A slice of this field directly accesses the field-values as 1d-array. The interpolation method returns the field values evaluated at the numeric integration points
qfor each cellcin the region (so-called trailing axes).\[u_{i(qc)} = \hat{u}_{ai}\ h_{a(qc)}\]The gradient method returns the gradient of the field values w.r.t. the undeformed mesh point coordinates, evaluated at the integration points of all cells in the region.
\[\left( \frac{\partial u_i}{\partial X_J} \right)_{(qc)} = \hat{u}_{ai} \left( \frac{\partial h_a}{\partial X_J} \right)_{(qc)}\]Examples
>>> import felupe as fem >>> >>> mesh = fem.Cube(n=6) >>> region = fem.RegionHexahedron(mesh) >>> displacement = fem.Field(region, dim=3) >>> >>> u = displacement.interpolate() >>> dudX = displacement.grad()
To obtain deformation-related quantities like the right Cauchy-Green deformation tensor or the principal stretches, use the math-helpers from FElupe. These functions operate on arrays with trailing axes.
\[\boldsymbol{C} = \boldsymbol{F}^T \boldsymbol{F}\]- as_container(**kwargs)[source]#
Create a
FieldContainerwith the field.
- extract(grad=True, sym=False, add_identity=True, dtype=None, out=None, order='C')[source]#
Generalized extraction method which evaluates either the gradient or the field values at the integration points of all cells in the region. Optionally, the symmetric part of the gradient is evaluated and/or the identity matrix is added to the gradient.
- Parameters:
grad (bool, optional) – Flag for gradient evaluation (default is True).
sym (bool, optional) – Flag for symmetric part if the gradient is evaluated (default is False).
add_identity (bool, optional) – Flag for the addition of the identity matrix if the gradient is evaluated (default is True).
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
(Symmetric) gradient or interpolated field values evaluated at the integration points of each cell in the region.
- Return type:
ndarray
See also
- classmethod from_mesh_container(mesh_container, dim=None, values=0.0)[source]#
Create a Field on a vertex mesh from a mesh container.
- grad(sym=False, dtype=None, out=None, order='C')[source]#
Gradient as partial derivative of field values w.r.t. undeformed coordinates, evaluated at the integration points of all cells in the region. Optionally, the symmetric part the gradient is evaluated.
\[\left( \frac{\partial u_i}{\partial X_J} \right)_{(qc)} = \hat{u}_{ai} \left( \frac{\partial h_a}{\partial X_J} \right)_{(qc)}\]- Parameters:
sym (bool, optional) – Calculate the symmetric part of the gradient (default is False).
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
Gradient as partial derivative of field value components
iat points w.r.t. the undeformed coordinatesj, evaluated at the quadrature pointsqof cellscin the region.- Return type:
ndarray of shape (i, j, q, c)
- hess(dtype=None, out=None, order='C')[source]#
Hessian as second partial derivative of field values w.r.t. undeformed coordinates, evaluated at the integration points of all cells in the region.
\[\left( \frac{\partial^2 u_i}{\partial X_J~\partial X_K} \right)_{(qc)} = \hat{u}_{ai} \left( \frac{\partial^2 h_a}{\partial X_J~\partial X_K} \right)_{(qc)}\]- Parameters:
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
Hessian as partial derivative of field value components
iat points w.r.t. the undeformed coordinatesjandk, evaluated at the quadrature pointsqof cellscin the region.- Return type:
ndarray of shape (i, j, k, q, c)
- interpolate(dtype=None, out=None, order='C')[source]#
Interpolate field values located at mesh-points to the quadrature points
qof cellscin the region.\[u_{i(qc)} = \hat{u}_{ai}\ h_{a(qc)}\]- Parameters:
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
Interpolated field value components
i, evaluated at the quadrature pointsqof each cellcin the region.- Return type:
ndarray of shape (i, q, c)
- reload(region, mode='edge', **kwargs)[source]#
Reload the field with a new region in-place. The field values are extended to the new region if necessary.
- Parameters:
region (Region) – The new region for the field.
mode (str, optional) – The padding mode to use if the field values need to be extended. Default is “edge”.
**kwargs (dict, optional) – Additional keyword arguments are passed to
numpy.pad().
- class felupe.FieldAxisymmetric(region, dim=1, values=0.0, dtype=None)[source]#
An axisymmetric
Fieldon points of a two-dimensionalRegionwith dimensiondim(default is 2) and initial pointvalues(default is 0).- Parameters:
region (Region) – The region on which the field will be created.
dim (int, optional) – The dimension of the field (default is 2).
values (float or array, optional) – A single value for all components of the field or an array of shape (region.mesh.npoints, dim)`. Default is 0.0.
dtype (data-type or None, optional) – Data-type of the array containing the field values.
Notes
component 1 = axial component
component 2 = radial component
x_2 (radial direction) ^ | _ | / \ --|-----------------> x_1 (axial rotation axis) \_^
This is a modified
Fieldin which the radial coordinates are evaluated at the numeric integration pointsqfor each cellc. Thegrad()-method is modified in such a way that it does not only contain the in-plane 2d-gradient but also the circumferential stretch, see Eq. (6).(6)#\[\begin{split}\frac{\partial \boldsymbol{u}}{\partial \boldsymbol{X}} = \begin{bmatrix} \left( \frac{\partial \boldsymbol{u}}{\partial \boldsymbol{X}} \right)_{2d} & \boldsymbol{0} \\ \boldsymbol{0}^T & \frac{u_r}{R} \end{bmatrix}\end{split}\]See also
felupe.FieldField on points of a
Regionwith dimensiondimand initial pointvalues.
- as_container(**kwargs)#
Create a
FieldContainerwith the field.
- copy()#
Return a copy of the field.
- extract(grad=True, sym=False, add_identity=True, dtype=None, out=None, order='C')#
Generalized extraction method which evaluates either the gradient or the field values at the integration points of all cells in the region. Optionally, the symmetric part of the gradient is evaluated and/or the identity matrix is added to the gradient.
- Parameters:
grad (bool, optional) – Flag for gradient evaluation (default is True).
sym (bool, optional) – Flag for symmetric part if the gradient is evaluated (default is False).
add_identity (bool, optional) – Flag for the addition of the identity matrix if the gradient is evaluated (default is True).
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
(Symmetric) gradient or interpolated field values evaluated at the integration points of each cell in the region.
- Return type:
ndarray
See also
- fill(a)#
Fill all field values with a scalar value.
- classmethod from_mesh_container(mesh_container, dim=None, values=0.0)#
Create a Field on a vertex mesh from a mesh container.
- grad(sym=False, dtype=None, out=None, order='C')[source]#
3D-gradient as partial derivative of field values at points w.r.t. the undeformed coordinates, evaluated at the integration points of all cells in the region. Optionally, the symmetric part of the gradient is returned.
\[\begin{split}\frac{\partial \boldsymbol{u}}{\partial \boldsymbol{X}} = \begin{bmatrix} \left( \frac{\partial \boldsymbol{u}}{\partial \boldsymbol{X}} \right)_{2d} & \boldsymbol{0} \\ \boldsymbol{0}^T & \frac{u_r}{R} \end{bmatrix}\end{split}\]- Parameters:
sym (bool, optional) – Calculate the symmetric part of the gradient (default is False).
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
Full 3D-gradient as partial derivative of field values at points w.r.t. undeformed coordinates, evaluated at the integration points of all cells in the region.
- Return type:
ndarray
- hess(dtype=None, out=None, order='C')#
Hessian as second partial derivative of field values w.r.t. undeformed coordinates, evaluated at the integration points of all cells in the region.
\[\left( \frac{\partial^2 u_i}{\partial X_J~\partial X_K} \right)_{(qc)} = \hat{u}_{ai} \left( \frac{\partial^2 h_a}{\partial X_J~\partial X_K} \right)_{(qc)}\]- Parameters:
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
Hessian as partial derivative of field value components
iat points w.r.t. the undeformed coordinatesjandk, evaluated at the quadrature pointsqof cellscin the region.- Return type:
ndarray of shape (i, j, k, q, c)
- interpolate(dtype=None, out=None, order='C')[source]#
Interpolate field values located at mesh-points to the quadrature points
qof cellscin the region.\[u_{i(qc)} = \hat{u}_{ai}\ h_{a(qc)}\]- Parameters:
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
Interpolated field value components
i, evaluated at the quadrature pointsqof each cellcin the region.- Return type:
ndarray of shape (i, q, c)
- reload(region, mode='edge', **kwargs)#
Reload the field with a new region in-place. The field values are extended to the new region if necessary.
- Parameters:
region (Region) – The new region for the field.
mode (str, optional) – The padding mode to use if the field values need to be extended. Default is “edge”.
**kwargs (dict, optional) – Additional keyword arguments are passed to
numpy.pad().
- class felupe.FieldPlaneStrain(region, dim=2, values=0.0, dtype=None)[source]#
A plane strain
Fieldon points of a two-dimensionalRegionwith dimensiondim(default is 2) and initial pointvalues(default is 0).- Parameters:
region (Region) – The region on which the field will be created.
dim (int, optional) – The dimension of the field (default is 2).
values (float or array) – A single value for all components of the field or an array of shape (region.mesh.npoints, dim)`. Default is 0.0.
dtype (data-type or None, optional) – Data-type of the array containing the field values.
Notes
This is a modified
Fieldfor plane strain. Thegrad()-method is modified in such a way that the in-plane 2d-gradient is embedded in 3d-space, see Eq. (7).(7)#\[\begin{split}\frac{\partial \boldsymbol{u}}{\partial \boldsymbol{X}} = \begin{bmatrix} \left( \frac{\partial \boldsymbol{u}}{\partial \boldsymbol{X}} \right)_{2d} & \boldsymbol{0} \\ \boldsymbol{0}^T & 0 \end{bmatrix}\end{split}\]See also
felupe.FieldField on points of a
Regionwith dimensiondimand initial pointvalues.
- as_container(**kwargs)#
Create a
FieldContainerwith the field.
- copy()#
Return a copy of the field.
- extract(grad=True, sym=False, add_identity=True, dtype=None, out=None, order='C')#
Generalized extraction method which evaluates either the gradient or the field values at the integration points of all cells in the region. Optionally, the symmetric part of the gradient is evaluated and/or the identity matrix is added to the gradient.
- Parameters:
grad (bool, optional) – Flag for gradient evaluation (default is True).
sym (bool, optional) – Flag for symmetric part if the gradient is evaluated (default is False).
add_identity (bool, optional) – Flag for the addition of the identity matrix if the gradient is evaluated (default is True).
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
(Symmetric) gradient or interpolated field values evaluated at the integration points of each cell in the region.
- Return type:
ndarray
See also
- fill(a)#
Fill all field values with a scalar value.
- classmethod from_mesh_container(mesh_container, dim=None, values=0.0)#
Create a Field on a vertex mesh from a mesh container.
- grad(sym=False, dtype=None, out=None, order='C')[source]#
3D-gradient as partial derivative of field values at points w.r.t. the undeformed coordinates, evaluated at the integration points of all cells in the region. Optionally, the symmetric part of the gradient is returned.
| dudX(2d) : 0 | dudX(planestrain) = | ..................| | 0 : 0 |
- Parameters:
sym (bool, optional) – Calculate the symmetric part of the gradient (default is False).
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
Full 3D-gradient as partial derivative of field values at points w.r.t. undeformed coordinates, evaluated at the integration points of all cells in the region.
- Return type:
ndarray
- hess(dtype=None, out=None, order='C')[source]#
3D-Hessian as second partial derivative of field values at points w.r.t. the undeformed coordinates, evaluated at the integration points of all cells in the region.
- Parameters:
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
Full 3D-hessian as second partial derivative of field values at points w.r.t. undeformed coordinates, evaluated at the integration points of all cells in the region.
- Return type:
ndarray
- interpolate(dtype=None, out=None, order='C')[source]#
Interpolate field values located at mesh-points to the quadrature points
qof cellscin the region.\[u_{i(qc)} = \hat{u}_{ai}\ h_{a(qc)}\]- Parameters:
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
Interpolated field value components
i, evaluated at the quadrature pointsqof each cellcin the region.- Return type:
ndarray of shape (i, q, c)
- reload(region, mode='edge', **kwargs)#
Reload the field with a new region in-place. The field values are extended to the new region if necessary.
- Parameters:
region (Region) – The new region for the field.
mode (str, optional) – The padding mode to use if the field values need to be extended. Default is “edge”.
**kwargs (dict, optional) – Additional keyword arguments are passed to
numpy.pad().
- class felupe.FieldDual(region, dim=1, values=0.0, offset=0, npoints=None, mesh=None, disconnect=None, calc_points=None, **kwargs)[source]#
A dual field on points of a
Regionwith dimensiondimand initial pointvalues.- Parameters:
region (Region) – The region on which the field will be created.
dim (int, optional) – The dimension of the field (default is 1).
values (float or array) – A single value for all components of the field or an array of shape (region.mesh.npoints, dim). Default is 0.0.
offset (int, optional) – Offset for cell connectivity of the dual mesh (default is 0).
npoints (int or None, optional) – Specified number of mesh points for the dual mesh (default is None).
mesh (Mesh or None, optional) – A mesh which is used for the dual region (default is None). If None, the mesh is taken from the region.
disconnect (bool or None, optional) – A flag to disconnect the dual mesh (default is None). If None, a disconnected mesh is used except for regions with quadratic-triangle or -tetra or MINI element formulations.
calc_points (bool or None, optional) – A flag to calculate points for the dual mesh (default is None).
**kwargs (dict, optional) – Optional keyword arguments for the dual region.
Examples
>>> import felupe as fem >>> >>> mesh = fem.Cube(n=6) >>> region = fem.RegionHexahedron(mesh) >>> >>> displacement = fem.Field(region, dim=3) >>> pressure = fem.FieldDual(region) >>> >>> field = fem.FieldContainer([displacement, pressure]) >>> field <felupe FieldContainer object> Number of fields: 2 Dimension of fields: Field: 3 FieldDual: 1
See also
felupe.FieldContainerA container which holds one or multiple (mixed) fields.
felupe.FieldField on points of a
Regionwith dimensiondimand initial pointvalues.felupe.FieldAxisymmetricAxisymmetric field on points of a
Regionwith dimensiondimand initial pointvalues.felupe.FieldPlaneStrainPlane strain field on points of a
Regionwith dimensiondimand initial pointvalues.felupe.mesh.dualCreate a dual
Mesh.
- as_container(**kwargs)#
Create a
FieldContainerwith the field.
- copy()#
Return a copy of the field.
- extract(grad=True, sym=False, add_identity=True, dtype=None, out=None, order='C')#
Generalized extraction method which evaluates either the gradient or the field values at the integration points of all cells in the region. Optionally, the symmetric part of the gradient is evaluated and/or the identity matrix is added to the gradient.
- Parameters:
grad (bool, optional) – Flag for gradient evaluation (default is True).
sym (bool, optional) – Flag for symmetric part if the gradient is evaluated (default is False).
add_identity (bool, optional) – Flag for the addition of the identity matrix if the gradient is evaluated (default is True).
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
(Symmetric) gradient or interpolated field values evaluated at the integration points of each cell in the region.
- Return type:
ndarray
See also
- fill(a)#
Fill all field values with a scalar value.
- classmethod from_mesh_container(mesh_container, dim=None, values=0.0)#
Create a Field on a vertex mesh from a mesh container.
- grad(sym=False, dtype=None, out=None, order='C')#
Gradient as partial derivative of field values w.r.t. undeformed coordinates, evaluated at the integration points of all cells in the region. Optionally, the symmetric part the gradient is evaluated.
\[\left( \frac{\partial u_i}{\partial X_J} \right)_{(qc)} = \hat{u}_{ai} \left( \frac{\partial h_a}{\partial X_J} \right)_{(qc)}\]- Parameters:
sym (bool, optional) – Calculate the symmetric part of the gradient (default is False).
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
Gradient as partial derivative of field value components
iat points w.r.t. the undeformed coordinatesj, evaluated at the quadrature pointsqof cellscin the region.- Return type:
ndarray of shape (i, j, q, c)
- hess(dtype=None, out=None, order='C')#
Hessian as second partial derivative of field values w.r.t. undeformed coordinates, evaluated at the integration points of all cells in the region.
\[\left( \frac{\partial^2 u_i}{\partial X_J~\partial X_K} \right)_{(qc)} = \hat{u}_{ai} \left( \frac{\partial^2 h_a}{\partial X_J~\partial X_K} \right)_{(qc)}\]- Parameters:
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
Hessian as partial derivative of field value components
iat points w.r.t. the undeformed coordinatesjandk, evaluated at the quadrature pointsqof cellscin the region.- Return type:
ndarray of shape (i, j, k, q, c)
- interpolate(dtype=None, out=None, order='C')#
Interpolate field values located at mesh-points to the quadrature points
qof cellscin the region.\[u_{i(qc)} = \hat{u}_{ai}\ h_{a(qc)}\]- Parameters:
dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the output. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
Interpolated field value components
i, evaluated at the quadrature pointsqof each cellcin the region.- Return type:
ndarray of shape (i, q, c)
- reload(region, mode='edge', **kwargs)#
Reload the field with a new region in-place. The field values are extended to the new region if necessary.
- Parameters:
region (Region) – The new region for the field.
mode (str, optional) – The padding mode to use if the field values need to be extended. Default is “edge”.
**kwargs (dict, optional) – Additional keyword arguments are passed to
numpy.pad().
- class felupe.FieldsMixed(region, n=3, values=(0.0, 0.0, 1.0, 0.0), axisymmetric=False, planestrain=False, offset=0, npoints=None, mesh=None, **kwargs)[source]#
A container with multiple (mixed)
Fieldsbased on aRegion.- Parameters:
region (RegionHexahedron, RegionQuad, RegionQuadraticQuad, RegionBiQuadraticQuad, RegionQuadraticHexahedron, RegionTriQuadraticHexahedron, RegionQuadraticTetra, RegionQuadraticTriangle, RegionTetraMINI, RegionTriangleMINI or RegionLagrange) – A template region.
n (int, optional) – Number of fields where the first one is a vector field of mesh- dimension and the following fields are scalar-fields (default is 3).
values (tuple of float or tuple of ndarray, optional) – Initial field values (default is (0.0, 0.0, 1.0, 0.0)).
axisymmetric (bool, optional) – Flag to initiate a
FieldAxisymmetricas the first field (default is False).planestrain (bool, optional) – Flag to initiate a
FieldPlaneStrainas the first field (default is False).offset (int, optional) – Offset for cell connectivity of the dual mesh (default is 0).
npoints (int or None, optional) – Specified number of mesh points for the dual mesh (default is None).
mesh (Mesh or None, optional) – A mesh which is used for the dual region (default is None). If None, the mesh is taken from the region.
Notes
The dual region is chosen automatically, i.e. for a
RegionHexahedronthe dual region isRegionConstantHexahedron. A total number ofnfields are generated inside aFieldContainer. For compatibility withThreeFieldVariation, the third field is created with ones, all values of the other fields are initiated with zeros by default.See also
felupe.FieldContainerA container which holds one or multiple (mixed) fields.
felupe.FieldField on points of a
Regionwith dimensiondimand initial pointvalues.felupe.FieldDualA dual field on points of a
Regionwith dimensiondimand initial pointvalues.felupe.FieldAxisymmetricAxisymmetric field on points of a
Regionwith dimensiondimand initial pointvalues.felupe.FieldPlaneStrainPlane strain field on points of a
Regionwith dimensiondimand initial pointvalues.felupe.mesh.dualCreate a dual
Mesh.
- checkpoint()#
Return a checkpoint of the field container.
- Returns:
A dict with a copy of the field container
"field"and, if available, a copy of the top-level field container"field.x0".- Return type:
Notes
The field containers, their fields and the values of the fields are copied. The regions, meshes, mesh containers and indices of the fields are not copied, i.e. they are shared with the field container. These are not modified during the evaluation of a job. Changes of the region or the mesh after a checkpoint is created (e.g. by
merge()) are also visible in the copied field container of the checkpoint, but they do not affectrestore(), which only restores the values of the fields. The copied field container of the checkpoint holds the copied top-level field container"field.x0"as attributex0.See also
felupe.FieldContainer.restoreRestore a checkpoint of a field container inplace.
- copy()#
Return a copy of the field.
- extract(grad=True, sym=False, add_identity=True, dtype=None, out=None, order='C')#
Generalized extraction method which evaluates either the gradient or the field values at the integration points of all cells in the region. Optionally, the symmetric part of the gradient is evaluated and/or the identity matrix is added to the gradient.
- Parameters:
grad (bool or list of bool, optional) – Flag(s) for gradient evaluation(s). A boolean value is applied on the first field only and all other fields are extracted with
grad=False. To enable or disable gradients per-field, use a list of boolean values instead (default is True).sym (bool, optional) – Flag for symmetric part if the gradient is evaluated (default is False).
add_identity (bool or list of bool, optional) – Flag(s) for the addition of the identity matrix if the gradient is evaluated. A boolean value is applied on the first gradient only and all other gradients are extracted with
add_identity=False. To enable or disable the addition of the identity matrix on gradients per-field, use a list of boolean values instead (default is True).dtype (data-type or None, optional) – If provided, forces the calculation to use the data type specified. Default is None.
out (None or ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly- allocated array is returned (default is None).
order (str or list of str, optional) – Controls the memory layout of the outputs. ‘C’ means it should be C contiguous. ‘F’ means it should be Fortran contiguous, ‘A’ means it should be ‘F’ if the inputs are all ‘F’, ‘C’ otherwise. ‘K’ means it should be as close to the layout as the inputs as is possible, including arbitrarily permuted axes. Default is ‘C’.
- Returns:
(Symmetric) gradient or interpolated field values evaluated at the integration points of each cell in the region.
- Return type:
tuple of ndarray
Notes
If the gradient is not requested, the interpolation method returns the field values evaluated at the numeric integration points
qfor each cellcin the region (so-called trailing axes).\[u_{i(qc)} = \hat{u}_{ai}\ h_{a(qc)}\]On the other hand, the gradient method returns the gradient of the field values w.r.t. the undeformed mesh point coordinates, evaluated at the integration points of all cells in the region.
\[\left( \frac{\partial u_i}{\partial X_J} \right)_{(qc)} = \hat{u}_{ai} \left( \frac{\partial h_a}{\partial X_J} \right)_{(qc)}\]See also
felupe.Field.interpolateInterpolate field values located at mesh-points to the quadrature points in the region.
felupe.Field.gradGradient as partial derivative of field values w.r.t. undeformed coordinates.
- extracted_fields()#
- imshow(*args, ax=None, dpi=None, **kwargs)#
Take a screenshot of the first field of the container, show the image data in a figure and return the ax.
- link(other_field=None)#
Link value array of other field.
- Parameters:
other_field (FieldContainer or None, optional) – The other field container (default is None). If None, all fields are linked to the first field. If the field container has
slotsand the other field container has noslots(e.g. a top-level field container), the fields are linked to the fields of the other field container, given by theslots. Otherwise, the fields are linked 1-to-1 by their position.
- merge(decimals=None, **kwargs)#
Merge all fields and return a list of field containers as well as the top-level field container.
- Parameters:
decimals (int or None, optional) – Precision decimals for merging duplicated mesh points. Default is None.
**kwargs (dict, optional) – Additional keyword arguments for
MeshContainer.
- Returns:
The top-level field container, to be used as the
x0-argument inevaluate()and for the creation of boundary conditions. The given field containers are modified & reloaded in-place, along with a new attributex0that points to this top-level field container.- Return type:
Notes
Mixed field containers, e.g.
FieldsMixed, are supported, seemerge()for details.Examples
>>> import felupe as fem >>> >>> mesh1 = fem.Rectangle(n=3) >>> displacement1 = fem.FieldAxisymmetric(fem.RegionQuad(mesh1), dim=2) >>> field1 = fem.FieldContainer([displacement1]) >>> >>> mesh2 = fem.Rectangle(a=(1, 0), b=(2, 1), n=3) >>> displacement2 = fem.FieldAxisymmetric(fem.RegionQuad(mesh2), dim=2) >>> field2 = fem.FieldContainer([displacement2]) >>> >>> x0 = (field1 & field2).merge() >>> >>> umat = fem.NeoHookeCompressible(mu=1, lmbda=2) >>> solid1 = fem.SolidBody(umat, field1) >>> solid2 = fem.SolidBody(umat, field2) >>> >>> boundaries = fem.dof.uniaxial(x0, clamped=True) >>> >>> step = fem.Step(items=[solid1, solid2], boundaries=boundaries) >>> job = fem.Job(steps=[step]).evaluate()
- plot(*args, project=None, **kwargs)#
Plot the first field of the container.
See also
felupe.Scene.plotPlot method of a scene.
felupe.projectProject given values at quadrature-points to mesh-points.
felupe.topointsShift given values at quadrature-points to mesh-points.
- reload(fields=None)#
Reload the Field Container with new fields.
- Parameters:
fields (list) – List of fields.
- restore(checkpoint)#
Restore a checkpoint inplace.
- Parameters:
checkpoint (dict) – A dict with checkpoint arrays / objects.
See also
felupe.FieldContainer.checkpointReturn a checkpoint of the field container.
- revolve(n=11, phi=180)#
Return a revolved field container.
- Parameters:
- Returns:
The revolved field container.
- Return type:
Examples
First, create an axisymmetric field.
>>> import felupe as fem >>> >>> region = fem.RegionQuad(mesh=fem.Rectangle(n=6)) >>> field = fem.FieldContainer([fem.FieldAxisymmetric(region, dim=2)]) >>> field.plot().show()
The first field of the field container is now revolved around the x-axis.
>>> new_field = field.revolve(n=11, phi=180) >>> new_field.plot().show()
See also
SolidBody.revolveReturn a revolved solid body
SolidBodyNearlyIncompressible.revolveReturn a revolved solid body
- screenshot(*args, filename='field.png', transparent_background=None, scale=None, **kwargs)#
Take a screenshot of the first field of the container.
See also
pyvista.Plotter.screenshotTake a screenshot of a PyVista plotter.
- values()#
Return the field values.
- view(point_data=None, cell_data=None, cell_type=None, project=None)#
View the field with optional given dicts of point- and cell-data items.
- Parameters:
point_data (dict or None, optional) – Additional point-data dict (default is None).
cell_data (dict or None, optional) – Additional cell-data dict (default is None).
cell_type (pyvista.CellType or None, optional) – Cell-type of PyVista (default is None).
project (callable or None, optional) – Project internal cell-data at quadrature-points to mesh-points (default is None).
- Returns:
A object which provides visualization methods for
felupe.FieldContainer.- Return type:
felupe.ViewField
See also
felupe.ViewFieldVisualization methods for
felupe.FieldContainer.felupe.projectProject given values at quadrature-points to mesh-points.
felupe.topointsShift given values at quadrature-points to mesh-points.