-
Notifications
You must be signed in to change notification settings - Fork 35
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
Tags for multi body #158
Tags for multi body #158
Conversation
Returns | ||
------- | ||
grid_ids : list | ||
list of grid IDs that correspond to given body/boundary tags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Asthelen, could we add a note to the docstring describing what returning None
by default implies?
Does this mean that all nodes will be used or none of them?
If its the latter does this represent a breaking change for older builders?
Are there any examples using this feature? I thought I remembered seeing one in the slides @Asthelen presented a couple of weeks ago |
Where is this method called? In the meld builder or the scenario level? |
I currently have my meld builder calling this function (as well as a geometry builder or two, and the "controls" builder I've been trying out). If None is returned, then the builder assumes it hasn't been implemented and will just use all nodes. So, perhaps the note would say "Returning None indicates that this function hasn't been implemented in the builder" or something along those lines? As for an example: the one I have set up uses VLM and pyShell, which of course aren't open source so I don't have it on my MPhys fork. I'm happy to share it though. |
Following Andrew's comment, we can have it be backwards compatible. None = not implemented. Return a zero length list if implemented but the builder doesn't have any nodes on this rank. |
@kejacobson, that makes sense to me. As long as we make it clear in the docstrings |
@Asthelen, if you're comfortable sharing it. Could we add that example to this PR? It'll make understanding how to use the feature easier (even if we can't run it). Could you also make a PR with your changes to smdogroup/funtofem on the meld side? |
In fact, maybe we can avoid ambiguity all together and implement the base method as below:
|
That's something I considered (and may have tried briefly). Would have required a new numpy import, and anything that uses this function wouldn't be aware that it hasn't been implemented, but maybe none of that is an issue. |
Regarding the FUNtoFEM PR: I'll plan on doing that soon. I think it needs tweaked since the version I started with didn't have the linearized option (which should just be a few lines). And if this get_tagged_indices function is changed in the above way then the MELD builder could be simplified a bit. As for the example: I think I should be able to add that to the PR. |
I agree with your concern that this masks if the method hasn't been implemented. It may not be the users intent to use all of the nodes. Can we make this method return a To preserve backwards compatibility, we could have the |
I think that would be problematic if get_tagged_indices has only been implemented in one of the aero/struct builders. For instance, currently, if I was to couple a VLM wing (body ID 0) to TACS and wanted the tail (body ID 1) to remain rigid, I think these body tags would work:
There, the TACS builder's get_tagged_indices would return None (or a list of all grid IDs), but it'd error out if the default returned NotImplementedError. |
An error here still makes sense to me. You're still passing a tag to TACS, even if its a "NULL" tag. So the user should get an error. I also don't like the use of |
I guess that's fair. It would be easy to make your builder just return a list of all nodes, if you wanted to, until you had that implemented. And yeah that None in the body tags list wouldn't be used anywhere, so I could've made that anything. In the MELD builder, there are aero_gid and struct_gid variables that are None when not using body tags... which I think is a little different and maybe fine. I can point them out once I have the builder pushed to my fork. |
Here's a link to that current MELD builder, if you want to take a look: https://github.com/Asthelen/funtofem/blob/mphys_multibody/funtofem/mphys/mphys_meld.py In my previous comment, I was referring to how the MeldBodyInstance class is used. When a list of bodies isn't given, I just have it using the numbers of nodes from the two builders, and aero_gid and struct_gid end up being None https://github.com/Asthelen/funtofem/blob/5ff3d3649eaa82b6e6e506c3b7b755cbcae83eb7/funtofem/mphys/mphys_meld.py#L462 |
I don't have problem with the use |
@timryanb The multi-body example has been added to the PR. As for the get_tagged_indices: @kejacobson mentioned he's more in favor of it returning None. Do you suppose it's worth having the MELD builder just print a warning if a builder's get_tagged_indices returns None, so that it's more of a "soft" error while still keeping the user informed? I put in a PR for the MELD builder, but could plan on adding that there. |
I'm not sure what the benefit of returning |
@Asthelen @kejacobson I can let it go if you guys feel that this is needed. Just trying to understand the intent here |
I'm not strongly opinionated on it, so I'm fine with making try-except blocks with raising exceptions too. There are two other functions, the getters for the number of nodes and degrees of freedom that could also raise exceptions instead of |
I guess that depends on whether we want to require all builders to have a mesh associated with them. |
|
Added get_tagged_indices to builder.py for cases with multiple coupled bodies. Addresses issue #116