Author |
Message |
yucheng zhang (stanley_z)
New member Username: stanley_z
Post Number: 2 Registered: 05-2006
| Posted on Monday, May 01, 2006 - 09:56 pm: | |
Hi, I would like to solve simple 1D time dependent diffusion problem. The variable is C and the equation is dxx(C)=dt(C) The intial value I would like to set is at t=0 and from x=0 to x=x0(constant,i.e. 150), C=C0 (constant say 1E19); at t=0 and from x>x0, C=0. How do I define the intial value and boundary condition in the script. It will be much appreciated if someone can advice on this script-writing. thanks |
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 595 Registered: 06-2003
| Posted on Tuesday, May 02, 2006 - 01:00 am: | |
How about this: INITIAL VALUES C=if(x<x0) then C0 else 0 Bear in mind that the mesh generator will not be aware of this break, and may span x0 with a cell, so that the exact breakpoint is not observed. You can overcome this by putting a gridding feature at x0 to force a node there. START(0) LINE TO (x0) TO (x1) |
Max Shao (mshao)
New member Username: mshao
Post Number: 1 Registered: 05-2006
| Posted on Tuesday, May 09, 2006 - 01:22 pm: | |
Dear Mr. Nelson: In the last line of your response to the 1D diffusion problem, why is it START (0) LINE TO (x0) TO (x1) rather than START (x0-0.1) LINE TO (x0+0.1) Thank you. |
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 601 Registered: 06-2003
| Posted on Tuesday, May 09, 2006 - 05:37 pm: | |
The domain description section of the script is where you describe your domain. Put in what you want for your shape. But if you want your initial values or parameters to have an abrupt change (as you have said you want), then you should add a gridding point at the switch point. If you want your domain to run from (x0-0.1) to (x0+0.1), then you are free to do that. But if you are going to switch the inital values at x0 you must add a gridding point there. In other words Start(x0-0.1) line to (x0) to (x0+0.1). What part of this do you not understand?
|
Max Shao (mshao)
New member Username: mshao
Post Number: 2 Registered: 05-2006
| Posted on Tuesday, May 09, 2006 - 05:58 pm: | |
Hi, Robert: In the original question of Yucheng, he wanted to have an abrupt change at xo. You answered his question by saying "You can overcome this by putting a gridding feature at x0 to force a node there. START(0) LINE TO (x0) TO (x1)". So, I think you are suggesting "FEATURE START(0) LINE TO (x0) TO (x1)" I think for putting a gridding feature at x0, it should be: FEATURE START(x0-x1) LINE TO (x0+x1) Where x1 is a small number such as 0.1. My question is whether this is correct. |
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 602 Registered: 06-2003
| Posted on Tuesday, May 09, 2006 - 06:42 pm: | |
No. |
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 603 Registered: 06-2003
| Posted on Tuesday, May 09, 2006 - 07:07 pm: | |
Mesh nodes separate mesh cells. Each cell extends from its leftmost node to its rightmost node. Putting a gridding point at x0 forces a mesh node at x0. This means that there will be a cell to the left of x0 and a cell to the right of x0. If you have a jump in parameters at x0, then this will guarantee that the cell to the left will have one value, and the cell to the right will have another, and there will be no cells with two values. For initial values, the value at x0 will be ambiguous, and the short transition region you suggest is certainly one way to deal with the ambiguity. GO ahead and do it.
|
Max Shao (mshao)
Junior Member Username: mshao
Post Number: 3 Registered: 05-2006
| Posted on Tuesday, May 09, 2006 - 11:58 pm: | |
Hi, Robert: What is your way to put a node at x0? Please write the code you suggest. Thank you. |
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 604 Registered: 06-2003
| Posted on Wednesday, May 10, 2006 - 01:27 am: | |
START(0) LINE TO (x0) TO (x1) See previous post. This statement, not too surprisingly, starts the domain at x=0, puts a point at X=x0 and continues to the end at x=x1. The section from 0 to x0 is gridded with the required density of nodes. The remaining segment from x0 to x1 is gridded with the required density of nodes. There is a node at x0. How hard can this be? START(0) LINE TO (x0-0.1) TO (x0+0.1) TO (x1) puts two nodes bracketing x0. It may put more nodes between (x0-0.1) and (x0+0.1) if the requested node density requires it.
|