Parameterise the position in a text file?

Topics: no topics

Thread index  |  Previous thread  |  Next thread  |  Start a new discussion

RSS FeedRSS feed   |   Email notificationsTurn on email notifications   |   2 Replies   Last post: February 8, 2013 9:31am UTC
Alexander Hartmann

Alexander Hartmann

February 7, 2013 1:40pm UTC

Parameterise the position in a text file?

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?


Attachments:   Forum 2.png   Forum 1.png  

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Alexander Kuznetsov

Alexander Kuznetsov

February 7, 2013 5:42pm UTC in response to Alexander Hartmann

Re: Parameterise the position in a text file?

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.

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Alexander Hartmann

Alexander Hartmann

February 8, 2013 9:31am UTC in response to Alexander Kuznetsov

Re: Parameterise the position in a text file?


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)

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse


Rules and guidelines