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.

Access values of one model in the other

Please login with a confirmed email address before reporting spam

Dear all,

is it possible in post-processing, to access all the models that are stored in a .mph comsol file?

I have a file that contains two models (with exactly the same geometry) and would like to plot e.g.

mod1.u - mod2.u2

For some reasons this does not work.
Plotting or accessing constant values, e.g. material constants of one model from the other sometimes is possible.
But trying to substract variables of one model from the other fails.
I can not even access variable values of one model from the solution of the other, even when referring to it using the "model2.something" referrer.

Does anyone know a work around, or do I have to export all the solutions to matlab and do the post-processing there?
I often ran out of java heap space, when I tried this...
So I would like to avoid that.

Is there a clever way of using the "at" or "with" operators for this purpose?

Thanks for any hints,
Juergen

9 Replies Last Post Jun 26, 2017, 8:08 a.m. EDT
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 Jan 24, 2011, 10:10 a.m. EST
Hi

you must define global variables that have specific definitions on the specific domains based on the specific physics, and then it mostly works out.

in v4 you should not forget that when adressing a variable from another embeded model you need the ful naming convention (and the variable must be defined solved previously via a specific solve or a order correspondingly in the segregated solver sequence

--
Good luck
Ivar
Hi you must define global variables that have specific definitions on the specific domains based on the specific physics, and then it mostly works out. in v4 you should not forget that when adressing a variable from another embeded model you need the ful naming convention (and the variable must be defined solved previously via a specific solve or a order correspondingly in the segregated solver sequence -- Good luck Ivar

Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 24, 2011, 11:37 a.m. EST
Hi,

All solutions are available for plotting and evaluation, but you can only plot fields defined on the geometry (model) in the solution data set that a plot group uses. You can use a model coupling operator to make a field variable available in another geometry (model).

In the simple case that the two models use exactly the same geometry, an Identity Mapping operator makes it possible to access, for example, u2 in the geometry for u. If you define it in Model 2, select Geometry 1 from the "Destination geometry" list. You can then plot the difference in a plot group for a Solution data set for Model 1 as, for example,

u-mod2.idmap1(mod2.u2)

The "at" and "with" operators are useful for combining solutions at different times or for different parameter values or eigenmodes in time-dependent, parametric, or eigenvalue simulations.

Best regards,
Magnus Ringh, COMSOL




Hi, All solutions are available for plotting and evaluation, but you can only plot fields defined on the geometry (model) in the solution data set that a plot group uses. You can use a model coupling operator to make a field variable available in another geometry (model). In the simple case that the two models use exactly the same geometry, an Identity Mapping operator makes it possible to access, for example, u2 in the geometry for u. If you define it in Model 2, select Geometry 1 from the "Destination geometry" list. You can then plot the difference in a plot group for a Solution data set for Model 1 as, for example, u-mod2.idmap1(mod2.u2) The "at" and "with" operators are useful for combining solutions at different times or for different parameter values or eigenmodes in time-dependent, parametric, or eigenvalue simulations. Best regards, Magnus Ringh, COMSOL

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 26, 2011, 4:12 a.m. EST
Dear Magnus,

thanks for your reply. I tried that and it works so far.

Greetings,
Juergen
Dear Magnus, thanks for your reply. I tried that and it works so far. Greetings, Juergen

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 22, 2011, 6:14 p.m. EDT
Hi,
I used the Identity Mapping function to move values from Model 1 to Model 2 in my simulation. Model 1 is a heat transfer problem where the geometry is first deformed, then the HT is solved for. Model 2 is just the heat transfer portion of the problem without the solid mechanics. They share the same geometry.

I created an idmap in Model 1, with destination Model 2. THen I went to plot using the Model 2 solution:
surface plot: mod2.T2 - mod1.idmap1(mod1.T)

This was meant to plot the difference in temperature with and without compression. The answer didnt make sense, and plotted alone, mod1.idmap1(mod1.T) is just a constant temperature, which is not the case when I just solve Model 1 alone (get a parabolic t-distribution).

Any ideas? Thank you!

Austin
Hi, I used the Identity Mapping function to move values from Model 1 to Model 2 in my simulation. Model 1 is a heat transfer problem where the geometry is first deformed, then the HT is solved for. Model 2 is just the heat transfer portion of the problem without the solid mechanics. They share the same geometry. I created an idmap in Model 1, with destination Model 2. THen I went to plot using the Model 2 solution: surface plot: mod2.T2 - mod1.idmap1(mod1.T) This was meant to plot the difference in temperature with and without compression. The answer didnt make sense, and plotted alone, mod1.idmap1(mod1.T) is just a constant temperature, which is not the case when I just solve Model 1 alone (get a parabolic t-distribution). Any ideas? Thank you! Austin

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 20, 2012, 4:52 p.m. EST
Hi. I am trying to take a solution from one geometry that has heat transfer and solid mechanics solutions and map the solid mechanics solution onto a smaller "cut-out" to simulate relaxation from material removal (assuming elasticity only response). From what I can tell, I need to create a second geometry (geom2) in another model (same root) and use identity mapping, with geom1 as the destination.

From there, I am unclear how to connect the two models. What exactly is the identity object and how is it used to connect the models once it's created? I can't just simply tell model 2 to solve at this point.

Thanks.
Hi. I am trying to take a solution from one geometry that has heat transfer and solid mechanics solutions and map the solid mechanics solution onto a smaller "cut-out" to simulate relaxation from material removal (assuming elasticity only response). From what I can tell, I need to create a second geometry (geom2) in another model (same root) and use identity mapping, with geom1 as the destination. From there, I am unclear how to connect the two models. What exactly is the identity object and how is it used to connect the models once it's created? I can't just simply tell model 2 to solve at this point. Thanks.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 16, 2012, 8:56 p.m. EDT
Still haven't fixed the problem yet. Any help would be most appreciated.
Still haven't fixed the problem yet. Any help would be most appreciated.

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Dec 8, 2014, 12:50 p.m. EST
Using mod1.u in the physics of mod2.u2 is possible by creating a identity mapping in !mod1! and creating a related source in physics of mod2.

mod1.idmap1 (Geometry2)
mod2.physics.source(mod1.idmap3(mod1.u1))

For a large number of DOFs in mod2 or mod1 the mapping requires quite some time - so avoiding seems much better!


Plotting works fine, thanks for that!

Best regards,
Matthias
Using mod1.u in the physics of mod2.u2 is possible by creating a identity mapping in !mod1! and creating a related source in physics of mod2. mod1.idmap1 (Geometry2) mod2.physics.source(mod1.idmap3(mod1.u1)) For a large number of DOFs in mod2 or mod1 the mapping requires quite some time - so avoiding seems much better! Plotting works fine, thanks for that! Best regards, Matthias


Please login with a confirmed email address before reporting spam

Posted: 7 years ago Jun 26, 2017, 8:01 a.m. EDT
Can you please help me with the problem in solving in the study 2 of the file that I have attached. It has some error regarding identity mapping. Thank you. It would be of great help
Can you please help me with the problem in solving in the study 2 of the file that I have attached. It has some error regarding identity mapping. Thank you. It would be of great help

Please login with a confirmed email address before reporting spam

Posted: 7 years ago Jun 26, 2017, 8:08 a.m. EDT
I don't why I am not able to attach the file by using the 'attach file' option.
I don't why I am not able to attach the file by using the 'attach file' option.

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.