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.

Parameterise the position in a text file?

Please login with a confirmed email address before reporting spam

Hello,

I want to use the 2D distribution of the relative permeability of a nonlinear calculation in a linear calculation of the same Model with same parameters etc.

For that I export the data of the relative Permeability, depending on my Parameter (Parametric Sweep) and the coordinates x and y (See attached file "Forum 2.png").

This text file is being imported into the linear model with an interpolation function and the source is set to "file" with 2 arguments!

It is possible to write every single "Position in File" per Hand, but since I want to use ca. 100 Parameter values, this would just take too long.

However, if I want to choose a parameter for the "Position in file" (same parameter as my Parametric Sweep parameter), COMSOL only allows positive integers (See attached File "Forum 1.png")

Do you guys have any tips?




2 Replies Last Post 08.02.2013, 04:31 GMT-5

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 07.02.2013, 12:42 GMT-5
I use Matlab Livelink to do this. In Matlab, I create a function that reads the 2D data and interpolates. In COMSOL, I call the Matlab function parsing two arguments from COMSOL.

If you don't have Matlab Livelink, you can re-structure your data into 4 columns: (x,y, stage, YourVariable). Your function will now have 3 arguments instead of 2. Of course your will have a huge increase in file size. But I can't think of a better way of doing it in COMSOL only.
I use Matlab Livelink to do this. In Matlab, I create a function that reads the 2D data and interpolates. In COMSOL, I call the Matlab function parsing two arguments from COMSOL. If you don't have Matlab Livelink, you can re-structure your data into 4 columns: (x,y, stage, YourVariable). Your function will now have 3 arguments instead of 2. Of course your will have a huge increase in file size. But I can't think of a better way of doing it in COMSOL only.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 08.02.2013, 04:31 GMT-5

I use Matlab Livelink to do this. In Matlab, I create a function that reads the 2D data and interpolates. In COMSOL, I call the Matlab function parsing two arguments from COMSOL.

If you don't have Matlab Livelink, you can re-structure your data into 4 columns: (x,y, stage, YourVariable). Your function will now have 3 arguments instead of 2. Of course your will have a huge increase in file size. But I can't think of a better way of doing it in COMSOL only.


Thank you for answering!

At the moment I am not using MATLAB, so I'd like to try out the second solution. The problem is that I don't know how to create a 3D Plot in the Post processor, using my own expressions as arguments. Everything I could find so far is the value of a Variable, with respect to the coordinate system!

But I want the value of the variable depending on two axes of the coordinate system and my parameter...

So I found:
rmm.murZZ(x,y,z)

But I need:
rmm.murZZ(x,y,stage)

[QUOTE] I use Matlab Livelink to do this. In Matlab, I create a function that reads the 2D data and interpolates. In COMSOL, I call the Matlab function parsing two arguments from COMSOL. If you don't have Matlab Livelink, you can re-structure your data into 4 columns: (x,y, stage, YourVariable). Your function will now have 3 arguments instead of 2. Of course your will have a huge increase in file size. But I can't think of a better way of doing it in COMSOL only. [/QUOTE] Thank you for answering! At the moment I am not using MATLAB, so I'd like to try out the second solution. The problem is that I don't know how to create a 3D Plot in the Post processor, using my own expressions as arguments. Everything I could find so far is the value of a Variable, with respect to the coordinate system! But I want the value of the variable depending on two axes of the coordinate system and my parameter... So I found: rmm.murZZ(x,y,z) But I need: rmm.murZZ(x,y,stage)

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.