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.

Converting a 2D time-dependent PDE into the Weak Form in Comsol

Please login with a confirmed email address before reporting spam

Hello,

How to transform the equation attached into the weak form in comosl? I'm struggling in representing the highlighed parts. Am I doing something wrong when breaking down the equation? Thanks!

Regards, Eman



4 Replies Last Post 2020年4月8日 GMT-4 06:50

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 2020年3月4日 GMT-5 10:20

Seems like you are trying to convert the Diffusion equation. The second term on the first line should be the divergence of the gradient of P, not the gradient of the gradient, which doesn't make sense mathematically. You can then use vector calculus identites to obtain a term div(Dgrad(P)test(P)). Then use the divergence theorem to obtain an integral at the boundary only.

Let me know if you need further help,

Alex

Seems like you are trying to convert the Diffusion equation. The second term on the first line should be the divergence of the gradient of P, not the gradient of the gradient, which doesn't make sense mathematically. You can then use vector calculus identites to obtain a term div(D*grad(P)*test(P)). Then use the divergence theorem to obtain an integral at the boundary only. Let me know if you need further help, Alex

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 2020年3月5日 GMT-5 09:12

Hello Alex,

Thank you for your reply. Yes, you are right, it is the diffusion equation, it worked well with the coefficient form PDE interface in Comsol.

Can you please explain further? do you mean I don't need to break down the 2nd term, but just use div(Dgrad(P)test(P) in the weak form equation part along with the rest of the equation? how is that I used the gradient twice? how to set the integral for the boundary only? I know that in comsol we can either set the weak contribution as a BC or use a ready BC such as Dirichlet Boundary condition.

I tried many things by now, but I keep getting the error (Repeated error test failures. May have reached a singularity. Time: 0.11456355169943476, Undefined value found., Undefined value found in the stiffness matrix., There are 3 equations giving NaN/Inf in the matrix rows for the variable comp1.Pb., at coordinates: )

Which indicates that I'm missing some boundary conditions.

Thanks!

Eman

Hello Alex, Thank you for your reply. Yes, you are right, it is the diffusion equation, it worked well with the coefficient form PDE interface in Comsol. Can you please explain further? do you mean I don't need to break down the 2nd term, but just use div(Dgrad(P)test(P) in the weak form equation part along with the rest of the equation? how is that I used the gradient twice? how to set the integral for the boundary only? I know that in comsol we can either set the weak contribution as a BC or use a ready BC such as Dirichlet Boundary condition. I tried many things by now, but I keep getting the error (Repeated error test failures. May have reached a singularity. Time: 0.11456355169943476, Undefined value found., Undefined value found in the stiffness matrix., There are 3 equations giving NaN/Inf in the matrix rows for the variable comp1.Pb., at coordinates: ) Which indicates that I'm missing some boundary conditions. Thanks! Eman

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 2020年3月5日 GMT-5 15:18
Updated: 5 years ago 2020年3月5日 GMT-5 15:24

Hi Eman,

Maybe you need to freshen up on your vector calculus. I have attached the equation I'm talking about. You will need to convert the first term on the right hand side into a boundary term by using the Divergence theorem (https://www.wikiwand.com/en/Divergence_theorem). This term will end up being input as a Zero Flux node by default, which you can change by adding a Weak Contribution or a Flux/Source node.

Cheers,

Alex

Hi Eman, Maybe you need to freshen up on your vector calculus. I have attached the equation I'm talking about. You will need to convert the first term on the right hand side into a boundary term by using the Divergence theorem (https://www.wikiwand.com/en/Divergence_theorem). This term will end up being input as a Zero Flux node by default, which you can change by adding a Weak Contribution or a Flux/Source node. Cheers, Alex


Please login with a confirmed email address before reporting spam

Posted: 5 years ago 2020年4月8日 GMT-4 06:50

Many thanks, Alex.

Many thanks, Alex.

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.