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.

Higher order derivatives in the RF interface

Please login with a confirmed email address before reporting spam

Hi

I am solving a scattering problem using the scattered field formulation in the RF module.

I would like to compute a second spacial derivative of the electric field:

d(d(relEx,x),x)

Unfortunately, this second derivative always gives zero, which is not the expected result. The first derivative works fine.

According to the doc, the order of the shape functions needs to be one higher than the highest order derivative that can be computed from it. So in my case I set the "Element order" in the advanced tap for the RF module in Comsol 4.1 to "Cubic" (it was set to "Quadratic" by default). Unfortunately, it still doesn't work.

In the documentation it says "Some physics interfaces use special element types or a reduced element order for some of the field variables". Does anyone know if the scattered electric field is one of these variables for which the element order has been reduced? And if so, is there any way to still get the second derivative for it?

Thanks!

15 Replies Last Post Apr 14, 2011, 2:28 p.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 Apr 12, 2011, 1:13 p.m. EDT
Hi

Have you tried to plot Exxx = d(d(Ex)/dx)/dx ?, if yu solve for E =(Ex,Ey,Ez) then these should be the quickest way to access them. Since the dependent variable is E, one could believe that the second derivative is there, but perhaps not (linked to curl shape element solving ?)

But I agree Exxx and dExx,x) both gives "0" for my first test. I believe this has been discussed before, try a search on the Forum. But I cannot remeber what were the outcome

--
Good luck
Ivar
Hi Have you tried to plot Exxx = d(d(Ex)/dx)/dx ?, if yu solve for E =(Ex,Ey,Ez) then these should be the quickest way to access them. Since the dependent variable is E, one could believe that the second derivative is there, but perhaps not (linked to curl shape element solving ?) But I agree Exxx and dExx,x) both gives "0" for my first test. I believe this has been discussed before, try a search on the Forum. But I cannot remeber what were the outcome -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 12, 2011, 3:01 p.m. EDT
Hi Ivar,

Thanks for your reply.

In your reply, when you wrote d(d(Ex)/dx)/dx did you mean that I should type d(d(Ex,x),x)? The syntax d(d(Ex)/dx)/dx triggers an error on my installation of comsol 4.1.

I have read more about how the shape functions work, but still haven't found the answer. I did learn that the electric field is stored in vector type shape functions rather than Lagrange shape functions. Also, vector shape functions appear to not allow for derivative recovery using the ppr (polynomial-preserving recovery) operator, which may be used when working with Lagrange shape functions that have a lower order than the derivative one seeks to compute. However, I did set the 'element order' for the electric field to cubic, which should allow for a second derivative to be evaluated.

By the way, the expression I would ultimately like to evaluate is del^2*E, which is a vector v with components
v1=Ex,xx+Ex,yy+Ex,zz,
v2=Ey,xx+Ey,yy+Ey,zz,
v3=Ez,xx+Ez,yy+Ez,zz.

Please let me know if you have any other ideas!
Hi Ivar, Thanks for your reply. In your reply, when you wrote d(d(Ex)/dx)/dx did you mean that I should type d(d(Ex,x),x)? The syntax d(d(Ex)/dx)/dx triggers an error on my installation of comsol 4.1. I have read more about how the shape functions work, but still haven't found the answer. I did learn that the electric field is stored in vector type shape functions rather than Lagrange shape functions. Also, vector shape functions appear to not allow for derivative recovery using the ppr (polynomial-preserving recovery) operator, which may be used when working with Lagrange shape functions that have a lower order than the derivative one seeks to compute. However, I did set the 'element order' for the electric field to cubic, which should allow for a second derivative to be evaluated. By the way, the expression I would ultimately like to evaluate is del^2*E, which is a vector v with components v1=Ex,xx+Ex,yy+Ex,zz, v2=Ey,xx+Ey,yy+Ey,zz, v3=Ez,xx+Ez,yy+Ez,zz. Please let me know if you have any other ideas!

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 13, 2011, 5:35 a.m. EDT
Yep, a similar problem was discussed in a previous thread. To my astonishment increasing the order of the shape functions didn't solve the higher-order-derivative=0-problem. I think, the solution was to do it with matlab ....
Yep, a similar problem was discussed in a previous thread. To my astonishment increasing the order of the shape functions didn't solve the higher-order-derivative=0-problem. I think, the solution was to do it with matlab ....

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 13, 2011, 5:51 a.m. EDT
Interesting! I didn't find the thread you were referring to. Do you have a rough idea when it was posted or any other keywords that may help me to find it?
Interesting! I didn't find the thread you were referring to. Do you have a rough idea when it was posted or any other keywords that may help me to find it?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 13, 2011, 7:22 a.m. EDT
Are you sure that the derivative does not blow up at any point in the field? In my experience, Comsol 3.5a always gave me a zero all over the place if there were singularities at any place/point within the domain.

If that is true, then may be you can simply export all the field values to Matlab and compute the derivative there. If it is possible in context of the problem you are trying to solve.
Are you sure that the derivative does not blow up at any point in the field? In my experience, Comsol 3.5a always gave me a zero all over the place if there were singularities at any place/point within the domain. If that is true, then may be you can simply export all the field values to Matlab and compute the derivative there. If it is possible in context of the problem you are trying to solve.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 13, 2011, 7:33 a.m. EDT
www.comsol.de/community/forums/general/thread/9776/
http://www.comsol.de/community/forums/general/thread/9776/

Magnus Olsson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 13, 2011, 7:47 a.m. EDT
Hello,

This is because the vector element family ("shcurl") in COMSOL only defines first order spatial derivatives for postprocessing. A workaround is to define a second field (u1,u2,u3) using Lagrange elements and assign (Ex,Ey,Ez) to it. You can of course also assign first order spatial derivatives of E to (u1,u2,u3) - in that case you can also use vector elements for (u1,u2,u3).

In general, higher order derivatives tend to be quite noisy.

Best regards,

Magnus Olsson
COMSOL
Hello, This is because the vector element family ("shcurl") in COMSOL only defines first order spatial derivatives for postprocessing. A workaround is to define a second field (u1,u2,u3) using Lagrange elements and assign (Ex,Ey,Ez) to it. You can of course also assign first order spatial derivatives of E to (u1,u2,u3) - in that case you can also use vector elements for (u1,u2,u3). In general, higher order derivatives tend to be quite noisy. Best regards, Magnus Olsson COMSOL

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 13, 2011, 7:54 a.m. EDT
Let's say you're able to post-process the second derivative of a quantity, u, but not its third derivative. I believe you can add a PDE physics interface for a variable u2 and set it up to solve the trivial equation u2=d^2u/dx^2. Then you should be able to access du2/dx.
Let's say you're able to post-process the second derivative of a quantity, u, but not its third derivative. I believe you can add a PDE physics interface for a variable u2 and set it up to solve the trivial equation u2=d^2u/dx^2. Then you should be able to access du2/dx.

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 Apr 13, 2011, 7:55 a.m. EDT
Hi

my notation effort was to make it less ambiguous, may not have managed. With COMSOL the diff() operator is d(,) see the doc

--
Good luck
Ivar
Hi my notation effort was to make it less ambiguous, may not have managed. With COMSOL the diff() operator is d(,) see the doc -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 13, 2011, 8:01 a.m. EDT
Hi,

You can get your higher order derivatives if you introduce a new PDE: (1D) u=d(d(T,x),x)

-> add PDE coefficient form

a=1
f=d(d(T,x),x)

leftover coefficients =0



then you can get your 3rd and 4th order x-derivatives by 'ux' respectively 'uxx'

have a look at the attached file (V3.5a) with a 1D example.

But still, I don't understand, why it isn't possible to get a 3rd order derivative, if quintic order lagrange elements are used.

regards

edit: some were faster :)


Hi, You can get your higher order derivatives if you introduce a new PDE: (1D) u=d(d(T,x),x) -> add PDE coefficient form a=1 f=d(d(T,x),x) leftover coefficients =0 then you can get your 3rd and 4th order x-derivatives by 'ux' respectively 'uxx' have a look at the attached file (V3.5a) with a 1D example. But still, I don't understand, why it isn't possible to get a 3rd order derivative, if quintic order lagrange elements are used. regards edit: some were faster :)


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 Apr 13, 2011, 8:51 a.m. EDT
Hi Kai

In v4.1.0.85 it gives this:

OK up to third derivative, 4th has a scaling issue ?

each derivative is divided by 2*pi*freq for normalization.

Why is TT=PDE of Txx renormalized to 1? ===> it's not, I was too quick, I forgot about my renormalization ;)

But why is TTxx at *5 the expected amplitude ===> not understood

--
Having (less?) fun COMSOLing
Ivar
Hi Kai In v4.1.0.85 it gives this: OK up to third derivative, 4th has a scaling issue ? each derivative is divided by 2*pi*freq for normalization. Why is TT=PDE of Txx renormalized to 1? ===> it's not, I was too quick, I forgot about my renormalization ;) But why is TTxx at *5 the expected amplitude ===> not understood -- Having (less?) fun COMSOLing Ivar


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 14, 2011, 4:32 a.m. EDT
Hi Ivar,

indeed, the 4th derivation is too high (approx. 5 times). If I switch to quartic elements for 'T', there is no 'scaling' issue anymore. -> Txxxx/((2*pi*f)^4)=T

So it's a numeric issue?!?

That's what you mentioned?

Having (even more!) fun COMSOLing ;)

Hi Ivar, indeed, the 4th derivation is too high (approx. 5 times). If I switch to quartic elements for 'T', there is no 'scaling' issue anymore. -> Txxxx/((2*pi*f)^4)=T So it's a numeric issue?!? That's what you mentioned? Having (even more!) fun COMSOLing ;)


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 Apr 14, 2011, 4:39 a.m. EDT
Hi

I agree using quadratics you can get 4th derivative, but do you then really need "TT", the second PDE solution

This does not fully convince me (yet) for the second PDE I'm using for TT

--
Good luck
Ivar
Hi I agree using quadratics you can get 4th derivative, but do you then really need "TT", the second PDE solution This does not fully convince me (yet) for the second PDE I'm using for TT -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 14, 2011, 4:56 a.m. EDT
Hi,

what do you mean? I never used 'TT'. My new dependent variable for my PDE is 'u'. It's a converting problem from 3.5 to 4.1?

Even though you use quartics, you can't get the 4th derivative out of the original variable 'T', because 'd(Txx,x)' and 'd(d(Txx,x),x)' are always zero. Therefore I have to introduce a new PDE ('u').

best regards
Hi, what do you mean? I never used 'TT'. My new dependent variable for my PDE is 'u'. It's a converting problem from 3.5 to 4.1? Even though you use quartics, you can't get the 4th derivative out of the original variable 'T', because 'd(Txx,x)' and 'd(d(Txx,x),x)' are always zero. Therefore I have to introduce a new PDE ('u'). best regards

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 Apr 14, 2011, 2:28 p.m. EDT
Hi

Sorry, when translating to 4.1 I mixed up u and u2, so I renamed them T and TT. Then as I was playing with the shape functions of u2 or my TT I did not manage to improve things, what I forgot was that the source is u (or my T) and I did only leave it as a quadratic.

Now it could be that in V4 the higher derivatives with d(uxx,x) are calculated correctly, I will have to check so one do not need to add the PDE, it would be rather logical (for me) that a higher order shape function allows to take higher derivatives without any additional PDE artifact

--
Anyhow, having fun Comsoling
Ivar
Hi Sorry, when translating to 4.1 I mixed up u and u2, so I renamed them T and TT. Then as I was playing with the shape functions of u2 or my TT I did not manage to improve things, what I forgot was that the source is u (or my T) and I did only leave it as a quadratic. Now it could be that in V4 the higher derivatives with d(uxx,x) are calculated correctly, I will have to check so one do not need to add the PDE, it would be rather logical (for me) that a higher order shape function allows to take higher derivatives without any additional PDE artifact -- Anyhow, having fun Comsoling 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.