Using Point Cloud Data in Your COMSOL Model
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:
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:
Next you want to fill in the form as shown below:
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:
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.
The blue arrows represent the loads read in from the file. Let’s take a look at how the boundary condition is defined here:
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 in an impeller.
Login to Comment
- Create Account
- Forgot your password?