Can COMSOL import topological data, meshes, and images?

Solution Number: 838
Title: Can COMSOL import topological data, meshes, and images?
Platform: All Platforms
Applies to: All Products
Versions: 4.2a
Created: April 1, 2002
Last Modified: January 9, 2012
Categories: Mesh, Import, Geometry, General
Keywords:

Problem Description

Can COMSOL Multiphysics import topological data, meshes, and images?

Solution

Topological Data, GIS, Digital Elevation Models (DEM)

If you have topological information saved in the DEM format, you can bring it into your COMSOL model by selecting Definitions > Functions > Elevation (DEM). This gives you a function containing the imported data. To turn this function into an actual geometry, use Geometry > More Primitives > Parametric Surface. The model StHelens.mph, available for download at the bottom of this article, demonstrates how to fill in the Settings tab of this feature. Note especially that you will often need to increase the number of knots from the default 20 to for example 100 in order to make the COMSOL geometry an accurate copy of the original DEM geometry. StHelens.mph also shows how to create a solid object bounded by the parametric surface.

 

 

The Parametric Surface feature can also be used with analytical expressions or interpolation data from a text file. See Case 935 for details on the latter.

Importing Meshes

Simpleware and Materialise  ( http://www.comsol.com/partners/ ) can export volumetric meshes created from 3D scans, that can be directly imported into COMSOL. More on the COMSOL mesh format can be found in the section The COMSOL File Formats in the COMSOL Multiphysics Reference Guide. Because the image is converted directly into a mesh and not into a geometry object, as in the other methods below, it is advisable to fine-tune the geometry/mesh within partnering software before the import is done to COMSOL. Arbitrary mesh data can be imported to COMSOL, providing the mphtxt mesh format is adhered to.

Importing Images

COMSOL supports import of BMP, JPEG, PNG, and GIF images. Definitions > Functions > Image leads you to the settings needed to convert an image file into a function. As with the DEM import, you can use this function to specify the local z-coordinate of a parametric surface. Another common use of images is to assign material properties based on the color scale. For example, in brains, grey and white matter can have different dielectric properties. Rather than create a complicated geometry of the cross-section of a brain, it  can be more convenient to just map these properties from an MRI image.

hot_circuit.mph is a toy example showing the principle. This model interpolates the local heat conductivity from a ballpoint drawing of a circuit. Note first the expression for the Color Scaling on the Settings tab of the Image feature, (r+g)/2<0.8. The default scaling is (r+g+b)/3, which results in a number on a linear grayscale from 0 for black to 1 for white. Removing the b means that the white background as well as the gray checkering of the notebook will get a high value and the blue drawing a low value. Finally, as comparisons are interpreted as 1 when true and 0 when false, the scaling expression will evaluate to 1 in the patch and 0 outside of it. This is a useful approach in situations where the colors in your picture represent a discrete set of materials. If you instead want your material parameters to be continuous functions of the color intensity, just skip the comparison.

The resulting image function, im1(x,y), is used in defining the thermal conductivity of the user-generated Material 1. The value of 5+395*im1(x,y) renders 400 W/(m*K) in the patch and 5 W/(m*K) in the surrounding circuit board material. Here the remaining parameters are assumed to be identical in both materials, but you could enter their values too as similar function-dependent expressions.

 

 

 

Related Files

hot_circuit.mph 327 KB
my_circuit.jpg 45 KB
StHelens.mph 3.2 MB
sthelens.dem 8.5 MB

Feedback

Poor | Excellent
Document quality?



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.