Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Efficient Selection of Multiple surfaces as boundaries
Posted 2025年12月3日 GMT+8 06:17 Geometry, Modeling Tools & Definitions, Modeling Workflow Version 6.4 1 Reply
Please login with a confirmed email address before reporting spam
Hello everyone,
I’m modeling a system in COMSOL where two rectangular boundary regions must be dynamically moved across a surface, as guided by an optimization algorithm. My current method updates rectangle coordinates on a workplane for each optimization step, but this requires running form union and remeshing every time boundaries change, which is very computationally expensive.
As an alternative, I’m considering pre-generating hundreds of small rectangles on the surface as potential boundary areas. For each optimization iteration, I would simply select subsets of these rectangles to define "terminal" and "ground" regions for electric current physics, without touching the geometry or mesh modules.
To clarify:
Geometry and mesh remain unchanged; only boundary conditions are reassigned among rectangles. I need an efficient way to programmatically select which rectangles to use at each step, ideally automated via MATLAB LiveLink. Currently, I reference rectangles by their surface numbers, which works for a simple test case, but managing hundreds will quickly become unwieldy. I’d like to avoid manually tracking indices.
My main questions:
Is this approach feasible for avoiding repeated form union and remeshing while constantly changing boundary conditions? Is there a robust way in COMSOL to tag or systematically reference large numbers of geometric entities for flexible boundary condition management, especially with MATLAB automation?
I've attached a sample model showcasing this approach, with hundreds of small rectangles and the previous large-rectangle method for reference. For this model, my optimization algorithm will guide me to shit my terminal and based on that I want to select another set of rectangles.
Thank you in advance for any insights!
Attachments:
