dt(integral(c,'area'))... Log Out | Topics | Search
Moderators | Register | Edit Profile

FlexPDE User's Forum » User Postings » dt(integral(c,'area')) « Previous Next »

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

Olexiy Orel (scorpion)
Member
Username: scorpion

Post Number: 12
Registered: 03-2007
Posted on Monday, April 13, 2009 - 10:23 am:   

Dear sirs,
I have following issue.
I need to set natural BC as a function of the charge stored in my region:
natural(C)=1-dt(integral(C,'region')). Rather essential BC: flux is a function of stored charge.
If I use plot to see integral(C,'region'), it shows me sinusoid - not a constant. But if I use plot to see dt(integral(C,'region'), it shows me eternal 0. Why? Can I somehow calculate derivative of a integral of a function of a region?
Also another question. If I have an equation:
dt(C)=D*del2(C), what will natural(C) on a vertical boundary (left) be? dx(C) or D*dx(C)?
Thank you very much. Sorry for disturbing.
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 1244
Registered: 06-2003
Posted on Monday, April 13, 2009 - 02:39 pm:   

1.
FlexPDE does not store a history of integrals, so it cannot compute a time derivative. You have two alternatives: You can declare a GLOBAL variable to hold the integral and use the Global variable in the BC, or you can move the time derivative inside the integral operator.

2.
First, FlexPDE moves all variable-dependent terms to the left side of the equation, resulting in
dt(C) - D*div(grad(C)) = 0.
It then moves the D* inside the divergence, giving
dt(C) - div(D*grad(C)) + grad(D)<dot>grad(C) = 0

It then integrates the equation over the cell volume, reducing the second-order spatial terms by integrating by parts.
This results in
Vol_integral(dt(C)) - Surf_integral(normal(D*grad(C))) + Vol_Integral(grad(D)<dot>grad(C)) = 0.

The Natural BC specifies the integrand of the surface integral.

In your case, this is normal(-D*grad(C)). The Natural BC on your left side boundary must specify the value of D*dx(C), because the outward normal vector points toward negative x.

The proper form of the equation is, of course, dt(C) - div(D*grad(C)) =0 {rate of change equals divergence of flux}, in which case the spurious grad(D).grad(C) disappears.

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