Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

v4.1 RF How to use two or more variables in parametric sweep

Please login with a confirmed email address before reporting spam

Hi

I want to do parametric sweep that effects the geometry too.
The first variable is the incident field wave length and second is angle of incidence.
How to run these parametrics or how to run nested parametric

Thanks

Irfan

12 Replies Last Post Oct 1, 2014, 6:10 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 Feb 20, 2011, 6:37 a.m. EST
Hi

in COMSOL v4 you have two types of parametric sweep, the "inner" one is the solver continuation sweep, this does NOT pass via the geometry, hence no geometrical nor mesh updates. And then the true "parametric sweep" (right click on the solver node add a parametric sweep) that loop around the full model, including geoemtry update and mesh update if requires

Nesting comes by itself, depending on the order of call/defiunition (use up/down as appropriate)

--
Good luck
Ivar
Hi in COMSOL v4 you have two types of parametric sweep, the "inner" one is the solver continuation sweep, this does NOT pass via the geometry, hence no geometrical nor mesh updates. And then the true "parametric sweep" (right click on the solver node add a parametric sweep) that loop around the full model, including geoemtry update and mesh update if requires Nesting comes by itself, depending on the order of call/defiunition (use up/down as appropriate) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 21, 2011, 11:29 a.m. EST
Thanks Ivar,

In one parametric node I can add multiple variables ,scroll up down but... cannot provide ranges for each variable separately. I mean for each variable, I cannot assign different values, it takes only one range for all variables

Thanks

Irfan
Thanks Ivar, In one parametric node I can add multiple variables ,scroll up down but... cannot provide ranges for each variable separately. I mean for each variable, I cannot assign different values, it takes only one range for all variables Thanks Irfan

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 21, 2011, 1:23 p.m. EST
Hello

Well I have a similar problem before if you have 2 or more variables that you want to sweep instead of writing range functions try to use sets

As far as I remember if you have two variables let say x and y, when you are filling the parameter values Comsol accept them as as a sets of 2

so if your parameters values are

10 20 40 50 60 70 80 90

Comsol first run the case when x =10 and y=20 in the second sweep x=40 y=50 and so on

Hope I understand the question and answer properly all the best
Hello Well I have a similar problem before if you have 2 or more variables that you want to sweep instead of writing range functions try to use sets As far as I remember if you have two variables let say x and y, when you are filling the parameter values Comsol accept them as as a sets of 2 so if your parameters values are 10 20 40 50 60 70 80 90 Comsol first run the case when x =10 and y=20 in the second sweep x=40 y=50 and so on Hope I understand the question and answer properly all the best

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 21, 2011, 1:45 p.m. EST
Thanks Mustufa,

What if i have x= [1 2 3 4 5] and y =[6 7 8 9]

Now i want to have solution for say x=1 and all values of y and then for x=2 with all values of y and so on.
With your method I suppose to write all possible combination of pairs (x,y).
I appreciate your solution but unfortunately it is not solving the problem fully.
I think comsol should have some provision for this/

Thanks

Irfan



Thanks Mustufa, What if i have x= [1 2 3 4 5] and y =[6 7 8 9] Now i want to have solution for say x=1 and all values of y and then for x=2 with all values of y and so on. With your method I suppose to write all possible combination of pairs (x,y). I appreciate your solution but unfortunately it is not solving the problem fully. I think comsol should have some provision for this/ Thanks Irfan

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 21, 2011, 4:53 p.m. EST
Well I write a small python script.which creates the sets for me

Please let me know if there is another solution

Well I write a small python script.which creates the sets for me Please let me know if there is another solution

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 Feb 21, 2011, 5:32 p.m. EST
Hi

have you triesd to add two paametrc sweep nodes one after the other ? at least in v4.1 it seems to work

else you have 1 1 1 2 1 3 1 4 1 5 2 1 2 2 2 3 2 4 2 5 3 1 ...

but this might not work as normally the first parameter should be monotonously increasing, in which case in 3.5, if I remember right, we added a first dummy parameter just counting 1 2 3 4 ... and then the nested pairs.

but it was indeed 1.1 1.2. 1.3 then 2.1 2.2. 2.3 etc and in that oder


--
Good luck
Ivar
Hi have you triesd to add two paametrc sweep nodes one after the other ? at least in v4.1 it seems to work else you have 1 1 1 2 1 3 1 4 1 5 2 1 2 2 2 3 2 4 2 5 3 1 ... but this might not work as normally the first parameter should be monotonously increasing, in which case in 3.5, if I remember right, we added a first dummy parameter just counting 1 2 3 4 ... and then the nested pairs. but it was indeed 1.1 1.2. 1.3 then 2.1 2.2. 2.3 etc and in that oder -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 22, 2011, 2:27 p.m. EST
Hi Ivar,

Your idea of two sweep nodes working. Thanks for the advice, but I still think COMSOL should do some thing in single node for nested loop, otherwise the provision of having multiple parameters in single node seems useless.

Thanks Mustafa, I think the idea of Ivar is good for now.

Thanks

Irfan
Hi Ivar, Your idea of two sweep nodes working. Thanks for the advice, but I still think COMSOL should do some thing in single node for nested loop, otherwise the provision of having multiple parameters in single node seems useless. Thanks Mustafa, I think the idea of Ivar is good for now. Thanks Irfan

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 Feb 23, 2011, 1:35 a.m. EST
Hi

Well send that as a suggestion to COMSOL,
Because, I'm not from COMSOL and have no more influence on the software more than you or anybody else out here. But I can say that the developers are listening to our suggestions, so when they are well explained and justified, I have noticed that they are taken into account and mostly arrive on the next release

--
Good luck
Ivar
Hi Well send that as a suggestion to COMSOL, Because, I'm not from COMSOL and have no more influence on the software more than you or anybody else out here. But I can say that the developers are listening to our suggestions, so when they are well explained and justified, I have noticed that they are taken into account and mostly arrive on the next release -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 21, 2011, 10:07 a.m. EDT
Hello,
to get more parametric sweep I used the same idea of Ivar. For now I think that is the best solution.
But I have another problem now. I'm doing another simulation and i wanna do a parametric sweep with wavelength fixed and changing the incidence angle. I have a single film (one cubic cell with periodic boundaries around), i put on this boundaries floquet periodicity, but i don't have the right solutions (i compared the transmittance curve with that one obtained by matlab). I'm using scattering boundary conditions on top and down (one of them with TE incidence wave).

Could anyone help me? In the attached file there is my project.
Thank you very much.
Hello, to get more parametric sweep I used the same idea of Ivar. For now I think that is the best solution. But I have another problem now. I'm doing another simulation and i wanna do a parametric sweep with wavelength fixed and changing the incidence angle. I have a single film (one cubic cell with periodic boundaries around), i put on this boundaries floquet periodicity, but i don't have the right solutions (i compared the transmittance curve with that one obtained by matlab). I'm using scattering boundary conditions on top and down (one of them with TE incidence wave). Could anyone help me? In the attached file there is my project. Thank you very much.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 22, 2011, 1:17 p.m. EDT
Ok, I've found my error: it is in the copy-face of the mesh node.

Thanks'.
Rino.
Ok, I've found my error: it is in the copy-face of the mesh node. Thanks'. Rino.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 10, 2013, 12:16 p.m. EDT
I am trying to export the data to MatLab through a model object (using the Comsol server). Does anyone know how to access the data after exporting to Matlab ?

I do not have any problem when sweeping for one parameter (V1) but with two parameters ... I do not know how to do it ... I cannot get the solutions for the pairs (V1,V2) ... any suggestion ?


Thanks !
I am trying to export the data to MatLab through a model object (using the Comsol server). Does anyone know how to access the data after exporting to Matlab ? I do not have any problem when sweeping for one parameter (V1) but with two parameters ... I do not know how to do it ... I cannot get the solutions for the pairs (V1,V2) ... any suggestion ? Thanks !

Please login with a confirmed email address before reporting spam

Posted: 10 years ago Oct 1, 2014, 6:10 a.m. EDT
Hello,

I also use this multiple parametric sweep method to find the stiffness curve of a geometry. My first parametric sweep gives displacement to the load point on the geometry and creates the x axis for my stiffness curve. I get the y axis values (force/displacement) by integration of reaction forces and I create a curve. The second parametric sweep is making some changes to the geometry to get a multitude of these curves.

My problem is that I have not been able to arrange the outcome of this solution into a matrix. I would like a stiffness matrix where the displacement is incremented in rows and setups for the geometry increment on columns. Because none of my sweeps create "inner solutions" I cannot do this. I only get one column that updates on the end of the first parametric sweep. Does anyone have a solution for this?

Thanks in advance,

Kerem Başaran
Hello, I also use this multiple parametric sweep method to find the stiffness curve of a geometry. My first parametric sweep gives displacement to the load point on the geometry and creates the x axis for my stiffness curve. I get the y axis values (force/displacement) by integration of reaction forces and I create a curve. The second parametric sweep is making some changes to the geometry to get a multitude of these curves. My problem is that I have not been able to arrange the outcome of this solution into a matrix. I would like a stiffness matrix where the displacement is incremented in rows and setups for the geometry increment on columns. Because none of my sweeps create "inner solutions" I cannot do this. I only get one column that updates on the end of the first parametric sweep. Does anyone have a solution for this? Thanks in advance, Kerem Başaran

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.