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

Create Facets From Point Cloud, and Volumes From Facets With Cubit #177

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Edgar-21
Copy link
Contributor

@Edgar-21 Edgar-21 commented Nov 17, 2024

Still work in progress, but this is functioning. Uses the point cloud data from surface objects to create facets. These facets are then connected into a surface, and the ends are closed off, forming a volume. Working from outside in, the overlap from volumes is removed, and then adjacent volumes are imprinted and merged. Volume ids are stored in the radial build during building so existing dagmc export functions work no problem. As can be seen from the diff here, this isn't particularly complicated, and it will be nice to have options when the splines are acting up, even if there are perhaps better ways long term to make this faceted representation.

Here's the geometry using the inputs from the parastell example, built using this workflow.
image

@gonuke
Copy link
Member

gonuke commented Nov 17, 2024

This looks promising - I wonder if we can do this easier/better/faster directly wit pymoab/MOAB?

i.e. without Cubit

Comment on lines 402 to 412
# remove overlap
print("removing overlap")
layers = list(self.radial_build.radial_build.values())
for layer, next_layer in zip(
reversed(layers[0:-1]), reversed(layers[1:])
):
cubit.cmd(
"remove overlap volume "
f"{layer['vol_id']} {next_layer['vol_id']} modify larger"
)
cubit.cmd('save cub5 "overlap_removed.cub5" overwrite')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What overlap is occurring?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

each volume is made without the through hole, similar to how they are made in CADquery now. This subtracts the inner component from the outer component, working outside in.

Comment on lines 418 to 421
cubit.cmd(
f"imprint volume {layer['vol_id']} {next_layer['vol_id']}"
)
cubit.cmd(f"merge volume {layer['vol_id']} {next_layer['vol_id']}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably make this the way we imprint and merge by default in Stellarator.export_dagmc

@connoramoreno
Copy link
Collaborator

Also, in response to @gonuke's comment, it should be possible to do this in MOAB instead, since we're not really performing any CAD operations (except maybe removing overlaps)

@Edgar-21
Copy link
Contributor Author

This looks promising - I wonder if we can do this easier/better/faster directly wit pymoab/MOAB?

i.e. without Cubit

I don't know much about pymoab/MOAB, but I'm sure it would be possible. This has the benefit of using tools I already knew and existing code in parastell, plus we still can get CAD solids out of Cubit, so even in the event that we implement a MOAB workflow, it might be nice to retain this.

A MOAB workflow would be faster/more scaleable but would need a lot of additional development work.

@Edgar-21
Copy link
Contributor Author

I can also confirm that this alleviates the issues in the geometries @FusionSandwich and I were having issues in with the splines causing self-intersecting volumes.

@FusionSandwich
Copy link
Contributor

Also, in response to @gonuke's comment, it should be possible to do this in MOAB instead, since we're not really performing any CAD operations (except maybe removing overlaps)

Pymoab version is incoming. It's making meshable geometry, I just need to test the code and clean it up a bit.

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.

4 participants