integration in contour plot Log Out | Topics | Search
Moderators | Register | Edit Profile

FlexPDE User's Forum » User Postings » integration in contour plot « Previous Next »

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

junqiao wu (charlesw)
Member
Username: charlesw

Post Number: 6
Registered: 04-2007
Posted on Monday, April 30, 2007 - 06:11 pm:   

In 3D problem, when plot a contour, usually we use something like

Contour(U) on z=0

But what should I use if I want to display contour(U) on the x-y plane, where for each point the intensity equal to U integrated along z direction over Zmin to Zmax ?
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 834
Registered: 06-2003
Posted on Monday, April 30, 2007 - 06:58 pm:   

Define a new VARIABLE, say UZ, and give it the EQUATION DZ(UZ)=U, and a boundary condition UZ=0 on Z=ZMIN.
Then plot CONTOUR(UZ) ON Z=ZMAX


Top of pagePrevious messageNext messageBottom of page Link to this message

Devesh Khanal (dr_chiao)
New member
Username: dr_chiao

Post Number: 1
Registered: 05-2007
Posted on Thursday, May 03, 2007 - 05:23 pm:   

Hi, I tried the advice you gave this user as I needed to do the same thing. But now the program takes much longer to run. I shut it down after 1.5 hours when it used to finish in 12 minutes. Is defining a new variable and equation a requirement? Do you have any alternate suggestions?

Thanks.
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 835
Registered: 06-2003
Posted on Thursday, May 03, 2007 - 06:01 pm:   

Your new variable may be oscillating. Put in a small diffusion term to damp oscillations.

See Help|Technical Notes|Smoothing Operators in PDE's
Top of pagePrevious messageNext messageBottom of page Link to this message

Devesh Khanal (dr_chiao)
New member
Username: dr_chiao

Post Number: 2
Registered: 05-2007
Posted on Thursday, May 03, 2007 - 09:30 pm:   

Thanks, but I have a few questions from the help file you mentioned: "Smoothing Operators in PDE's". The section "Smoothing Steady-State Equations" reads:

If we have, for example,

U = F(..)

then we can replace this equation with

U - (D2/;2)∇2 U = F(..), with D the approximate spatial wavelength of acceptable oscillations.

First, I'm not sure how to intepret (D2/;2) and I assume the Laplacian mentioned there is precisecly than the DEL2() function.

Second, in my case, I have 3 equations:

1. The Poisson's equation which defines the potential (V), but which has on the right hand side for the charge distribution an expression that depends on (V).
2. a VARIABLE and corresponding EQUATION defining said charge distribution (ch).
3. the VARIABLE (chz) and EQUATION "DZ(chz)=ch" as suggested in your post.

So I'm not certain as to how to apply the suggestions form the help when my variable is defined in terms of its derivative, and also what the D2/;2 mean?
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 836
Registered: 06-2003
Posted on Thursday, May 03, 2007 - 10:19 pm:   

This is a browser formatting problem.
The statement is supposed to read
U - (D^2/pi^2)*delsq(U) = F(...)

Change your chz equation to read
dz(chz) = ch + (D^2/pi^2)*delsq(chz)
Top of pagePrevious messageNext messageBottom of page Link to this message

Devesh Khanal (dr_chiao)
Junior Member
Username: dr_chiao

Post Number: 3
Registered: 05-2007
Posted on Friday, May 04, 2007 - 01:21 pm:   

Thanks Robert for your help with this. Unfortunately this charge integration still takes too long and freezes my computer after a few hours, even though without the integration, the pde finishes in 12 minutes. Perhaps it's just too much computation?

In case you have the time, I've attached the .pde file (perhaps you will notice a mistake I'm making that I haven't seen), but if not, no worries. I think I will try to export the data, integrate elsewhere, and import to plot.
application/octet-streamcharge integration
backgate08-2.pde (6.4 k)
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 838
Registered: 06-2003
Posted on Friday, May 04, 2007 - 01:52 pm:   

You put the delsq() inside a dz(). This makes the equation third-order, which FlexPDE cannot handle.

Write the equation as I presented it in a previous post, and it should work correctly:
dz(chz) = ch + (D^2/pi^2)*delsq(chz)

Incidentally, this introduces a NATURAL BC, so at the ZMAX plane you should use
NATURAL(chz) = (D^2/pi^2)*ch
Top of pagePrevious messageNext messageBottom of page Link to this message

Devesh Khanal (dr_chiao)
Member
Username: dr_chiao

Post Number: 4
Registered: 05-2007
Posted on Friday, May 04, 2007 - 04:01 pm:   

Sorry, I attached an older version before I asked for clarification about the smoothing. So here is the most recent version, the equation is as you say and that boundary condition has been added. I also removed the "equation" and "variable" defining "ch" so I'd have one less equation to deal with. It still doesn't seem to work though.
application/octet-streamcharge
backgate08-2.pde (6.8 k)
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 839
Registered: 06-2003
Posted on Saturday, May 05, 2007 - 12:49 pm:   

You're right. It doesn't work very well.
There appears to be feedback between the ch and chz equations that destabilizes the system.
It also appears that the buffering caused by making ch a variable is necessary.

Another way to address this is to run the v,ch system and export (TRANSFER) ch. Then duplicate your script, change the variables to chz only, read in the ch values and solve chz alone.

We are working on a mechanism for version 6 that will allow the definition of sequences of equation sets to be solved alternately. This would automate the above export/import procedure. No release date is available for v6.

Top of pagePrevious messageNext messageBottom of page Link to this message

Devesh Khanal (dr_chiao)
Member
Username: dr_chiao

Post Number: 5
Registered: 05-2007
Posted on Saturday, May 05, 2007 - 04:02 pm:   

Thanks, I am trying your idea of using another script to just integrate. That makes sense.

Here I've tried to export ch using TRANSFER and read it back in and plot the surface plot of ch around the cylinder and calculate Qave, the integrated ch, to see if the plot and the Qave number would agree. This way I would know it transfered properly. However, the plot and the integral Qave don't agree. The help file for transfer says "the exported domain cannot be zoomed" does that mean once I input ch into the new script, I can't plot its values just around the cylinder (i.e. use the same surface plot as in the original script)? Attached are 08-3.pde showing my output and 08-03chz which has the input, the plots, and Qave in the summary.

In 08-03chz I've removed V, Poisson's equation, and all boundary conditions for V (which are all boundary conditions period). I'm merely trying to transfer ch back in and get the identical plots of charge in the cylinder and Qave.

If I can get a faithful transfer of ch and replicate the charge surface and contour plots and the Qave value perfectly, I think the integration to chz should be fast and straightforward!

application/octet-stream08-3 The Output
backgate08-3.pde (6.9 k)
application/octet-stream08-03chz
backgate08-3chz.pde (5.5 k)
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 840
Registered: 06-2003
Posted on Saturday, May 05, 2007 - 05:55 pm:   

You should send the table files to support@pdesolutions.com so I can be sure I'm running the same conditions.
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 841
Registered: 06-2003
Posted on Sunday, May 06, 2007 - 06:27 pm:   

The computation mesh (and therefore the TRANSFER mesh) is refined in order to resolve your variable V.

CH, the exported value, is very strongly peaked (and also discontinuous) on one side of the cylinder. The computation mesh is not
sufficiently fine that a finite element interpolation can resolve the proper shape of CH (see attached graphics).
There are therefore siginficant lookup errors in interpolating CH from the TRANSFER.

Since CH is an algebraic fucntion of V, and V has been satisfactorily resolved, you should TRANSFER V and recompute CH, instead of TRANSFERRING CH itself.

You could use RESOLVE(CH) to force mesh refinement sufficient to resolve CH, but this increases the run time dramatically, and still stumbles on the discontinuity of CH.



Top of pagePrevious messageNext messageBottom of page Link to this message

Devesh Khanal (dr_chiao)
Member
Username: dr_chiao

Post Number: 6
Registered: 05-2007
Posted on Sunday, May 06, 2007 - 07:10 pm:   

Alas, I tried doing that as well and still weren't able to duplicate the contour or surface plots of charge in the cylinder (e.g. the second figure you show above or it's painted contour version). 08-03 is where I transfer V out. 08-04-chz... is where I read in V and compute ch with the usual definition. I even used TRANSFERMESH instead of TRANSFER to read in the "transfer-v.dat" file in 08-04 but it gave similar noisy results. At least with this transferring of V method the charge remains IN the cylinder, which is progress made.

The reason I want to do this in the first place is simply to get rid of the "noise" in the charge contour plots. (e.g. CONTOUR(ch) on z=0 (x=0, y=0)...) So I just want to get a plot of CONTOUR(ch) AVERAGED along z. You can tell the asymmetry of the charge collected at the bottom of the cylinder near the insulating layer is "noise" (i.e. a lack of accuracy) because: 1) it changes when you take slices at different z. 2) you can see it in the CONTOUR(ch) on x=0 and y=0 plots. 3) There is no physical reason for the asymmetry from Poisson's equation. 4) if I use a smaller error limit, it reduces, but it begins to take very long to run. I just need to find a way to get a the averaged plot to demonstrate undeniably that those variations are, indeed, noise.
application/octet-streamtransfer out V
backgate08-3.pde (7.0 k)
application/octet-streamtransfer in V - calculate ch
backgate08-4chz-transfermesh.pde (5.7 k)

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