pyCAPS
pyCAPS: A Python Extension Module for CAPS
Loading...
Searching...
No Matches
Analysis Class Reference

Defines a CAPS Analysis Object. More...

Inherits object.

Inherited by capsAnalysis.

Public Member Functions

 preAnalysis (self)
 Run the pre-analysis function for the AIM.
 
 runAnalysis (self)
 Run the pre/exec/post functions for the AIM (if AIM execution is available).
 
 system (self, cmd, rpath=None)
 Execute the Command Line String Notes:
 
 postAnalysis (self)
 Run post-analysis function for the AIM.
 
 analysisDir (self)
 Property returns the path to the analysis directory.
 
 name (self)
 Property returns the name of the CAPS Analysis Object.
 
 history (self)
 Returns the history list of the CAPS Analysis Object.
 
 markForDelete (self)
 Mark a CAPS Analysis Object for deletion on the next Phase.
 
 dirty (self)
 Returns linked analyses that are dirty.
 
 info (self, printInfo=False, **kwargs)
 Gets analysis information for the analysis object.
 
 createTree (self, filename="name", **kwargs)
 Create a HTML dendrogram/tree of the current state of the analysis.
 
 createOpenMDAOComponent (self, inputVariable, outputVariable, **kwargs)
 Create an OpenMDAO Component[1.7.3]/ExplicitComponent[2.8+] object; an external code component (ExternalCode[1.7.2]/ExternalCodeComp[2.8+]) is created if the executeCommand keyword arguement is provided.
 

Detailed Description

Defines a CAPS Analysis Object.

Created via Problem.analysis.create().

Parameters
Analysis.geometryAnalysisGeometry instances representing the bodies associated with the analysis
Analysis.inputValueInSequence of ValueIn inputs
Analysis.outputValueOutSequence of ValueOut outputs
Analysis.attrAttrSequence of ValueIn attributes

Member Function Documentation

◆ createOpenMDAOComponent()

createOpenMDAOComponent (   self,
  inputVariable,
  outputVariable,
**  kwargs 
)

Create an OpenMDAO Component[1.7.3]/ExplicitComponent[2.8+] object; an external code component (ExternalCode[1.7.2]/ExternalCodeComp[2.8+]) is created if the executeCommand keyword arguement is provided.

This functionality should work with either verison 1.7.3 or >=2.8 of OpenMDAO.

Parameters
inputVariableInput variable(s)/parameter(s) to add to the OpenMDAO component. Variables may be either analysis input variables or geometry design parameters. Note, that the setting of analysis inputs supersedes the setting of geometry design parameters; issues may arise if analysis input and geometry design variables have the same name. If the analysis parameter wanting to be added to the OpenMDAO component is part of a capsTuple the following notation should be used: "AnalysisInput:TupleKey:DictionaryKey", for example "AVL_Control:ControlSurfaceA:deflectionAngle" would correspond to the AVL_Control input variable, the ControlSurfaceA element of the input values (that is the name of the control surface being created) and finally deflectionAngle corresponds to the name of the dictionary entry that is to be used as the component parameter. If the tuple's value isn't a dictionary just "AnalysisInput:TupleKey" is needed.
outputVariableOutput variable(s)/parameter(s) to add to the OpenMDAO component. Only scalar output variables are currently supported
**kwargsSee below.

Valid keywords:

Parameters
changeDirAutomatically switch into the analysis directory set for the AIM when executing an external code (default - True).
saveIterationIf the generated OpenMDAO component is going to be called multiple times, the inputs and outputs from the analysis and the AIM will be automatically bookkept ( = True) by moving the files to a folder within the AIM's analysis directory ( analysisDir ) named "Iteration_#" were # represents the iteration number (default - False). By default ( = False) input and output files will be continously overwritten. Notes:
  • If the AIM has 'parents' their genertated files will not be bookkept.
  • If previous iteration folders already exist, the iteration folders and any other files in the directory will be moved to a folder named "Instance_#".
  • This bookkeeping method will likely fail if the iterations are run concurrently!
executeCommandCommand to be executed when running an external code. Command must be a list of command line arguements (see OpenMDAO documentation). If provided an ExternalCode[1.7.2]/ExternalCodeComp[2.8+] object is created; if not provided or set to None a Component[1.7.3]/ExplicitComponent[2.8+] object is created (default - None).
inputFileOptional list of input file names for OpenMDAO to check the existence of before OpenMDAO excutes the "solve_nonlinear"[1.7.3]/"compute"[2.8+] (default - None). This is redundant as the AIM automatically does this already.
outputFileOptional list of output names for OpenMDAO to check the existence of before OpenMDAO excutes the "solve_nonlinear"[1.7.3]/"compute"[2.8+] (default - None). This is redundant as the AIM automatically does this already.
stdinSet I/O connection for the standard input of an ExternalCode[1.7.2]/ExternalCodeComp[2.8+] component. The use of this depends on the expected AIM execution.
stdoutSet I/O connection for the standard ouput of an ExternalCode[1.7.2]/ExternalCodeComp[2.8+] component. The use of this depends on the expected AIM execution.
setSensitivityOptional dictionary containing sensitivity/derivative settings/parameters. Currently only Finite difference is is supported!. See OpenMDAO documentation for addtional details of "deriv_options"(version 1.7) or "declare_partials"(version 2.8). Common values for a finite difference calculation would be setSensitivity['type'] = "fd" (Note in the version 2.8 documentation this varibale has been changed to "method" both variations will work when using version 2.8+), setSensitivity['form'] = "forward" or "backward" or "central", and setSensitivity['step_size'] = 1.0E-6 (Note in the version 2.8 documentation this varibale has been changed to "step" both variations will work when using version 2.8+).
Returns
Returns the reference to the OpenMDAO component object created.

◆ createTree()

createTree (   self,
  filename = "name",
**  kwargs 
)

Create a HTML dendrogram/tree of the current state of the analysis.

The HTML file relies on the open-source JavaScript library, D3, to visualize the data. This library is freely available from https://d3js.org/ and is dynamically loaded within the HTML file. If running on a machine without internet access a (miniaturized) copy of the library may be written to a file alongside the generated HTML file by setting the internetAccess keyword to False. If set to True, internet access will be necessary to view the tree.

Parameters
filenameFilename to use when saving the tree (default - "aimName"). Note an ".html" is automatically appended to the name (same with ".json" if embedJSON = False).
**kwargsSee below.

Valid keywords:

Parameters
embedJSONEmbed the JSON tree data in the HTML file itself (default - True). If set to False a seperate file is generated for the JSON tree data.
internetAccessIs internet access available (default - True)? If set to True internet access will be necessary to view the tree.
analysisGeomShow the geometry currently load into the analysis in the tree (default - False).
internalGeomAttrShow the internal attributes (denoted by starting with an underscore, for example "_AttrName") that exist on the geometry (default - False). Note: "analysisGeom" must also be set to True.
reverseMapReverse the attribute map (default - False). See attrMap for details.

◆ dirty()

dirty (   self)

Returns linked analyses that are dirty.

Returns
A list of dirty analyses that need to be exeuted before executing this analysis. An empty list is returned if no linked analyses are dirty.

◆ info()

info (   self,
  printInfo = False,
**  kwargs 
)

Gets analysis information for the analysis object.

Parameters
printInfoPrint information to sceen (default - False).
**kwargsSee below.
Returns
Cleanliness state of analysis object or a dictionary containing analysis information (infoDict must be set to True). For cleanliness state: 0 = "Up to date", 1 = "Dirty analysis inputs", 2 = "Dirty geometry inputs", 3 = "Both analysis and geometry inputs are dirty", 4 = "New geometry", 5 = "Post analysis required", 6 = "Execution and Post analysis required"

Valid keywords:

Parameters
infoDictReturn a dictionary containing analysis information instead of just the cleanliness state (default - False).

◆ system()

system (   self,
  cmd,
  rpath = None 
)

Execute the Command Line String Notes:

  1. only needed when explicitly executing the appropriate analysis solver (i.e., not using the AIM)
  2. should be invoked after caps_preAnalysis and before caps_postAnalysis
  3. this must be used instead of the OS system call to ensure that journaling properly functions
Parameters
cmdthe command line string to execute
rpaththe relative path from the Analysis' directory or None (in the Analysis path)

The documentation for this class was generated from the following file: