Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

How to extract many coordinates in geometry?

Please login with a confirmed email address before reporting spam

Hi, I'm trying to extract the coordinates of several points and more importantly, I need to assign their coordinates as a variable.

Let's simplify it.
There is a random function (has a value between 0 and 1) and i'd like to find where(value>=0.9) and their coordinates and finally want to assign as variable.

1. coordinates of several points.
2. set up a new variable with their coordinates.

How could it be possible? I've been working for a month.
any suggestion would be thankful and whether it need to use livelink or not doesn't matter

Best regards.

1 Reply Last Post 30 août 2017, 07:57 UTC−4
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 30 août 2017, 07:57 UTC−4
Hi Min

I depends on what you wish to use the data/variable for.

In Comsol you can just write something like this:
if(value>=0.9, 1, 0)
and use it every where you can enter an expression (e.g. as a source term just to give an example).

If you really wish to extract coordinates where value>=0.9 we need more info. Do you need these coordinates on vertices in the geometry, vertices on the mesh or where? The number of points is (generally) infinite so you need to specify what you are interested in.

You can also define an isosurface to extract volumes where value<=0.9.


If you can solve your problem without using LiveLink for Matlab you will most likely get the fastest solution. mpheval in LiveLink for Matlab can help you extract values from the entire mesh and you can use Matlab to find where the value>=0.9.

We need more info on what you wish to use the data for in order to help you with the best way to use the extracted data.

--
Lars Gregersen
Comsol Denmark
Hi Min I depends on what you wish to use the data/variable for. In Comsol you can just write something like this: if(value>=0.9, 1, 0) and use it every where you can enter an expression (e.g. as a source term just to give an example). If you really wish to extract coordinates where value>=0.9 we need more info. Do you need these coordinates on vertices in the geometry, vertices on the mesh or where? The number of points is (generally) infinite so you need to specify what you are interested in. You can also define an isosurface to extract volumes where value=0.9. We need more info on what you wish to use the data for in order to help you with the best way to use the extracted data. -- Lars Gregersen Comsol Denmark

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.