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 to program this equation

Please login with a confirmed email address before reporting spam

Hi
How to program such equation with COMSOL.
ds/dt +d(D(s)ds/dx)dx=R with D(s)=a+b*s^2+c*s^3

I'm a new user. and my probleme is about the second term wich coefficient depend of the variable (s)
d(D(s)ds/dx)dx

Thanks for your help

5 Replies Last Post 28 feb 2010, 20:11 GMT-5

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 26 feb 2010, 11:26 GMT-5
One way is the following:

1. Open a new project, general form, 1D, dependent variable s
2. Draw a line, any length. hit mesh once
3. Options -> Constants, enter values for a, b, c, R, then Apply
4. Options -> Global expression, enter D, a+b*s^2+c^s^3, then Apply
5. Under Subdomain settings, set Gamma = D*sx, F=R, ea=0, da=1
6. Under Solver parameters, adjust time stepping as desired
7. Hit Solve Button
8. Go to Plot parameters to view results.

The constants a, b, c, and F0 are set in Step 3. above.
They are combined into the expression for D, which is also a function
of the dependent parameter s.

Your term D(s)ds/dx is the flux term Gamma in the general form.
D(s) is calculated according to the expression in Step 4.
The ds/dx term is expressed in Comsol as sx (could also use d(s,x))
hence the flux term in Step 5 is written as D*sx.

You may need to adjust your parameter values a, b, c and R to get
actual solutions - not everything has real solutions. Also, you can
adjust the boundary conditions.

You could also do this same problem using the coefficient form,
or (less easily) set it up using the weak form.

Hope this helps.

Good luck!

One way is the following: 1. Open a new project, general form, 1D, dependent variable s 2. Draw a line, any length. hit mesh once 3. Options -> Constants, enter values for a, b, c, R, then Apply 4. Options -> Global expression, enter D, a+b*s^2+c^s^3, then Apply 5. Under Subdomain settings, set Gamma = D*sx, F=R, ea=0, da=1 6. Under Solver parameters, adjust time stepping as desired 7. Hit Solve Button 8. Go to Plot parameters to view results. The constants a, b, c, and F0 are set in Step 3. above. They are combined into the expression for D, which is also a function of the dependent parameter s. Your term D(s)ds/dx is the flux term Gamma in the general form. D(s) is calculated according to the expression in Step 4. The ds/dx term is expressed in Comsol as sx (could also use d(s,x)) hence the flux term in Step 5 is written as D*sx. You may need to adjust your parameter values a, b, c and R to get actual solutions - not everything has real solutions. Also, you can adjust the boundary conditions. You could also do this same problem using the coefficient form, or (less easily) set it up using the weak form. Hope this helps. Good luck!

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 26 feb 2010, 16:25 GMT-5
Thanks very much for your help.
Thanks very much for your help.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 26 feb 2010, 18:54 GMT-5
Hi
I want to know how to put a constant boundary like s=1 or s=0.2. with PDE mode
The PDE mode give me a Dirichlet and Neumann condition.
But it's a flux ?

Thanks
Hi I want to know how to put a constant boundary like s=1 or s=0.2. with PDE mode The PDE mode give me a Dirichlet and Neumann condition. But it's a flux ? Thanks


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 26 feb 2010, 21:45 GMT-5

Hi
I want to know how to put a constant boundary like s=1 or s=0.2. with PDE mode
The PDE mode give me a Dirichlet and Neumann condition.
But it's a flux ?

Thanks


The boundary conditions are of two types. (a) a value (Dirichlet) or slope (Neumann).
For your problem above, setting values would be using Dirichlet BCs.

To set these, in the Boundary mode, Boundary Settings, you'll see two items
listed in Boundary selections, one for each boundary. Select Item 1, corresponding
to the left boundary. The point on the line will be highlighted in red. In the
right panel under the Coefficients tab, select the Dirichlet boundary condition
radio button. At the top you'll see the equation template with the variables
and their context. You'll only need to be concerned with the R=0 part of this,
so leave G=0. R=0 is the equation that has to be satisfied on the boundary,
so for the left boundary if you want to set s=1, you would write it as s-1=0,
and in the entry for R you would then have s-1.

For the second boundary it's the same procedure, only for R you would enter s-0.2.
[QUOTE] Hi I want to know how to put a constant boundary like s=1 or s=0.2. with PDE mode The PDE mode give me a Dirichlet and Neumann condition. But it's a flux ? Thanks [/QUOTE] The boundary conditions are of two types. (a) a value (Dirichlet) or slope (Neumann). For your problem above, setting values would be using Dirichlet BCs. To set these, in the Boundary mode, Boundary Settings, you'll see two items listed in Boundary selections, one for each boundary. Select Item 1, corresponding to the left boundary. The point on the line will be highlighted in red. In the right panel under the Coefficients tab, select the Dirichlet boundary condition radio button. At the top you'll see the equation template with the variables and their context. You'll only need to be concerned with the R=0 part of this, so leave G=0. R=0 is the equation that has to be satisfied on the boundary, so for the left boundary if you want to set s=1, you would write it as s-1=0, and in the entry for R you would then have s-1. For the second boundary it's the same procedure, only for R you would enter s-0.2.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 28 feb 2010, 20:11 GMT-5
Thanks very much.
You know more about COMSOL.
good!
I have an other question.
The value of (s) should be between 0 and 1. 0<= s<1.
So I want this equation and other equation be resolved only for 0<= s<1.
So where or how can I put this condition?
Thanks very much. You know more about COMSOL. good! I have an other question. The value of (s) should be between 0 and 1. 0

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.