Constraints
Constraints are defined globally, and may be used for introducing additional scalar equations into the global equation system.
Example syntax:
*constraint, type=rigidbody, name=myRigigBody
nSet=right
referencePoint=rBottom
equalvaluelagrangian
- Constrain nodal values to equal values
Module edelweissfe.constraints.equalvaluelagrangian
Option |
Description |
---|---|
field |
The field this constraint acts on. |
component |
The component of the field. |
nSet |
The node set to be constrained. |
testfiles/EqualValueLagrangianConstraint/test.inp
*modelGenerator, generator=planeRectQuad, name=gen
elType=CPS8R
nX=20
nY=20
l=100
h=100
*constraint, type=equalValueLagrangian, name=myConstraint
nSet=gen_top
field=displacement
component=1
*material, name=linearelastic, id=linearelastic
30000.0, 0.15
*section, name=section1, thickness=1.0, material=linearelastic, type=plane
all
*job, name=myJob, domain=2d
*solver, solver=NIST, name=theSolver
*fieldOutput
create=perNode, name=displacement, elSet=all, field=displacement, result=U,
create=perNode, name=RF, nSet=gen_bottom, field=displacement, result=P,
create=perElement, name=stress, elSet=all, result=stress, quadraturePoint=0:4, f(x)='mean(x, axis=1)'
create=perElement, name=strain, elSet=all, result=strain, quadraturePoint=0:4, f(x)='mean(x, axis=1)'
*output, type=monitor, name=theMonitor
fieldOutput = RF, f(x) = 'sum ( x, axis=0)'
*output, type=ensight, name=ensightExport
create=perNode, fieldOutput=displacement
create=perElement, fieldOutput=stress
create=perElement, fieldOutput=strain
configuration, overwrite=yes
*step, solver=theSolver, maxInc=1e-1, minInc=1e-5, maxNumInc=1000, maxIter=25, stepLength=1
options, category=NISTSolver, extrapolation=linear
dirichlet, name=bottom, nSet=gen_bottom, field=displacement, 1=0.0, 2=0.0
dirichlet, name=load, nSet=gen_rightTop, field=displacement, 1=5.0, 2=5.0
equalvaluepenalty
- Constrain nodal values to equal values
Module edelweissfe.constraints.equalvaluepenalty
Option |
Description |
---|---|
field |
The field this constraint acts on. |
component |
The component of the field. |
penalty |
The numerical penalty value. |
nSet |
The node set to be constrained. |
testfiles/EqualValuePenaltyConstraint/test.inp
*modelGenerator, generator=planeRectQuad, name=gen
elType=CPS8R
nX=20
nY=20
l=100
h=100
*constraint, type=equalValuePenalty, name=myConstraint
nSet=gen_top
field=displacement
component=1
penalty=1e8
*material, name=linearelastic, id=linearelastic
30000.0, 0.15
*section, name=section1, thickness=1.0, material=linearelastic, type=plane
all
*job, name=myJob, domain=2d
*solver, solver=NIST, name=theSolver
*fieldOutput
create=perNode, name=displacement, elSet=all, field=displacement, result=U,
create=perNode, name=RF, nSet=gen_bottom, field=displacement, result=P,
create=perElement, name=stress, elSet=all, result=stress, quadraturePoint=0:4, f(x)='mean(x, axis=1)'
create=perElement, name=strain, elSet=all, result=strain, quadraturePoint=0:4, f(x)='mean(x, axis=1)'
*output, type=monitor, name=theMonitor
fieldOutput = RF, f(x) = 'sum ( x, axis=0)'
*output, type=ensight, name=ensightExport
create=perNode, fieldOutput=displacement
create=perElement, fieldOutput=stress
create=perElement, fieldOutput=strain
configuration, overwrite=yes
*step, solver=theSolver, maxInc=1e-1, minInc=1e-5, maxNumInc=1000, maxIter=25, stepLength=1
options, category=NISTSolver, extrapolation=linear
dirichlet, name=bottom, nSet=gen_bottom, field=displacement, 1=0.0, 2=0.0
dirichlet, name=load, nSet=gen_rightTop, field=displacement, 1=5.0, 2=5.0
linearizedrigidbody
- Linearized rigid body constraints
Module edelweissfe.constraints.linearizedrigidbody
Option |
Description |
---|---|
nSet |
(Slave) node set, which is constrained to the reference point |
referencePoint |
(Master) reference point |
testfiles/LinearizedRigidBodyConstraint/test.inp
*modelGenerator, generator=planeRectQuad, name=gen
l=100
h=10
nX=15
nY=5
elType=CPS4
*material, name=linearElastic, id=le
30000.0, 0.15
*section, name=section1, thickness=1.0, material=le, type=plane
all
*job, name=cps4job, domain=2d
*solver, solver=NIST, name=theSolver
*fieldOutput
create=perNode, name=load, nSet=gen_left, field=displacement, result=P, f(x)='sum(x[:,1])'
create=perNode, name=displacement, elSet=all, field=displacement, result=U, name=displacement
*output, type=monitor
fieldOutput=load
*constraint, type=linearizedRigidBody, name=rb1
nSet=gen_right
referencePoint=gen_rightTop
*output, type=ensight, name=ensightExport
create=perNode, fieldOutput=displacement
configuration, overwrite=yes
*step, solver=theSolver, maxInc=1e-1, minInc=1e-4, maxNumInc=1000, maxIter=4
options, category=NISTSolver, extrapolation=linear
dirichlet, name=leftCorner, nSet=gen_leftBottom, field=displacement, 1=0.0, 2=0.0
dirichlet, name=rotRP, nSet=gen_rightTop, field=rotation, 1=0.05
dirichlet, name=movRP, nSet=gen_rightTop, field=displacement, 2=0.00
testfiles/LinearizedRigidBodyConstraint2D/test.inp
*modelGenerator, generator=planeRectQuad, name=gen
l=100
h=10
nX=15
nY=5
elType=CPS4
*node, nSet=RP
999999, 150, 5
*material, name=linearElastic, id=myMaterial
30000.0, 0.15
*section, name=section1, thickness=1.0, material=myMaterial, type=plane
all
*job, name=myJob, domain=2d
*solver, solver=NIST, name=theSolver
*fieldOutput
create=perNode, name=load, nSet=gen_left, field=displacement, result=P, f(x)='sum(x[:,1])'
create=perNode, name=displacement, elSet=all, field=displacement, result=U, name=displacement
*output, type=monitor
fieldOutput=load
*constraint, type=linearizedRigidBody, name=fixedSupport
nSet=gen_left
referencePoint=gen_leftTop
*constraint, type=linearizedRigidBody, name=pinnedSupport
nSet=gen_right
referencePoint=RP
*output, type=ensight, name=test
create=perNode, fieldOutput=displacement
configuration, overwrite=yes
*step, solver=theSolver, maxInc=1e-1, minInc=1e-4, maxNumInc=1000, maxIter=4
options, category=NISTSolver, extrapolation=linear
dirichlet, name=rotFixedSupport, nSet=gen_leftTop, field=rotation, 1=0
dirichlet, name=movFixedSupport, nSet=gen_leftTop, field=displacement, 1=0, 2=0
dirichlet, name=movPinnedSupport, nSet=RP, field=displacement, 1=0, 2=0
*step, solver=theSolver, maxInc=1e-1, minInc=1e-4, maxNumInc=1000, maxIter=4
options, category=NISTSolver, extrapolation=linear
distributedload, name=loadTop, surface=gen_top, type=pressure, magnitude=10.0, f(t)=1
testfiles/LinearizedRigidBodyConstraint3D/test.inp
*modelGenerator, generator=boxGen, name=gen
lX=100
lY=10
lZ=10
nX=15
nY=5
nZ=5
elType=C3D8
*node, nSet=RP
999999, 150, 5, 5
*material, name=linearElastic, id=myMaterial
30000.0, 0.15
*section, name=section1, material=myMaterial, type=solid
all
*job, name=myJob, domain=3d
*solver, solver=NIST, name=theSolver
*fieldOutput
create=perNode, name=load, nSet=gen_left, field=displacement, result=P, f(x)='sum(x[:,1])'
create=perNode, name=displacement, elSet=all, field=displacement, result=U, name=displacement
*output, type=monitor
fieldOutput=load
*constraint, type=linearizedRigidBody, name=fixedSupport
nSet=gen_left
referencePoint=gen_topLeftBack
*constraint, type=linearizedRigidBody, name=pinnedSupport
nSet=gen_right
referencePoint=RP
*output, type=ensight, name=test
create=perNode, fieldOutput=displacement
configuration, overwrite=yes
*step, solver=theSolver, maxInc=1e-1, minInc=1e-4, maxNumInc=1000, maxIter=4
options, category=NISTSolver, extrapolation=linear
dirichlet, name=rotFixedSupport, nSet=gen_topLeftBack, field=rotation, 1=0, 2=0, 3=0
dirichlet, name=movFixedSupport, nSet=gen_topLeftBack, field=displacement, 1=0, 2=0, 3=0
dirichlet, name=movPinnedSupport, nSet=RP, field=displacement, 1=0, 2=0, 3=0
*step, solver=theSolver, maxInc=1e-1, minInc=1e-4, maxNumInc=1000, maxIter=4
options, category=NISTSolver, extrapolation=linear
distributedload, name=loadTop, surface=gen_top, type=pressure, magnitude=10.0, f(t)=1
dirichlet, name=rotation, nSet=RP, field=rotation, 2=0.1
rigidbody
- Geometrically exact rigid body constraints in 3D
Module edelweissfe.constraints.rigidbody
Option |
Description |
---|---|
nSet |
(slave) node set, which is constrained to the reference point |
referencePoint |
(master) reference point |
testfiles/RigidBodyConstraintLargeDeformations3D/test.inp
*include, input=mesh.inp
*material, name=stvenantkirchhoffisotropic, id=le,
30000.0, 0.15
*section, name=section1, material=le, type=solid
all
*job, name=c3d8job, domain=3d
*solver, solver=NISTParallel, name=theSolver
*fieldOutput
create=perNode, name=displacement, elSet=all, field=displacement, result=U, name=displacement
create=perElement, name=stress, elSet=all, result=stress, f(x)=' mean(x, axis=1) ', quadraturePoint=0:8
*constraint, type=rigidbody, name=rb1
nSet=right
referencePoint=rBottom
*output, type=ensight, name=ensightExport
create=perNode, fieldOutput=displacement
create=perElement, fieldOutput=stress
configuration, overwrite=yes
*step, solver=theSolver, maxInc=2e-1, minInc=1e-4, maxNumInc=1000, maxIter=10
options, category=NISTSolver, extrapolation=linear
dirichlet, name=left, nSet=left, field=displacement, 1=0.0, 2=0, 3=0
dirichlet, name=rotRP, nSet=rBottom, field=rotation, 1=3.141,
penaltyindirectcontrol
- Penalty based indirect control
Module edelweissfe.constraints.penaltyindirectcontrol
Option |
Description |
---|---|
field |
The field this constraint acts on |
cVector |
The projection vector for the constrained nodes (e.g., CMOD) |
constrainedNSet |
The node set for determining the constraint (e.g., CMOD) |
loadNSet |
The node set for application of the controlled load |
loadVector |
The vector (in correct) dimensions and tensorial order determining the load |
length |
The value of the constraint (e.g., CMOD) |
penaltyStiffness |
The stiffness for formulating the constraint |
offset |
(Optional) a correction value for the computation of the constraint (e.g, initial displacement) |
normalizeLoad |
(Optional) normalize the applied force per node wrt. the number of nodes, i.e., apply a load irrespective of the total number of nodes in ``loadNSet`` |
testfiles/PenaltyBasedIndirectControl/test.inp
*material, name=LinearElastic, id=myMaterial
**Isotropic
**E nu
1000, 0.2
*job, name=job, domain=2d
*solver, solver=NIST, name=theSolver
*modelGenerator, generator=planerectquad, name=gen
nX =5
nY =5
l =20
h =50
elType = CPE4
*section, name=section1, material=myMaterial, type=plane, thickness=1
all
*fieldOutput
create=perNode, elSet=all, field=displacement, result=U, name=displacement
create=perNode, nSet=gen_top, field=displacement, result=U, name=disp_top
create=perNode, nSet=gen_bottom, field=displacement, result=P, name=RF
create=perElement, elSet=all, result=strain, name=strain, quadraturePoint=0:4, f(x)='np.mean(x,axis=1)'
create=perElement, elSet=all, result=stress, name=stress, quadraturePoint=0:4, f(x)='np.mean(x,axis=1)'
*output, type=ensight,
create=perNode, fieldOutput=displacement
create=perElement, fieldOutput=stress
create=perElement, fieldOutput=strain
configuration, overwrite=yes
*output, type=monitor, name=dispMon
fieldOutput=disp_top, f(x)='(x[:,1])'
fieldOutput=RF, f(x)='sum(x[:,1])'
*nset, nset=measurement_nodes
gen_leftBottom
gen_leftTop
*constraint, type=penaltyindirectcontrol, name=pc1
field=displacement
cVector='0, 1, 0, -1'
constrainedNSet=measurement_nodes
loadNSet=gen_rightTop
loadVector='0, -1'
length=-1
penaltyStiffness=1e8
offset=0
*step, solver=theSolver, maxInc=1e0, minInc=1e0, maxNumInc=100, maxIter=25, stepLength=1
modelupdate, update='model.constraints["pc1"].active=False'
dirichlet, name=fix_bottom, nSet=gen_bottom, field=displacement, 1=0, 2=0
*step, solver=theSolver, maxInc=2e-2, minInc=1e-6, maxNumInc=1000, maxIter=25, stepLength=1
modelupdate, update='model.constraints["pc1"].active=True'
Implementing your own constraints
Subclass from the constraint base class in module edelweissfe.constraints.base.constraintbase
- class edelweissfe.constraints.base.constraintbase.ConstraintBase(name, options, model)[source]
The constraint base class.
Constraints can act on nodal variables, and scalar variables. If scalar variables are required, the can be created on demand by defining
getNumberOfAdditionalNeededScalarVariables()
andassignAdditionalScalarVariables()
, which are called at the beginning of an analysis.If scalar variables are used, EdelweissFE expects the layout of the external load vector PExt (and the stiffness) to be of the form
[ node 1 - dofs field 1, node 1 - dofs field 2, node 1 - ... , node 1 - dofs field n, node 2 - dofs field 1, ... , node N - dofs field n, scalar variable 1, scalar variable 2, ... , scalar variable J ].
- Parameters
name (str) – The name of the constraint.
options (dict) – A dictionary containing the options for the constraint.
model (FEModel) – A dictionary containing the model tree.
- Attributes
fieldsOnNodes
The fields on the nodes this constraint is acting on.
nDof
The total number of degrees of freedom this constraint is associated with.
nodes
The nodes this constraint is acting on.
Methods
applyConstraint
(U_np, dU, PExt, V, timeStep)Apply the constraint.
assignAdditionalScalarVariables
(scalarVariables)Assign a list of scalar variables associated with this constraint.
This method is called to determine the additional number of scalar variables this Constraint needs.
- abstract applyConstraint(U_np, dU, PExt, V, timeStep)[source]
Apply the constraint. Add the contributions to the external load vector and the system matrix.
- Parameters
U_np (ndarray) – The current total solution vector.
dU (ndarray) – The current increment since the last time the constraint was applied.
PExt (ndarray) – The external load vector.
K – The system (stiffness) matrix.
dT – The time increment.
time – The current step and total time.
V (ndarray) –
timeStep (TimeStep) –
- assignAdditionalScalarVariables(scalarVariables)[source]
Assign a list of scalar variables associated with this constraint.
- Parameters
list – The list of ScalarVariables associated with this constraint.
scalarVariables (list[edelweissfe.variables.scalarvariable.ScalarVariable]) –
- getNumberOfAdditionalNeededScalarVariables()[source]
This method is called to determine the additional number of scalar variables this Constraint needs.
- Returns
Number of ScalarVariables required.
- Return type
int
- abstract property fieldsOnNodes: list
The fields on the nodes this constraint is acting on.
- abstract property nDof: int
The total number of degrees of freedom this constraint is associated with.
- abstract property nodes: list
The nodes this constraint is acting on.