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.

Variable using results from two studies using different components

Please login with a confirmed email address before reporting spam

Hi all,

I am running two different frequency domain studies(Solid Mechanics and EM), each one using a different component and after the computation is done, I would like to define a variable taking as expression the multiplication of the effective mode index of the EM mode with the total power of the mechanical mode, and this for each optical mode and each mechanical mode found. Since these variables are not reference frame dependent, I assumed that I don't need any coupling between the components. Note that this multiplication doesn't make any sense but this is just a minimal example showing my issue, see attached file.

So I first compute the Solid Mechanics and then the EM, in which I have set "Values of variables not solved for" to be the solution of the Solid Mechanics and I defined my variable in the EM component.

When I export my variable after the two studies computed, I am then expecting to be able to choose the solid mechanic mode AND the optical mode for each study that Comsol will use to compute my variable. But this is not what happens.

In the "Derived Values/Global Evaluation 1" section, if I select "Study2/Solution2(3)" , it exports some values but I have no idea for which mechanical mode it is computed for and if I choose "Study2/Solution2(4)" It says "Undefined variable", which is weird because it is perfectly defined in the EM components.

I thank you in advance for your help !



1 Reply Last Post 03.05.2018, 05:22 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 03.05.2018, 05:22 GMT-4
Updated: 7 years ago 03.05.2018, 05:29 GMT-4

Comsol support team helped me to find the solution to my problem. I will post it here in hope that it will help other people.

The solution is to create a new study sweeping over the acoustic and optical mode number named IND1 and IND2 respectively and to access the different mode parameters by using 'withsol' operator together with 'setind' in a global ODE placed in a new 0D component:

u-(withsol('sol1',comp2.solid.Wh_tot,setind(lambda,IND1))*withsol('sol2',comp1.emw.intWe,setind(lambda,IND2))).

Note that 'withsol' also works with geometry-dependent variables. See the attached screenshot and corrected example.

Comsol support team helped me to find the solution to my problem. I will post it here in hope that it will help other people. The solution is to create a new study sweeping over the acoustic and optical mode number named IND1 and IND2 respectively and to access the different mode parameters by using 'withsol' operator together with 'setind' in a global ODE placed in a new 0D component: u-(withsol('sol1',comp2.solid.Wh_tot,setind(lambda,IND1))*withsol('sol2',comp1.emw.intWe,setind(lambda,IND2))). Note that 'withsol' also works with geometry-dependent variables. See the attached screenshot and corrected example.

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.