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.

Variable problem

Please login with a confirmed email address before reporting spam

Im working in comsol v4.2. In my work, I want to assign a variable 'nz' that is dependant upon the variable 'z',for the value of z from 0 to 0.5 um. and want to use this varying 'nz' in material property. Is it possible to do?or how to do?

Anyone reply please.Thanks

8 Replies Last Post 21 lug 2012, 10:41 GMT-4
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 19 lug 2012, 14:01 GMT-4
Hi

I believe so, you need to use the definitions variables and define the entities where it applies then enter your equaition.
BUT call it something else as "nz" as "nz" is already the local COMSOl variable name for the z component of the vector normal to a boundary.

You can give it another combinatin such as "Nz" or "my_nz"
Note that COMSOL does not always flag an error if you redefine an internal variable as COMSOl allows the user to change its formulas, but COMSOl assumes the user know what he/she is doing, sometimes it's by mistake, and the results can become funny, or it might go undetected (worse)

--
Good luck
Ivar
Hi I believe so, you need to use the definitions variables and define the entities where it applies then enter your equaition. BUT call it something else as "nz" as "nz" is already the local COMSOl variable name for the z component of the vector normal to a boundary. You can give it another combinatin such as "Nz" or "my_nz" Note that COMSOL does not always flag an error if you redefine an internal variable as COMSOl allows the user to change its formulas, but COMSOl assumes the user know what he/she is doing, sometimes it's by mistake, and the results can become funny, or it might go undetected (worse) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 20 lug 2012, 04:32 GMT-4
Thanks for the replay. Sorry I didn't get you, what is the 'definitions variables'?
I need to assign a 'z' ranging from 0 to 0.5 in 20 steps and 'Nz' will vary for this 20 values. How to assign the value of 'z'?
Thanks for the replay. Sorry I didn't get you, what is the 'definitions variables'? I need to assign a 'z' ranging from 0 to 0.5 in 20 steps and 'Nz' will vary for this 20 values. How to assign the value of 'z'?

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 20 lug 2012, 04:46 GMT-4
Hi

Is it this you want ?, I', using X in 2D X,Y but it could also be in Z in 3D. Note in solid x and X are different, use rather upper-case in Solids as this reefers to the actual geometrical position (material frame)

--
Good luck
Ivar
Hi Is it this you want ?, I', using X in 2D X,Y but it could also be in Z in 3D. Note in solid x and X are different, use rather upper-case in Solids as this reefers to the actual geometrical position (material frame) -- Good luck Ivar


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 20 lug 2012, 12:51 GMT-4
I tried 'Z' as the geometric frame but it says circular variable dependency detected. What can i do?
In my problem, 'Nz' should vary across the Z axis.
I tried 'Z' as the geometric frame but it says circular variable dependency detected. What can i do? In my problem, 'Nz' should vary across the Z axis.

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 20 lug 2012, 14:25 GMT-4
Hi

circular variable references is a know issue in numerical simulations, but often tricky to solve, it happens when variables depends on variables that depends ... and so on, and sudenly you loop around.

The trick is to cut the loop by adding a new dependent variable but it all depends on the model and the loop you have, far from trivial to say anything more

--
Good luck
Ivar
Hi circular variable references is a know issue in numerical simulations, but often tricky to solve, it happens when variables depends on variables that depends ... and so on, and sudenly you loop around. The trick is to cut the loop by adding a new dependent variable but it all depends on the model and the loop you have, far from trivial to say anything more -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 21 lug 2012, 03:04 GMT-4
Thanks for your replay. It'd be helpful if an example is given. And I'll upload my file next time.
Thanks for your replay. It'd be helpful if an example is given. And I'll upload my file next time.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 21 lug 2012, 10:22 GMT-4
I've tried like the pics. But it says out of memory. Im really in a great trouble.
what should I do with it now?
Thanks in advance.
I've tried like the pics. But it says out of memory. Im really in a great trouble. what should I do with it now? Thanks in advance.


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 21 lug 2012, 10:41 GMT-4
Hi

well first I do not see why you define NZ, you can use directly "z" no ?

then if it is for a periodic index variation, probably you should check your offsets and the formula should read something like ...sin(2*pi*(z-Z0)/0.5[um])) with a Z0 defined per domain, as I see that this material property is applied to many elements.
Finally in wave and optics you need a very fine mesh, which means that you need a lot of RAM (mesh density < 1/5 of the wavelength IN THE MATERIAL (do not forget "n" the index effect!)
One way is if your model is symmetric, you might be aple to use a 2D-axi, but sometimes with some types of polarized light the axisymmetry is not respected

Have you tried to see how the index varies, if it is correctly entered ? The easiest is to select the "dependent variables" sub node in the solver sub-tree and do a right click "compute to current/here" This will load in all initial conditions, you can then use the Results section to visualise the initial values, such as index variations, initial fields etc

--
Good luck
Ivar
Hi well first I do not see why you define NZ, you can use directly "z" no ? then if it is for a periodic index variation, probably you should check your offsets and the formula should read something like ...sin(2*pi*(z-Z0)/0.5[um])) with a Z0 defined per domain, as I see that this material property is applied to many elements. Finally in wave and optics you need a very fine mesh, which means that you need a lot of RAM (mesh density < 1/5 of the wavelength IN THE MATERIAL (do not forget "n" the index effect!) One way is if your model is symmetric, you might be aple to use a 2D-axi, but sometimes with some types of polarized light the axisymmetry is not respected Have you tried to see how the index varies, if it is correctly entered ? The easiest is to select the "dependent variables" sub node in the solver sub-tree and do a right click "compute to current/here" This will load in all initial conditions, you can then use the Results section to visualise the initial values, such as index variations, initial fields etc -- Good luck Ivar

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.