My flux calculation seems wrong

Solution Number: 973
Title: My flux calculation seems wrong
Platform: All Platforms
Applies to: All Products
Versions: All versions
Categories: Physics, Physics
Keywords:

Problem Description

I am solving a diffusion-like problem in COMSOL Multiphysics and discovered that boundaries that are defined with insulation/symmetry conditions have an integrated value of the normal component of the flux that is far from being zero. I also notice that the flux values, on the boundaries where I imposed a flux, seems to be different from the values I imposed. Why is there such a difference?

Solution

You have probably looked at the flux variables based on the evaluation of a spatial gradient. The evaluation of a spatial gradient is done using discrete values and its accuracy is mesh dependent. The difference between what you set as flux boundary condition and what you see after solving arises from the postprocessing to evaluate the spatial gradient. In other words, accurate values of the imposed flux are used to compute the solution, and you get postprocessing errors because the flux value is based on a spatial gradient evaluation. This last calculation is mesh sensitive. By refining the mesh you would get better match, but in some cases the incertitude is still strong. For most of the physics you should instead look at the predefined accurate boundary flux variables. Note that these variables are available only in the postprocessing tools and you can't access or use them in the model during the computation.

To use accurate boundary flux variables, make sure that the check box Compute boundary fluxes is selected in the Discretization section of the physics' head node. Then COMSOL computes and stores, along with the calculation, predefined accurate boundary flux variables which will be available in the postprocessing tools. Check the physics interface documentation to learn which variables to use. Please note that the Apply smoothing on boundary fluxes option (also normally selected by default) can provide a more well-behaved flux value close to singularities. Note: To display this option, you first need to click the Show button at the top of the Model Builder and select Discretization.

In case of you want to integrate the total flux, defined by an expression on a boundary, it is recommend to integrate the same expression as has been specified in the flux condition. In a heat transfer convective boundary condition that could for example be h*(To-T), where h is your heat transfer coefficient.

To get accurate fluxes by an alternative method or to use this flux in the model during the computation, use weak boundary constraints. However, this can only be applied where the dependent variable (T or V for example) is set to a fixed value (Dirichlet boundary condition). It will give you access to additional variables on the boundaries that let you integrate the flux very accurately. To use weak constraints, click the boundary condition of interest and select the Use weak constraints check box under Constraint Settings. Again only on the boundaries where you have set the dependent variable (T or V for example) to a fixed value. Note: To see the weak constraint option and other advanced settings, you first need to click the Show button at the top of the Model Builder and select Advanced Physics Options. This method also applies for force evaluations in mechanics. For more reading, see the section Weak Constraints in the COMSOL Multiphysics Reference Manual.

See also

For more information, either search the Help (press F1 in COMSOL Multiphysics) for Computing Accurate Fluxes, or open the electronic Documentation (press Ctrl F1 in COMSOL Multiphysics) and then go to the COMSOL Multiphysics Reference Manual> Building a COMSOL Model > Computing Accurate Fluxes section.

Information is also available with the Heat Transfer Module User's Guide in the section Heat Transfer Theory > Theory for the Heat Transfer Interfaces > A Note on Heat Flux and Balance.


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.