pyoomph.equations.ALE module
- class pyoomph.equations.ALE.BaseMovingMeshEquations(coordsys=None)[source]
Bases:
EquationsDefines the base class for moving mesh equations. This class should be inherited by all moving mesh equations.
The coordinate space is whatever the highest space of all fields on the domain is. To ask for a higher one than the fields require - a mesh on
"C2"while only"C1"fields are present, say - add anElementSpaceto the domain:eqs = LaplaceSmoothedMesh() + ElementSpace("C2")
The moving-mesh classes used to take a
coordinate_spaceargument of their own for this. It went throughactivate_coordinates_as_dofs, which assigns the space rather than raising it to at least that order, so the outcome depended on whether the other fields were defined before or after the smoother - and asking for a space below what the fields need was rejected further down anyway.ElementSpaceis order-independent and is the one place that decides this.- Parameters:
coordsys (
BaseCoordinateSystem|None) – The coordinate system. Default is None.
- class pyoomph.equations.ALE.ConnectMeshAtInterface(lagr_mult_prefix='_lagr_conn_', use_highest_space=False)[source]
Bases:
InterfaceEquationsConnects the mesh at the interface by enforcing the equality of the nodal coordinates at the interface.
- Parameters:
lagr_mult_prefix (
str) – The prefix for the Lagrange multipliers. Default is “_lagr_conn_”.use_highest_space (
bool) – If True, the highest space used in other elements is used for the Lagrange Multipliers. Default is False.
- class pyoomph.equations.ALE.ConstrainPositionsToC1Space(where=None)[source]
Bases:
EquationsConstrains the positions of the mesh to the C1 space. This is useful if you want to reduce the number of degrees of freedom of the mesh. Can be combined with UnconstrainPositionsFromC1Space at boundaries to still allow for curved boundaries.
- Parameters:
where (
Callable[[list[float]],bool] |None) – Where to apply the constraint. If None, the constraint is applied to all nodes. If a callable, it should take a list of nondimensional coordinates and return True if the constraint should be applied to that node.
- class pyoomph.equations.ALE.EnforceVolumeByPressure(volume, *, ode_storage_domain=None, only_for_stationary_solve=False, set_zero_on_normal_mode_eigensolve=True, scaling_factor=None)[source]
Bases:
IntegralConstraintEnforces a volume of an ALE mesh with a (Navier-)Stokes equation by adjusting the pressure until the volume is correct. Usually, you need a free surface for this as well which can deform to grow or shrink until the desired volume is reached by adjusting the pressure.
- Parameters:
volume (
Expression|GiNaC_GlobalParam|int|float) – The desired volume to be enforced. This can be a constant or any expression, e.g. a global parameter or a function of time.
- class pyoomph.equations.ALE.EnforcedInterfacialLaplaceSmoothing(coordsys=<pyoomph.expressions.coordsys.CartesianCoordinateSystem object>, sorting=None)[source]
Bases:
InterfaceEquationsThis class can be attached to interfaces of a moving mesh. It ensures that the nodes along this boundary will be placed equidistantly along the interface line with respect to the initial configuration. This can be helpful if you e.g. add a mesh deformation at a single point, e.g. a contact line, which will deform the bulk elements quite dramatically. If the interfaces are associated with this class, the interfaces will move nicely along, keeping the bulk elements in better shape. In order to use it, add it to the interface and use the with_corners method to specify the corners of the interface. So if e.g. a line “substrate” of a domain “droplet” starts at a corner with the boundary “axis” and ends at a corner at the boundary “liquid_gas”, just add
EnforcedInterfacialLaplaceSmoothing().with_corners(“axis”,”liquid_gas”)@”substrate”
to the droplet domain. The same should be done with
EnforcedInterfacialLaplaceSmoothing().with_corners(“axis”,”substrate”)@”liquid_gas”
So that a motion of the contact line will be smooth.
- required_parent_type
alias of
BaseMovingMeshEquations
- class pyoomph.equations.ALE.EnforcedInterfacialLaplaceSmoothingCorner(*args: Any, **kwargs: Any)[source]
Bases:
InterfaceEquationsHelper class to pin the arclength and deactivate the tangential shift at a corner of an interface. This is used in EnforcedInterfacialLaplaceSmoothing.with_corners
- required_parent_type
alias of
EnforcedInterfacialLaplaceSmoothing
- class pyoomph.equations.ALE.HyperelasticSmoothedMesh(mu=1, kappa=1, coordsys=<pyoomph.expressions.coordsys.CartesianCoordinateSystem object>)[source]
Bases:
BaseMovingMeshEquationsHyperelastic mesh smoothing. The mesh is smoothed by minimizing the energy functional:
W = integral( mu/2*(I1-d)+kappa/2*(J-1)**2 dOmega )
where I1 is the first invariant of the right Cauchy-Green deformation tensor, J is the determinant of the deformation gradient, mu is the shear modulus, and kappa is the bulk modulus. d is the dimension of the mesh.
- Parameters:
mu (
float) – The shear modulus. Default is 1.kappa (
float) – The bulk modulus. Default is 1.coordsys (
BaseCoordinateSystem|None) – The coordinate system. Default is cartesian.
- class pyoomph.equations.ALE.InterfaceMeshStiffening(factor=1, *, mode='elastic', stiffness=None, nu=3 / 10, coordsys=None)[source]
Bases:
InterfaceEquationsStiffens the mesh in the layer of bulk elements attached to an interface, without touching the bulk equations themselves.
Interface conditions that drag the mesh along – most prominently
FSIConnection, which slaves the fluid mesh position to the solid displacement – only constrain the nodes lying on the interface. Wherever the imposed motion varies quickly along the interface (around corners and tips of an FSI structure, in particular), the first layer of bulk elements has to absorb the entire mismatch between the strongly moving interface nodes and the almost stationary interior, and is sheared or squashed far more than the elements further inside.This equation counteracts that by evaluating a mesh smoothing operator on the interface, but with gradients of the bulk mesh test function, i.e. of
testfunction("mesh",domain=".."). The shape function of a node that is not on the face does vanish on the face, but its gradient does not, so the term reaches the interior nodes of the attached elements although it is only integrated over the interface. It is the surface-concentrated limit of a bulk integral over a layer of thicknessh, which is why the element size enters the prefactor:factoris then just the relative extra stiffness of that layer, i.e.factor=1roughly doubles the mesh stiffness there. The distortion is thereby pushed further into the domain, where more elements can share it.Since it is a quadratic form in the gradient of the displacement, the contribution is positive semi-definite and can therefore only add stiffness – it cannot render the mesh problem indefinite. It is nevertheless rank-deficient (only the face integration points are sampled), so it must be used in addition to, never instead of, a bulk moving mesh equation.
factormay be any expression, e.g. one that is only large close to a corner, if the stiffening shall be applied locally. Since the element size in the prefactor is the one of the current (deformed) mesh - the undeformed one would needelement_size_Lagrangian, which oomph-lib does not provide on face elements - the term is weakly nonlinear even when the bulk mesh equation is linear, costing a few extra Newton steps. Passstiffnessto fix the prefactor and keep a linear mesh problem.- Parameters:
factor (
Expression|GiNaC_GlobalParam|int|float) – Extra stiffness of the attached element layer, relative to the bulk mesh stiffness. Default is 1.mode (
Literal['normal','laplace','elastic']) – Which operator to use, see below. Default is"elastic".stiffness (
Expression|GiNaC_GlobalParam|int|float|None) – Absolute prefactor, overridingfactortimes the bulk mesh stiffness times the element size.nu (
Expression|GiNaC_GlobalParam|int|float) – Poisson ratio, only used formode="elastic". Default is 3/10, as inPseudoElasticMesh.coordsys (
BaseCoordinateSystem|None) – Optional coordinate system override. Defaults to the one of the interface.
The available modes are:
"elastic": penalizes the linear elastic energy of the displacement, the interface analogue ofPseudoElasticMesh."laplace": penalizes the fullgrad(x-X), the interface analogue ofLaplaceSmoothedMesh."normal": penalizes onlygrad(x-X)*n, i.e. it drives the displacement to be constant along the normal direction, so that the attached elements follow the interface as rigidly as possible.
On a fluid-structure problem with a bending flap, all three keep the fluid mesh well away from the tangling that the unstiffened mesh runs into;
"elastic"was marginally the best of them, and going fromfactor=5tofactor=25changed little, since a surface term cannot rigidify the layer completely.- get_nondimensional_bulk_element_size()[source]
The typical size of the attached bulk element, nondimensionalized by the spatial scale.
- Return type:
- get_stiffness()[source]
The absolute prefactor of the interface contribution.
- Return type:
Expression|GiNaC_GlobalParam|int|float
- required_parent_type
alias of
BaseMovingMeshEquations
- class pyoomph.equations.ALE.LaplaceSmoothedMesh(factor=scale(spatial, < code=0, tags=>)**2, coordsys=<pyoomph.expressions.coordsys.CartesianCoordinateSystem object>, symmetrize=False)[source]
Bases:
BaseMovingMeshEquationsRepresents a Laplace smoothed mesh. The Laplace smoothed mesh is defined by the kinematic boundary condition:
laplace(x - X) = 0
where x is the unknown Eulerian coordinate, X is the is the Lagrangian coordinate and lapalce represents the Laplacian operator.
This class is a subclass of BaseMovingMeshEquations and inherits all its arguments.
- Parameters:
factor (
Expression|GiNaC_GlobalParam|int|float) – The factor. Default is scale_factor(“spatial”)**2.
- class pyoomph.equations.ALE.PrescribedMovingMesh(umesh, lagrangian=False, coordsys=None)[source]
Bases:
BaseMovingMeshEquationsInstead of solving e.g. a Laplace-smoothed mesh, you can also directly prescribe the mesh velocity. This class allows you to do so by passing an expression for the mesh velocity.
- Parameters:
umesh (
Expression|GiNaC_GlobalParam|int|float) – The prescribed mesh velocity.lagrangian – If True, the integration is performed in the Lagrangian frame. Default is False.
coordsys – The coordinate system. Default is cartesian.
- class pyoomph.equations.ALE.PseudoElasticMesh(E=scale(spatial, < code=0, tags=>)**2, nu=3/10, spatial_error_factor=None, coordsys=<pyoomph.expressions.coordsys.CartesianCoordinateSystem object>)[source]
Bases:
BaseMovingMeshEquationsRepresents a deformable solid mesh defined by the a kinematic boundary condition:
lambda = 2 * E / 2 / (1 + nu) * (E * nu / (1 + nu) / (1 - 2 * nu)) / (nu / (1 + nu) / (1 - 2 * nu) + 2 * E / 2 / (1 + nu)) sigma = lambda * tr(sym(grad(x - X))) * I + 2 * mu * sym(grad((x - X))) div(sigma) = 0
where x is the unknown Eulerian coordinate, X is the is the Lagrangian coordinate, E is the Young’s modulus, nu is the Poisson’s ratio, lambda is the Lamé parameter, sigma is the stress tensor, tr is the trace operator, sym(grad()) is the symmetric gradient operator, div is the divergence operator, f is the bulk force, and I is the identity matrix.
This class is a subclass of BaseMovingMeshEquations and inherits all its arguments.
- Parameters:
E (
Expression|GiNaC_GlobalParam|int|float) – The Young’s modulus. Default is 1*scale_factor(“spatial”)**2.nu (
Expression|GiNaC_GlobalParam|int|float) – The Poisson’s ratio. Default is rational_num(3,10).spatial_error_factor (
float|None) – The spatial error factor. Default is None.coordsys (
BaseCoordinateSystem|None) – The coordinate system. Default is cartesian.
- class pyoomph.equations.ALE.SetLagrangianToEulerianAfterSolve(*args: Any, **kwargs: Any)[source]
Bases:
EquationsSets the Lagrangian nodal coordinates to the Eulerian nodal coordinates after the Newton solve.
- class pyoomph.equations.ALE.StabilizeElementSizeAtMovingInterface(factor)[source]
Bases:
InterfaceEquationsEnsures that the size of the interface elements remains the same.
This class requires the parent equations to be of type BaseMovingMeshEquations, meaning that if BaseMovingMeshEquations (or subclasses) are not defined in the parent domain, an error will be raised.
- Parameters:
factor (
float) – Multiplicative stabilization factor. Default is 1.
- required_parent_type
alias of
BaseMovingMeshEquations
- class pyoomph.equations.ALE.UnconstrainPositionsFromC1Space(where=None)[source]
Bases:
EquationsUnconstrains the positions of the mesh from the C1 space. Can be applied to a boundary on a domain with ConstrainPositionsToC1Space in the bulk to allow for curved boundaries.
- Parameters:
where (
Callable[[list[float]],bool] |None) – Where to apply the constraint. If None, the constraint is applied to all nodes. If a callable, it should take a list of nondimensional coordinates and return True if the constraint should be applied to that node.
- class pyoomph.equations.ALE.VolumeEnforceStorage(volume, scale='auto')[source]
Bases:
ODEEquationsStores the volume that should be enforced.
- Parameters:
volume (
Expression|GiNaC_GlobalParam|int|float) – The volume that should be enforced.scale (
Union[Literal['auto'],Expression,GiNaC_GlobalParam,int,float]) – The scale factor. Default is “auto”.
- class pyoomph.equations.ALE.VolumeEnforcingBoundary(storage_var)[source]
Bases:
EquationsAdd these to the boundaries of a volume that should be enforced and pass the var(“volume_enforcing”,domain=”<ode domain>”) as arg. The volume is enforced by the weak form of the volume constraint:
V=(1,vltest)=(div(x)/NORM,vltest)=-1/NORM*<x*n,vltest>
- Parameters:
storage_var (
Expression) – The storage variable that contains the volume that should be enforced.
- class pyoomph.equations.ALE.YeohSmoothedMesh(kappa=1, C1=1, C2=10, C3=0, coordsys=<pyoomph.expressions.coordsys.CartesianCoordinateSystem object>)[source]
Bases:
BaseMovingMeshEquationsYeoh mesh smoothing. The mesh is smoothed by minimizing the energy functional:
W = integral( 1/2 * (C1*I1min+C2*I1min**2+C3*I1min**3+kappa*(J-1)**2 ) * dOmega )
where I1min=I1-d is the first invariant of the right Cauchy-Green deformation tensor minus the dimension d of the mesh, J is the determinant of the deformation gradient, C1, C2, and C3 are the Yeoh constants, and kappa is the bulk modulus.
- Parameters:
kappa (
float) – The bulk modulus. Default is 1.C1 (
float) – The Yeoh constant C1. Default is 1.C2 (
float) – The Yeoh constant C2. Default is 10.C3 (
float) – The Yeoh constant C3. Default is 0.coordsys (
BaseCoordinateSystem|None) – The coordinate system. Default is cartesian