Updating Model Settings
The COMSOL model object allows you to modify parameters, features, or feature properties, using the set method. Once a property value is updated, you can run the appropriate sequence, depending on where the changes were introduced into the model — for example, in the geometry or the mesh sequence. Running the solver sequence automatically runs all sequences where modified settings are detected.
Starting with the busbar model described in A Thorough Example: The Busbar, this section modifies a parameter value and re-solves the model. For this purpose, the geometry of the model is prepared using parameters such as L for the length of the busbar, and tbb for the thickness of the busbar.
1
2
mphopen busbar
3
mphplot(model,'pg4');
4
Change the parameter L (length of the busbar):
mphsetparam(model,'L','18[cm]');
5
mphrun(model,'study');
Note: The solver node automatically detects all modifications in the model, and runs the geometry or mesh sequences when needed. The new value for the parameter L induces a change in the geometry, requiring a new mesh. Full associativity is also ensured, making sure that all physics settings remain applied as in the original model.
6
mphplot(model,'pg4');
Code for Use with MATLAB®
mphopen busbar
mphplot(model,'pg4');
mphsetparam(model,'L','18[cm]');
mphrun(model,'study');
mphplot(model,'pg4');