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.

how many boundary condition should be imposed on spatially first order differential equation in comsol?

Please login with a confirmed email address before reporting spam

I'd like to solve a 1st order differential equation like this in 1d domain:

du/dx =u
x in [0,2]
u(0) = 1000

while I was using the General Form PDE in stationary , there are two boundary point in x=0 and x=2.
the default condition is zero flux condition at both ends. However, for a 1st order equation there should be only one boundary condition. zero flux at x = 2 is over-determinant for this problem.

The results obtained is also oscillating as shown in the attachment.

So, my question is: what condition should I impose at x=2? for this kind of equation?



8 Replies Last Post 07.02.2015, 02:56 GMT-5

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 24.01.2015, 07:49 GMT-5
Hi

Your question is more like calculus than FEM problem. Of course you are right, the solution is in closed form

u(x) = 1000*exp(x)

and boundary condition u(2) is overkilling. But if the problem were

du/dx = k*u

the solution would be

u(x) = 1000*exp(k*x)

and, e.g., a boundary condition u(2) = b would require that k =½*ln(b/1000); zero flux condition is not possible, neither u(2) = 0.

Lasse
Hi Your question is more like calculus than FEM problem. Of course you are right, the solution is in closed form u(x) = 1000*exp(x) and boundary condition u(2) is overkilling. But if the problem were du/dx = k*u the solution would be u(x) = 1000*exp(k*x) and, e.g., a boundary condition u(2) = b would require that k =½*ln(b/1000); zero flux condition is not possible, neither u(2) = 0. Lasse

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 03.02.2015, 23:00 GMT-5
So, If the ODE is very complex, what B.C. should I impose at x=2?

I am not sure if using COMSOL to solve parabolic equation is a right choice.
So, If the ODE is very complex, what B.C. should I impose at x=2? I am not sure if using COMSOL to solve parabolic equation is a right choice.

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 04.02.2015, 05:23 GMT-5
Hi

I do not quite understand your question. What do you mean by a complex ODE? Heat transfer and diffusion equations are examples of a parabolic PDEs which are solved with Comsol in several physics. Boundary conditions depend on your physical situation. Your original equation was a first order ODE, and only one BC is needed.

br
Lasse
Hi I do not quite understand your question. What do you mean by a complex ODE? Heat transfer and diffusion equations are examples of a parabolic PDEs which are solved with Comsol in several physics. Boundary conditions depend on your physical situation. Your original equation was a first order ODE, and only one BC is needed. br Lasse

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 04.02.2015, 22:34 GMT-5
I mean mathematically, I cannot solve a 1st order ODE with two BCs. right? But in comsol, I cannot just set one BC during setting the problem. If I do not set BC at x = x_end, the system will impose a default BC for me. This will cause a mathematical fallacy. And the result is also wrong.

Your previous solution is to solve the ODE first, and set the BC at another end using the correct value. I think it is a kind of cheating, right? If I can solve the ODE, why I have to set the BC?
I mean mathematically, I cannot solve a 1st order ODE with two BCs. right? But in comsol, I cannot just set one BC during setting the problem. If I do not set BC at x = x_end, the system will impose a default BC for me. This will cause a mathematical fallacy. And the result is also wrong. Your previous solution is to solve the ODE first, and set the BC at another end using the correct value. I think it is a kind of cheating, right? If I can solve the ODE, why I have to set the BC?

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 05.02.2015, 01:34 GMT-5
What is the physics behind your equation? Google a two point boundary value problem, and you'll see that there are no first order ODEs. You are trying to do something unphysical.

br
Lasse
What is the physics behind your equation? Google a two point boundary value problem, and you'll see that there are no first order ODEs. You are trying to do something unphysical. br Lasse

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 06.02.2015, 03:19 GMT-5
It is a simple quasi-1d compressible flow equation of motion with known pressure distribution and friction factor

u: velocity of gas, unknown
cf: 0.003, Darcy friction factor
qm: mass flow rate, qm(x) is known
A: area, A(x) is measured
Cw: wetting perimeter, Cw(x) is known
x: axial distance. 0<=x<=2
p: pressure, p(x) is measured

du/dx = -A/qm*(dp/dx) - cf*u/2/A*Cw - u/qm*(dqm/dx)
u(0) = u0

This is the equation I need to solve. What is the BC at x=2?

I do not have second BC for my problem, I did not set the second BC either. But the comsol set it for me automatically.

It seems that comsol cannot be used to solve IVP in 1d space.

It is a simple quasi-1d compressible flow equation of motion with known pressure distribution and friction factor u: velocity of gas, unknown cf: 0.003, Darcy friction factor qm: mass flow rate, qm(x) is known A: area, A(x) is measured Cw: wetting perimeter, Cw(x) is known x: axial distance. 0

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 06.02.2015, 04:32 GMT-5
This is entirely different problem from that you initially disclosed, as you do not have constant coefficients. Still, only one BC should suffice, it is not question of the dimension. If all the variables depending on x can be expressed with closed form functions, I would use Matlab's Runge-Kutta algorithm. If the variables are given as a table of values and interpolation between the measured points must be used, I have no experience of doing that in Comsol, I am sorry.

br
Lasse
This is entirely different problem from that you initially disclosed, as you do not have constant coefficients. Still, only one BC should suffice, it is not question of the dimension. If all the variables depending on x can be expressed with closed form functions, I would use Matlab's Runge-Kutta algorithm. If the variables are given as a table of values and interpolation between the measured points must be used, I have no experience of doing that in Comsol, I am sorry. br Lasse

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 07.02.2015, 02:56 GMT-5
I think they are the same problem. du/dx = f(u,x;p), p is given parameters including spline coeff.s to fit with experiment data, which is pre-defined before ODE solver runs. It does not matter whether the coeff.s are constants or varies with x. I used python odeint in scipy to solve this. constant friction coeff. is not a problem.

I think the problem is the default behavior of comsol. It impose a default B.C. for 1d-ODE at unspecified end, which make the equation over-determined. I do not know what happend next, but I can still produce a result to meet the over-determined ode.

The general form of PDE in comsol includes d^2u/dx^2 terms, which means it is designed to solve 2nd PDE. I think comsol should have some limit on the coeff. of general form of PDE, or illegal BC will cause misleading and confusing results.
I think they are the same problem. du/dx = f(u,x;p), p is given parameters including spline coeff.s to fit with experiment data, which is pre-defined before ODE solver runs. It does not matter whether the coeff.s are constants or varies with x. I used python odeint in scipy to solve this. constant friction coeff. is not a problem. I think the problem is the default behavior of comsol. It impose a default B.C. for 1d-ODE at unspecified end, which make the equation over-determined. I do not know what happend next, but I can still produce a result to meet the over-determined ode. The general form of PDE in comsol includes d^2u/dx^2 terms, which means it is designed to solve 2nd PDE. I think comsol should have some limit on the coeff. of general form of PDE, or illegal BC will cause misleading and confusing results.

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.