Ivar KJELBERG
COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)
Please login with a confirmed email address before reporting spam
Posted:
2 decades ago
16 lug 2009, 17:11 GMT-4
Hello
I had the same difficulties when starting with Comsol, I wanted to extensively parametrise my geometries. Comsol accepts quite well "constants" for 2D figures, BUT you cannot use the [units], this is not understood by the software (I have learned that COMSOL developpers are working on correcting that).
Unfortnately for most 3D geometry entities, "constants" are not accepted.
I have also heard that COMSOL developpers are evolving their geometric core software, so changes and improvements might well be just around the corner.
For complex geometry parametrised with only one, or a few, variable(s), I mostly use the link to SolidWorks for my 3D geometry.
Nevertheless, the first answer in your case is: run your simulation from Matlab (or Script if you have an older version than 3.5)
To start I can suggest to generate your model once with COMSOL GUI's and use the "history" file (or saved ".m" file for V<3.5) as baseline for writing the Matlab call to COMSOL. This is OK for simple geometries, but become difficult for more complex geometries, in which case probably there is only the "CAD" interface approach that will work.
Now, I'm a "user" so I might have this wrong, but the COMSOL people will certanly correct me in that case: "Constants" are processed only once when you start the software, when you use them to create a geometry they are translated into their numerical values at the moment of geometry generation.
Whith the GUI interface you manually create your geometry, ONCE, but this geometry is NOT "rebuild" each time you run the software, only the FEM calculation is restarted, based on the constructed geometry and the physics and boundary settings defined. I believe this is the main misunderstanding here.
When you do a "reset model", the FEM calculations and meshing is reset, but not the geometry, nor your physics settings.
Just as well as the newly arrived "parametric sweep" solving, it's typically intended for PDE parameters, or CAD (i.e. SolidWorks) interface parameters, but not COMSOL geometry.
Hope this helps you on your way, good luck
PS: I read the manuals at least 3 times, over several months, before I really believed I had got most of the knowledge, I'm not saying the the books are badly written, nor that I'm particularly dumb, it's just that they are dense, there is a lot to absorb, and I was quite biaised from the use of more traditional FEM programmes. There is really a switch of mindset you have to accept when you start to use COMSOL for true multiphysics, but you will not regret your old software.
Hello
I had the same difficulties when starting with Comsol, I wanted to extensively parametrise my geometries. Comsol accepts quite well "constants" for 2D figures, BUT you cannot use the [units], this is not understood by the software (I have learned that COMSOL developpers are working on correcting that).
Unfortnately for most 3D geometry entities, "constants" are not accepted.
I have also heard that COMSOL developpers are evolving their geometric core software, so changes and improvements might well be just around the corner.
For complex geometry parametrised with only one, or a few, variable(s), I mostly use the link to SolidWorks for my 3D geometry.
Nevertheless, the first answer in your case is: run your simulation from Matlab (or Script if you have an older version than 3.5)
To start I can suggest to generate your model once with COMSOL GUI's and use the "history" file (or saved ".m" file for V