学习中心

Manually Setting the Scaling of Variables


The default behavior of the COMSOL®software is to assume a different scaling for each set of variables in your model. These scale factors are automatically determined by default, but sometimes need to be manually tuned. In this article, we discuss the importance of scaling for a model and how to manually set the scaling of dependent variables.

A screenshot of the Settings window for the Dependent Variables node, with the General, Initial Values of Variables Solved For, Scaling, and Residual Scaling sections expanded.

TheDependent Variablesnode'sSettingswindow.

Significance of Scaling of Variables

Scaling is often necessary for numerical purposes. When solving for several different fields, some fields may have an average magnitude quite different from the others, and solving for both at once may lead to numerical issues. Scaling is used to avoid this.

As an example, consider a transient problem involving electric currents, heat transfer, and solid mechanics physics. The default initial value for theHeat Transfer in Solidsphysics interface is 293.15 K, and the software will automatically use this as the scale. The default initial values for theElectric CurrentsandSolid Mechanicsphysics interfaces set the electric potential and displacement fields to zero, respectively.

A screenshot of the Initial Values node Settings window when modeling electrical physics in COMSOL Multiphysics. A screenshot of the Initial Values node Settings window when modeling electrical physics in COMSOL Multiphysics.
The Settings window for the Initial Values node, with the Domain Selection and Initial Values sections expanded and set for a structural modeling problem. The Settings window for the Initial Values node, with the Domain Selection and Initial Values sections expanded and set for a structural modeling problem.
The Settings window for the Initial Values node, with the Domain Selection and Initial Values sections expanded and set for a structural modeling problem. The Settings window for the Initial Values node, with the Domain Selection and Initial Values sections expanded and set for a structural modeling problem.

Default settings for theInitial Valuesnode for the electrical (left), thermal (center), and structural (right) physics.

When the initial values are zero, the software will automatically use information from the physics interfaces to estimate a scaling. In the case of theSolid Mechanicsinterface, for example, a scaling of 0.01 times the bounding box size of the geometry is used. Other physics interfaces will have different defaults. The scaling is shown at the beginning of theLogwindow, as in the screenshot below.

A screenshot of the solver log window in COMSOL Multiphysics with the default scales highlighted with red boxes.

Solver log window showing the default scales that are automatically determined by the software.

Sometimes, these automatically determined scale factors are not reasonable, and you will need to manually set them.

Manually Setting the Scaling

For example, you may know that the actual electric potential can get up to 10 kV and the temperatures up to 500 K, but the displacements are expected to be quite small, on the order of 0.01 mm.

To manually set scales, first generate the default solver sequence, if it does not already exist. Right-click theStudynode and selectShow Default Solver. This will populate theStudy>Solver Configurationsnode with the default solver settings. Go to theDependent Variablesnode and expand it. You will see separate nodes for each field being solved for within the model.

Select each node and, in theSettingswindow for that node, switch theScaling MethodtoManualand enter the expected peak magnitude of that field over the whole simulation timespan, as shown in the screenshot below.

A screenshot of the settings for the electric potential in a model with the Scaling section open and the Scale manually set to 10000.

Manual scaling of the electric potential, assuming a peak voltage of 10 kV during the simulation.

A screenshot of the settings for the temperature in a model, with the Scaling section open and the Scale manually set to 500.

Manual scaling of the temperature, assuming a peak temperature of 500 K during the simulation.

A screenshot of the settings for the displacement field in a model, with the Scaling section opened and the Scale manually set to 1e-5.

Manual scaling of the displacement, assuming it to be quite small, on the order of 0.01 mm.

After completing the simulation, check the actual computed peak absolute values of all of the fields and compare them to these scale factors. If they differ by significantly more than an order of magnitude, recompute the results with new scales and compare results.

For more information on the scaling of variables, you can check out theScaling of Variables and EquationsandDependent Variablessections in theCOMSOL Multiphysics Reference Manual.


请提交与此页面相关的反馈,或点击此处联系技术支持

Baidu
map