Boundary Condition Types
There are two fundamental ways to specify what is happening at a boundary, and two corresponding fundamental boundary condition types:
Flux conditions specify how the surroundings affect and interact with the model at the boundary, often expressed as an applied force, flux, or current. This type of boundary condition is also called a Neumann boundary condition.
Constraints specify the result of the interaction between the model and its surroundings, expressed as prescribed values of the dependent variables. This type of boundary condition is also called a Dirichlet boundary condition.
The two types are closely related because in a well-posed model, every flux condition results in some unique values of the dependent variables, and every constraint requires a unique flux to enforce the expected values. Which type of condition to use depends on what is known about the conditions at the boundary: if the flux is known, the model computes the dependent variables for you; if the values of the dependent variables are known, the model computes the flux.
Flux Conditions
Flux boundary conditions specify the component of a vector or tensor quantity in the direction normal to the boundary, per unit area of the boundary. Typical examples of flux conditions are the specification of:
A Boundary Load in a solid model, which prescribes the stress acting on the boundary.
Heat Flux in a heat transfer model, which prescribes the heat per unit area flowing into (or out of) the model across the boundary.
A Normal Current Density in an AC/DC model, which prescribes the electrical current per unit area entering (or exiting) the model at the boundary.
There are also more advanced types of flux conditions, where the flux or force is calculated based on local values of dependent variables and other parameters. For example, a Convective Heat Flux boundary condition on a heated body computes the heat flux based on a heat transfer coefficient and the temperature difference to the surroundings.
In COMSOL Multiphysics, by convention, the force acting on the model or the flux into the model is specified. That is, specify how the surroundings affect the model and not how the model affects its surroundings. You can change the direction by reversing the sign before the numerical value of the force or flux.
Constraints
Constraint boundary conditions specify the value of one or more dependent variables at the boundary, or a relationship between two or more dependent variables. Typical examples include specifying:
A Prescribed Displacement of the boundary of a solid object.
That the velocity is zero on a Wall boundary in a CFD model.
The Temperature at the boundary of a heated solid.
The Electric Potential on an electrode in an AC/DC model.
Examples specifying a relation between dependent variables include Roller conditions on solids and Wall conditions for slip flow.
Because constraint conditions generally specify the value of a dependent variable, they also provide a reference level for that variable, which a flux condition normally does not. In many types of physics, the model equations together with only flux boundary conditions uniquely describe the local behavior of the dependent variable, but leave the global level undefined. From a physical point of view, the absolute value of the dependent variables are often of less interest, but the existence of a single, unique, solution is essential for some solvers.
Therefore it is often necessary to apply at least one constraint condition in a model, to provide a global reference value for the dependent variables. For example, it is common to designate one of the electrodes in an AC/DC model as Ground, which constrains the electric potential there to zero and gives a reference with which to compare other parts of the model.
In most physics features, the default boundary condition is of a flux type and does not fix a reference level for the dependent variable. Therefore, when solving certain study types (notably stationary studies), you must manually add at least one boundary condition of constraint type (or a point constraint) for the model to be well-defined.
Switching Off a Constraint
If you want to model a constraint that is active only for a certain period of time in a time-dependent simulation, for example, you can use the fact that a 0 constraint (or a Dirichlet boundary condition u = u) means that there is no constraint; instead, the boundary condition becomes a “no flux” or “insulation” condition. To implement such a time-limited constraint, you can use the if operator: for example, for a Dirichlet boundary condition, if(t<2,1,u) means that for t < 2, u is equal to 1 but at t = 2 the boundary condition is turned off by setting u = u. For a Constraint node, the corresponding if statement is if(t<2,1-u,0).