# Discussion Forum

## Parameterise the position in a text file?

 Topics: no topics
RSS feed   |   Turn on email notifications   |   2 Replies   Last post: February 8, 2013 9:31am UTC

Jan Güdelhöfer

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?

Alexander Kuznetsov

February 7, 2013 5:42pm UTC in response to Jan Güdelhöfer

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.

Jan Güdelhöfer

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.