smdogroup / tacs

Finite-element library for analysis and adjoint-based gradient evaluation
Apache License 2.0
108 stars 75 forks source link

Mphys helper functions #323

Closed A-CGray closed 3 months ago

A-CGray commented 3 months ago

Adds a helper function to the TACS MPhys wrapper for adding constraints. add_tacs_constraints takes in an OpenMDAO model and an MPhys scenario and automatically adds any TACS constraints it finds in the scenario as constraints in the model. Saves the user having to manually call add_constraint for all of their TACS constraints.

I put it in a utils file for now, happy to take suggestions on a better place for it.

timryanb commented 3 months ago

@A-CGray, the log function call looks helpful, but it seems more like a general OpenMDAO feature than specific to TACS. Could we reach out to OpenMDAO/OpenMDAO and see if they'd be willing to adopt this feature (or such a feature already exist)?

A-CGray commented 3 months ago

Sure, I'll remove it from this PR and bring it up with the OpenMDAO team

A-CGray commented 3 months ago

Don't merge this yet, I will add a test

A-CGray commented 3 months ago

@timryanb looks there is an OpenMDAO bug that results in an indexing error if you only have linear constraints, I'll open an issue on the OpenMDAO repo