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.

using variable of one component in another component

Please login with a confirmed email address before reporting spam

Hello guys,

I have a model made up of two components, I want to use a variable solved in one component as a background field in the second component but I don't know how to do that. used comp1.something but it doesn't work, also I defined a global variable to hold variable of comp1.something but it doesn't work either. Someone said use " general extrusion " but I don't think that's the case.

Kind regards Jason


5 Replies Last Post Jan 20, 2021, 12:02 p.m. EST

Please login with a confirmed email address before reporting spam

Posted: 4 years ago Sep 27, 2020, 8:39 p.m. EDT

I have the same question here. The data can be exported and re-imported, but that's an ugly solution...

-------------------
ZHANG, Pu
School of Physics,
Huazhong University of Science and Technology
I have the same question here. The data can be exported and re-imported, but that's an ugly solution...

Please login with a confirmed email address before reporting spam

Posted: 4 years ago Sep 28, 2020, 1:24 p.m. EDT

Hello,

Indeed, a general extrusion will do the trick. Simply define a general extrusion operator in the first component, then call it in the second component as:

comp1.genext1(withsol('sol1',A))

Where 'sol1' is the solution which has the variable A needed from component 1 to component 2.

Let me know if you need more clarification,

Cheers,

Alex

Hello, Indeed, a general extrusion will do the trick. Simply define a general extrusion operator in the first component, then call it in the second component as: comp1.genext1(withsol('sol1',A)) Where 'sol1' is the solution which has the variable A needed from component 1 to component 2. Let me know if you need more clarification, Cheers, Alex

Please login with a confirmed email address before reporting spam

Posted: 4 years ago Sep 28, 2020, 3:27 p.m. EDT

Hello,

Indeed, a general extrusion will do the trick. Simply define a general extrusion operator in the first component, then call it in the second component as:

comp1.genext1(withsol('sol1',A))

Where 'sol1' is the solution which has the variable A needed from component 1 to component 2.

Let me know if you need more clarification,

Cheers,

Alex

Thanks man, my first geometry (comp1) is a rectangle but my second geometry is a rectangle with two holes in it (two solids), could you tell me how do I define this general extrusion?

Kind regards

>Hello, > >Indeed, a general extrusion will do the trick. Simply define a general extrusion operator in the first component, then call it in the second component as: > > comp1.genext1(withsol('sol1',A)) > >Where 'sol1' is the solution which has the variable A needed from component 1 to component 2. > >Let me know if you need more clarification, > >Cheers, > >Alex Thanks man, my first geometry (comp1) is a rectangle but my second geometry is a rectangle with two holes in it (two solids), could you tell me how do I define this general extrusion? Kind regards

Please login with a confirmed email address before reporting spam

Posted: 4 years ago Sep 29, 2020, 9:48 a.m. EDT

Hi Jason,

I've never tried using the general extrusion for different geometries, but I suppose it is still possible. If selecting the whole rectangle in the comp1 geometry for the general extrusion does not work, you might be able to define the holes in the comp1 geometry without removing them, so that you can deselect those in the general extrusion. I'm not sure if I'm being clear or if this would apply to your model though...

Cheers,

Alex

Hi Jason, I've never tried using the general extrusion for different geometries, but I suppose it is still possible. If selecting the whole rectangle in the comp1 geometry for the general extrusion does not work, you might be able to define the holes in the comp1 geometry without removing them, so that you can deselect those in the general extrusion. I'm not sure if I'm being clear or if this would apply to your model though... Cheers, Alex

Please login with a confirmed email address before reporting spam

Posted: 4 years ago Jan 20, 2021, 12:02 p.m. EST

Hello,

Indeed, a general extrusion will do the trick. Simply define a general extrusion operator in the first component, then call it in the second component as:

comp1.genext1(withsol('sol1',A))

Where 'sol1' is the solution which has the variable A needed from component 1 to component 2.

Let me know if you need more clarification,

Cheers,

Alex

Thank you man. You made my day.

Regards, Julian

>Hello, > >Indeed, a general extrusion will do the trick. Simply define a general extrusion operator in the first component, then call it in the second component as: > > comp1.genext1(withsol('sol1',A)) > >Where 'sol1' is the solution which has the variable A needed from component 1 to component 2. > >Let me know if you need more clarification, > >Cheers, > >Alex Thank you man. You made my day. Regards, Julian

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.