Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(in progress) playing around with materials library #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

whoburg
Copy link
Collaborator

@whoburg whoburg commented Nov 19, 2015

@bqpd, this isn't working quite yet, but could you take a quick look at what I'm trying to do? I thought it might be really clean to implement a material property look-up table as a model, but turns out this is awkward because it requires adding constraints when all I really want is the variable values (for now at least).

@whoburg
Copy link
Collaborator Author

whoburg commented Nov 19, 2015

More commits welcome if you want to run with this...

@bqpd
Copy link
Contributor

bqpd commented Nov 19, 2015

Two options:

  • instead of values, use substitutions
  • we can add a special flag that supersedes other values when merging
    • right now, if two merged variables have different values the merged variable has no value

@whoburg
Copy link
Collaborator Author

whoburg commented Nov 22, 2015

Using substitutions sounds great. If I create a ColumnBuckling and an Aluminum6061:

from materials import Aluminum6061
from structures import ColumnBuckling
alum = Aluminum6061()
colb = ColumnBuckling()

... then how do I substitute alum.constants into colb? I tried passing substitutions=alum.constants into ColumnBuckling.__init__, but I got a TypeError: setup() takes exactly 1 argument (2 given).

@bqpd
Copy link
Contributor

bqpd commented Nov 22, 2015

That sounds like a GPkit which hasn't been updated to use the substitutions arg...

@whoburg
Copy link
Collaborator Author

whoburg commented Nov 22, 2015

Ah -- you're correct. Fixed that. It looks like the substitution doesn't happen quite as intended though -- is the E_ColumnBucklingAluminum6061 expected?

In [1]: from materials import Aluminum6061

In [2]: from structures import ColumnBuckling

In [3]: alum = Aluminum6061()

In [4]: colb = ColumnBuckling(substitutions=alum.constants)

In [5]: colb
Out[5]:
gpkit.ColumnBuckling(# minimize
    F_ColumnBuckling**-1 [1/lbf],
[   # subject to
    9.87*E_ColumnBuckling*I_ColumnBuckling*K_ColumnBuckling**-2*L_ColumnBuckling**-2 [GPa*m**2] >= F_ColumnBuckling [lbf],
],
    substitutions={E_ColumnBucklingAluminum6061: 69, rho_ColumnBucklingAluminum6061: 2.7, sigma_{y}_ColumnBucklingAluminum6061: 55, I_ColumnBuckling: 1e-09, K_ColumnBuckling: 2.0, L_ColumnBuckling: 1})

In [6]: colb.solve()
E_ColumnBuckling has no upper bound
Using solver 'cvxopt'
Solving for 2 variables.

@whoburg
Copy link
Collaborator Author

whoburg commented Nov 22, 2015

(it's perfectly possible I'm using substitutions wrong -- let me know if there's a better way to get the desired behavior).

@bqpd
Copy link
Contributor

bqpd commented Nov 22, 2015

Ack, no, this is expected. And right now merging doesn't cover substitutions, otherwise I'd just recommend you merge them...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants