New Accumulators Boost Particle and Ray Tracing Functionality

November 26, 2014

With the release of COMSOL Multiphysics version 5.0, the Particle Tracing Module now includes a series of features called Accumulators, which can be used to couple the results of a particle tracing simulation to other physics interfaces. The accumulated variables may represent any physical quantity and can be defined either within domains or on boundaries, making them extremely flexible. Here, I will explain the different types of accumulators and their applications in particle tracing and ray optics models.

What Are Accumulators?

In particle tracing and ray tracing simulations, we often need to use the particle or ray properties to change a variable that is defined on a set of domains or boundaries. For example, solid particles in a fluid might exert a significant force on the surrounding fluid, and they may also erode the surfaces they hit.

In previous blog posts, I’ve discussed two other cases in greater detail: divergence of an electron beam due to self-potential and thermal deformation of lenses in a high-powered laser system. Each of these phenomena can be modeled using Accumulators or the specialized features that are derived from them.

An Accumulator is a physics feature that communicates information from particles or rays to the underlying finite element mesh. For each Accumulator feature in a model, a corresponding dependent variable, called an accumulated variable, is declared. These accumulated variables can be defined either within a set of domains or on a set of boundaries, and they can represent any physical quantity, making them extremely flexible.

The Accumulator features can be added to any of the physics interfaces of the Particle Tracing Module. They can also be used in the Geometrical Optics interface, available with the Ray Optics Module, and the Ray Acoustics interface, available with the Acoustics Module.

Depending on the physics interface, more specialized versions of the Accumulator may be available for computing specific types of physical quantities. For example, the Particle Tracing for Fluid Flow interface includes a dedicated Erosion boundary condition that includes several built-in models for computing the rate of erosive wear on a surface.

The Accumulators can be divided into three broad categories, which function in the following ways:

  1. Accumulators on boundaries increment a variable defined on a boundary element whenever a particle hits it.
  2. Accumulators on domains project information from each particle to the mesh elements the particle passes through.
  3. Nonlocal accumulators communicate information from a particle’s current position to the location where it was originally released.

We will now investigate each of these varieties in greater detail.

Accumulators on Boundaries

When particles or rays strike a surface, they can affect that surface in a wide variety of ways. For example, a laser can cause a boundary to heat up, sediment particles can erode their surroundings, and sputtering can occur when high-velocity ions strike a wafer in a process chamber. All of these effects require the same basic modeling procedure; we define a variable on the boundary and change its value when particles or rays interact with the boundary.

To begin, let’s consider a simple case in which we want to count the number of times a boundary is hit. We first define a variable, called rpd, for example, which can have a distinct value in every boundary mesh element. Initially, this variable is set to zero in all elements. Every time a particle hits a mesh element on this boundary, we would like to increment the variable on that element by 1.

The values of the accumulated variable on the boundary elements (illustrated as triangles) after one collision are shown below:

A schematic illustrating the impact after one collision.
To implement this in COMSOL Multiphysics, we first set up the particle tracing model, then add a “Wall” node to the boundary for which we want to count collisions. In this case, let’s specify that particles are reflected at this surface by selecting the Bounce wall condition. We then add the Accumulator node as a subnode to this Wall.

The settings shown in the following screenshot cause the accumulated variable (called rpb) to be incremented by 1 (the expression in the Source edit field) every time a particle hits the wall.

The Accumulator boundary settings.
I have created an animation that demonstrates how the number of collisions with each boundary element is counted over the course of the study. Check it out:

By changing the expression in the Source edit field, it is possible to increment the accumulated variable using any combination of variables that exist on the particle and on the boundary. For example, the accumulated variable may increase by a different amount based on the velocity or mass of incoming particles. The dependent variable need not be dimensionless. In fact, it can represent any physical quantity.

In addition to the generic Accumulator subnode — which can represent anything — dedicated accumulator-based features are available in the different physics interfaces, including the following:

  • In the Charged Particle Tracing physics interface:
    • Etch (Use this to model physical sputtering of a surface by energetic ions.)
    • Current Density
    • Heat Source
    • Surface Charge Density
  • In the Particle Tracing for Fluid Flow physics interface:
    • Erosion (For computing the total mass removed from the surface or the rate of erosive wear.)
    • Mass Deposition
    • Boundary Load
    • Mass Flux
  • In the Geometrical Optics physics interface:
    • Deposited Ray Power (For computing a boundary heat source using the power of incident rays.)

Accumulators on Domains

We may also want to transfer information from particles to all of the mesh elements they pass through, not just the boundary elements they touch. We can do so by adding an Accumulator node to the physics interface directly, instead of adding it as a subnode to a Wall or other boundary condition.

For example, we can use an Accumulator to reconstruct the number density of particles within a domain. This technique is used in a benchmark model of free molecular flow through an s-bend in which the Free Molecular Flow interface is used to compute the number density of molecules in a rarefied gas.

Here is the geometry of the s-bend:

An image depicting the geometry of the s-bend.

The settings window for the Accumulator is shown below.

Th s-bend settings in COMSOL Multiphysics.

The expression in the Source edit field is a bit more complicated than in the previous case. The source term R is defined as


R = \frac{J_{\textrm{in}} L}{N_{p}}

where J_{\textrm{in}} (SI unit: 1/(m^2 s)) is the molecular flux at the inlet, L (SI unit: m) is the length of the inlet, and N_{p} (dimensionless) is the number of model particles.

Physically, we can interpret R as the number of real molecules per unit time, per unit length in the out-of-plane direction, that are represented by each model particle. Because this source term acts on the time derivative of the accumulated variable, each particle leaves behind a “trail” in the mesh elements it passes through, which contributes to the number density in those elements.

I have created a second animation in which the number density of molecules is computed using the Accumulator (bottom) and the result is compared to the result of the Free Molecular Flow interface (top). Here it is:

We do see some noise in the particle tracing solution because each particle can only make a uniform contribution to the mesh element it is currently in. However, when the number of particles is large compared to the number of mesh elements, it is still possible to obtain an accurate solution.

In addition to the generic Accumulator node, which can represent anything, dedicated accumulator-based features are available in the different physics interfaces, including the following:

  • In the Charged Particle Tracing physics interface:
    • Particle-Field Interaction computes the charge density of particles, which can then be used as a source term to compute the self-potential of a beam of ions or electrons. It is also possible to compute the current density, which can create a significant magnetic field if the beam is relativistic.
  • In the Particle Tracing for Fluid Flow physics interface:
    • Fluid-Particle Interaction computes the body load exerted by particles on the surrounding fluid.
  • In the Geometrical Optics physics interface:
    • Deposited Ray Power generates a heat source term based on the amount of power absorbed by the medium if rays propagate through an absorbing medium.

Nonlocal Accumulators

The third variety of Accumulator is a bit more advanced than the previous two. A Nonlocal Accumulator is used to communicate information from a particle’s current position to the initial position from which it was released. The Nonlocal Accumulator can be added to an “Inlet” node, causing it to declare an accumulated variable on the mesh elements on the Inlet boundary.

The Nonlocal Accumulator can be used in some advanced models of surface-to-surface radiation. In many cases, the Surface-to-Surface Radiation physics interface (available with the Heat Transfer Module) can be used to efficiently and accurately model radiative heat transfer. However, the Surface-to-Surface Radiation interface relies on the assumption that all surfaces reflect radiation diffusely. That is, the direction of reflected radiation is completely independent of the direction of incident radiation. It cannot be used, for example, if some of the radiation undergoes specular reflection at smooth, polished, metallic surfaces.

One approach to modeling radiative heat transfer with a combination of specular and diffuse radiation is to use the Mathematical Particle Tracing interface, as demonstrated in the example of mixed diffuse and specular reflection between two parallel plates.

The incident heat flux on each plate is computed by releasing particles from the plate surface, querying the temperature of each surface the particles hit, and communicating this information back to the point at which the particles are initially released. The below image shows the temperature distribution between the two plates, where the top plate is heated by an external Gaussian source.

Temperature distribution between two parallel plates.

Conclusions and Next Steps

We have seen that Accumulators can be used to model interactions between particles or rays and any field that is defined on the surrounding domains of boundaries. The accumulated variables can represent any physical quantity. The Accumulator is the basic building block that allows for sophisticated one-way or two-way coupling between a particle- or ray-based physics interface and any of the other products in the COMSOL product suite.

The Accumulators and related physics features have too many settings and applications to discuss in detail in a single blog post. To learn more about the many options available, please refer to the User’s Guide for the Particle Tracing Module (for particle tracing physics interfaces), the Ray Optics Module (for the Geometrical Optics interface), or the Acoustics Module (for the Ray Acoustics interface).

If you are interested in learning more about any of these products, please contact us.

Comments (9)

Leave a Comment
Log In | Registration
Sunil Kumar Sudhakaran
Sunil Kumar Sudhakaran
December 15, 2014

Dear Christopher

My name is Sunil, currently working as a postdoc in MPI of Nuclear Physics. This question is not related to this article, but a different one! I did not see any other way to contact you regarding my question. I want to define a cylindrical light source emitting rays in every direction. An elliptical mirror with cylindrical/spherical/elliptical symmetry will then be defined such that the light source is at one of the foci of the mirror. This will lead to the situation where the light rays hitting the elliptical mirror are focused onto the second focus where I would like to have the detector. Then I wish to determine what fraction of the emitted light rays hitting the detector. I would like to optimize the elliptical mirror and possibly the shape of the detector plane to achieve the maximum light. Will it be possible to do the entire thing using the standard version of the Comsol? Your kind reply is highly appreciated.

Thanks and regards

Christopher Boucher
Christopher Boucher
December 15, 2014

Dear Sunil,

It is possible to model propagation and reflection of rays using the Ray Optics Module. For more information about the capabilities of this add-on module, please refer to the product page ( To learn more about optimization capability in COMSOL Multiphysics, please see the product page for the Optimization Module ( The Ray Optics Module includes built-in tools for computing the deposited power on a surface, from which it is often possible to define a suitable objective function for shape optimization.

Best Regards,
Christopher Boucher

Sunil Kumar Sudhakaran
Sunil Kumar Sudhakaran
December 18, 2014

Dear Christopher,

Thank you for your kind reply. One more query: Are there material libraries for standard lenses and mirrors in the ray optics module? Is it possible to define any geometrical object as a light source in the COMSOL, for instance as a source emitting light uniformly in 4*PI solid angle?

Best regards

songzhen tang
songzhen tang
January 6, 2015

Dear Christopher

My name is Songzhen Tang. I’m a Ph.D. of xi’an jiaotong university. Now I want to use COMSOL 5.0 to simulate the process of particle deposition, but some problems occur. Questions are as follows:

1. Will it be possible to simulate the influence of particle size distribution? User define function?
2. For Particle Tracing for Fluid Flow , how to simulate the elastic or non-elastic collision of particles with walls.

For other questions, I hope we can communicate with Email, my email is

I am looking forward to hearing from you

kind regards

Joseph Cibere
Joseph Cibere
April 14, 2016

Joseph Cibere
Joseph Cibere
April 14, 2016

Dear Christopher

I am currently using COMSOL 5.2 with the Ray Optics Module and I would like to know if I can set up a special type of Deposited Ray Power accumulator that accumulates the power from incident rays that only have incident angles, Theta, that meet the condition: Theta_1 < Theta < Theta_2, where Theta_1 and Theta_2 are some user defined constant.

Daniel Bulgadaryan
Daniel Bulgadaryan
February 16, 2018

Hello. I would like to ask how the results of particle counting with Accumulator features can be accessed? I have set the Current density node on a boundary, but I cannot figure out how to plot the results.

Andrea Giordano
Andrea Giordano
February 17, 2020

Hello everybody,
I have the same question as Daniel.
Does anybody know the answer?
Thank you!
Best regards,

Andrea Giordano

Buccma Accumulator
Buccma Accumulator
May 13, 2022

Your blog is always useful. Thank You