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.

RF field - initial value - comsol 4.1

Please login with a confirmed email address before reporting spam

Dear forum,

I ask for an advice in the following things:

1)
Is there a predefined Poynting vector in RF module?
& where exactly can I list through the comsol-names for physical quantities?


2)
I have defined own analytic function
besselbeam(x,y,z,kz) = besselj(0, kz*sqrt(x^2+y^2)) * exp(-j*z*kz)

When I try to use it for the initial field Ez = besselbeam(x,y,z,kacko_z)

then the solver says

Error in user-defined function.
- Function: besselbeam
Failed to evaluate expression.
- Expression: besselbeam(x/unit_m_cf,y/unit_m_cf,z/unit_m_cf,kacko_z*unit_m_cf)

I am solving for a fluid velocity field, not EM at the moment.

What is wrong? Thanks for ideas.

Lukas Chvatal



6 Replies Last Post Jul 10, 2015, 4:57 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 7, 2011, 2:00 a.m. EST
Hi

have you selected "May produce complex output for real arguments" ?

if you try to plot it for 1,2,3 variables (x,y,z) without you will get an error from the moment you scan all three (but not the 2 first x,y

This could be it (ps I'm in 4.1.0.112)

--
Good luck
Ivar
Hi have you selected "May produce complex output for real arguments" ? if you try to plot it for 1,2,3 variables (x,y,z) without you will get an error from the moment you scan all three (but not the 2 first x,y This could be it (ps I'm in 4.1.0.112) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 31, 2011, 10:06 a.m. EST
Dear Ivar,

thanks very much for your reply, I, too, am using version 4.1.0.112.
Ticking "may produce complex..." has fixed the plotting, which is great.
However, I still get an error, when trying to initialize the field by a defined function.
I will appreciate, If you happen to find time to see the enclosed file and perhaps comment on it.

L.Ch.



have you selected "May produce complex output for real arguments" ?

This could be it (ps I'm in 4.1.0.112)


Dear Ivar, thanks very much for your reply, I, too, am using version 4.1.0.112. Ticking "may produce complex..." has fixed the plotting, which is great. However, I still get an error, when trying to initialize the field by a defined function. I will appreciate, If you happen to find time to see the enclosed file and perhaps comment on it. L.Ch. [QUOTE] have you selected "May produce complex output for real arguments" ? This could be it (ps I'm in 4.1.0.112) [/QUOTE]


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 1, 2011, 2:26 a.m. EST
Hi

first ting I notice is that you have some naming conflicts, you define "eps" in your parameter but that variable name is already used by COMSOL to represent the smallest binary-representative decimal number deviating from 1 that can be identified. then is it eps. I assume you are defining epsilon here but you can use COMSOl in n-k mode too

I agree it would be nice if COMSOL could add a list or qa function to check the names if already used/defined inside COMSOL

I assume again that your "n" is the imaginary part of the index of refraction that COMSOL calls "k" AND take care with the sign convention, there are two different ones commonly used in the literature, COMSOL is using one: if I remember right "-" is absorption, pls check in the doc

I expect that you have noticed that your bessel analytical function is oscillating for x,y,z > 5 (have you looked ad the 2D/3D plots by adding 5 to y and z ?)

As you have a cylindrical symmetry, you could easily define a default "sys2" cylindrical reference frame and then access and use in your formulas the variables sys2.r sys2.phi sys2.a

Then I notice a Warning sign for your "water material" a) you should ALWAYS recheck your material after having defined your geometry, as when you change the physics this might ask for new or different material properties so these flags change depending on what you do further down in the model tree (one of the few places where the top/down link is not respected)

You have an empty node with the Volume force and I believe your the boundary conditions for SPF are not complete ?

Then I agree why is the "E2init" initial condition not accepted ?

Well I can only suggest that you send the model to "support" and ask COMSOL directly, that is strange, pls report back as its not clear for me. I'm using the latest patch 154 so its also wrong in the updated revision


--
Good luck
Ivar
Hi first ting I notice is that you have some naming conflicts, you define "eps" in your parameter but that variable name is already used by COMSOL to represent the smallest binary-representative decimal number deviating from 1 that can be identified. then is it eps. I assume you are defining epsilon here but you can use COMSOl in n-k mode too I agree it would be nice if COMSOL could add a list or qa function to check the names if already used/defined inside COMSOL I assume again that your "n" is the imaginary part of the index of refraction that COMSOL calls "k" AND take care with the sign convention, there are two different ones commonly used in the literature, COMSOL is using one: if I remember right "-" is absorption, pls check in the doc I expect that you have noticed that your bessel analytical function is oscillating for x,y,z > 5 (have you looked ad the 2D/3D plots by adding 5 to y and z ?) As you have a cylindrical symmetry, you could easily define a default "sys2" cylindrical reference frame and then access and use in your formulas the variables sys2.r sys2.phi sys2.a Then I notice a Warning sign for your "water material" a) you should ALWAYS recheck your material after having defined your geometry, as when you change the physics this might ask for new or different material properties so these flags change depending on what you do further down in the model tree (one of the few places where the top/down link is not respected) You have an empty node with the Volume force and I believe your the boundary conditions for SPF are not complete ? Then I agree why is the "E2init" initial condition not accepted ? Well I can only suggest that you send the model to "support" and ask COMSOL directly, that is strange, pls report back as its not clear for me. I'm using the latest patch 154 so its also wrong in the updated revision -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 1, 2011, 6:04 p.m. EST
Hi back,

thanks again for having looked at my model, as you say at the end, one sometimes really needs luck with Comsol.

Is there some facebook group we-are-for-the-list-of-comsol-internal-variables ? I would like to join at once.

The 2d/3d plots of defined analytic function works perfectly well, though one might appreciate
a choice of real/imaginary part... but ok, matlab plots real part implicitly, too.

I prefered the dielectric function to the refractive index, because I thought 'epsilon' in some intended
formulas would be better than 'sqrt(refrind)'. So no serious reason...

boundary conditions for SPF are not complete ? - You are right. So far I have not finished SPF,
or enabled to solve for.

And I have sent the E field init to the support, as you have suggested. I look forward to what may come out of it.

Sincerely
L.Ch.
Hi back, thanks again for having looked at my model, as you say at the end, one sometimes really needs luck with Comsol. Is there some facebook group we-are-for-the-list-of-comsol-internal-variables ? I would like to join at once. The 2d/3d plots of defined analytic function works perfectly well, though one might appreciate a choice of real/imaginary part... but ok, matlab plots real part implicitly, too. I prefered the dielectric function to the refractive index, because I thought 'epsilon' in some intended formulas would be better than 'sqrt(refrind)'. So no serious reason... boundary conditions for SPF are not complete ? - You are right. So far I have not finished SPF, or enabled to solve for. And I have sent the E field init to the support, as you have suggested. I look forward to what may come out of it. Sincerely L.Ch.

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 2, 2011, 1:21 a.m. EST
Hi

I would say luck but experience. how many years have you spent studying math and physics ? and how many different math and physics skills are you really using in COMSOL?
Try to count you will be astonished.
So I find it normal that you need time to learn and experience to use it efficiently (that's also my reason that I'm answering here: to learn more by studying the cases of others) sometime it would be nice to have some more challenging issues, but then again time is limiting (I must also sleep a little over the night ;)

By the way isnt the real/ imag plot option there now? No you are right, worth a mail to support to suggest for enhancement ;)

n,k is OK, just as epsilon (not eps) it's just that one need to ensure that we all (including COMSOL) are using the same sign convention. And to carefully check with the imaginary if its the dot() or the realdot() operator that is correct

--
Good luck
Ivar
Hi I would say luck but experience. how many years have you spent studying math and physics ? and how many different math and physics skills are you really using in COMSOL? Try to count you will be astonished. So I find it normal that you need time to learn and experience to use it efficiently (that's also my reason that I'm answering here: to learn more by studying the cases of others) sometime it would be nice to have some more challenging issues, but then again time is limiting (I must also sleep a little over the night ;) By the way isnt the real/ imag plot option there now? No you are right, worth a mail to support to suggest for enhancement ;) n,k is OK, just as epsilon (not eps) it's just that one need to ensure that we all (including COMSOL) are using the same sign convention. And to carefully check with the imaginary if its the dot() or the realdot() operator that is correct -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Jul 10, 2015, 4:57 a.m. EDT
Hi,

I just wonder whether anyone have solved this problem?
I have the same problem. In component 1, I define two variables and then I want to use the result from the component 1 of the two defined variables as initial condition for component2. I use the expression: comp1.x to fill the initial values of component2. I got the error message: fail to evaluate varibles?
Any Help?
Thanks in advance!

Best,
Leo
Hi, I just wonder whether anyone have solved this problem? I have the same problem. In component 1, I define two variables and then I want to use the result from the component 1 of the two defined variables as initial condition for component2. I use the expression: comp1.x to fill the initial values of component2. I got the error message: fail to evaluate varibles? Any Help? Thanks in advance! Best, Leo

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.