PanelLengthConstraint¶
- Author:
Alasdair Christison Gray
This class implements a constraint which enforces the panel length design variable values passed to elements using the BladeStiffenedShell constitutive model to be consistent with the true length of the panel they are a part of.
Note
This class should be created using the
pyTACS.createPanelLengthConstraint
method.
API Reference¶
- class tacs.constraints.PanelLengthConstraint(name, assembler, comm, outputViewer=None, meshLoader=None, options=None)[source]¶
NOTE: This class should not be initialized directly by the user. Use pyTACS.createPanelLengthConstraint instead.
- Parameters:
name (str) -- Name of this tacs problem
assembler (TACS.Assembler) -- Cython object responsible for creating and setting tacs objects used to solve problem
comm (mpi4py.MPI.Intracomm) -- The comm object on which to create the pyTACS object.
outputViewer (TACS.TACSToFH5) -- Cython object used to write out f5 files that can be converted and used for postprocessing.
meshLoader (pymeshloader.pyMeshLoader) -- pyMeshLoader object used to create the assembler.
options (dict) -- Dictionary holding problem-specific option parameters (case-insensitive).
- setDesignVars(x)[source]¶
Update the design variables used by tacs.
- Parameters:
x (numpy.ndarray or dict or tacs.TACS.Vec) -- The variables (typically from the optimizer) to set. It looks for variable in the
self.varName
attribute if in dict.
- externalClearUpToDate()[source]¶
clear UpToDate by FUNtoFEM which sets variables into TACS through a different interface
- setNodes(Xpts)[source]¶
Set the mesh coordinates of the structure.
- Parameters:
coords (numpy.ndarray) -- Structural coordinate in array of size (N * 3) where N is the number of structural nodes on this processor.
- computeRefAxis(refAxis: ndarray, comp_bndry_node_coords: ndarray)[source]¶
remove the panelNormal from the refAxis
- Parameters:
refAxis (numpy.ndarray) -- an array of size (3,) for the xyz coordinates of the original refAxis from transform object
comp_bndry_node_coords (numpy.ndarray) -- an array of size (3*N,) for the boundary nodal coordinates on the current panel / current TACS component
- Returns:
an array of size (3,) for xyz coords of the panel length axis after the panelNormal component has been removed
- Return type:
- addConstraint(conName, compIDs=None, lower=None, upper=None, dvIndex=0)[source]¶
Generic method to adding a new constraint set for TACS.
- Parameters:
conName (str) -- The user-supplied name for the constraint set. This will typically be a string that is meaningful to the user
compIDs (list[int] or None) -- List of compIDs to apply constraints to. If None, all compIDs will be used. Defaults to None.
lower (float or complex) -- lower bound for constraint. Not used.
upper (float or complex) -- upper bound for constraint. Not used.
dvIndex (int) -- Index number of the panel length DV's. Defaults to 0.
- getConstraintBounds(bounds, evalCons=None)[source]¶
Get bounds for constraints. The constraints corresponding to the strings in evalCons are evaluated and updated into the provided dictionary.
The panel length constraints are equality constraints so both the upper and lower bounds are zero
- Parameters:
bounds (dict) -- Dictionary into which the constraint bounds are saved. Bounds will be saved as a tuple: (lower, upper)
evalCons (iterable object containing strings.) -- If not none, use these constraints to evaluate.
Examples
>>> conBounds = {} >>> tacsConstraint.getConstraintBounds(conBounds, 'LE_SPAR') >>> conBounds >>> # Result will look like (if TACSConstraint has name of 'c1'): >>> # {'c1_LE_SPAR': (array([-1e20]), array([1e20]))}
- getConstraintSizes(sizes, evalCons=None)[source]¶
Get number for constraint equations in each set. The constraints corresponding to the strings in evalCons are evaluated and updated into the provided dictionary.
- Parameters:
sizes (dict) -- Dictionary into which the constraint sizes are saved.
evalCons (iterable object containing strings.) -- If not none, use these constraints to evaluate.
Examples
>>> conSizes = {} >>> tacsConstraint.getConstraintSizes(conSizes, 'LE_SPAR') >>> funconSizescs >>> # Result will look like (if TACSConstraint has name of 'c1'): >>> # {'c1_LE_SPAR': 10}
- evalConstraints(funcs, evalCons=None, ignoreMissing=False)[source]¶
Evaluate values for constraints. The constraints corresponding to the strings in evalCons are evaluated and updated into the provided dictionary.
The same constraint arrays are returned on every proc
- Parameters:
Examples
>>> funcs = {} >>> adjConstraint.evalConstraints(funcs, 'LE_SPAR') >>> funcs >>> # Result will look like (if PanelLengthConstraint has name of 'c1'): >>> # {'c1_LE_SPAR': array([1.325, 2.1983645, 3.1415926, ...])}
- evalConstraintsSens(funcsSens, evalCons=None)[source]¶
This is the main routine for returning useful (sensitivity) information from constraint. The derivatives of the constraints corresponding to the strings in evalCons are evaluated and updated into the provided dictionary. The derivitives with respect to all design variables and node locations are computed.
The sensitivities returned on each proc are a sparse m x n matrix where m is the number of constraints and n is the number of design variables or 3x the number of nodes on this proc. The matrix contains the sensitivities of all constraints w.r.t only the design variables/node coordinates on this proc.
- Parameters:
funcsSens (dict) -- Dictionary into which the derivatives are saved.
evalCons (iterable object containing strings) -- The constraints the user wants returned
Examples
>>> funcsSens = {} >>> adjConstraint.evalConstraintsSens(funcsSens, 'LE_SPAR') >>> funcsSens >>> # Result will look like (if AdjacencyConstraint has name of 'c1'): >>> # {'c1_LE_SPAR':{'struct':<50x242 sparse matrix of type '<class 'numpy.float64'>' with 100 stored elements in Compressed Sparse Row format>}}
- dtype¶
alias of
float64
- getConstraintKeys()¶
Return a list of the current constraint key names
- getDesignVarRange()¶
get the lower/upper bounds for the design variables.
- Returns:
xlb (numpy.ndarray) -- The design variable lower bound.
xub (numpy.ndarray) -- The design variable upper bound.
- getDesignVars()¶
Get the current set of design variables for this problem.
- Returns:
x -- The current design variable vector set in tacs.
- Return type:
- getNodes()¶
Return the mesh coordinates of this problem.
- Returns:
coords -- Structural coordinate in array of size (N * 3) where N is the number of structural nodes on this processor.
- Return type:
- getNumCoordinates()¶
Return the number of mesh coordinates on this processor.
- Returns:
ncoords -- Number of mesh coordinates on this processor.
- Return type:
- getNumDesignVars()¶
Return the number of design variables on this processor.
- Returns:
ndvs -- Number of design variables on this processor.
- Return type:
- getNumOwnedNodes()¶
Get the number of nodes owned by this processor.
- Returns:
nnodes -- Number of nodes on this processor.
- Return type:
- getNumVariables()¶
Return the number of degrees of freedom (states) that are on this processor
- Returns:
nstate -- number of states.
- Return type:
- getOption(name)¶
Get a solver option value. The name is not case sensitive.
- Parameters:
name (str) -- Name of option to get
- getVarsPerNode()¶
Get the number of variables per node for the model.
- Returns:
vpn -- Number of variables per node.
- Return type:
- classmethod printDefaultOptions()¶
Prints a nicely formatted dictionary of all the default solver options to the stdout
- printModifiedOptions()¶
Prints a nicely formatted table of all the options that have been modified from their defaults
- printOptions()¶
Prints a nicely formatted dictionary of all the current solver options to the stdout on the root processor
- setOption(name, value)¶
Set a solver option value. The name is not case sensitive.
- Parameters:
name (str) -- Name of option to modify
value (depends on option) -- New option value to set