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.

COMSOL Failing at Simple DE?

Please login with a confirmed email address before reporting spam

I've encountered a very simple problem with COMSOL's eigenvalue solver and I was wondering if anyone else has had the same problem.

I'm trying to solve the simplest DE imaginable. I'm trying to find eigenmodes for the 1D wave equation.

Governing Equation:
phixx = - lambda*phi

Domain:
x in [0, pi]

Boundary Conditions:
phi(0) = phi(pi) = 0

I'm using the eigenvalue solver in the General Form PDE module.

The solutions to this problem are sine waves. phi = A*sin(sqrt(lambda)*x), where lambda = n^2 for an integer n. COMSOL solves this problem fine.


The problem comes if I try to solve this problem by introducing an auxiliary field, beta.

Governing Equation:
phix = beta
betax = -lambda * phi

Domain:
x in [0,pi]

Boundary Conditions:
phi(0) = phi(pi) = 0

This should be an equivalent problem, but COMSOL is not able to solve it correctly. All of the modes it gives me look like garbage. Frankly, I'm beginning to distrust my previous results in COMSOL because of this issue...

Has anyone encountered anything like this before?

Any help would be appreciated,
-Julian

3 Replies Last Post 11.03.2013, 17:11 GMT-4
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 01.03.2013, 03:56 GMT-5
Hi

I cannot help much from your explanations, it would be easier to have the model though.

But what I can tell you that I have very seldom caught COMSOL giving wrong results, far more often it's me who had missed a BC, not respected a mesh density, or forgotten to tick one of the numerous settings ...

Sometimes it helps by remaking the model from scratch, making it simpler, then adding complexity (even whn you think your model is "very" simple ;)

--
Good luck
Ivar
Hi I cannot help much from your explanations, it would be easier to have the model though. But what I can tell you that I have very seldom caught COMSOL giving wrong results, far more often it's me who had missed a BC, not respected a mesh density, or forgotten to tick one of the numerous settings ... Sometimes it helps by remaking the model from scratch, making it simpler, then adding complexity (even whn you think your model is "very" simple ;) -- Good luck Ivar

Nagi Elabbasi Facebook Reality Labs

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 01.03.2013, 09:25 GMT-5
Hi Julian,

Even though both sets of equation you provided are equivalent the solution method COMSOL applies to them are not. With the second set of equations COMSOL is discretizing two independent fields, phi and beta. I don’t remember now if there is a theoretical or numerical reason why that set of discretized first order equations would not work with the provided eigensolver. However, if you define phix=beta as a variable field instead of a governing equation I believe it should work.

Nagi Elabbasi
Veryst Engineering
Hi Julian, Even though both sets of equation you provided are equivalent the solution method COMSOL applies to them are not. With the second set of equations COMSOL is discretizing two independent fields, phi and beta. I don’t remember now if there is a theoretical or numerical reason why that set of discretized first order equations would not work with the provided eigensolver. However, if you define phix=beta as a variable field instead of a governing equation I believe it should work. Nagi Elabbasi Veryst Engineering

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 11.03.2013, 17:11 GMT-4
Hi Nagi,

Thanks for your suggestion. It was very helpful. Unfortunately, while your suggestion DOES let me run a first order version of the wave equation, it does not totally solve my problem.

I've attached four files. All four are trying to solve the equation phixx = -lambda*phi.

nobeta.mph - Solves the equation directly. This solution works.

beta_var.mph - Recasts phixx = -lambda*phi as a first order equation by beta = phix. Here, beta is a variable, but not a dependent variable (your suggestion, Nagi). This solution works, but only allows me to compute derivatives of phi to second order.

beta_dep.mph - Again, sets beta = phix, but this time makes beta a dependent variable. This solution does NOT work.

beta_dep2.mph - Here, we set beta = phixx, with beta as a dependent variable. This solution works AND allows me to compute derivatives of phi to fourth order.


I'm asking this because I want to solve a more difficult equation that depends on a third derivative of phi. To accomplish this, I think I need to set beta = phixx to be a dependent variable. I would like to know the reason why beta=phix fails as a dependent variable while beta=phixx appears to be working fine.


Again, thank you so much for the comments so far. They've been very helpful and I feel like I'm *close* to understanding this problem.
-Julian
Hi Nagi, Thanks for your suggestion. It was very helpful. Unfortunately, while your suggestion DOES let me run a first order version of the wave equation, it does not totally solve my problem. I've attached four files. All four are trying to solve the equation phixx = -lambda*phi. nobeta.mph - Solves the equation directly. This solution works. beta_var.mph - Recasts phixx = -lambda*phi as a first order equation by beta = phix. Here, beta is a variable, but not a dependent variable (your suggestion, Nagi). This solution works, but only allows me to compute derivatives of phi to second order. beta_dep.mph - Again, sets beta = phix, but this time makes beta a dependent variable. This solution does NOT work. beta_dep2.mph - Here, we set beta = phixx, with beta as a dependent variable. This solution works AND allows me to compute derivatives of phi to fourth order. I'm asking this because I want to solve a more difficult equation that depends on a third derivative of phi. To accomplish this, I think I need to set beta = phixx to be a dependent variable. I would like to know the reason why beta=phix fails as a dependent variable while beta=phixx appears to be working fine. Again, thank you so much for the comments so far. They've been very helpful and I feel like I'm *close* to understanding this problem. -Julian

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.