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 Apr 8, 2020, 6:50 a.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 4 years ago Mar 4, 2020, 10:20 a.m. EST

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: 4 years ago Mar 5, 2020, 9:12 a.m. EST

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: 4 years ago Mar 5, 2020, 3:18 p.m. EST
Updated: 4 years ago Mar 5, 2020, 3:24 p.m. EST

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: 4 years ago Apr 8, 2020, 6:50 a.m. EDT

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.