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.

Solving differential equations (Diffusion and Reaction) using the Mathematics Physics

Mikael Noerregaard Nielsen

Please login with a confirmed email address before reporting spam

Hi all

I'm trying to learn a bit of mathematical modeling of chemical reactions whilst combining it with the Mathematics physics of COMSOL. I am however, in a bit of trouble and I hope you can help me out with a few problems.

Problem 1) - Example 8.4
I have the following second order differential equation with the boundary conditions:
d^2y/dx^2-phi^2*y=0
x=0, dy/dx=0
x=1, y=1
This yields the analytical solution: y=cosh(phi*x)/cosh(phi).
My numerical solution is implemented using the General Form (PDE) in 1-D and writing the following as the source term with remaining parameters equal to zero:
f = -d^2y/dx^2+phi^2*y
with zero flux at x=0 and Dirichlet (y=1) at x=1.
The solutions are (I feel) pretty off, as the equations are relatively simple.

Problem 2) - Example 8.5
Equations are the same however, I now change the Dirichlet boundary condition to a Robin bc.
The bc is giving as:
x=1, dy/dx=Bi*(1-y), where y is evaluated a x=1
This produces the analytical solution:
y=cosh(phi*x)/(cosh(phi)+(phi/Bi)*sinh(phi))
I have tried implementing the Robin bc through the flux/source bc in COMSOL where g and q both are equal to Bi.
My numerical solution is off and doesn't seem to change with changing the parameter Bi.

Any help would be greatly appreciated. Models are attached as example 8.4 for problem 1 and example 8.5 for problem 2.

Best regards

Mikael





3 Replies Last Post 2015年11月26日 GMT-5 10:27
Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2015年11月26日 GMT-5 03:03
Hi,

In both cases, you should put the d^2y/dx^2 term into the Gamma coefficient in the General Form PDE settings as

yx (that is, dy/dx)

to make the problem better posed.

Also, in example 8.5, to match

-n.Gamma (-dy/x) = g - qy

to

dy/dx=Bi*(1-y)

you should enter -Bi into the g and q coefficients' text fields.

With those changes, the numerical solutions in COMSOL match the analytical solutions.

Best regards,
Magnus Ringh, COMSOL
Hi, In both cases, you should put the d^2y/dx^2 term into the Gamma coefficient in the General Form PDE settings as yx (that is, dy/dx) to make the problem better posed. Also, in example 8.5, to match -n.Gamma (-dy/x) = g - qy to dy/dx=Bi*(1-y) you should enter -Bi into the g and q coefficients' text fields. With those changes, the numerical solutions in COMSOL match the analytical solutions. Best regards, Magnus Ringh, COMSOL

Mikael Noerregaard Nielsen

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2015年11月26日 GMT-5 04:56
Dear Magnus

Thanks for the answer. I shall try you suggestions during the day and get back to this thread.

Best regards
Dear Magnus Thanks for the answer. I shall try you suggestions during the day and get back to this thread. Best regards

Mikael Noerregaard Nielsen

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 2015年11月26日 GMT-5 10:27
Dear Magnus

Thanks for your help - it works perfectly now.

Best regards
Dear Magnus Thanks for your help - it works perfectly now. Best regards

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.