Using Point Cloud Data in Your COMSOL Model

Walter Frei March 20, 2013
Share this on Facebook Share this on Twitter Share this on Google+ Share this on LinkedIn

There is sometimes a need to include data from other simulation packages into a COMSOL Multiphysics model. There are a variety of ways in which this can be done, but one of the easiest approaches is to read in the point cloud data via a spreadsheet format text file. In this blog post, we walk through the steps of reading in such data, and using it in a COMSOL model.

Reading in Point Cloud Data as a Spreadsheet Text File

Let us start by looking at some data that was generated in another analysis package:

%X Y Z VectorX VectorY VectorZ
-0.03041 0.013353 0.138253 0.001493 0.003518 -0.00302
-0.03862 0.01627 0.137537 0.001332 0.003296 -0.00329
0.010981 0.132823 9.60E-04 0.00287 -0.00287

The first line you see is a header for the columnar data. We have XYZ data, and at each of these points we have the x-, y-, and z-components of a vector, which is a force that we will want to read into COMSOL Multiphysics. The remaining rows of the file are the point cloud data.

To read in this data, go to Model > Definitions > Functions and define a new Interpolation function. Like this:

Interpolation function

Next you want to fill in the form as shown below:

Filling in the form, Using Point Cloud Data in COMSOL Multiphysics

Set the Data Source to File, and use the Browse button to locate the text file on your disk. The Spreadsheet data format is the default setting, and other formats are described in the documentation. Set the Number of Arguments to 3, since we are reading in XYZ data here, and toggle on the Use space coordinates as arguments check-box since the data we are reading in is a function of position. Switch the Frame drop-down menu to Material. Why? Because we are going to be applying loads to a structural problem, and by setting the Frame to Material, we specify that the loads are applied in the original, undeformed, configuration rather than the deformed, or Spatial, frame.

Finally, you want to enter a Function name. Here we can use Fx, Fy, and Fz for the components of a force vector. The Position in file column specifies that these data are in the three columns after the space coordinates. Note that COMSOL automatically detects that there are three arguments and sets the Number of arguments field to 3 automatically.

Also note the Interpolation and Extrapolation settings. A linear interpolation method means that the spreadsheet data is mapped linearly from the source mesh points in the data file onto the destination mesh in COMSOL Multiphysics. If the COMSOL mesh lies outside of the space defined by the external data, then a constant extrapolation is used. These defaults are reasonable in most cases, and more details about the mapping are given in the documentation.

After you click the Import button, the form will look like this:

Form after Import of Point Cloud Data

Wish to read in a new data file instead? You also have the option to Discard the data.

Using the Point Cloud Data in a Model

Now let us see how to use this point cloud data in a model. Let’s suppose we wish to compute stresses in an impeller. The loads in the data file we have just read in represent the fluid loads on the surface of the vanes. (We could just as easily have read in volumetric data, but in this example we have read in surface data.) The impeller model, and loads, are shown below:

Simulating loads on an impeller
Simulating loads on an impeller.

The blue arrows represent the loads read in from the file. Let’s take a look at how the boundary condition is defined here:

Boundary condition definition when simulating loads on an impeller

And that’s it! Just by calling Fx, Fy, and Fz we have used the loads defined in our text file. Here are the results, showing the stresses as well:

Stresses on an impeller
Stresses in an impeller.


Post Tags

Technical Content


  1. Din-Chih Hwang January 15, 2014   3:38 pm

    How about import a scalar function of (x,y,z,t) as spreadsheet/txt file? Thanks

  2. Hugo Cabrera December 18, 2015   9:02 am


  3. Shirin Moradi August 29, 2017   9:06 am

    Could we create geometry from the interpolation function?
    for example I have created a surface (x,y,z) in the interpolation function and I want to create the same surface for my geometry.

  4. Walter Frei August 29, 2017   9:48 am

    Hello Shirin,
    Yes, you can. You can call interpolation functions within the parametric surface geometry primitive.

    For a related example, see:

    Entirely separately from that, you may also find this article interesting:

Loading Comments...