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.

A spatially varying function does not appear to vary spatially

Please login with a confirmed email address before reporting spam

Hi! I'm using comsol 5.2a. I've found a function for results from another comsol file, and I'd like to use that function to describe it in another file in order to save file size and computational time.

I've defined it as a variable with lots of parameters associated, as shown in the screenshot. I went to check that it was working correctly but unfortunately comsol believes the function is actually a constant - the value of the function at it's maximum (x=0). What's going on here?

Thanks!


4 Replies Last Post 2017年4月5日 GMT-4 11:49

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 2017年4月3日 GMT-4 16:59
Joshua

That's weird. These are things that I would do:

1) Check the values of a1, a2, a3, ...to make sure they are non-zero.

2) Make sure you have plotted your defined variable "surfacecharge" not anything else defined by COMSOL.

3) Check the units of b1, b2, b3, b4, ... and see if the products of bi*x in the parentheses are comparable to ci. If not, you should expect a constant function rather than a sine function.

I think (3) is probably the issue.

Amin,
Joshua That's weird. These are things that I would do: 1) Check the values of a1, a2, a3, ...to make sure they are non-zero. 2) Make sure you have plotted your defined variable "surfacecharge" not anything else defined by COMSOL. 3) Check the units of b1, b2, b3, b4, ... and see if the products of bi*x in the parentheses are comparable to ci. If not, you should expect a constant function rather than a sine function. I think (3) is probably the issue. Amin,

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 2017年4月4日 GMT-4 10:36
Hi Mohammad, thanks for the response. I've screencapped the relevent part of the parameters list for you in parameters.png. The parameters are non-zero. The a parameters have units of surface charge density, the b parameters have inverse spatial units so to cancel b*x to be unitless, which is compatible with the c parameters which are also unitless.

I also changed the variable to "surfacechargerrr" with the plot also changed, just in case comsol reserves the string "surfacecharge", but it still displays the same thing.

I have previously tried to plot another constant called omega0 which can be seen in straightline.png, but this depends on fermienergy too so that isn't too surprising.

I initially thought that perhaps it had to do with the order the variables are listed in, but for some reason the ability to move the order has been greyed out for me. I can manually delete the ones above it and input them in the correct order again, but after saving and reopening, they are back in the wrong order. It doesn't seem to matter in this case though, as comsol seems to recognize all the variables regardless of order.

Would you like me to send you the file? I'd rather not send it in public, as it is private research material, but if you'd like to make a temporary email address (temp-mail.org, mytemp.email etc) I can send it over.
Hi Mohammad, thanks for the response. I've screencapped the relevent part of the parameters list for you in parameters.png. The parameters are non-zero. The a parameters have units of surface charge density, the b parameters have inverse spatial units so to cancel b*x to be unitless, which is compatible with the c parameters which are also unitless. I also changed the variable to "surfacechargerrr" with the plot also changed, just in case comsol reserves the string "surfacecharge", but it still displays the same thing. I have previously tried to plot another constant called omega0 which can be seen in straightline.png, but this depends on fermienergy too so that isn't too surprising. I initially thought that perhaps it had to do with the order the variables are listed in, but for some reason the ability to move the order has been greyed out for me. I can manually delete the ones above it and input them in the correct order again, but after saving and reopening, they are back in the wrong order. It doesn't seem to matter in this case though, as comsol seems to recognize all the variables regardless of order. Would you like me to send you the file? I'd rather not send it in public, as it is private research material, but if you'd like to make a temporary email address (temp-mail.org, mytemp.email etc) I can send it over.


Please login with a confirmed email address before reporting spam

Posted: 8 years ago 2017年4月4日 GMT-4 12:09
Jashua
I'd be happy to help you. But, no need to send your file. Just look at the terms in the sine function. They are not in the same order of magnitude. Therefore, the sine functions are almost constant and do not vary with variable x.
For instance, lets look at sin(b1x+c1):
b1x=0.2094[1/m]*15*1e-6[m]=0.00000314
while c1=1.571
Thus:
sin(b1x+c1)~sin(c1)
sin(b2x+c2)~sin(c2)
sin(b3x+c3)~sin(c3)
sin(b4x+c4)~sin(c4)
...
Try to change the units of b1, b2, b3, ... to micrometers and see the difference.
Amin,
Jashua I'd be happy to help you. But, no need to send your file. Just look at the terms in the sine function. They are not in the same order of magnitude. Therefore, the sine functions are almost constant and do not vary with variable x. For instance, lets look at sin(b1x+c1): b1x=0.2094[1/m]*15*1e-6[m]=0.00000314 while c1=1.571 Thus: sin(b1x+c1)~sin(c1) sin(b2x+c2)~sin(c2) sin(b3x+c3)~sin(c3) sin(b4x+c4)~sin(c4) ... Try to change the units of b1, b2, b3, ... to micrometers and see the difference. Amin,

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 2017年4月5日 GMT-4 11:49
Perfect, that fixed it. I changed the units from micrometres to metres and b*x became comparable to c. Matlab was able to render the tiny variation but Comsol was not so I guess there is a decimal difference there or something.

Thank you very much!
Perfect, that fixed it. I changed the units from micrometres to metres and b*x became comparable to c. Matlab was able to render the tiny variation but Comsol was not so I guess there is a decimal difference there or something. Thank you very much!

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.