Computing Total Normal Flux on a Planar Surface
Supratik Datta | June 9, 2014
Today, we will find out how to compute the total normal flux through a cross-section plane, passing through your simulation geometry. This can help us bridge the gap between simulations and experiments where, in the latter, it is often easier to physically measure the total flux. The approach discussed here works for any type of physics problem as long as we can identify the appropriate flux term corresponding to that physics.
What is Flux?
Flux refers to the area density of any quantity that flows through a well-defined boundary of a domain. The domain could be a volume (in 3D), surface (in 2D), or edge (in 1D). Correspondingly, the boundary through which we compute the flux would be surface (in 3D), edge (in 2D), and point (in 1D), respectively. The total flux through the cross section is then the sum total of flux coming out of that boundary. Although this idea has its origin in the field of transport processes, the concept of flux and total flux can be related to many physics. This is because most physics are mathematically formulated based on some form of conservation equation. The following table provides a summary of flux-type physical quantities from different physics areas.
Physics | Flux | Total Flux | ||
---|---|---|---|---|
Electrostatics | Electric displacement or Surface charge density (Unit: C/m^{2}) | Surface charge (Unit: C) | ||
Electric Currents | Current density (Unit: A/m^{2}) | Current (Unit: A) | ||
Magnetic Fields | Magnetic flux density (Unit: T) | Magnetic flux (Unit: Wb) | ||
Mass Transport | Rate of Material flux (Unit: mol/m^{2}s) | Material flow rate (Unit: mol/s) | ||
Fluid Dynamics | Mass flux or Mass flow rate per unit area (Unit: kg/m^{2}s) | Mass flow rate (Unit: kg/s) | ||
Heat Transfer | Heat flux or Power per unit area (Unit: W/m^{2}) | Power (Unit: W) | ||
Structural Mechanics | Stress (Unit: Pa) | Force (Unit: N) |
Computing Flux
Now, let’s look at an example to find out the simple math behind computing flux.
A simple example of computing current through a conductor.
Imagine a cylindrical conductor (shown above) through which electric current flows as a result of a potential difference across its two ends. Now, let’s focus on a small section of the conductor along its length (shown above as the red-dashed disk). The left and right ends of the disk are at position x_{1} and x_{2}, respectively, and have a constant cross-section area of A. The electric potential on the left and right ends of the disk are V_{1} and V_{2}, respectively. The electrical conductivity is denoted by σ. For electric current conduction, the flux physically signifies the total number of electrons flowing through the cross section per unit time (referred to as current density). Using Ohm’s Law, the current density (J) through this cross section can be computed from the following expression:
Now, in order to compute the current density through a cross-section boundary, let’s imagine that we squeeze the thickness of this disk, so that Δx ≈ 0. This helps us make the jump from algebra to differential calculus and express the flux through a boundary as:
Now, let’s make another jump from one-dimensional current conduction to a three-dimensional scenario where the electric potential as well as the conductivity could, in general, vary as a function of x-, y-, and z-coordinates. This would give us a current density vector:
Using notations from vector calculus, the above expression could be written in a more compact form:
Computing Total Normal Flux
Going back to our simple example, let’s say we are interested in finding out the total current passing through any arbitrary cross section of the conductor. For a straight cylinder with a constant cross-section area, we can easily find the total current passing through any section, by multiplying the cross-section area with the current density (flux).
What would you do for the three-dimensional case with the flux vector?
Here, we will follow the principles of integral calculus to find that out.
An arbitrary boundary (∂Ω) in 3D space whose normal vector is \hat{\bf n}=\begin{bmatrix} n_x & n_y & n_z\end{bmatrix}. The flux through this boundary is specified by the vector, \overrightarrow{\bf J}=\begin{bmatrix} J_x & J_y & J_z\end{bmatrix}.
To find the total normal flux through an arbitrary boundary, denoted by ∂Ω, we first need to find the normal flux through that boundary. This can be obtained from the dot product of the normal vector (\hat{\bf n}) of the boundary and the flux vector (\overrightarrow{\bf J}). The total normal flux can then be obtained by integrating this quantity over the boundary. The final expression used for computing the total normal flux would then be:
Computing Total Normal Flux in COMSOL Multiphysics
Now let’s find out how you can compute the total normal flux on a planar surface in the COMSOL software. We will look into two possibilities.
- When the planar surface is a 2D boundary (internal or external) of a 3D modeling geometry
- When the planar surface is not a part of the modeling geometry, but is created during postprocessing, using the Cut Plane data set feature
Model Overview
Let’s solve a DC electric current conduction problem on a bent copper wire whose two ends are at a potential difference of 1 mV.
Overview of the electric current conduction model set-up. All geometric units are in millimeters (mm).
Here, we use the Electric Currents interface and a stationary study to solve a DC current conduction problem. A swept mesh is used on the geometry.
Representation of the problem in the COMSOL software.
Variation in Current Density
Before we proceed to compute the total current in the conductor, let’s take a look at the current density variation inside the conductor.
Spatial variation in the magnitude of current density and direction of current flow.
As moving charges try to take the shortest path (least resistance), we see that, in the curved section of the conductor, the current density varies through the volume significantly. It is largest near the inner radius and smallest near the outer radius.
Computing on a Geometric Boundary
Now, let’s turn our attention to one of the internal boundaries that connects the straight and curved regions.
Spatial variation in the magnitude of current density on one of the internal geometric boundaries. The arrows show the direction of the normal vector of this boundary. Note that this direction coincides with that of the direction of the current flow.
In order to compute the total current flowing through this cross section, we will use the Surface Integration feature, which is available under Results > Derived Values.
Snapshot of performing a surface integration to compute the area integral of the dot product of current density vector and surface normal vector.
Remember the integrand to obtain the normal flux: ( n_xJ_x+n_yJ_y+n_zJ_z ). For arbitrary geometrical shapes, this expression can be very complicated. The good news is that the COMSOL software contains automatic, built-in expressions for this, which can be used in both pre- and postprocessing. Here is how the expression looks in COMSOL Multiphysics:
nx*ec.Jx+ny*ec.Jy+nz*ec.Jz
Here, the components of the current density vector are available as built-in variables, namely, ec.Jx, ec.Jy, and ec.Jz. You can also find similar variables for the the flux quantity in other physics interfaces. The COMSOL software automatically computes the normal vector for all of the boundaries on the geometry. This information can be accessed by using the variables nx, ny, and nz.
Using this approach, we find the resulting current to be 62.9 A.
Computing on a Cut Plane
Now, let’s find out how you can implement the same idea on an arbitrary planar surface that cuts through the modeling geometry.
Creating a Cut Plane
You can use the Cut Plane feature under Results > Data Sets to create such a planar surface. There is no need to go back and change the actual modeling geometry to insert this surface and solve the model again. This is a big advantage when you decide to visualize or compute some quantity on an arbitrary planar surface. The cut plane can be created using two alternate approaches.
- Add one under Results > Data Sets
- This gives you a default set of coordinates for three points that define the cut plane
- You can then manually modify the coordinates to get the desired plane
- Click on an existing plot group and use some of the buttons on the ribbon
- This gives you the added flexibility to drag a slider bar and move the plane around
- COMSOL Multiphysics also automatically creates a Cut Plane branch (under Results > Data Sets) with information on the coordinates of the three points in space that defines this plane
Screenshot showing the options to create a cut plane. The green line in the Graphics window represents the boundary of the cut plane intersecting the modeling geometry. The red line is the normal of the cut plane. (Click to enlarge)
Screenshot of the Settings window for the Cut Plane branch, which is found under Results > Data Sets. Variable names for the surface normal vector can be invoked from the Advanced settings, by checking the “Define normal variables” checkbox.
Surface Normal of a Cut Plane
In order to access the variables corresponding to the normal vector of the cut plane, you would need to look under the Advanced section in the settings window of the Cut Plane data set branch and check the box to “Define normal variables“. This will invoke the variables cpl1nx, cpl1ny, and cpl1nz. The default naming convention for these variables uses the tag name (cpl1) attached to the Cut Plane 1 data set. So, if you create another cut plane, its normal variables will automatically be given a different name. You can also replace these default variables names with other names of your choice.
The COMSOL software computes the cut plane normal vector from the cross product of the two base vectors that define the plane. These base vectors are computed from the coordinates of the three points that are used to define the cut plane.
Surface plot of the magnitude of current density on the cut plane and an arrow surface plot showing the cut plane normal vector with red arrows.
Computing the Surface Integral
Finally, let’s find out how we can compute the total normal flux (current) passing through the cut plane.
Once again, we use the Surface Integration feature. This time, we need to ensure that the data set for the Surface Integration branch is set to Cut Plane 1 (or the desired cut plane data set, if you have multiple cut planes).
Snapshot of performing a surface integration to compute the area integral of the dot product of current density vector and surface normal vector of the cut plane.
The expression that we integrate over the surface of the cut plane is the following.
-(cpl1nx*ec.Jx+cpl1ny*ec.Jy+cpl1nz*ec.Jz)[1/mm]
Here, the negative sign that precedes the expression is used, because the direction of the cut plane normal is opposite to that of the direction of current flow. Also, note the normalization of the unit by using the [1/mm] factor. This is done to take into account the fact that the modeling geometry uses the millimeter as the length unit of choice. Using this approach, once again, we confirm the resulting current to be 62.9 A.
Now you just need to open your favorite COMSOL Multiphysics model and try out what you learned here on any other physics of your choice.
Further Reading
You can learn more about postprocessing in COMSOL Multiphysics from the videos and blogs available on our website.
Article Tags
Postprocessing- Certified Consultants 30
- Chemical 48
- COMSOL Now 136
- Conference 102
- Core Functionality 58
- Electrical 116
- AC/DC 42
- MEMS 14
- Plasma 4
- RF 30
- Semiconductor 2
- Wave Optics 6
- Fluid 86
- CFD 40
- Microfluidics 8
- Mixer 3
- Molecular Flow 8
- Pipe Flow 6
- Subsurface Flow 10
- Interfacing 36
- Mechanical 142
- Multipurpose 14
- Tips & Tricks 32
- Trending Topics 44
- User Perspectives 82
- Video 64
Comments
Why the surface integration of variable “ec.normJ” is a little bigger than that the integration of expression “nx*ec.Jx+ny*ec.Jy+nz*ec.Jz”?
and, secondly, the negative sign in “-(cpl1nx*ec.Jx+cpl1ny*ec.Jy+cpl1nz*ec.Jz)[1/mm]” is not necessary if the order of selecting the “first point for cut plane normal” and the second point is changed.
Hi Lingling, Thanks for taking out the time to read this blog. Let me address your questions.
1. The variable ec.normJ is the L2 norm of the current density vector. This is usually not the same as the normal component of the same vector on a given surface. In the Electric Currents interface COMSOL actually stores the normal current density in another variable which is ec.nJ. So you can actually replace “nx*ec.Jx+ny*ec.Jy+nz*ec.Jz” with “ec.nJ” and try out again.
2. You are right about the negative sign. The only purpose of showing it in this blog is to highlight that in case you have created the cut plane in such a way that its normal vector points in exactly the direction, that is opposite of what you want, instead of trying to create another cut plane, you can simply type in the negative of the normal vector variables to obtain the desired direction.