Flux Calculation Example — Heat Transfer Model
Consider a heat transfer model where a heat flux of 1 W/m2 flows in through one boundary of a square 2D region. All other boundaries are kept at a fixed temperature of 293.15 K. The material is copper. This example verifies that the flux is conserved exactly using a Lagrange multiplier for computing the total flux over the boundaries with a fixed temperature.
Model Wizard
1
2
On the Select Space Dimension page, click the 2D button .
3
In the list of physics interfaces, under Heat Transfer click Heat Transfer in Solids . Click Add.
4
Click the Study button . On the Select Study page under Preset Studies, click Stationary .
5
Click Done.
Geometry
In the Geometry toolbar, from the Rectangle menu, click to add a Square (1-by-1 m).
Materials
1
In the Material toolbar, click Browse Materials .
2
Under Built-in, click Copper then click Add to Component.
3
Click Done .
Heat Transfer
The Heat Transfer in Solids node defines the material properties to be those from the material (copper) and does not need to be changed, but the default boundary condition is thermal insulation. Instead, add a heat flux to the bottom boundary and a fixed temperature on the other three boundaries.
1
In the Model Builder, click the Heat Transfer in Solids node .
2
In the Physics toolbar, from the Boundaries menu click Heat Flux .
3
In the Graphics window, click boundary 2 (the bottom boundary) to add it to the selection.
4
In the Settings window for Heat Flux, enter 1 (1 W/m2) in the General inward heat flux field for q0.
5
Right-click Heat Transfer in Solids node and select Temperature .
6
In the Graphics window, select the other three boundaries (1, 3, and 4) and add them to the selection for the temperature condition.
7
To display the weak constraint option to add the Lagrange multipliers, click the Show More Options button () and select Advanced Physics Options in the Show More Options dialog box. In the Model Builder click the Temperature node. In the Settings window, keep the default value for the temperature, 293.15 K. Click to expand the Constraint Settings section and select the Use weak constraints check box. This adds a Lagrange multiplier for the heat flux as an extra variable to compute.
Computing the Solution
In the Home toolbar, click Compute . The resulting plot shows the temperature distribution in the domain.
Results — Flux Expression AND Lagrange Multiplier
1
Under Results>Derived Values>Integration, click Line Integration .
2
3
Click the Replace Expression button () and select Heat Transfer in Solids>Boundary fluxes>Normal total heat flux (the variable ht.ntflux).
4
Click the Evaluate button ().
The total normal heat flux across these boundaries appears in the Table under Normal total heat flux (W/m) and is exactly equal to the influx of 1 W/m (the normal flux is by convention positive in the direction of the normal).
If you were to clear the Compute boundary fluxes check box in the Discretization section (click the Show More Options button  and select Advanced Physics Options in the Show More Options dialog box first) for the Heat Transfer in Solids node, and then re-solve the model, the same flux variable is not as accurate and has a value of about 0.986 W/m. That value approaches 1 if you refine the mesh.
5
Click the Replace Expression button () and select Heat Transfer>Lagrange multiplier for temperature (the variable T_lm).
6
Click the Evaluate button ().
The total heat flux across these boundaries appears in the Table under Lagrange multiplier for temperature and is 1, exactly equal to the influx (but with opposite sign) without the need for a computationally expensive extremely fine mesh. This method is useful for physics where built-in accurate flux variables are not available.