If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.
Special Thanks To:
Aaron Holmes
Aaron Wheeler
Adam Horden
Alan Scrimgeour
Andre
Andrew Haynes
Anonymous000
asabase
Austin Weil
barney
Barry
Bert Hickman
Bill Kukowski
Blitzorn
Brandon Paradelas
Bruce Bowling
BubeeMike
Byong Park
Cesiumsponge
Chris F.
Chris Hooper
Corey Worthington
Derek Woodroffe
Dalus
Dan Strother
Daniel Davis
Daniel Uhrenholt
datasheetarchive
Dave Billington
Dave Marshall
David F.
Dennis Rogers
drelectrix
Dr. John Gudenas
Dr. Spark
E.TexasTesla
eastvoltresearch
Eirik Taylor
Erik Dyakov
Erlend^SE
Finn Hammer
Firebug24k
GalliumMan
Gary Peterson
George Slade
GhostNull
Gordon Mcknight
Graham Armitage
Grant
GreySoul
Henry H
IamSmooth
In memory of Leo Powning
Jacob Cash
James Howells
James Pawson
Jeff Greenfield
Jeff Thomas
Jesse Frost
Jim Mitchell
jlr134
Joe Mastroianni
John Forcina
John Oberg
John Willcutt
Jon Newcomb
klugesmith
Leslie Wright
Lutz Hoffman
Mads Barnkob
Martin King
Mats Karlsson
Matt Gibson
Matthew Guidry
mbd
Michael D'Angelo
Mikkel
mileswaldron
mister_rf
Neil Foster
Nick de Smith
Nick Soroka
nicklenorp
Nik
Norman Stanley
Patrick Coleman
Paul Brodie
Paul Jordan
Paul Montgomery
Ped
Peter Krogen
Peter Terren
PhilGood
Richard Feldman
Robert Bush
Royce Bailey
Scott Fusare
Scott Newman
smiffy
Stella
Steven Busic
Steve Conner
Steve Jones
Steve Ward
Sulaiman
Thomas Coyle
Thomas A. Wallace
Thomas W
Timo
Torch
Ulf Jonsson
vasil
Vaxian
vladi mazzilli
wastehl
Weston
William Kim
William N.
William Stehl
Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
Registered Member #2099
Joined: Wed Apr 29 2009, 12:22AM
Location: Los Altos, California
Posts: 1716
I see a lot of simplifying assumptions, for example it looks like the gas temperature is constant. Any energy calculations will miss the heat going in or out to maintain the temperature, as you move the piston.
In that case, the product P*V had better be constant. It's called Boyle's Law. You can't figure the work by taking the difference between initial and final P*V values, even though pressure is dimensionally equivalent to energy per unit volume.
Now if you want to figure the energy or work needed to compress the gas by moving the piston, it would be proper to integrate P * dV in small steps. Same as integrating force * dX. You already know that P would have to be the difference between absolute pressures inside and outside the cylinder.
I can think of one test case where the numbers are particularly simple. Start with a vacuum between the piston and the closed cylinder end. For any linear position X, P_inside = 0 and P_outside = 1 atm. Work is directly proportional to stroke length, piston area, and atmospheric pressure. At standard pressure (101.325 kPa, unless you are a follower of IUPAC) it's, uh, 101.325 kJ/m^3 = 101.325 joules per liter of displacement. That's the sucking energy of a vacuum reservoir.
Here is another interesting test case. Start with some initial values of P and V, and let the outside pressure be zero (as if we are doing the experiment in space). How much work can be done by isothermal, Boyle-ian expansion of the gas pushing on the piston?
No matter how far the piston moves (if cylinder is long enough), the gas pressure will never reach zero and there will always be force on the piston. One might guess that the cumulative work approaches a limit, which might happen to be the product of initial pressure and initial volume. Nope. The cumulative work increases without bound. Just like integral(1/x dx) = ln(x).
Registered Member #518
Joined: Tue Feb 13 2007, 05:20AM
Location: New York
Posts: 168
I fixed some bugs....
I start with 15 psi on the inside of the chamber, and 15 psi on the outside.... (at first i made the imstake to set inside pressure to 0, and then there was nothing to compress.... you can't compress a vacuum)
I move the piston in by a quantity of delta_x ....then i use the formula, force time distance to get a finite energy amount and add it to the total....
then I compute the new chamber pressure using P1V1 = P2V2 ...P2 = P1V1 / V2
Registered Member #2099
Joined: Wed Apr 29 2009, 12:22AM
Location: Los Altos, California
Posts: 1716
Yeah, what Dr H said. Are you familiar with the edit button?
For help with the program, could you please post the exact details of a test case? It's easier to work it from scratch, and give step by step results, than to actually review your code. - Cylinder diameter or area - Cylinder length (piston position) X: initial value, final value, and step size. - Initial gas pressure, inside and out. - Confirm that we are talking about isothermal compression or expansion, and ideal gas behavior. - What value does your program give for the work? What is the correct value, and how did you get it?
By the way, is the program in question an assignment for a class you are taking or teaching?
Registered Member #518
Joined: Tue Feb 13 2007, 05:20AM
Location: New York
Posts: 168
klugesmith wrote ...
Yeah, what Dr H said. Are you familiar with the edit button?
For help with the program, could you please post the exact details of a test case? It's easier to work it from scratch, and give step by step results, than to actually review your code. - Cylinder diameter or area - Cylinder length (piston position) X: initial value, final value, and step size. - Initial gas pressure, inside and out. - Confirm that we are talking about isothermal compression or expansion, and ideal gas behavior. - What value does your program give for the work? What is the correct value, and how did you get it?
By the way, is the program in question an assignment for a class you are taking or teaching?
Nah, I'm just doing it for fun. I'm practicing finite element algorithms so that I can get by without calculus ...
Today I wrote a program that simulates terminal velocity of rain drops given their diameter....
Registered Member #2099
Joined: Wed Apr 29 2009, 12:22AM
Location: Los Altos, California
Posts: 1716
The wikipedia article you cited is pretty sloppy in places. That formula accounts for force from cylinder pressure between pA and pB, but not for force from the atmosphere on the opposite side of the piston.
I computed the wiki example case in Excel, with compression in 78 discrete steps. Cylinder area 1 m^2. Piston moves from x = 70 m to x = 1 m, and internal pressure increases from 1 bar to 70 bar. Got a work value of 29.76 MJ when p_atm = 0.
External pressure of 1 bar changes the answer to 22.86 MJ, a loss of exactly 6.9 MJ (same as 1 bar x 1 m^2 x 69 m). We can make the correction on the bottom line or on each incremental step:
By the way, the wikipedia formula agrees* with the curious case I mentioned in previous email. If there's no atmosphere, there is no limit to the work extractable from a finite amount of gas expanded isothermally (as we let pA approach zero).
* Saying that wikipedia agrees with a statement is not the same as saying the statement is confirmed because wikipedia agrees with it.
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.