Please login with a confirmed email address before reporting spam
Posted:
9 months ago
May 23, 2024, 9:52 a.m. EDT
Updated:
9 months ago
May 23, 2024, 9:53 a.m. EDT
You can use programmatic "if" statements in the geometry tree to enumerate a parameter and determine if a geometric entity gets created.
So, for simplicaity, you could have a cylinder and a cube as possible geometric entities to model.
In your parameters, you can have a parameter called "cylinder" and a parameter called "cube".
Your "if" settings window would have a statement like cylinder==1, to determine (parametrically) if your cylider is created or not. See attached simple example.
You can extend this to an Application by having the user select which geometric entities they wish to include.
You can use programmatic "if" statements in the geometry tree to enumerate a parameter and determine if a geometric entity gets created.
So, for simplicaity, you could have a cylinder and a cube as possible geometric entities to model.
In your parameters, you can have a parameter called "cylinder" and a parameter called "cube".
Your "if" settings window would have a statement like cylinder==1, to determine (parametrically) if your cylider is created or not. See attached simple example.
You can extend this to an Application by having the user select which geometric entities they wish to include.
Jeff Hiller
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
9 months ago
May 24, 2024, 4:39 p.m. EDT
Updated:
9 months ago
May 24, 2024, 5:39 p.m. EDT
Hello David,
You could use if statements, like Mark mentioned above. An example can be found here.
Another approach is to use the concept of selections, along the lines of what is done in this blog post.
If it was me, I would probably take the easy way out and go a third route:
With only 3 components, there are "only" 8 possible cases (empty set, A, B, C, A+B, B+C, A+C, A+B+C) to deal with. I would create 8 separate Components, each dealing with one of those cases. I'll grant you that it's not an elegant solution, but it's going to be easy to set up, debug and maintain over time. Otherwise, depending on the specifics of your problem, you are going to have to deal with changing numbers of boundaries, changing numbers of domains/overlaps between objects, even possibly changing physics, etc based on which case you're in, and that may get messy.
Best,
Jeff
-------------------
Jeff Hiller
Hello David,
You could use if statements, like Mark mentioned above. An example can be found [here](https://www.comsol.com/blogs/why-do-tennis-rackets-tumble-the-dzhanibekov-effect-explained).
Another approach is to use the concept of selections, along the lines of what is done in [this blog post](https://www.comsol.com/blogs/how-to-create-an-app-with-cad-import-and-selections).
If it was me, I would probably take the easy way out and go a third route:
With only 3 components, there are "only" 8 possible cases (empty set, A, B, C, A+B, B+C, A+C, A+B+C) to deal with. I would create 8 separate Components, each dealing with one of those cases. I'll grant you that it's not an elegant solution, but it's going to be easy to set up, debug and maintain over time. Otherwise, depending on the specifics of your problem, you are going to have to deal with changing numbers of boundaries, changing numbers of domains/overlaps between objects, even possibly changing physics, etc based on which case you're in, and that may get messy.
Best,
Jeff