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.

Import results from a different simulation as a boundary condition or solve simulation for each geometry separetly

Please login with a confirmed email address before reporting spam

Hi folks,

I am simulating a pipe flow with 2 sections, and due to the dense mesh, the cluster is running out of memory.

So I was wondering: is it possible to simulate the first section and save the results, then later on import the profiles from this simulation into another file?

I just need the profiles at the pipe exit so I can use it as a boundary condition in the inlet of the second pipe.

Edit:

Another option would be to solve for each geometry but not at the same time, in other words, solve for the various
geometry parts but one after the other.

Is this possible or something similar?

Best Regards,

Rui Silva

8 Replies Last Post 30.10.2015, 13:28 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 09.03.2012, 06:13 GMT-5
Anyone?
Anyone?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 17.04.2012, 14:18 GMT-4
Hi Ruis,
I have the same matter.

For a static model, that is very easy, you need to interpolate your previous results. create an interpolate function and give it a name. the file should be written as x,y,z,data2beinterpolate1,data2beinterpolate2,...
chose a name for each function eg. data_interpolated

Now on your boundary you need to write as load condition : data_interpolated(x,y,z) <-- do not forget x,y,z


Mesh will generated vectors : X,Y,Z (X = [x1,x2,...], Y = [y1,y2,...],Z = [z1,z2,...]), for each nodes N = [n1,n2,...]

finally, XYZ are passed in argument in the interpolated function, and interpolation value at XYZ will be returned.



Now if you are using a frequency domain study, i am in this case, COMSOL support will tell you to use a MATLAB function, and the liveLink for MATLAB. I have passed one month on it, solving "epsilon issues". I am still on a 3D interpolation.
I have other things to run, so I do not have enough time to compute all the things.









Hi Ruis, I have the same matter. For a static model, that is very easy, you need to interpolate your previous results. create an interpolate function and give it a name. the file should be written as x,y,z,data2beinterpolate1,data2beinterpolate2,... chose a name for each function eg. data_interpolated Now on your boundary you need to write as load condition : data_interpolated(x,y,z)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 17.04.2012, 14:24 GMT-4
Hello Sylvain,

I got this answer from support:

Dear Rui ,
You can segment your problem in different files. I believe you need to
transfer the flow profiles at the outlet of one to the inlet of another.
You can try the following steps(note that Model 1 and Model 2 are in
separate files):

1. Solve Model 1. It should generate a 'Solution 1' under the 'Data set'
node.

2. Right click 'Solution 1' and select 'Duplicate'. You should get
'Solution 2'.

3. Right click 'Solution 2' and select 'Add Selection'. In the settings
window for 'Add selection' select geometry entity level as 'Boundary' and
select the outlet boundary of 'Model 1'.

4. Right click the 'Export' node in the model builder and select 'Data'. In
the settings window for 'Data' select 'Solution 2' as the 'Data set'. You
can select 'u', 'v' and 'w' from the expressions. You can export this to a
'.CSV' file which allow greater readability.

5. In 'Model 2>Definitions(right click)>Functions>Interpolation'. In its
corresponding settings window import the '.CSV' file you just exported it
should create 3 functions. Use these functions in the inlet boundary
condition of 'Model 2'.

I hope this helps. Let me know if it doesn't work.


But thank you for your input. :)

Best Regards,

Rui Silva
Hello Sylvain, I got this answer from support: Dear Rui , You can segment your problem in different files. I believe you need to transfer the flow profiles at the outlet of one to the inlet of another. You can try the following steps(note that Model 1 and Model 2 are in separate files): 1. Solve Model 1. It should generate a 'Solution 1' under the 'Data set' node. 2. Right click 'Solution 1' and select 'Duplicate'. You should get 'Solution 2'. 3. Right click 'Solution 2' and select 'Add Selection'. In the settings window for 'Add selection' select geometry entity level as 'Boundary' and select the outlet boundary of 'Model 1'. 4. Right click the 'Export' node in the model builder and select 'Data'. In the settings window for 'Data' select 'Solution 2' as the 'Data set'. You can select 'u', 'v' and 'w' from the expressions. You can export this to a '.CSV' file which allow greater readability. 5. In 'Model 2>Definitions(right click)>Functions>Interpolation'. In its corresponding settings window import the '.CSV' file you just exported it should create 3 functions. Use these functions in the inlet boundary condition of 'Model 2'. I hope this helps. Let me know if it doesn't work. But thank you for your input. :) Best Regards, Rui Silva

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 17.04.2012, 14:32 GMT-4
Hi

thank you for reporting it back here, that's always interesting to learn, and then we other users do not need to bother support again on the same subject ;)

--
Good luck
Ivar
Hi thank you for reporting it back here, that's always interesting to learn, and then we other users do not need to bother support again on the same subject ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 19.04.2012, 03:36 GMT-4
Hello Rui,

Thank you for this answer. I managed to do each step except the 5th one.

How can I use a function in a boundary condition?

Thank you for your answer!
Hello Rui, Thank you for this answer. I managed to do each step except the 5th one. How can I use a function in a boundary condition? Thank you for your answer!

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 06.02.2015, 06:55 GMT-5

Hello Rui,

Thank you for this answer. I managed to do each step except the 5th one.

How can I use a function in a boundary condition?

Thank you for your answer!

This is too late for you but it may be useful for others.
In Model 2, you create a new variable and point it to the imported function.
In your boundary condition, use the variable.
See the image for more details.

UPDATE: I found that my step of defining a new variable is redundant. You can read this article on COMSOL blog:
www.comsol.se/blogs/using-point-cloud-data-in-your-comsol-model/

Remember to specify the units for arguments and function in the settings of your interpolation function. You might encounter problem when, for example, the coordinates of your imported data is in micro meter but you don't tell the software about that.

[QUOTE] Hello Rui, Thank you for this answer. I managed to do each step except the 5th one. How can I use a function in a boundary condition? Thank you for your answer! [/QUOTE] This is too late for you but it may be useful for others. In Model 2, you create a new variable and point it to the imported function. In your boundary condition, use the variable. See the image for more details. UPDATE: I found that my step of defining a new variable is redundant. You can read this article on COMSOL blog: http://www.comsol.se/blogs/using-point-cloud-data-in-your-comsol-model/ Remember to specify the units for arguments and function in the settings of your interpolation function. You might encounter problem when, for example, the coordinates of your imported data is in micro meter but you don't tell the software about that.


Please login with a confirmed email address before reporting spam

Posted: 9 years ago 30.10.2015, 12:41 GMT-4
perhaps you can help me...

My inlet doesnt recognize my parameter or variable (I tried both) as variable. I interpolated my imported data.

It says : ''unknown variable'' and i dont understand why.

I tried everything what was posted in here, but perhaps i have a small mistake and i dont find it.

Would be very nice, if somebody could help me!

perhaps you can help me... My inlet doesnt recognize my parameter or variable (I tried both) as variable. I interpolated my imported data. It says : ''unknown variable'' and i dont understand why. I tried everything what was posted in here, but perhaps i have a small mistake and i dont find it. Would be very nice, if somebody could help me!


Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 30.10.2015, 13:28 GMT-4
Hello Stefanie,
When you call a function, you need to call it with an argument, like rcomp(r) not simply rcomp.
I hope this helps.
Best regards,
Jeff
Hello Stefanie, When you call a function, you need to call it with an argument, like rcomp(r) not simply rcomp. I hope this helps. Best regards, Jeff

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.