Specifying initial values for cooridi... Log Out | Topics | Search
Moderators | Register | Edit Profile

FlexPDE User's Forum » User Postings » Specifying initial values for cooridinates. « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Jessica Dunn (jessica)
New member
Username: jessica

Post Number: 1
Registered: 09-2008
Posted on Monday, September 15, 2008 - 08:07 pm:   

I am working with GIS data and a continuous systems model. I was wondering if there is anyway for me to specify the initial conditions for a variable, u, at a specific point:

i.e. u(x=1,t=0)=10 and u(x=3,t=0)=15.



Top of pagePrevious messageNext messageBottom of page Link to this message

Marek Nelson (mgnelson)
Moderator
Username: mgnelson

Post Number: 72
Registered: 07-2007
Posted on Tuesday, September 16, 2008 - 03:20 pm:   

There is no way to specify the initial value at a point. You can specify a value boundary condition at a point, but there are arguments against doing this.

You could specify the initial conditions as narrowly peaked functions (e.g. narrow gaussians) centered at the points. If you do this you should use FIXED POINT specifications to force nodes at the selected positions. Otherwise the sparse sampling of the numerical method may not see the peak of the function. The tail of the gaussian allows the grid refinement to sense the presence of the gaussian from a distance.
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 1170
Registered: 06-2003
Posted on Tuesday, September 16, 2008 - 03:38 pm:   

PS
In a heat equation, for example, in the absence of sources the integral of the final distribution will be the same as the integral of the initial distribution. A true "point value" initial condition will have zero spatial extent, ergo zero integral, ergo zero final result. The mathematical abstraction of a "point value" is therefore not of much value.

Top of pagePrevious messageNext messageBottom of page Link to this message

Jessica Dunn (jessica)
New member
Username: jessica

Post Number: 2
Registered: 09-2008
Posted on Wednesday, September 17, 2008 - 12:57 am:   

Cheers, thanks for your help. I would have naturally assumed that if needed, when we have a PDE with is space and time dependent, the initial values could be space dependent i.e: u specified at it's location (x,y,z) at time t=0.
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 1171
Registered: 06-2003
Posted on Wednesday, September 17, 2008 - 02:16 pm:   

The two points you mention could be initialized (in 1D) with narrow Gaussians (width=w) as follows:

INITIAL VALUES
U = 10*exp(-(x-1)^2/w^2) + 15*exp(-(x-3)^2/w^2)
(See "Initial Values" in the Help Index).

In 1D, you cannot use FIXED POINT, so just include the Gaussian centers in the path layout:

BOUNDARIES
REGION 1
START (0) LINE TO (10) TO (15) TO (xend)

---------------------------------

In 2D, use

INITIAL VALUES
U = A0*EXP(-((X-X0)^2+(Y-Y0)^2)/W0^2) + ....

BOUNDARIES
REGION 1
START(...) LINE TO (...)
FIXED POINT (X0,Y0)

(See "Fixed Point" in the Help Index)

-------------------------------------

For a large number of points, you could use the SUM function. See SUM in the HELP index and the example "Samples | Misc | Sum.pde".
Top of pagePrevious messageNext messageBottom of page Link to this message

Jessica Dunn (jessica)
Junior Member
Username: jessica

Post Number: 3
Registered: 09-2008
Posted on Sunday, September 21, 2008 - 12:31 am:   

Great thanks so much. Am I also right in my understanding that the software no longer supports Neumann boundary conditions?
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 1172
Registered: 06-2003
Posted on Sunday, September 21, 2008 - 12:57 pm:   

The control word "NEUMANN" has been deleted.
But in most cases, the NATURAL boundary condition provides the same facility in a formalism that is more closely related to the physics of the PDE system.
Top of pagePrevious messageNext messageBottom of page Link to this message

Jessica Dunn (jessica)
Member
Username: jessica

Post Number: 4
Registered: 09-2008
Posted on Sunday, September 21, 2008 - 07:19 pm:   

So say I had a 2D box with an advection and diffusion system and wanted to specify NEUMANN conditions (no flow through the boundary) how would I go about defining this?
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 1173
Registered: 06-2003
Posted on Sunday, September 21, 2008 - 11:42 pm:   

See "Help->User Guide->Addressing More Difficult Problems->Natural Boundary Conditions" for a general discussion of Natural Boundary conditions, as well as the other entries under "Natural Boundary Conditions" in the Help Index.

The NATURAL boundary condition defines the integrand of the surface integrals generated by the application of the Divergence Theorem to second-order spatial derivatives.

For the equation Div(Grad(U))+S=0, it is identical to the Neumann BC. For other equations, it may be different. Zero flux is the default value of Natural().

Also take a look at some of our example problems. Most of them use Natural boundary conditions in one way or another.


Top of pagePrevious messageNext messageBottom of page Link to this message

larssl
New member
Username: larssl

Post Number: 1
Registered: 06-2010
Posted on Wednesday, June 23, 2010 - 11:58 am:   

I'm continuing this thread, because this is exactly my problem (and going a little further).

I'm simulating a very simple 1D diffusion - reaction problem with molecule A diffusing in from the left boundary, where I use a natural BC (const. flux), and reacting with a molecule B already in the material.

I'm also defining the initial condition of A (the diffusing species) by using a gaussian of the type

A_0 = A_surf * exp(-(x)^2/(0.1)^2

whereas the initial value of B is based on measured data. In my case the width of the gaussian is 0.1.

The problem arises when I try to minimize the width of the initial (half) gaussian peak at the surface. At 0.1 it is about 200 nm into the material, which is substantial I think. However, if I try to reduce it to e.g. 0.01, then the concentration of A becomes negative and hence causes the concentration of B to INCREASE when it should reduce due to reacting with A... unphysical.

Any thoughts on solving this? Files attached if needed.
application/octet-streamScript
A_vs_B_flux_bc.pde (1.5 k)
application/octet-streamData B_initial
B_measured_initial.tbl (1.1 k)
application/octet-streamData B_final
B_measured_final.tbl (1.1 k)
Top of pagePrevious messageNext messageBottom of page Link to this message

larssl
New member
Username: larssl

Post Number: 2
Registered: 06-2010
Posted on Wednesday, June 23, 2010 - 12:24 pm:   

I tried using a uramp to generate the initial values instead, but actually became slightly worse:

A_0 = A_surf * (1 - uramp(x - 0, x - 0.15) )

Now a width of 0.15 is the smallest that can be used before A becomes negative at t=12600 s (end
of the simulation).

Btw, I'm using the student version which has a node limit of 100 (?), so I thought maybe that could have something to do with this. But it doesn't seem like this is the reason, because when I decrease the domain (length, 0 .. L) things do not improve.

I realize that as a (non-paying) student, I'm not exactly entitled to any help, but I'm still hoping for a small tip :-)
Top of pagePrevious messageNext messageBottom of page Link to this message

rgnelson
Moderator
Username: rgnelson

Post Number: 1377
Registered: 06-2003
Posted on Wednesday, June 23, 2010 - 01:14 pm:   

You have a boundary condition that extracts a constant flux of A, regardless of whether A has been depleted. So naturally at some point A must go negative.

Perhaps you meant the BC to inject A at a constant rate? Recall that the NATURAL() BC is the outward normal component of the argument of the divergence term, ie outward flux in your case.
Top of pagePrevious messageNext messageBottom of page Link to this message

larssl
Junior Member
Username: larssl

Post Number: 3
Registered: 06-2010
Posted on Wednesday, June 23, 2010 - 01:39 pm:   

Well, I'll be... that did it :-) Need to watch those signs. Now it looks like the initial value gaussian can be as narrow as I'd like (or at least as is physically reasonable).

Thanks for making a terrific piece of software. I'm already spreading the word.

Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:

Topics | Last Day | Last Week | Tree View | Search | Help/Instructions | Program Credits Administration