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 Spatial Derivatives

Please login with a confirmed email address before reporting spam

Hi,

I am trying to use a third order spatial derivative in an equation for a variable, but it does not seem to be working out. For example, I want to know d(d(d(A, x),x),x) to obtain the third derivative of A in the x direction, but keep getting 0 when I know what isn't the answer.

I have tried the PDE solver, to no avail. And, I have tried substituting a variable name for a lower derivative, via
B = d(d(A,x),x)
d(B,x)

But that produced an answer of zero also. What to do?

9 Replies Last Post 2010年9月30日 GMT-4 10:39
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 2010年9月28日 GMT-4 17:36
Hi

have you tried to plot d(A,x), and then d(d(A,x),x) ... just to see how they look ?

--
Good luck
Ivar
Hi have you tried to plot d(A,x), and then d(d(A,x),x) ... just to see how they look ? -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年9月28日 GMT-4 17:42
Yep. They're fine. Any way that I try to find the second derivative, things work perfectly. Its the third that's giving me trouble.
Yep. They're fine. Any way that I try to find the second derivative, things work perfectly. Its the third that's giving me trouble.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年9月28日 GMT-4 18:07
Here is an example of what I mean. When Txy is plotted along y, clearly there is still a gradient. However, when plotting d(Txy,y) or a new variable called Txyy, all thats returned is zero.
Here is an example of what I mean. When Txy is plotted along y, clearly there is still a gradient. However, when plotting d(Txy,y) or a new variable called Txyy, all thats returned is zero.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年9月29日 GMT-4 16:54
Well, i can't open your model, since this is V4?

However, you just get zeros while deriving spatial derivatives in postprocessing mode?

May be this is because COMSOL gets these derivatives out of the shape functions. E.g. if you are using second order shape functions, the third derivative would be always zero, just due to the fact, that the third derivation of this 2.order polynom is always zero. In COMSOL V3.5a you can use "Recover" option in postprocessing options. Then COMSOL calculates the spatial derivativs in another (slower) more accurate (may be not zero) way (new approximation of the depedent variable to another polynom). See the doc.

Another option would be, if you increase the order of your shape/basis functions. This will increase your DoF, too.



Well, i can't open your model, since this is V4? However, you just get zeros while deriving spatial derivatives in postprocessing mode? May be this is because COMSOL gets these derivatives out of the shape functions. E.g. if you are using second order shape functions, the third derivative would be always zero, just due to the fact, that the third derivation of this 2.order polynom is always zero. In COMSOL V3.5a you can use "Recover" option in postprocessing options. Then COMSOL calculates the spatial derivativs in another (slower) more accurate (may be not zero) way (new approximation of the depedent variable to another polynom). See the doc. Another option would be, if you increase the order of your shape/basis functions. This will increase your DoF, too.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年9月29日 GMT-4 17:08
It happens whether I try to calculate it in postprocessing and if I name it to a variable and try to calculate it with the solution. Its not a new function that I am writing. Its the solution itself. For example, I want to know the third order of the resulting temperature gradient of a heat transfer problem.
It happens whether I try to calculate it in postprocessing and if I name it to a variable and try to calculate it with the solution. Its not a new function that I am writing. Its the solution itself. For example, I want to know the third order of the resulting temperature gradient of a heat transfer problem.

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 2010年9月29日 GMT-4 17:50
Hi

but the argument advanced: that with second order elements (the default of COMSOL) we can get out at most the second derivative (any higher derivatives are equal = 0) is clearly a good argument.

There is some remarks in the doc reminding this, but I havent manaage to find it back just now ;)

--
Good luck
Ivar
Hi but the argument advanced: that with second order elements (the default of COMSOL) we can get out at most the second derivative (any higher derivatives are equal = 0) is clearly a good argument. There is some remarks in the doc reminding this, but I havent manaage to find it back just now ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年9月29日 GMT-4 17:57

What's interesting is that I HAVE been able to get third order derivatives in a 2D model, but not a 3D one.
What's interesting is that I HAVE been able to get third order derivatives in a 2D model, but not a 3D one.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年9月29日 GMT-4 19:10
I did a quick test on 1D heattransfer.

I always get zero for d(Txx,x), altough Txx is definitely not constant. Even when i use "recover" or quintic elements. (I'm using V3.5a)

A quick workaround is to calculate the derivative with an extern program - matlab connection or other Math tools (there are many: Octave, Origin, ....)
I did a quick test on 1D heattransfer. I always get zero for d(Txx,x), altough Txx is definitely not constant. Even when i use "recover" or quintic elements. (I'm using V3.5a) A quick workaround is to calculate the derivative with an extern program - matlab connection or other Math tools (there are many: Octave, Origin, ....)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年9月30日 GMT-4 10:39
I could do that, but I need the third derivative for another calculation within Comsol, so finding it in post-processing doesn't solve my problem. Our company does not have the license for the LiveLink for Matlab, which I believe you need in order to work with the two together.... is that right? This was always my belief so I've never even tried using Matlab with Comsol.

Nonetheless, this seems like a relatively straightforward issue and there ought to be a way to figure it out within Comsol alone. I have no clue why/ how I got it to work in 2D when it doesn't in 3D or 1D. Odd.
I could do that, but I need the third derivative for another calculation within Comsol, so finding it in post-processing doesn't solve my problem. Our company does not have the license for the LiveLink for Matlab, which I believe you need in order to work with the two together.... is that right? This was always my belief so I've never even tried using Matlab with Comsol. Nonetheless, this seems like a relatively straightforward issue and there ought to be a way to figure it out within Comsol alone. I have no clue why/ how I got it to work in 2D when it doesn't in 3D or 1D. Odd.

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.