Adding ODEs, DAEs, and Other Global Equations
When working on complex models, single named degrees of freedom may be needed to track and update information that is not logically related to any particular point in space. The evolution of these degrees of freedom is generally governed by equations that are independent of space but often time dependent. In particular, such situations arise when modeling physics in interaction with an external system — for example, a controller or an electrical circuit built from standard components. It is often possible to describe such external systems by a system of ordinary differential equations (ODEs) with a limited number of degrees of freedom. It is also possible to create a model in COMSOL Multiphysics that only solves a set of ODEs or DAEs.
See also State Variables for information about how to define states that are updated using an update expression at the beginning or end of each completed solver step. The state variables are dependent variables in the model and stored as such in solutions.
The Global ODEs and DAEs Interface has a Global Equations node that is designed for implementing this type of external equation. Such equations are often tightly coupled to a model in a physical domain. The Global Equations node is also available for any of the physics interfaces.
To access the node, right-click the main interface in the Model Builder and select Global Equations.
Use the Global Equations node for ODEs, differential algebraic equations, purely algebraic equations and conditions, and transcendental equations, or to add degrees of freedom to a model. Possible uses include:
An example of the use of an extra degree of freedom defined using an ODE is to add a variable that indicates when a condition changes, such as temperature reaching a certain value, where it affects the material properties so that they need to change in the model. You can then add an ODE like
where the indicator variable q is zero as an initial value and remains at zero until T exceeds Tmelt; it then takes on a nonzero positive value. You can then use q to switch from one set of material properties to another set that is valid when it exceeds Tmelt.
Presenting Results for Global Equations
The dependent variables in global equations are scalar values and are available globally. To view the results for an ODE, use the Line Graph, Point Graph, and Global plot types, and Global Evaluation for displaying the numerical solution.