Manually Setting the Scaling of Variables

Solution Number: 1240
Title: Manually Setting the Scaling of Variables
Platform:
Versions: All versions
Categories: Solver
Keywords:

Problem Description

The default behavior of the software is to assume a different scaling for each set of variables in your model. These scale factors are by default automatically determined, but sometimes may need to be manually tuned.

Solution

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 the Electric Currents, Heat Transfer, and Solid Mechanics physics. The default initial value for Heat Transfer physics interface is 293.15K, and the software will automatically use this as the scale. The default initial values for Electric Currents and Solid Mechanics are that the electric potential and displacement fields are zero. When the initial values are zero the software will automatically use information from the physics interfaces to estimate a scaling. In the case of Solid Mechanics, 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 the Log window, as in the screenshot below.
Default Scaling in the Solver Log

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. For example, you may know that the actual electric potential may get up to 10kV, the temperatures up to 500K, and but the displacements are expected to be quite small, on the order of 0.01mm.

To manually set scales, first generate the default solver sequence, if it does not already exist. Right-click on Study and select Show Default Solver, this will populate the the Study > Solver Configurations with the default solver settings. Go to the Dependent Variables node and expand it, you will see separate nodes for each field being solved for within the model. Select each node and, in the Settings for that node, switch the Scaling Method to Manual and enter the expected peak magnitude of that field over the whole simulation timespan, as shown in the screenshot below.

If you use manual scaling for one variable that is being solved for, you should usually use it for all variables.

Manual Scaling

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

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, re-compute the results with new scales and compare results.


Disclaimer

COMSOL makes every reasonable effort to verify the information you view on this page. Resources and documents are provided for your information only, and COMSOL makes no explicit or implied claims to their validity. COMSOL does not assume any legal liability for the accuracy of the data disclosed. Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark details.