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.

Solving a 1D partial differential equation

Please login with a confirmed email address before reporting spam

Hello

I am trying to solve a 1D PDE, where the dependent variable is temperature, 'u' and independent variables are spatial coordinate, 'x' and time, 't'. My equation is of the form

du/dt = k*d^2u/dx^2 - h*(u(x) - u(x+)) - h*(u(x) - u(x-))

where u(x) is the temperature at a given point
u(x+) and u(x-) are the temperatures of the points adjacent to the given point
k and h are are constants.
For a better representation of the equation, please find attached the word file.

To solve this, I tried 2 methods (as in the mph extension file attached below) which are briefly described below
1. Defined an analytical function that takes an argument x and gives the temperature, at that point, as the output.
2. Defined an interpolation function that takes an argument x and interpolates the temperature, at that point, as the output.

Unfortunately both these methods end up in giving errors as follows
1. Unknown function or operator.
- Name: u
2. Unknown variable name.
- Table row: 1
- Table column: 1
- Function name: temp
Error in multiphysics compilation.

Could someone please tell me how to resolve this issue? Or does anyone know of a better way to solve this type of problem?


3 Replies Last Post 21.04.2015, 11:10 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 02.04.2015, 02:00 GMT-4
Hi

There are several issues that I do not understand (perhaps my fault):

1. Your equation simplifies to du/dt = k*d^2u/dx^2 + h*(u(x+) + u(x-)).
2. Do you have a discontinuity at the particular point, and u(x+) and u(x-) is the lim(u) from left and right?
3. If there is a discontinuity, how are you able to keep it, as heat flow will try to level it?
4. If it is only a certain value of temperature at the given point, draw that point and give it Dirichlet condition or a Pointwise Constraint.
5. You have given u as the Dirichlet condition at both ends of your interval. It should be a fixed value.
6. You have several issues with units, but those do not probably crash the calculation, they are just warnings.
7. Are you sure you cannot do this with the heat transfer module? PDE mode has several pitfalls you can drop into.

br
Lasse
Hi There are several issues that I do not understand (perhaps my fault): 1. Your equation simplifies to du/dt = k*d^2u/dx^2 + h*(u(x+) + u(x-)). 2. Do you have a discontinuity at the particular point, and u(x+) and u(x-) is the lim(u) from left and right? 3. If there is a discontinuity, how are you able to keep it, as heat flow will try to level it? 4. If it is only a certain value of temperature at the given point, draw that point and give it Dirichlet condition or a Pointwise Constraint. 5. You have given u as the Dirichlet condition at both ends of your interval. It should be a fixed value. 6. You have several issues with units, but those do not probably crash the calculation, they are just warnings. 7. Are you sure you cannot do this with the heat transfer module? PDE mode has several pitfalls you can drop into. br Lasse

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 02.04.2015, 04:13 GMT-4
Hi Lasse

Firstly thanks for your quick response.

1. Indeed it does simplify to the form you have written but there is an additional term, -2*h*u(x). But anyway this does not matter much I guess.
2. x+ and x- are discrete points that are adjacent to a given point x. And to be more precise, x+ = x+0.01 and x- = x-0.01. My model is a discretized one but I don't know if it is otherwise referred to as discontinuous.
3. I discretize my geometry into a fixed number of set points and compute the temperature at these points.
4. As mentioned in the previous point, it is a set of points in one dimension.
5. That was a mistake, now I have replaced it with heat flux.
6. Yes indeed, I have written a simplified equation for the ease of communication. For now, I think, we can assume the missing parameters to be unity.
7. I have not tried that yet. I will look into that and see if I could obtain a suitable solution.

Thanks again.

Venkat.
Hi Lasse Firstly thanks for your quick response. 1. Indeed it does simplify to the form you have written but there is an additional term, -2*h*u(x). But anyway this does not matter much I guess. 2. x+ and x- are discrete points that are adjacent to a given point x. And to be more precise, x+ = x+0.01 and x- = x-0.01. My model is a discretized one but I don't know if it is otherwise referred to as discontinuous. 3. I discretize my geometry into a fixed number of set points and compute the temperature at these points. 4. As mentioned in the previous point, it is a set of points in one dimension. 5. That was a mistake, now I have replaced it with heat flux. 6. Yes indeed, I have written a simplified equation for the ease of communication. For now, I think, we can assume the missing parameters to be unity. 7. I have not tried that yet. I will look into that and see if I could obtain a suitable solution. Thanks again. Venkat.

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 21.04.2015, 11:10 GMT-4

Hello

I am trying to solve a 1D PDE, where the dependent variable is temperature, 'u' and independent variables are spatial coordinate, 'x' and time, 't'. My equation is of the form

du/dt = k*d^2u/dx^2 - h*(u(x) - u(x+)) - h*(u(x) - u(x-))

where u(x) is the temperature at a given point
u(x+) and u(x-) are the temperatures of the points adjacent to the given point
k and h are are constants.
For a better representation of the equation, please find attached the word file.

To solve this, I tried 2 methods (as in the mph extension file attached below) which are briefly described below
1. Defined an analytical function that takes an argument x and gives the temperature, at that point, as the output.
2. Defined an interpolation function that takes an argument x and interpolates the temperature, at that point, as the output.

Unfortunately both these methods end up in giving errors as follows
1. Unknown function or operator.
- Name: u
2. Unknown variable name.
- Table row: 1
- Table column: 1
- Function name: temp
Error in multiphysics compilation.

Could someone please tell me how to resolve this issue? Or does anyone know of a better way to solve this type of problem?


For those of you who might encounter a similar situation, please note that the use of 'comp1.at1' command at the appropriate place would solve this issue.
[QUOTE] Hello I am trying to solve a 1D PDE, where the dependent variable is temperature, 'u' and independent variables are spatial coordinate, 'x' and time, 't'. My equation is of the form du/dt = k*d^2u/dx^2 - h*(u(x) - u(x+)) - h*(u(x) - u(x-)) where u(x) is the temperature at a given point u(x+) and u(x-) are the temperatures of the points adjacent to the given point k and h are are constants. For a better representation of the equation, please find attached the word file. To solve this, I tried 2 methods (as in the mph extension file attached below) which are briefly described below 1. Defined an analytical function that takes an argument x and gives the temperature, at that point, as the output. 2. Defined an interpolation function that takes an argument x and interpolates the temperature, at that point, as the output. Unfortunately both these methods end up in giving errors as follows 1. Unknown function or operator. - Name: u 2. Unknown variable name. - Table row: 1 - Table column: 1 - Function name: temp Error in multiphysics compilation. Could someone please tell me how to resolve this issue? Or does anyone know of a better way to solve this type of problem? [/QUOTE] For those of you who might encounter a similar situation, please note that the use of 'comp1.at1' command at the appropriate place would solve this issue.

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.