Computing an integral Log Out | Topics | Search
Moderators | Register | Edit Profile

FlexPDE User's Forum » User Postings » Computing an integral « Previous Next »

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

sue
New member
Username: sue

Post Number: 1
Registered: 06-2010
Posted on Thursday, June 24, 2010 - 11:50 am:   

application/octet-streamProgram file
dounce2_demo.pde (3.7 k)


Hello. I am novice attempting to navigate FlexPDE. The attached file shows the fluid flux program (essentially just the LaPlace equation with an added third dimension) in which I am having a hard time figuring out how to properly compute an integral. Specifically, I would like to solve the equation:
norm_flux = integral [with respect to ro from ro=-1 to ro=1] of dY(theta)_evaluated at Y=1.

Ultimately, I would like to generate a 2D graph of norm_flux vs. K and be able to output that data in table format.

Here's my attempt (the full file is attached). The integral seems to be 0 and independent of K. Any insight as to what I'm doing wrong?

COORDINATES
CARTESIAN3('ro','Y','K')
DEFINITIONS
norm_flux = AREA_INTEGRAL(dY(theta), 'line')
EQUATIONS
theta: dro(dro(theta)) + (1/K)*dY(dY(theta))=0
BOUNDARIES
Region 'line'
Start 'outer1' (-1,0)
line to (1,0)
Top of pagePrevious messageNext messageBottom of page Link to this message

rgnelson
Moderator
Username: rgnelson

Post Number: 1379
Registered: 06-2003
Posted on Thursday, June 24, 2010 - 02:26 pm:   

Looks to me like you don't want K to be a coordinate, but a STAGED parameter.

Or perhaps a pseudo-time problem with K=t and SELECT FIXDT, giving the desired timestep in a TIME clause.

Then define a named FEATURE from (-1,1) to (1,1) and form a SURF_INTEGRAL. You can plot this result as a HISTORY() VS K and export it to a text file.
Top of pagePrevious messageNext messageBottom of page Link to this message

sue
New member
Username: sue

Post Number: 2
Registered: 06-2010
Posted on Thursday, June 24, 2010 - 03:18 pm:   

Thanks Robert. Great advice. I think I'm on the right track now.
Top of pagePrevious messageNext messageBottom of page Link to this message

sue
Junior Member
Username: sue

Post Number: 3
Registered: 06-2010
Posted on Friday, June 25, 2010 - 10:35 am:   

I'm getting closer. Now I can plot norm_flux vs. K. However, the plot shows a strange discontunity and the values are without physical meaning (norm_flux should increase with increasing K and vary between 0 and 1). I don't know if you can help out with this question or not. Any insight? I can't find any errors in the equations or input values.
application/octet-streamupdated file
dounce2_demo.pde (4.3 k)
Top of pagePrevious messageNext messageBottom of page Link to this message

sue
Member
Username: sue

Post Number: 4
Registered: 06-2010
Posted on Friday, June 25, 2010 - 11:36 am:   

And one more thing...
I would like to export the data as two columns, one with K values (the STAGED parameter) and one with norm_flux values. Can you correct my syntax below?

HISTORY (norm_flux) VS K EXPORT format "#1#b#2" file="Flux_vs_K.txt"
Top of pagePrevious messageNext messageBottom of page Link to this message

hof
Member
Username: hof

Post Number: 6
Registered: 06-2010
Posted on Friday, June 25, 2010 - 12:36 pm:   

1) You can specify a format for text output. See "format" in the Help Index, and the example problems referenced at the end of that article.
The format facility will output one line per spatial point, with values of as many quantities as you specify in the output command.

i use history (variable) export format '#T#R,#I' file 'filename' to get two columns of data with a comma in between
Top of pagePrevious messageNext messageBottom of page Link to this message

sue
Member
Username: sue

Post Number: 5
Registered: 06-2010
Posted on Friday, June 25, 2010 - 12:52 pm:   

Thank you. That worked.
Top of pagePrevious messageNext messageBottom of page Link to this message

sue
Member
Username: sue

Post Number: 6
Registered: 06-2010
Posted on Friday, June 25, 2010 - 02:52 pm:   

I'm still having problems with the integration in the attached file above. Changing the mesh spacing seems to change the answer a lot. Suggestions?

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