473,473 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

simulations contra the terroristic nimbus of the second law

On Mar 2, 11:29 pm, galath...@veawb.coop (galathaea) wrote:
language and scientific recognition
are intimately linked

fundamental laws
are ascribed a number of names over the languages
identifying different people credited
for first or best by each culture

often there is an ethnocentrism

one particular case i admire
is found in the case of johann josef loschmidt

in 1861 he published " chemische studien "
proposing chemical structures for many substances

including benzene
for which kekule's 1865 dream is often credited

loschmidt was first to propose many things

loschmidt was first to derive
the number of molecules in one cubic centimeter
of ideal gas

and using avogadro's principle
he was first to calculate the quantitative value
that is now commonly called " avogadro's number "
but in german often " loschmidt'sche zahl "

.

he also proposed a way to violate the second law

-+-+-

gravity is the violator

maxwell, boltzmann, and loschmidt would argue
about temperature stratification in columns of gas

boltzmann and maxwell argued the column
must be the same temperature

loschmidt argued the column mst be warmer near the bottom
and cooler towards the top

they all agreed that if it was stratified
it would allow a perpetuum mobile of the second kind

loschmidt believed he had found a foreversource of energy
to free humanity of " theterroristicnimbusof the second law "

^*^*^*^*^*^*..

roederich graeff has performed that experiment
and carefully noted a repeatable stratification

molecular simulations have predicted stratification

andreas trupp has derived it from very basic physics

http://users.aol.com/atrupp/loschmidt01.pdf

and there is even suggestion
that the troposphere of venus also evidences this stratification

..&%&%&%&%&%&%

so loschmidt is one of those
" respectable " physicists stutter nervously about
definitely a very bright man with many acheivements
( but none that should be commonly accepted as his in english )

a very punk lifestyle
son of bohemian farmers
challenging the orthodoxy of his friends

speaking the unspeakables

;;

there is no shame in pursuing possibility
still being very naive about this whole crackpot / crank thing
i accidentally let the engineer inside think too hard about this

since my degree is in physics simulations
and my career is in programming
and i happened to have a simulation generator i have been building
i generated a simulation for a gas in a column with gravity

the simulation generator is my attempt at building
a commercially viable product at home
and although it still needs much work
and doesn't generate the prettiest code yet
i couldn't help seeing what it would give me here

i have run some simulations
playing around with the specifications
and all my tests have validated loschmidt so far

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !
THE TEMPERATURE AT THE BOTTOM IS HOTTER THAN AT TOP
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !

of course this seemed obvious to me
because gravity accelerates particles moving down the column
and slows them moving up
but there is nothing better than seeing it validated in a simulation

now
currently particle collisions are very rare
( due to size of particles and iteration delta )
and i haven't fully tested that handling yet
so the values are not mixing the z components with the x,y

collisions with the wall only affect x,y
collisions with the floor or ceiling only affect z

but i will play with that some more

i have hand entered some comments
and added output of the simulation
( the generator creates blanket output for the specification
but litle descriptive output currently )

anyways
i cannot stress that i am well aware
of many of the refactorings needed in this code
as the generator placed code in places i normally wouldn't

also since it was working with a larger model
it has some stuff that can be completely refactored out

despite that
here is my generated loschmidt simulation
( in c++, from a generator written in OCaml )
in one large file format (the only working generation right now)

this may get mercilessly chopped by google (sorry)

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <exception>

#include <boost/shared_ptr.hpp>
#include <boost/random.hpp>

namespace
{
// math
double pi(3.14159265358);

// particle descriptors
unsigned numberOfParticles(1000);
double particleMass(1.67372e-24); // (kg)
double particleRadius(2.4e-11); // (m)

// environment
double columnRadius(20.); // (m)
double columnHeight(100.); // (m)

// energetics
double temperature(273.15); // (K) = 0(C)
double boltzmann_k(1.3806505e-23); // (J/K)
double sigma(std::sqrt(boltzmann_k * temperature /
particleMass)); // ~ 47.468

// gravity
double g(-9.807); // (m/s)
}

double distance(double x, double y)
{
return std::sqrt(x * x + y * y);
}

double distance(double x, double y, double z)
{
return std::sqrt(x * x + y * y + z * z);
}
struct Point3D
{
Point3D() :
x_(),
y_(),
z_()
{}

Point3D(double x, double y, double z) :
x_(x),
y_(y),
z_(z)
{}

double x_;
double y_;
double z_;
};

struct Velocity3D : Point3D
{
Velocity3D()
{}

Velocity3D(double x, double y, double z) :
Point3D(x, y, z)
{}
};

enum CollisionType
{
column,
particle
};

class Existent
{
public:
Existent(Point3D const& initialPosition,
Velocity3D const& initialVelocity,
double mass,
std::string const& name) :
position_(initialPosition),
velocity_(initialVelocity),
mass_(mass),
name_(name)
{}

double x() const
{
return position_.x_;
}

void x(double x)
{
position_.x_ = x;
}

double y() const
{
return position_.y_;
}

void y(double y)
{
position_.y_ = y;
}

double z() const
{
return position_.z_;
}

void z(double z)
{
position_.z_ = z;
}

double vx() const
{
return velocity_.x_;
}

void vx(double vx)
{
velocity_.x_ = vx;
}

double vy() const
{
return velocity_.y_;
}

void vy(double vy)
{
velocity_.y_ = vy;
}

double vz() const
{
return velocity_.z_;
}

void vz(double vz)
{
velocity_.z_ = vz;
}

double m() const
{
return mass_;
}

std::string name() const
{
return name_;
}

virtual bool isCollided(boost::shared_ptr<ExistentotherEntity)
const = 0;
virtual CollisionType collisionType() const = 0;

private:
Point3D position_;
Velocity3D velocity_;

double mass_;

std::string name_;
};

class Particle : public Existent
{
public:
Particle(
Point3D const& initialPosition,
Velocity3D const& initialVelocity,
double radius,
double mass,
std::string const& name) :
Existent(initialPosition, initialVelocity, mass, name),
radius_(radius)
{}

double radius() const
{
return radius_;
}

virtual bool isCollided(boost::shared_ptr<ExistentotherEntity)
const
{
// a particle can only be a first entity if the second is also a
particle
if (distance(x() - otherEntity->x(), y() - otherEntity->y(), z() -
otherEntity->z()) <
(radius() + boost::static_pointer_cast<Particle>(otherEntity)-
>radius()))
{
if (name() == "0")
std::cout << "particle on particle action" << std::endl;
return true;
}
return false;
}

virtual CollisionType collisionType() const
{
return particle;
}

private:
double radius_;
};

class EnclosingColumn : public Existent
{
public:
EnclosingColumn(double radius, double height) :
Existent(Point3D(), Velocity3D(), 0., "column"),
radius_(radius),
height_(height)
{}

virtual bool isCollided(boost::shared_ptr<ExistentotherEntity)
const
{
// otherEntity must always be a particle!
if (distance(otherEntity->x(), otherEntity->y()) (radius_ -
boost::static_pointer_cast<Particle>(otherEntity)->radius()))
{
if (otherEntity->name() == "0")
std::cout << "collision with wall of column" << std::endl;
return true;
}
else if (otherEntity->z() (height_ -
boost::static_pointer_cast<Particle>(otherEntity)->radius()))
{
if (otherEntity->name() == "0")
std::cout << "collision with ceiling" << std::endl;
return true;
}
else if (otherEntity->z() <
boost::static_pointer_cast<Particle>(otherEntity)->radius())
{
if (otherEntity->name() == "0")
std::cout << "collision with floor" << std::endl;
return true;
}
return false;
}

virtual CollisionType collisionType() const
{
return column;
}

private:
double radius_;
double height_;
};

class PhysicalWorld
{
public:
typedef std::vector<boost::shared_ptr<Existent Existents;

Existents::iterator begin()
{
return existents_.begin();
}

Existents::iterator end()
{
return existents_.end();
}

void pushBack(boost::shared_ptr<Existentexistent)
{
existents_.push_back(existent);
}

private:
Existents existents_;
};

struct StrataProfile
{
StrataProfile() :
temperatureAccumulatorX_(),
temperatureAccumulatorY_(),
temperatureAccumulatorZ_(),
count_()
{}

void add(double tx, double ty, double tz)
{
temperatureAccumulatorX_ += tx;
temperatureAccumulatorY_ += ty;
temperatureAccumulatorZ_ += tz;

++count_;
}

double temperatureAccumulatorX_;
double temperatureAccumulatorY_;
double temperatureAccumulatorZ_;

unsigned count_;
};

class PhysicsEngine
{
public:
PhysicsEngine(PhysicalWorld & world, double final, double delta) :
world_(world),
time_(0.),
final_(final),
delta_(delta)
{}

double time() const
{ return time_; }

double delta() const
{ return delta_; }

void cycle()
{
time_ += delta_;
}

void run()
{
std::cout << "entering the run loop" << std::endl;

// full run statistics
StrataProfile top;
StrataProfile bottom;

// main event loop
while (time_ < final_)
{
std::cout << "^~^~^~^~^~^~^~^ loop time " << time_ << "
^~^~^~^~^~^~^~^" << std::endl;

// check for collisions first as initial adjustment of velocity
for (PhysicalWorld::Existents::iterator
initialIntersector(world_.begin());
initialIntersector != world_.end();
++initialIntersector)
{
if ((initialIntersector + 1) != world_.end())
{
//std::cout << "-" << std::flush;

for (PhysicalWorld::Existents::iterator
secondIntersector(initialIntersector + 1);
secondIntersector != world_.end();
++secondIntersector)
{
//std::cout << "+" << std::flush;

if (collision(initialIntersector, secondIntersector))
{
//std::cout << "collision" << std::endl;
adjustFromCollision(initialIntersector,
secondIntersector);
}
}
}
}

// then cycle through each and adjust their final positions and
force changes to velocity
for (PhysicalWorld::Existents::iterator
existent(world_.begin());
existent != world_.end();
++existent)
{
adjustFreeMoving(existent);
}

// and cycle the time
cycle();

// now we can snapshot the new state
// follow a particle
PhysicalWorld::Existents::iterator existent(world_.begin() + 1);

std::cout << "particle 1's iterated state:"
<< "\n x: " << (*existent)->x()
<< "\n y: " << (*existent)->y()
<< "\n z: " << (*existent)->z()
<< "\n vx: " << (*existent)->vx()
<< "\n vy: " << (*existent)->vy()
<< "\n vz: " << (*existent)->vz() << std::endl;

// and build temperature profile
unsigned strata(5);
std::vector<StrataProfiletemperatures(strata);

while (existent != world_.end())
{
unsigned particularStrata(((*existent)->z() * 5.0) /
columnHeight);
if (particularStrata >= strata)
particularStrata = strata - 1;
if (particularStrata < 0)
particularStrata = 0;

double tx((*existent)->m() * (*existent)->vx() * (*existent)-
>vx() / boltzmann_k);
double ty((*existent)->m() * (*existent)->vy() * (*existent)-
>vy() / boltzmann_k);
double tz((*existent)->m() * (*existent)->vz() * (*existent)-
>vz() / boltzmann_k);
temperatures[particularStrata].add(tx, ty, tz);

++existent;
}

for (unsigned stratum(0); stratum < strata; ++stratum)
{
std::cout << "in stratum " << stratum << " there were " <<
temperatures[stratum].count_ << " particles" << std::endl;

if (temperatures[stratum].count_)
{
double tx(temperatures[stratum].temperatureAccumulatorX_ /
temperatures[stratum].count_);
double ty(temperatures[stratum].temperatureAccumulatorY_ /
temperatures[stratum].count_);
double tz(temperatures[stratum].temperatureAccumulatorZ_ /
temperatures[stratum].count_);

std::cout << " tx: " << tx
<< " ty: " << ty
<< " tz: " << tz
<< " Tavg: " << ((tx + ty + tz) / 3.) << std::endl;

if (0 == stratum)
bottom.add(tx, ty, tz);
else if ((strata - 1) == stratum)
top.add(tx, ty, tz);
}
else std::cout << "no temperature information possible" <<
std::endl;
}
}

// dump full run statistics
double txTop(top.temperatureAccumulatorX_ / top.count_);
double tyTop(top.temperatureAccumulatorY_ / top.count_);
double tzTop(top.temperatureAccumulatorZ_ / top.count_);
double txBottom(bottom.temperatureAccumulatorX_ / bottom.count_);
double tyBottom(bottom.temperatureAccumulatorY_ / bottom.count_);
double tzBottom(bottom.temperatureAccumulatorZ_ / bottom.count_);

std::cout << "over the simulation we have"
<< "\ntop strata of the column - tx: " << txTop << " ty: " <<
tyTop << " tz: " << tzTop << " Tavg: " << ((txTop + tyTop + tzTop) /
3.)
<< "\nbottom strata of the column - tx: " << txBottom << " ty: "
<< tyBottom << " tz: " << tzBottom << " Tavg: " << ((txBottom +
tyBottom + tzBottom) / 3.)
<< std::endl;
}

private:
bool collision(PhysicalWorld::Existents::iterator object1,
PhysicalWorld::Existents::iterator object2)
{
return (*object1)->isCollided(*object2);
}

virtual void adjustFromCollision(PhysicalWorld::Existents::iter ator
object1, PhysicalWorld::Existents::iterator object2) = 0;
virtual void adjustFreeMoving(PhysicalWorld::Existents::iterato r
object) = 0;

PhysicalWorld & world_;

double time_;
double final_;
double const delta_;
};

class LinearGravityEngine : public PhysicsEngine
{
public:
LinearGravityEngine(PhysicalWorld & world, double final, double
delta) :
PhysicsEngine(world, final, delta)
{}

private:
virtual void adjustFromCollision(PhysicalWorld::Existents::iter ator
object1, PhysicalWorld::Existents::iterator object2)
{
if ((*object1)->collisionType() == particle)
{
// calculate relative distances and speed
double deltaX((*object1)->x() - (*object2)->x());
double deltaY((*object1)->y() - (*object2)->y());
double deltaZ((*object1)->z() - (*object2)->z());
double deltaVX((*object1)->vx() - (*object2)->vx());
double deltaVY((*object1)->vy() - (*object2)->vy());
double deltaVZ((*object1)->vz() - (*object2)->vz());

double relativeDistance(std::sqrt(deltaX * deltaX + deltaY *
deltaY + deltaZ * deltaZ));
double relativeVelocity(std::sqrt(deltaVX * deltaVX + deltaVY *
deltaVY + deltaVZ * deltaVZ));

// find relative angle
double theta(std::acos(deltaZ / relativeDistance));
double phi((deltaX == 0 && deltaY == 0) ? 0. :
std::atan2(deltaY, deltaX));

// ch-ch-ch-changes
double mu((*object2)->m() / (*object1)->m());
double diffZ(2. * (deltaVZ + std::tan(theta) *
(std::cos(phi) * deltaVX + std::sin(phi) *
deltaVY)) /
(1 + std::tan(theta) * std::tan(theta)) * (1 +
mu));

(*object2)->vz((*object2)->vz() + diffZ);
(*object2)->vx((*object2)->vx() + std::tan(theta) *
std::cos(phi) * diffZ);
(*object2)->vy((*object2)->vy() + std::tan(theta) *
std::sin(phi) * diffZ);
(*object1)->vz((*object1)->vz() - mu * diffZ);
(*object1)->vx((*object1)->vx() - std::tan(theta) *
std::cos(phi) * mu * diffZ);
(*object1)->vy((*object1)->vy() - std::tan(theta) *
std::sin(phi) * mu * diffZ);
}
else if ((*object1)->collisionType() == column)
{
if ((*object2)->z() < 0.)
{
// reflect off bottom
(*object2)->vz(-(*object2)->vz());
}
else if ((*object2)->z() columnHeight)
{
// reflect off top
(*object2)->vz(-(*object2)->vz());
}

if (distance((*object2)->x(), (*object2)->y()))
{
// reflect off sides
// calculate the collision theta
double theta(((*object2)->x() == 0 && (*object2)->y() == 0) ?
0. : std::atan2((*object2)->y(), (*object2)->x()));
double velocityTheta(((*object2)->vx() == 0 && (*object2)-
>vy() == 0) ? 0. : std::atan2((*object2)->vy(), (*object2)->vx()));
double velocity(distance((*object2)->vx(), (*object2)->vy()));

(*object2)->vx(velocity * std::cos(pi + 2 * theta -
velocityTheta));
(*object2)->vy(velocity * std::sin(pi + 2 * theta -
velocityTheta));
}
}
}

virtual void adjustFreeMoving(PhysicalWorld::Existents::iterato r
object)
{
// simple linear free with vertical gravity
(*object)->x((*object)->x() + (*object)->vx() * delta());
(*object)->y((*object)->y() + (*object)->vy() * delta());

(*object)->z((*object)->z() + (*object)->vz() * delta() + (1./2.)
* g * delta() * delta());
(*object)->vz((*object)->vz() + g * delta());
}
};

int main()
{
try
{
std::cout << "Functional Simulations Engine 0.39 - starting" <<
std::endl;
std::cout << "generated from source loschmidt.ml" << std::endl;

// build up the world
PhysicalWorld world;

std::cout << "created the world" << std::endl;

// add the column (radius 1
boost::shared_ptr<Existentcolumn(new EnclosingColumn(columnRadius,
columnHeight));
world.pushBack(column);

std::cout << "added the column" << std::endl;

// rng for simulations
boost::mt19937 rng;
rng.seed(static_cast<unsigned int>(std::time(0)));

// create particles
for (unsigned particleCounter(0); particleCounter <
numberOfParticles; ++particleCounter)
{
if (! particleCounter)
std::cout << "creating particle 1" << std::endl;

// find a random position in the column
// height in [0, columnHeight]
boost::uniform_real<possibleHeight(0., columnHeight);
boost::variate_generator<boost::mt19937 &, boost::uniform_real<
heightGenerator(rng, possibleHeight);

double particleHeight(heightGenerator());

double particleX(0.);
double particleY(0.);

// find an x, y position in the column
// just loop until valid in a circle (to maintain distribution)
do
{
// build generator
boost::uniform_real<possibleXY(0., columnRadius);
boost::variate_generator<boost::mt19937 &, boost::uniform_real<
tranverseGenerator(rng, possibleXY);

// pull an x, y
particleX = tranverseGenerator();
particleY = tranverseGenerator();
}
while (distance(particleX, particleY) >= columnRadius);

// now get a velocity in the maxwellian-boltzmann distribution for
the temperature
// which is just a normal distribution
// with mean = 0
// variance sigma^2 = k T / m
boost::normal_distribution<possibleVelocity(0., sigma);
boost::variate_generator<boost::mt19937 &,
boost::normal_distribution< velocityGenerator(rng,
possibleVelocity);

double velocityX(velocityGenerator());
double velocityY(velocityGenerator());
double velocityZ(velocityGenerator());

if (! particleCounter)
std::cout << "initial state position: "
<< "\n x: " << particleX
<< " y: " << particleY
<< " z: " << particleHeight
<< "\n vx: " << velocityX
<< " vy: " << velocityY
<< " vz: " << velocityZ << std::endl;

std::stringstream converter;
converter << particleCounter;

// now build the particle
boost::shared_ptr<Existentparticle(new Particle(
Point3D(particleX, particleY, particleHeight),
Velocity3D(velocityX, velocityY, velocityZ),
particleRadius,
particleMass,
converter.str()));

world.pushBack(particle);
}

std::cout << "all particles created!" << std::endl;

// now that we have the world built
// build the physics engine
// attach the world
// and configure to run x deltas
LinearGravityEngine engine(world, 5., 0.1);
engine.run();
}
catch (std::exception & blowUp)
{
std::cout << "exception at lowest level: " << blowUp.what() <<
std::endl;
}
catch (...)
{
std::cout << "blowUps happen" << std::endl;
}
}

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

i apologise if my hand editing inserted any tabs or other errata

you will need to have a download of boost

on a UN*X/Linux/MacOSX machine simply type:
g++ -I<boost locationmain.cpp

where <boost locationis the path to the outermost boost folder
from the distribution

enjoy the crankdom!

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 7 '07 #1
28 2628
<snipped history lesson>
>
still being very naive about this whole crackpot / crank thing
i accidentally let the engineer inside think too hard about this

since my degree is in physics simulations
How is this possible, when you don;t know ANY physics at all?
and my career is in programming
and i happened to have a simulation generator i have been building
i generated a simulation for a gas in a column with gravity
No offense, but your simulation is pitiful, even for an undergraduate.
>
the simulation generator is my
pathetic
>attempt at building
a commercially viable product at home
and although it still needs much work
and doesn't generate the prettiest code yet
i couldn't help seeing what it would give me here

i have run some simulations
playing around with the specifications
and all my tests have validated loschmidt so far

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !
THE TEMPERATURE AT THE BOTTOM IS HOTTER THAN AT TOP
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !

of course this seemed obvious to me
since you don't know anything about physics, who cares?
because gravity accelerates particles moving down the column
and slows them moving up
but there is nothing better than seeing it validated in a simulation

now
currently particle collisions are very rare
Without particle collisons, EVERYTHING you say is MEANINGLESS. Do you
omit particle collisions because you are too shitty a programmer to
include them?
( due to size of particles and iteration delta )
and i haven't fully tested that handling yet
so the values are not mixing the z components with the x,y
Since i guess that your "stratification" is along the z axis, this
makes everything WORTHLESS.
>
collisions with the wall only affect x,y
collisions with the floor or ceiling only affect z

but i will play with that some more
Save yourself the trouble.
>
i have hand entered some comments
and added output of the simulation
( the generator creates blanket output for the specification
but litle descriptive output currently )

anyways
i cannot stress that i am well aware
of many of the refactorings needed in this code
as the generator placed code in places i normally wouldn't

also since it was working with a larger model
it has some stuff that can be completely refactored out

despite that
here is my generated loschmidt simulation
( in c++, from a generator written in OCaml )
So you can't actually even program in C++?
in one large file format (the only working generation right now)

this may get mercilessly chopped by google (sorry)
<snipped embarassing attempt at programming>

Dude, your biggest problem is that you DEFINE temperature as a
constant. You would need to set up temperature as a FUNCTION, a
function of the kinetic energy of the particles in a particular
region.

You could define temperature a number of ways, the simplest being that
the average kinetic energy = 3/2 kT.

If you knew the first thing about "physics simulations", you would
realize that you will get much different (and unreliable) results is
your particle density is too small, of if your time scale is too
short. Remember, temperature is UNDEFINED except at equilibrium.

If you try to follow each particle around, you'll go crazy and the
program won't accomplish much. There are sophisticated algorithms that
would simplify the process enormous, but you would already know these
if you were experienced at "physics simulations".

Before you can destroy the Second Law by a simulation, you would need
to write a simulation that would not be an embarassment to a high
school student.

Mar 7 '07 #2
On Mar 7, 11:59 am, "The_Man" <me_so_hornee...@yahoo.comwrote:
<snipped history lesson>
still being very naive about this whole crackpot / crank thing
i accidentally let the engineer inside think too hard about this
since my degree is in physics simulations

How is this possible, when you don;t know ANY physics at all?
and my career is in programming
and i happened to have a simulation generator i have been building
i generated a simulation for a gas in a column with gravity

No offense, but your simulation is pitiful, even for an undergraduate.
the simulation generator is my

pathetic
attempt at building
a commercially viable product at home
and although it still needs much work
and doesn't generate the prettiest code yet
i couldn't help seeing what it would give me here
i have run some simulations
playing around with the specifications
and all my tests have validated loschmidt so far
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !
THE TEMPERATURE AT THE BOTTOM IS HOTTER THAN AT TOP
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !
of course this seemed obvious to me

since you don't know anything about physics, who cares?
because gravity accelerates particles moving down the column
and slows them moving up
but there is nothing better than seeing it validated in a simulation
now
currently particle collisions are very rare

Without particle collisons, EVERYTHING you say is MEANINGLESS. Do you
omit particle collisions because you are too shitty a programmer to
include them?
wow

you are so hateful and angry
you cannot even read properly

you want so dearly for me to be wrong
you make shit up
and don't even have an intuitive enough grasp of physics
to realise that the collisions do not change the result

but just to be _very_ explicit for your vituperative mind
( just so you don't avoid what i am saying ):

collisions are accounted for

if you read what i said and the code
you will see "particle on particle action"

the reason they are "very rare"
is because i have been testing low particle numbers
( 1000 - 10000 )
in a large column (100m tall by 20m radius)
and the particles are very very small
( i use the atomic hydrogen radius 2.4e-11m )

it is of course quite possible to create very rarefied physical
systems
with low enough torr to make collisions very unlikely
( we used to do it all the time in the ion labs )
in such a system
as the simulation shows
( and if you had any reading comprehension you would have noticed
_has_been_experimentally_verified_ as well by graeff )
you can still place a thermocouple on the top and bottom
and find a temperature difference

it is not particle collisions that would disturb the stratification
since collisions occur in the same strata

it is convection currents and other large scale movements
that obstruct the process and make it only metastable

however
the same idea works for passing a static electric field
through an ionised heat bath
and the idea can be shrunk down considerably

there are even published papers on this!
( due to size of particles and iteration delta )
and i haven't fully tested that handling yet
so the values are not mixing the z components with the x,y

Since i guess that your "stratification" is along the z axis, this
makes everything WORTHLESS.
well

except for capital letters
what is your PHYSICS argument?
collisions with the wall only affect x,y
collisions with the floor or ceiling only affect z
but i will play with that some more

Save yourself the trouble.
i have hand entered some comments
and added output of the simulation
( the generator creates blanket output for the specification
but litle descriptive output currently )
anyways
i cannot stress that i am well aware
of many of the refactorings needed in this code
as the generator placed code in places i normally wouldn't
also since it was working with a larger model
it has some stuff that can be completely refactored out
despite that
here is my generated loschmidt simulation
( in c++, from a generator written in OCaml )

So you can't actually even program in C++?
i do it for a living

i wrote my generator in OCaml because i like the language
and because i already had some foundational OpenGL stuff

also
as i am sure you are intimately aware of
( from the sound of your pretensions )
parsing and walking tree structures is very easy in functional
languages

Camlp4 helps here a lot
and is much better than the antiquated and unsafe c preprocessor
in one large file format (the only working generation right now)
this may get mercilessly chopped by google (sorry)

<snipped embarassing attempt at programming>

Dude, your biggest problem is that you DEFINE temperature as a
constant. You would need to set up temperature as a FUNCTION, a
function of the kinetic energy of the particles in a particular
region.
no
currently my biggest problem is that you cannot read the code

i defined the initial temperature of the gas
so i could randomly pick velocities for the particles
using the standard maxwell-boltzmann distribution
which gives the relation you mention!

but i measure temperature in 3 components at each strata
when i take the snapshot
( if you are not familiar with Tx, Ty, Tz components to temperature
they are common in calculations at colliders
where it is common to take transverse and parallel temperature )

the temperature is measured and averaged
not defined as constant

( i am not even sure how you could think i was doing that
_and_ somehow getting the result that T is stratified...)
You could define temperature a number of ways, the simplest being that
the average kinetic energy = 3/2 kT.
in the code...
If you knew the first thing about "physics simulations", you would
realize that you will get much different (and unreliable) results is
your particle density is too small, of if your time scale is too
short. Remember, temperature is UNDEFINED except at equilibrium.
i have been running a number of tests
varying parameters
If you try to follow each particle around, you'll go crazy and the
program won't accomplish much. There are sophisticated algorithms that
would simplify the process enormous, but you would already know these
if you were experienced at "physics simulations".
i know a number of techniques

many are already coded in the OCaml simulator
which the generator cannibalises and translates

this was one simulation i knew i could already generate
because i had recently added the necessary functionality

i am only one person though
with many interests
and it takes time to put everything together

this i think was a very good "initial public offering"
of what my generator could offer
Before you can destroy the Second Law by a simulation, you would need
to write a simulation that would not be an embarassment to a high
school student.
i have written plenty of simulations

i am trying to write a simulation generator now
using the ideas of metaprogramming and domain specific languages

my specification is basically a modified category theory
where i define my ontology of objects
and the transformations they undergo
and let the generator publish a program for public consumption

this allows me to keep my core technology
and still be opensource about the simulations
( which should always be opensource )

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

so

how about this?

you can point out a flaw in the simulation
which would be great for me because
i am actually interested in the physics here
and it would help improve my product
or you can point out a flaw in the physics
which i would also benefit from

or i (and any thread lurkers) will just consider you
an ignorant old man who likes trying to belittle others
by meaningless handwaving

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 7 '07 #3
On Mar 7, 3:41 pm, "galathaea" <galath...@gmail.comwrote:
On Mar 7, 11:59 am, "The_Man" <me_so_hornee...@yahoo.comwrote:


<snipped history lesson>
still being very naive about this whole crackpot / crank thing
i accidentally let the engineer inside think too hard about this
since my degree is in physics simulations
How is this possible, when you don;t know ANY physics at all?
and my career is in programming
and i happened to have a simulation generator i have been building
i generated a simulation for a gas in a column with gravity
No offense, but your simulation is pitiful, even for an undergraduate.
the simulation generator is my
pathetic
>attempt at building
a commercially viable product at home
and although it still needs much work
and doesn't generate the prettiest code yet
i couldn't help seeing what it would give me here
i have run some simulations
playing around with the specifications
and all my tests have validated loschmidt so far
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !
THE TEMPERATURE AT THE BOTTOM IS HOTTER THAN AT TOP
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !
of course this seemed obvious to me
since you don't know anything about physics, who cares?
because gravity accelerates particles moving down the column
and slows them moving up
but there is nothing better than seeing it validated in a simulation
now
currently particle collisions are very rare
Without particle collisons, EVERYTHING you say is MEANINGLESS. Do you
omit particle collisions because you are too shitty a programmer to
include them?

wow

you are so hateful and angry
actually, I am in a good mood today. Thanks for asking.
you cannot even read properly

you want so dearly for me to be wrong
Whether you are right or wrong makes no difference to me at all.
you make shit up
and don't even have an intuitive enough grasp of physics
to realise that the collisions do not change the result
Without collisions, YOU DON'T HAVE TEMPERATURE. Since your simulation
is designed to prove a hypothesis about tempreature distribuition,
this would be a rather significant problem.
>
but just to be _very_ explicit for your vituperative mind
( just so you don't avoid what i am saying ):

collisions are accounted for

if you read what i said and the code
you will see "particle on particle action"

the reason they are "very rare"
is because i have been testing low particle numbers
( 1000 - 10000 )
in a large column (100m tall by 20m radius)
and the particles are very very small
( i use the atomic hydrogen radius 2.4e-11m )
I understand that. To have more particles gets to be a pain, since the
number of collisiosn goes as N^2.
>
it is of course quite possible to create very rarefied physical
systems
with low enough torr to make collisions very unlikely
( we used to do it all the time in the ion labs )
in such a system
as the simulation shows
( and if you had any reading comprehension you would have noticed
_has_been_experimentally_verified_ as well by graeff )
you can still place a thermocouple on the top and bottom
and find a temperature difference

it is not particle collisions that would disturb the stratification
since collisions occur in the same strata
How can collisions occur ONLY in the same starta? This is a very
unphysical condition.
>
it is convection currents and other large scale movements
that obstruct the process and make it only metastable
How do you have convection without collisions?
>
however
the same idea works for passing a static electric field
through an ionised heat bath
and the idea can be shrunk down considerably

there are even published papers on this!
( due to size of particles and iteration delta )
and i haven't fully tested that handling yet
so the values are not mixing the z components with the x,y
Since i guess that your "stratification" is along the z axis, this
makes everything WORTHLESS.

well

except for capital letters
what is your PHYSICS argument?
My physics argument is that "temperature" is a phenomena closely
linked to the transfer of kinetic energy between particles by elastic
collisions. These collisions take place in 3 dimensions, not 2. While
I said (for simplicity) that you could calculate the temperature by
means of the average kinetic energy, BY DEFINTION, if your velocity
distribution doesn't follow the Maxwell-Boltzmann distribution, you
have NO temperature (the temperature is undefined).

>

collisions with the wall only affect x,y
collisions with the floor or ceiling only affect z
but i will play with that some more
Save yourself the trouble.
i have hand entered some comments
and added output of the simulation
( the generator creates blanket output for the specification
but litle descriptive output currently )
anyways
i cannot stress that i am well aware
of many of the refactorings needed in this code
as the generator placed code in places i normally wouldn't
also since it was working with a larger model
it has some stuff that can be completely refactored out
despite that
here is my generated loschmidt simulation
( in c++, from a generator written in OCaml )
So you can't actually even program in C++?

i do it for a living

i wrote my generator in OCaml because i like the language
and because i already had some foundational OpenGL stuff

also
as i am sure you are intimately aware of
( from the sound of your pretensions )
parsing and walking tree structures is very easy in functional
languages

Camlp4 helps here a lot
and is much better than the antiquated and unsafe c preprocessor
in one large file format (the only working generation right now)
this may get mercilessly chopped by google (sorry)
<snipped embarassing attempt at programming>
Dude, your biggest problem is that you DEFINE temperature as a
constant. You would need to set up temperature as a FUNCTION, a
function of the kinetic energy of the particles in a particular
region.

no
currently my biggest problem is that you cannot read the code

i defined the initial temperature of the gas
so i could randomly pick velocities for the particles
using the standard maxwell-boltzmann distribution
which gives the relation you mention!

but i measure temperature in 3 components at each strata
when i take the snapshot
( if you are not familiar with Tx, Ty, Tz components to temperature
they are common in calculations at colliders
where it is common to take transverse and parallel temperature )

the temperature is measured and averaged
not defined as constant

( i am not even sure how you could think i was doing that
_and_ somehow getting the result that T is stratified...)
You could define temperature a number of ways, the simplest being that
the average kinetic energy = 3/2 kT.

in the code...
If you knew the first thing about "physics simulations", you would
realize that you will get much different (and unreliable) results is
your particle density is too small, of if your time scale is too
short. Remember, temperature is UNDEFINED except at equilibrium.

i have been running a number of tests
varying parameters
If you try to follow each particle around, you'll go crazy and the
program won't accomplish much. There are sophisticated algorithms that
would simplify the process enormous, but you would already know these
if you were experienced at "physics simulations".

i know a number of techniques

many are already coded in the OCaml simulator
which the generator cannibalises and translates

this was one simulation i knew i could already generate
because i had recently added the necessary functionality

i am only one person though
with many interests
and it takes time to put everything together

this i think was a very good "initial public offering"
of what my generator could offer
Before you can destroy the Second Law by a simulation, you would need
to write a simulation that would not be an embarassment to a high
school student.

i have written plenty of simulations

i am trying to write a simulation generator now
using the ideas of metaprogramming and domain specific languages

my specification is basically a modified category theory
where i define my ontology of objects
and the transformations they undergo
and let the generator publish a program for public consumption

this allows me to keep my core technology
and still be opensource about the simulations
( which should always be opensource )

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

so

how about this?

you can point out a flaw in the simulation
which would be great for me because
i am actually interested in the physics here
and it would help improve my product
or you can point out a flaw in the physics
which i would also benefit from

or i (and any thread lurkers) will just consider you
an ignorant old man who likes trying to belittle others
by meaningless handwaving

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -

Mar 7 '07 #4
On Mar 7, 1:19 pm, "The_Man" <me_so_hornee...@yahoo.comwrote:
On Mar 7, 3:41 pm, "galathaea" <galath...@gmail.comwrote:
On Mar 7, 11:59 am, "The_Man" <me_so_hornee...@yahoo.comwrote:
[...]
it is of course quite possible to create very rarefied physical
systems
with low enough torr to make collisions very unlikely
( we used to do it all the time in the ion labs )
in such a system
as the simulation shows
( and if you had any reading comprehension you would have noticed
_has_been_experimentally_verified_ as well by graeff )
you can still place a thermocouple on the top and bottom
and find a temperature difference
it is not particle collisions that would disturb the stratification
since collisions occur in the same strata

How can collisions occur ONLY in the same strata? This is a very
unphysical condition.
a collision is almost pointlike

it exchanges energy between two particles
that differ in distance by ~ 2 * particleRadius
which is like half an angstrom here

so the total energy accounting in any strata does not change
which is the only thing that affects the total temperature in that
strata
( my Tavg in the program )

what it does accomplish is a mixing of Tx, Ty, and Tz

but that does not change the fact that
the particles still lose kinetic energy as they rise
and gain kinetic energy as they fall
it is convection currents and other large scale movements
that obstruct the process and make it only metastable

How do you have convection without collisions?
i don't model convection here

that would be a full fluid dynamic simulation
or a collective property of the particles that i do not measure

i was simply pointing out that there is a mechanism
to mix temperatures between strata
but it wasn't simply collisions

there is a stable regime before convection sets in
even with collisions occurring

[...]
except for capital letters
what is your PHYSICS argument?

My physics argument is that "temperature" is a phenomena closely
linked to the transfer of kinetic energy between particles by elastic
collisions. These collisions take place in 3 dimensions, not 2. While
I said (for simplicity) that you could calculate the temperature by
means of the average kinetic energy, BY DEFINTION, if your velocity
distribution doesn't follow the Maxwell-Boltzmann distribution, you
have NO temperature (the temperature is undefined).
[...]

the particles are colliding with the walls of the container
and sometimes colliding with each other

i can measure pressure
there is a defined volume
all the physics needed to do thermodynamic work

at this point
i have enough of the "temperature" to show
that a rarefied heat bath at equilibrium
will have a delta capable of driving a heat engine

which violates the second law

that therefore it is possible
if the simulation corresponds well enough with reality
to extract energy from a heat bath of a rarefied gas

whatever you want to call temperature
does not change these results in the energetics for this model

what would question this model
is to explain how this differential
still couldn't drive a carnot engine

that in itself may be interesting physics

-+-+-+-

when i get home tonight i will crank the radii up to .1m
and test that the collisions are handled properly
( another reason i code the generator in OCaml
is because there are so many available tools
for checking program correctness
particularly for the mathematical transformations it does )

i will post the results

the importance of opensource here
is that anyone can do the same

or even modify the program to account for other effects

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 8 '07 #5
"galathaea" <ga*******@gmail.comwrote in news:1173314396.031294.195110
@q40g2000cwq.googlegroups.com:
at this point
i have enough of the "temperature" to show
that a rarefied heat bath at equilibrium
will have a delta capable of driving a heat engine

which violates the second law
Interesting stuff, g. Probably worth pointing out, though, that the
"violation" is only apparent. Gravity produces a temperature stratification
(a delta T) from which energy may (in principle) be extracted. But unless
that energy is replaced, e.g., by solar heating, the delta T will quickly
become too small to extract any further energy. Basically we are "stealing"
from the system heat which would otherwise drive convection.

Mar 8 '07 #6
On Mar 7, 7:46 pm, Publius <m.publ...@nospam.comcast.netwrote:
"galathaea" <galath...@gmail.comwrote in news:1173314396.031294.195110
@q40g2000cwq.googlegroups.com:
at this point
i have enough of the "temperature" to show
that a rarefied heat bath at equilibrium
will have a delta capable of driving a heat engine
which violates the second law

Interesting stuff, g. Probably worth pointing out, though, that the
"violation" is only apparent. Gravity produces a temperature stratification
(a delta T) from which energy may (in principle) be extracted. But unless
that energy is replaced, e.g., by solar heating, the delta T will quickly
become too small to extract any further energy. Basically we are "stealing"
from the system heat which would otherwise drive convection.
absolutely

that is the point

there is no violation
of the conservation of energy

extracting heat from a heat bath cools it

the friction and other dissipative forces
near turbulence and free energy
generate heat

so we have a completely reversible system

if you can turn a heat bath
into something that generates work
you have a perpetuum mobile of the second kind

all energy becomes potentially infinitely reusable

this is actually a problem in information theory as well

distinguishing force and work
from heat
is actually a distinction of _use_ or _understanding_

that is why thermodynamics was so important to the industrial
revolution
because it allowed us to automate uses of energy

understanding engines
meant understanding how to make the universe
do what we _intend_

gravity stratification
( or general field stratification )
means we can recover energy for use

in a physics that associates information with energy
in the manner of maxwell's demon solutions
field stratification means we can extract
a potentially infinite amount of energy from the universe

this may be
in secret
constructivisms greatest defense
against the defeatism of ultrafinitism

-+-+-+-

i performed the checks on particle-particlelast night
and noticed that when collisions occurred
there was a boost in the energy of the system

it turns out that the spherical collision equations
it uses as reference
are in a canonical basis in relation to the particles
but that i only coded it to boost one of the velocities to the frame

i've changed it to now properly perform the coordinate transformations
completely in both directions

i generated the program
asking it to also make a few code motions useful to debugging
to illustrate the usefulness and speed of generation

i have verified that the energetics of collisions conserve energy
and i have tracked several collisions
and verified realistic final conditions
( angles work out to maintain momentum )

now
velocities are mixing properly

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
AND THE TEMPERATURE STRATIFICATION REMAINS
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

i have tested radii of particles up to 1m
and a variety of deltas as low as .0001s

i have extended the times of the simulation

everything currently still supports loschmidt

here is the dump of the current generation:

-+-+-+-+-+-+-+-+-+-+-+-+-++++++...
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <exception>

#include <boost/shared_ptr.hpp>
#include <boost/random.hpp>

namespace
{
// math
double pi(3.14159265358);

// particle descriptors
double particleMass(1.67372e-24); // (kg)
//double particleRadius(2.4e-11); // (m)
double particleRadius(.5); // (m)

// environment
double columnRadius(20.); // (m)
double columnHeight(100.); // (m)

// energetics
double temperature(273.15); // (K) = 0(C)
double boltzmann_k(1.3806505e-23); // (J/K)
double sigma(std::sqrt(boltzmann_k * temperature /
particleMass)); // ~ 47.468

// gravity
double g(-9.807); // (m/s)

// simulation controls
unsigned numberOfParticles(2000);
double simulationTime(5.);
double simulationDelta(.01);

// debug
bool collisionData(true);
bool stateData(true);
bool temperatureStratumData(true);
bool particleCollisionCalculations(true);
}

template <typename Metric>
Metric distance(Metric const& x, Metric const& y)
{
return std::sqrt(x * x + y * y);
}

template <typename Metric>
Metric distance(Metric const& x, Metric const& y, Metric const& z)
{
return std::sqrt(x * x + y * y + z * z);
}
struct Point3D
{
Point3D() :
x_(),
y_(),
z_()
{}

Point3D(double x, double y, double z) :
x_(x),
y_(y),
z_(z)
{}

double x_;
double y_;
double z_;
};

struct Velocity3D : Point3D
{
Velocity3D()
{}

Velocity3D(double x, double y, double z) :
Point3D(x, y, z)
{}
};

enum CollisionType
{
column,
particle
};

class Existent
{
public:
Existent(Point3D const& initialPosition,
Velocity3D const& initialVelocity,
double mass,
std::string const& name) :
position_(initialPosition),
velocity_(initialVelocity),
mass_(mass),
name_(name)
{}

double x() const
{
return position_.x_;
}

void x(double x)
{
position_.x_ = x;
}

double y() const
{
return position_.y_;
}

void y(double y)
{
position_.y_ = y;
}

double z() const
{
return position_.z_;
}

void z(double z)
{
position_.z_ = z;
}

double vx() const
{
return velocity_.x_;
}

void vx(double vx)
{
velocity_.x_ = vx;
}

double vy() const
{
return velocity_.y_;
}

void vy(double vy)
{
velocity_.y_ = vy;
}

double vz() const
{
return velocity_.z_;
}

void vz(double vz)
{
velocity_.z_ = vz;
}

double m() const
{
return mass_;
}

std::string name() const
{
return name_;
}

virtual bool isCollided(boost::shared_ptr<ExistentotherEntity)
const = 0;
virtual CollisionType collisionType() const = 0;

private:
Point3D position_;
Velocity3D velocity_;

double mass_;

std::string name_;
};

class Particle : public Existent
{
public:
Particle(
Point3D const& initialPosition,
Velocity3D const& initialVelocity,
double radius,
double mass,
std::string const& name) :
Existent(initialPosition, initialVelocity, mass, name),
radius_(radius)
{}

double radius() const
{
return radius_;
}

virtual bool isCollided(boost::shared_ptr<ExistentotherEntity)
const
{
// a particle can only be a first entity if the second is also a
particle
if (distance(x() - otherEntity->x(), y() - otherEntity->y(), z() -
otherEntity->z()) <
(radius() + boost::static_pointer_cast<Particle>(otherEntity)-
>radius()))
{
if (collisionData && (name() == "0"))
std::cout << "particle on particle action" << std::endl;
return true;
}
return false;
}

virtual CollisionType collisionType() const
{
return particle;
}

private:
double radius_;
};

class EnclosingColumn : public Existent
{
public:
EnclosingColumn(double radius, double height) :
Existent(Point3D(), Velocity3D(), 0., "column"),
radius_(radius),
height_(height)
{}

virtual bool isCollided(boost::shared_ptr<ExistentotherEntity)
const
{
// otherEntity must always be a particle!
if (distance(otherEntity->x(), otherEntity->y()) (radius_ -
boost::static_pointer_cast<Particle>(otherEntity)->radius()))
{
if (collisionData && (otherEntity->name() == "0"))
std::cout << "collision with wall of column" << std::endl;
return true;
}
else if (otherEntity->z() (height_ -
boost::static_pointer_cast<Particle>(otherEntity)->radius()))
{
if (collisionData && (otherEntity->name() == "0"))
std::cout << "collision with ceiling" << std::endl;
return true;
}
else if (otherEntity->z() <
boost::static_pointer_cast<Particle>(otherEntity)->radius())
{
if (collisionData && (otherEntity->name() == "0"))
std::cout << "collision with floor" << std::endl;
return true;
}
return false;
}

virtual CollisionType collisionType() const
{
return column;
}

private:
double radius_;
double height_;
};

class PhysicalWorld
{
public:
typedef std::vector<boost::shared_ptr<Existent Existents;

Existents::iterator begin()
{
return existents_.begin();
}

Existents::iterator end()
{
return existents_.end();
}

void pushBack(boost::shared_ptr<Existentexistent)
{
existents_.push_back(existent);
}

private:
Existents existents_;
};

struct StrataProfile
{
StrataProfile() :
temperatureAccumulatorX_(),
temperatureAccumulatorY_(),
temperatureAccumulatorZ_(),
count_()
{}

void add(double tx, double ty, double tz)
{
temperatureAccumulatorX_ += tx;
temperatureAccumulatorY_ += ty;
temperatureAccumulatorZ_ += tz;

squareAccumulatorX_ += tx * tx;
squareAccumulatorY_ += ty * ty;
squareAccumulatorZ_ += tz * tz;

++count_;
}

double tx() const
{
return temperatureAccumulatorX_ / count_;
}

double ty() const
{
return temperatureAccumulatorY_ / count_;
}

double tz() const
{
return temperatureAccumulatorZ_ / count_;
}

double mean() const
{
return (tx() + ty() + tz()) / 3.;
}

double standardDeviation() const
{
return std::sqrt(((squareAccumulatorX_ + squareAccumulatorY_ +
squareAccumulatorZ_) / (3. * count_)) - mean() * mean());
}

double temperatureAccumulatorX_;
double temperatureAccumulatorY_;
double temperatureAccumulatorZ_;

double squareAccumulatorX_;
double squareAccumulatorY_;
double squareAccumulatorZ_;

unsigned count_;
};

class PhysicsEngine
{
public:
PhysicsEngine(PhysicalWorld & world, double final, double delta) :
world_(world),
time_(0.),
final_(final),
delta_(delta)
{}

double time() const
{ return time_; }

double delta() const
{ return delta_; }

void cycle()
{
time_ += delta_;
}

void run()
{
std::cout << "entering the run loop" << std::endl;

// full run statistics
StrataProfile top;
StrataProfile bottom;

// main event loop
while (time_ < final_)
{
std::cout << "^~^~^~^~^~^~^~^ loop time " << time_ << "
^~^~^~^~^~^~^~^" << std::endl;

// check for collisions first as initial adjustment of velocity
for (PhysicalWorld::Existents::iterator
initialIntersector(world_.begin());
initialIntersector != world_.end();
++initialIntersector)
{
if ((initialIntersector + 1) != world_.end())
{
//std::cout << "-" << std::flush;

for (PhysicalWorld::Existents::iterator
secondIntersector(initialIntersector + 1);
secondIntersector != world_.end();
++secondIntersector)
{
//std::cout << "+" << std::flush;

if (collision(initialIntersector, secondIntersector))
{
//std::cout << "collision" << std::endl;
adjustFromCollision(initialIntersector,
secondIntersector);
}
}
}
}

// then cycle through each and adjust their final positions and
force changes to velocity
for (PhysicalWorld::Existents::iterator
existent(world_.begin());
existent != world_.end();
++existent)
{
adjustFreeMoving(existent);
}

// and cycle the time
cycle();

// now we can snapshot the new state
// follow a particle
PhysicalWorld::Existents::iterator existent(world_.begin() + 1);

if (stateData)
std::cout << "particle 1's iterated state:"
<< "\n x: " << (*existent)->x()
<< "\n y: " << (*existent)->y()
<< "\n z: " << (*existent)->z()
<< "\n vx: " << (*existent)->vx()
<< "\n vy: " << (*existent)->vy()
<< "\n vz: " << (*existent)->vz() << std::endl;

// and build temperature profile
unsigned strata(5);
std::vector<StrataProfiletemperatures(strata);

while (existent != world_.end())
{
unsigned particularStrata(static_cast<unsigned>(((*existent )-
>z() * 5.0) / columnHeight));
if (particularStrata >= strata)
particularStrata = strata - 1;
if (particularStrata < 0)
particularStrata = 0;

double tx((*existent)->m() * (*existent)->vx() * (*existent)-
>vx() / boltzmann_k);
double ty((*existent)->m() * (*existent)->vy() * (*existent)-
>vy() / boltzmann_k);
double tz((*existent)->m() * (*existent)->vz() * (*existent)-
>vz() / boltzmann_k);
temperatures[particularStrata].add(tx, ty, tz);

++existent;
}

for (unsigned stratum(0); stratum < strata; ++stratum)
{
if (temperatureStratumData)
std::cout << "in stratum " << stratum << " there were " <<
temperatures[stratum].count_ << " particles" << std::endl;

if (temperatures[stratum].count_)
{
if (temperatureStratumData)
std::cout << " tx: " << temperatures[stratum].tx()
<< " ty: " << temperatures[stratum].ty()
<< " tz: " << temperatures[stratum].tz()
<< " Tavg: " << temperatures[stratum].mean()
<< " std dev: +/-" <<
temperatures[stratum].standardDeviation() << std::endl;

if (0 == stratum)
bottom.add(temperatures[stratum].tx(),
temperatures[stratum].ty(), temperatures[stratum].tz());
else if ((strata - 1) == stratum)
top.add(temperatures[stratum].tx(),
temperatures[stratum].ty(), temperatures[stratum].tz());
}
else if (temperatureStratumData)
std::cout << "no temperature information possible" <<
std::endl;
}
}

// dump full run statistics
std::cout << "over the simulation we have"
<< "\ntop strata of the column - tx: " << top.tx() << " ty: " <<
top.ty() << " tz: " << top.tz()
<< " Tavg: " << top.mean() << " std dev: +/-" <<
top.standardDeviation()
<< "\nbottom strata of the column - tx: " << bottom.tx() << "
ty: " << bottom.ty() << " tz: " << bottom.tz()
<< " Tavg: " << bottom.mean() << " std dev: +/-" <<
bottom.standardDeviation()
<< std::endl;
}

private:
bool collision(PhysicalWorld::Existents::iterator object1,
PhysicalWorld::Existents::iterator object2)
{
return (*object1)->isCollided(*object2);
}

virtual void adjustFromCollision(PhysicalWorld::Existents::iter ator
object1, PhysicalWorld::Existents::iterator object2) = 0;
virtual void adjustFreeMoving(PhysicalWorld::Existents::iterato r
object) = 0;

PhysicalWorld & world_;

double time_;
double final_;
double const delta_;
};

class LinearGravityEngine : public PhysicsEngine
{
public:
LinearGravityEngine(PhysicalWorld & world, double final, double
delta) :
PhysicsEngine(world, final, delta)
{}

private:
virtual void adjustFromCollision(PhysicalWorld::Existents::iter ator
object1, PhysicalWorld::Existents::iterator object2)
{
if ((*object1)->collisionType() == particle)
{
if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "particles colliding:"
<< "\n 1 - x: " << (*object1)->x() << " y: " << (*object1)-
>y() << " z: " << (*object1)->z()
<< "\n 1 - vx: " << (*object1)->vx() << " vy: " <<
(*object1)->vy() << " vz: " << (*object1)->vz()
<< "\n 2 - x: " << (*object2)->x() << " y: " << (*object2)-
>y() << " z: " << (*object2)->z()
<< "\n 2 - vx: " << (*object2)->vx() << " vy: " <<
(*object2)->vy() << " vz: " << (*object2)->vz() << std::endl;

// calculate relative distances and speed
double deltaX((*object2)->x() - (*object1)->x());
double deltaY((*object2)->y() - (*object1)->y());
double deltaZ((*object2)->z() - (*object1)->z());
double deltaVX((*object2)->vx() - (*object1)->vx());
double deltaVY((*object2)->vy() - (*object1)->vy());
double deltaVZ((*object2)->vz() - (*object1)->vz());

double relativeDistance(distance(deltaX, deltaY, deltaZ));
double relativeVelocity(distance(deltaVX, deltaVY, deltaVZ));

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "relativeDistance: " << relativeDistance << "
relativeVelocity: " << relativeVelocity << std::endl;

// find relative angle
double theta(std::acos(deltaZ / relativeDistance));
double phi(((0 == deltaX) && (0 == deltaY)) ? 0. :
std::atan2(deltaY, deltaX));

if ((*object1)->name() == "0")
std::cout << "theta: " << theta << " phi: " << phi <<
std::endl;

// rotate to canonical coordinates
double rotatedVelocityX(- std::cos(theta) * std::cos(phi) *
deltaVX - std::cos(theta) * std::sin(phi) * deltaVY + std::sin(theta)
* deltaVZ);
double rotatedVelocityY(std::sin(phi) * deltaVX - std::cos(phi)
* deltaVY);
double rotatedVelocityZ(- std::sin(theta) * std::cos(phi) *
deltaVX - std::sin(theta) * std::sin(phi) * deltaVY - std::cos(theta)
* deltaVZ);

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "rotatedVelocityX: " << rotatedVelocityX << "
rotatedVelocityY: "
<< rotatedVelocityY << " rotatedVelocityZ: " <<
rotatedVelocityZ << std::endl;

// find relative velocity angles
double velocityTheta(std::acos(rotatedVelocityZ /
relativeVelocity));
double velocityPhi(((0 == rotatedVelocityX) && (0 ==
rotatedVelocityY)) ? 0. : std::atan2(rotatedVelocityY,
rotatedVelocityX));

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "velocityTheta: " << velocityTheta << "
velocityPhi: " << velocityPhi << std::endl;

// classic impact parameter
double impact(relativeDistance * std::sin(velocityTheta) /
(boost::static_pointer_cast<Particle>(*object1)->radius() +
boost::static_pointer_cast<Particle>(*object2)->radius()));

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "impact: " << impact << std::endl;

// reverse motion to collision time
double collisionTime((relativeDistance*std::cos(velocityT heta) -
(boost::static_pointer_cast<Particle>(*object1)->radius() +
boost::static_pointer_cast<Particle>(*object2)->radius()) *
std::sqrt(1. - impact * impact)) / relativeVelocity);

(*object1)->x((- deltaVX + (*object2)->vx()) * collisionTime +
(*object1)->x());
(*object1)->y((- deltaVY + (*object2)->vy()) * collisionTime +
(*object1)->y());
(*object1)->z((- deltaVZ + (*object2)->vz()) * collisionTime +
(*object1)->z());
(*object2)->x(deltaX + deltaVX * collisionTime + (*object1)-
>x());
(*object2)->y(deltaY + deltaVY * collisionTime + (*object1)-
>y());
(*object2)->z(deltaZ + deltaVZ * collisionTime + (*object1)-
>z());
if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "collisionTime: " << collisionTime << std::endl;

// calculate collision angles
double impactAngle(std::asin(-impact));
double velocityAngleTotal(std::tan(velocityTheta +
impactAngle));

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "impactAngle: " << impactAngle << "
velocityAngleTotal: " << velocityAngleTotal << std::endl;

// mass impact
double mu((*object2)->m() / (*object1)->m());
double diffZ(2. * (rotatedVelocityZ + velocityAngleTotal *
(std::cos(velocityPhi) * rotatedVelocityX +
std::sin(velocityPhi) * rotatedVelocityY)) /
((1 + velocityAngleTotal * velocityAngleTotal) * (1
+ mu)));
// boost coordinate frame for impact
double boostedVelocityX(velocityAngleTotal *
std::cos(velocityPhi) * diffZ);
double boostedVelocityY(velocityAngleTotal *
std::sin(velocityPhi) * diffZ);
double boostedVelocityZ(diffZ);

rotatedVelocityX -= mu * boostedVelocityX;
rotatedVelocityY -= mu * boostedVelocityY;
rotatedVelocityZ -= mu * boostedVelocityZ;

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "boostedVelocityX: " << boostedVelocityX << "
boostedVelocityY: "
<< boostedVelocityY << " boostedVelocityZ: " <<
boostedVelocityZ
<< "\n and updated rotatedVelocityX: " << rotatedVelocityX
<< " rotatedVelocityY: "
<< rotatedVelocityY << " rotatedVelocityZ: " <<
rotatedVelocityZ << std::endl;

// and finally transform velocities
(*object1)->vx(std::cos(theta) * std::cos(phi) *
rotatedVelocityX - std::sin(phi) * rotatedVelocityY
+ std::sin(theta) * std::cos(phi) *
rotatedVelocityZ + (*object2)->vx());
(*object1)->vy(std::cos(theta) * std::sin(phi) *
rotatedVelocityX + std::cos(phi) * rotatedVelocityY
+ std::sin(theta) * std::sin(phi) *
rotatedVelocityZ + (*object2)->vy());
(*object1)->vz(- std::sin(theta) * rotatedVelocityX +
std::cos(theta) * rotatedVelocityZ + (*object2)->vz());
(*object2)->vx(std::cos(theta) * std::cos(phi) *
boostedVelocityX - std::sin(phi) * boostedVelocityY
+ std::sin(theta) * std::cos(phi) *
boostedVelocityZ + (*object2)->vx());
(*object2)->vy(std::cos(theta) * std::sin(phi) *
boostedVelocityX + std::cos(phi) * boostedVelocityY
+ std::sin(theta) * std::sin(phi) *
boostedVelocityZ + (*object2)->vy());
(*object2)->vz(- std::sin(theta) * boostedVelocityX +
std::cos(theta) * boostedVelocityZ + (*object2)->vz());

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "particles leaving:"
<< "\n 1 - x: " << (*object1)->x() << " y: " << (*object1)-
>y() << " z: " << (*object1)->z()
<< "\n 1 - vx: " << (*object1)->vx() << " vy: " <<
(*object1)->vy() << " vz: " << (*object1)->vz()
<< "\n 2 - x: " << (*object2)->x() << " y: " << (*object2)-
>y() << " z: " << (*object2)->z()
<< "\n 2 - vx: " << (*object2)->vx() << " vy: " <<
(*object2)->vy() << " vz: " << (*object2)->vz() << std::endl;
}
else if ((*object1)->collisionType() == column)
{
if ((*object2)->z() < 0.)
{
// reflect off bottom
(*object2)->vz(-(*object2)->vz());
}
else if ((*object2)->z() columnHeight)
{
// reflect off top
(*object2)->vz(-(*object2)->vz());
}

if (distance((*object2)->x(), (*object2)->y()))
{
// reflect off sides
// calculate the collision theta
double theta(((*object2)->x() == 0 && (*object2)->y() == 0) ?
0. : std::atan2((*object2)->y(), (*object2)->x()));
double velocityTheta(((*object2)->vx() == 0 && (*object2)-
>vy() == 0) ? 0. : std::atan2((*object2)->vy(), (*object2)->vx()));
double velocity(distance((*object2)->vx(), (*object2)->vy()));

(*object2)->vx(velocity * std::cos(pi + 2 * theta -
velocityTheta));
(*object2)->vy(velocity * std::sin(pi + 2 * theta -
velocityTheta));
}
}
}

virtual void adjustFreeMoving(PhysicalWorld::Existents::iterato r
object)
{
// simple linear free with vertical gravity
(*object)->x((*object)->x() + (*object)->vx() * delta());
(*object)->y((*object)->y() + (*object)->vy() * delta());

(*object)->z((*object)->z() + (*object)->vz() * delta() + (1./2.)
* g * delta() * delta());
(*object)->vz((*object)->vz() + g * delta());
}
};

int main()
{
try
{
std::cout << "Functional Simulations Engine 0.39 - starting" <<
std::endl;
std::cout << "generated from source loschmidt.ml" << std::endl;

// build up the world
PhysicalWorld world;

std::cout << "created the world" << std::endl;

// add the column (radius 1
boost::shared_ptr<Existentcolumn(new
EnclosingColumn(columnRadius, columnHeight));
world.pushBack(column);

std::cout << "added the column" << std::endl;

// rng for simulations
boost::mt19937 rng;
rng.seed(static_cast<unsigned int>(std::time(0)));

// create particles
for (unsigned particleCounter(0); particleCounter <
numberOfParticles; ++particleCounter)
{
if (! particleCounter)
std::cout << "creating particle 1" << std::endl;

// find a random position in the column
// height in [0, columnHeight]
boost::uniform_real<possibleHeight(0., columnHeight);
boost::variate_generator<boost::mt19937 &, boost::uniform_real<>
heightGenerator(rng, possibleHeight);
double particleHeight(heightGenerator());

double particleX(0.);
double particleY(0.);

// find an x, y position in the column
// just loop until valid in a circle (to maintain distribution)
do
{
// build generator
boost::uniform_real<possibleXY(0., columnRadius);
boost::variate_generator<boost::mt19937 &,
boost::uniform_real< tranverseGenerator(rng, possibleXY);

// pull an x, y
particleX = tranverseGenerator();
particleY = tranverseGenerator();
}
while (distance(particleX, particleY) >= columnRadius);

// now get a velocity in the maxwellian-boltzmann distribution
for the temperature
// which is just a normal distribution
// with mean = 0
// variance sigma^2 = k T / m
boost::normal_distribution<possibleVelocity(0., sigma);
boost::variate_generator<boost::mt19937 &,
boost::normal_distribution< velocityGenerator(rng,
possibleVelocity);

double velocityX(velocityGenerator());
double velocityY(velocityGenerator());
double velocityZ(velocityGenerator());

if (! particleCounter)
std::cout << "initial state position: "
<< "\n x: " << particleX
<< " y: " << particleY
<< " z: " << particleHeight
<< "\n vx: " << velocityX
<< " vy: " << velocityY
<< " vz: " << velocityZ << std::endl;

std::stringstream converter;
converter << particleCounter;

// now build the particle
boost::shared_ptr<Existentparticle(new Particle(
Point3D(particleX, particleY, particleHeight),
Velocity3D(velocityX, velocityY, velocityZ),
particleRadius,
particleMass,
converter.str()));

world.pushBack(particle);
}

std::cout << "all particles created!" << std::endl;

// now that we have the world built
// build the physics engine
// attach the world
// and configure to run x deltas
LinearGravityEngine engine(world, simulationTime,
simulationDelta);
engine.run();
}
catch (std::exception & blowUp)
{
std::cout << "exception at lowest level: " << blowUp.what() <<
std::endl;
}
catch (...)
{
std::cout << "blowUps happen" << std::endl;
}
}

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 8 '07 #7
In comp.programming galathaea <ga*******@gmail.comwrote:
collisions are accounted for
the reason they are "very rare"
is because i have been testing low particle numbers
( 1000 - 10000 )
in a large column (100m tall by 20m radius)
and the particles are very very small
( i use the atomic hydrogen radius 2.4e-11m )
Do you realize that that's about one particle within 1 to 10
cubic meters? That's a pretty good vacuum. Do you made an
estimate of how long a system under such conditions requires
to achieve thermal equilibrium (not that you can achieve that
at all if you do not take collisions into account - where else
would it result from)?

Do yourself a favour and, just for a test, start your system
with a non-Maxwell-velocity-distribution (but were you know
the initial total energy) and check how long it takes, swit-
ching off gravity, to end up with a Maxwell-distribution (if
it does at all) and check if the energy didn't change more
than to be expected (due to just rounding errors) before you
try to draw any conclusions from your simulation under more
complicated conditions.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Mar 9 '07 #8
galathaea wrote:
>

there is no violation
of the conservation of energy

extracting heat from a heat bath cools it

the friction and other dissipative forces
near turbulence and free energy
generate heat

so we have a completely reversible system

if you can turn a heat bath
into something that generates work
you have a perpetuum mobile of the second kind
Except for that darned Laws of Thermodynamics!!!!
Mar 9 '07 #9
On Mar 8, 4:39 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
In comp.programming galathaea <galath...@gmail.comwrote:
collisions are accounted for
the reason they are "very rare"
is because i have been testing low particle numbers
( 1000 - 10000 )
in a large column (100m tall by 20m radius)
and the particles are very very small
( i use the atomic hydrogen radius 2.4e-11m )

Do you realize that that's about one particle within 1 to 10
cubic meters? That's a pretty good vacuum.
my first goal was to demonstrate the principle
in "any" regime of state space

once that was done
and the simulation established
then i could expand into other regimes
and map the property space

but you are right that the full principle needs to be demonstrated
and i was cautious to immediately expand radii
because i didn't trust the particle on particle collision routine

it entrusted a lot of sophistication on the part of the generator
to handle complex translation and rotation matrices
in various three dimensional frames
(and i knew i hadn't spent much time there...)

it has turned out to have a few transformation bugs
which i have explored in this related discussion:

http://groups.google.com/group/sci.p...ba7853d?hl=en&

as it mentions towards the bottom
i have worked out now even the particle-particle collisions
and in these regimes it is still illustrating stratification

by enlarging radii in the simulation
the system can be reinterpreted as a
lower temperature
higher gravity
smaller volume
higher density
system of normal sized particles

its just a variable scaling

so now i am beginning to map a volume of phase space
that appears to obey loschmidt's law
Do you make an
estimate of how long a system under such conditions requires
to achieve thermal equilibrium (not that you can achieve that
at all if you do not take collisions into account - where else
would it result from)?
actually i haven't made hard bounds yet
because i wanted to examine the actual dynamic data

notice that i place the system
in the state proposed by boltzmann and maxwell
as _the_ equilibrium state

so it is interesting
that it naturally and regularly
deviates in favor of loschmidt's law

i have run the simulation as long as 20 seconds
and in the regime's i was testing
this separated the stratification by 3 or more standard deviations
so there is evidence
i am allowing the systems to come to good equilibrium

but i can run the simulation for several minutes or longer
this may take several hours on my macbook

i think you are absolutely correct that it is needed
to establish trust this is not a false equilibrium
Do yourself a favour and, just for a test, start your system
with a non-Maxwell-velocity-distribution (but were you know
the initial total energy) and check how long it takes, swit-
ching off gravity, to end up with a Maxwell-distribution (if
it does at all) and check if the energy didn't change more
than to be expected (due to just rounding errors) before you
try to draw any conclusions from your simulation under more
complicated conditions.
i think these are all very good tests to put the simulator through
and i thank you for all your suggestions

i do not have an agenda here
and only want to predict what actually occurs in experience
because that is the only source of valid technology

so i want to explore all regimes relevant to experience

i will post results as they are known

in the meantime
do yourself a favor and download "b@un(e"
the new musical accompaniment to particle collision simulators
at

http://www.garageband.com/artist/galathaea

=p

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 9 '07 #10
Hi Galathaea, I think your model is too myopic.

Photons are redshifted ( i.e. cooled )
as they climb out of the earth's ( or sun's ) gravity well,
and both the earth and the sun have been
cooled down by the net loss of photons and atoms.

As I told you in, " news:Je*********************@Cotse.NET ":

By definition, the cosmos is a closed system
and the energy in it is continuously, spontaneously, irreversibly,
being spent. That's entropy, the second law of thermodynamics.

Many have speculated ( hoped, really )
that the known Universe is an open system
( " plugged into the wall ", so to speak )
but all empirical evidence suggests that this is not the case.

For example, 13.7 Giga_Years ago the CMB blackbody radiation
was 3 thousand Kelvin... today it's 3 Kelvin.
The energy of the known Universe is continually being consumed,
creating ' Life '.
Mar 9 '07 #11
On Mar 8, 9:40 pm, "galathaea" <galath...@gmail.comwrote:
On Mar 8, 4:39 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
In comp.programming galathaea <galath...@gmail.comwrote:
collisions are accounted for
the reason they are "very rare"
is because i have been testing low particle numbers
( 1000 - 10000 )
in a large column (100m tall by 20m radius)
and the particles are very very small
( i use the atomic hydrogen radius 2.4e-11m )
Do you realize that that's about one particle within 1 to 10
cubic meters? That's a pretty good vacuum.

my first goal was to demonstrate the principle
in "any" regime of state space

once that was done
and the simulation established
then i could expand into other regimes
and map the property space

but you are right that the full principle needs to be demonstrated
and i was cautious to immediately expand radii
because i didn't trust the particle on particle collision routine

it entrusted a lot of sophistication on the part of the generator
to handle complex translation and rotation matrices
in various three dimensional frames
(and i knew i hadn't spent much time there...)

it has turned out to have a few transformation bugs
which i have explored in this related discussion:

http://groups.google.com/group/sci.p...ba7853d?hl=en&

as it mentions towards the bottom
i have worked out now even the particle-particle collisions
and in these regimes it is still illustrating stratification

by enlarging radii in the simulation
the system can be reinterpreted as a
lower temperature
higher gravity
smaller volume
higher density
system of normal sized particles

its just a variable scaling

so now i am beginning to map a volume of phase space
that appears to obey loschmidt's law
Do you make an
estimate of how long a system under such conditions requires
to achieve thermal equilibrium (not that you can achieve that
at all if you do not take collisions into account - where else
would it result from)?

actually i haven't made hard bounds yet
because i wanted to examine the actual dynamic data

notice that i place the system
in the state proposed by boltzmann and maxwell
as _the_ equilibrium state

so it is interesting
that it naturally and regularly
deviates in favor of loschmidt's law

i have run the simulation as long as 20 seconds
and in the regime's i was testing
this separated the stratification by 3 or more standard deviations
so there is evidence
i am allowing the systems to come to good equilibrium

but i can run the simulation for several minutes or longer
this may take several hours on my macbook

i think you are absolutely correct that it is needed
to establish trust this is not a false equilibrium
Do yourself a favour and, just for a test, start your system
with a non-Maxwell-velocity-distribution (but were you know
the initial total energy) and check how long it takes, swit-
ching off gravity, to end up with a Maxwell-distribution (if
it does at all) and check if the energy didn't change more
than to be expected (due to just rounding errors) before you
try to draw any conclusions from your simulation under more
complicated conditions.

i think these are all very good tests to put the simulator through
and i thank you for all your suggestions

i do not have an agenda here
and only want to predict what actually occurs in experience
because that is the only source of valid technology

so i want to explore all regimes relevant to experience

i will post results as they are known

in the meantime
do yourself a favor and download "b@un(e"
the new musical accompaniment to particle collision simulators
at

http://www.garageband.com/artist/galathaea

=p

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar
You can save yourself a lot of computational effort by omitting
collisions with the walls in the x and y axes. If you imagine that
your box is oriented so that the z axis is "up" (the one affected by
gravity), a good deal of your simulation is following the particles as
they bounce off the walls.

A way to have a more realistic simulation (and one that is more
typical of how physics simulations are usually run) is to use so-
called "periodic boundary conditions" for the x and y axes. Don;t use
them on the z axis, or you won;t have any information about the gavity
effect.

By perioidic bounary conditions I mean, that every time a particle
would "hit the wall" of the +x axis, a particle should emerge for the -
x axis, with the same velocity as the previous particle. These
conditions are necessary to remove "edge" effects. It also simplifies
the progrmming somewhat.

Another way to simplify the programming, while testing your code, is
to make the whole problem 1-dimensional. In this case, there is only 1
axis, the z axis. Start with a random distribution of points, with
random velocities. Now collisions are easier to predict, and determine
their effect, since there is only 1 dimension. Gravity affects along
the z axis.

Mar 9 '07 #12
On Mar 9, 1:28 am, "galathaea" <galath...@gmail.comwrote:
<very extensive snip>
>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar
Leapin' Becquerels Batman! Another victim of The Riddler!

Listen girl, go outside pick a flower and smell at it. You really need
it. And when you're your old self meditate on why you can't put that
in C.
Regards.

Mar 9 '07 #13
On Mar 9, 7:29 am, "guenther vonKnakspot" <apa...@gmail.comwrote:
On Mar 9, 1:28 am, "galathaea" <galath...@gmail.comwrote:
<very extensive snip>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Leapin' Becquerels Batman! Another victim of The Riddler!
i know

it appears i have finally lost it

i have taken a rather unorthodox approach to crankdom
however
by posting andreaas trupp's mathematical derivation
and following with my own particle simulations

maybe i should start making some obvious errors
to make it it easier for others to point them out
at which point i can repeatedly
AND ALL IN CAPS
start calling them boltzmann zombies...

that just doesn't sound like it would be as much fun
though...
Listen girl, go outside pick a flower and smell at it. You really need
it. And when you're your old self meditate on why you can't put that
in C.
my plum tree made it through the winter

i was very scared for it
because we get freezing temperatures at times
and its still very small (smaller than i!)

it has a whole bunch of pretty white flowers now

but
and i apologise for what i am about to say
there are times
when i am dreaming larger than anyone really out to dream
where i imagine my simulations generator
one day mapping much of the space of evolution

starting with a basic reaction engine
exploring early autocatalysis
and the initial encapsulations
simulating the great oxygen catastrophe
and the endosymbioses it engenders until eukarya

until
space and moore's law willing
i have simulations of that plum tree
and the olfactory responses of the neural system
of some strange monkeygirl
that keeps walking up to it and sniffing

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 9 '07 #14
On Mar 8, 5:34 pm, red floyd <no.s...@here.dudewrote:
galathaea wrote:
there is no violation
of the conservation of energy
extracting heat from a heat bath cools it
the friction and other dissipative forces
near turbulence and free energy
generate heat
so we have a completely reversible system
if you can turn a heat bath
into something that generates work
you have a perpetuum mobile of the second kind

Except for that darned Laws of Thermodynamics!!!!
yes

and i do not disagree that these are well verified in experience

and i am also not questioning the first law
conservation of energy
which is the basis of all modern formulations of physics
in terms of lagrangians and hamiltonians
from which the time invariance of physical law is derived

but the second law has the most tenuous link
of all the thermodynamic laws
to fundamental physics

microscopic reversibility challenges it
poincare's recurrence theorem challenges it

so it is still being tackled by physicists to this day

and the second and third laws are intimately linked
because of quantum effects
and the fact that 0 is not a temperature of absolute rest
but merely a temperature of minimal energy
due to zero-point fluctuations
( as mentioned even by feynman )

it would be a rather elegant resolution to the problem
if the second law was simply an approximation in many ordered
circumstances

if it could in fact be violated
thus validating many of the modern physical symmetries

the effect i am simulating
is very small to say the least
and would require a slightly different formulation
for technology

daniel sheehan has published more about such possibilities
in phys. rev. e
phys. lett. a
phys. plasma
among others

quite reputable publications...

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 9 '07 #15
On Mar 8, 3:28 pm, "galathaea" <galath...@gmail.comwrote:
On Mar 7, 7:46 pm, Publius <m.publ...@nospam.comcast.netwrote:
"galathaea" <galath...@gmail.comwrote in news:1173314396.031294.195110
@q40g2000cwq.googlegroups.com:
at this point
i have enough of the "temperature" to show
that a rarefied heat bath at equilibrium
will have a delta capable of driving a heat engine
which violates the second law
Interesting stuff, g. Probably worth pointing out, though, that the
"violation" is only apparent. Gravity produces a temperature stratification
(a delta T) from which energy may (in principle) be extracted. But unless
that energy is replaced, e.g., by solar heating, the delta T will quickly
become too small to extract any further energy. Basically we are "stealing"
from the system heat which would otherwise drive convection.

absolutely

that is the point

there is no violation
of the conservation of energy

extracting heat from a heat bath cools it

the friction and other dissipative forces
near turbulence and free energy
generate heat

so we have a completely reversible system

if you can turn a heat bath
into something that generates work
you have a perpetuum mobile of the second kind

all energy becomes potentially infinitely reusable

this is actually a problem in information theory as well

distinguishing force and work
from heat
is actually a distinction of _use_ or _understanding_

that is why thermodynamics was so important to the industrial
revolution
because it allowed us to automate uses of energy

understanding engines
meant understanding how to make the universe
do what we _intend_

gravity stratification
( or general field stratification )
means we can recover energy for use

in a physics that associates information with energy
in the manner of maxwell's demon solutions
field stratification means we can extract
a potentially infinite amount of energy from the universe
^^^^^^
information

correction here

without which
the whole mention of ultrafinitism-v-constructivism makes no sense
this may be
in secret
constructivisms greatest defense
against the defeatism of ultrafinitism

-+-+-+-

i performed the checks on particle-particlelast night
and noticed that when collisions occurred
there was a boost in the energy of the system

it turns out that the spherical collision equations
it uses as reference
are in a canonical basis in relation to the particles
but that i only coded it to boost one of the velocities to the frame

i've changed it to now properly perform the coordinate transformations
completely in both directions

i generated the program
asking it to also make a few code motions useful to debugging
to illustrate the usefulness and speed of generation

i have verified that the energetics of collisions conserve energy
and i have tracked several collisions
and verified realistic final conditions
( angles work out to maintain momentum )

now
velocities are mixing properly

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
AND THE TEMPERATURE STRATIFICATION REMAINS
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

i have tested radii of particles up to 1m
and a variety of deltas as low as .0001s

i have extended the times of the simulation

everything currently still supports loschmidt

here is the dump of the current generation:

-+-+-+-+-+-+-+-+-+-+-+-+-++++++...

#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <exception>

#include <boost/shared_ptr.hpp>
#include <boost/random.hpp>

namespace
{
// math
double pi(3.14159265358);

// particle descriptors
double particleMass(1.67372e-24); // (kg)
//double particleRadius(2.4e-11); // (m)
double particleRadius(.5); // (m)

// environment
double columnRadius(20.); // (m)
double columnHeight(100.); // (m)

// energetics
double temperature(273.15); // (K) = 0(C)
double boltzmann_k(1.3806505e-23); // (J/K)
double sigma(std::sqrt(boltzmann_k * temperature /
particleMass)); // ~ 47.468

// gravity
double g(-9.807); // (m/s)

// simulation controls
unsigned numberOfParticles(2000);
double simulationTime(5.);
double simulationDelta(.01);

// debug
bool collisionData(true);
bool stateData(true);
bool temperatureStratumData(true);
bool particleCollisionCalculations(true);

}

template <typename Metric>
Metric distance(Metric const& x, Metric const& y)
{
return std::sqrt(x * x + y * y);

}

template <typename Metric>
Metric distance(Metric const& x, Metric const& y, Metric const& z)
{
return std::sqrt(x * x + y * y + z * z);

}

struct Point3D
{
Point3D() :
x_(),
y_(),
z_()
{}

Point3D(double x, double y, double z) :
x_(x),
y_(y),
z_(z)
{}

double x_;
double y_;
double z_;

};

struct Velocity3D : Point3D
{
Velocity3D()
{}

Velocity3D(double x, double y, double z) :
Point3D(x, y, z)
{}

};

enum CollisionType
{
column,
particle

};

class Existent
{
public:
Existent(Point3D const& initialPosition,
Velocity3D const& initialVelocity,
double mass,
std::string const& name) :
position_(initialPosition),
velocity_(initialVelocity),
mass_(mass),
name_(name)
{}

double x() const
{
return position_.x_;
}

void x(double x)
{
position_.x_ = x;
}

double y() const
{
return position_.y_;
}

void y(double y)
{
position_.y_ = y;
}

double z() const
{
return position_.z_;
}

void z(double z)
{
position_.z_ = z;
}

double vx() const
{
return velocity_.x_;
}

void vx(double vx)
{
velocity_.x_ = vx;
}

double vy() const
{
return velocity_.y_;
}

void vy(double vy)
{
velocity_.y_ = vy;
}

double vz() const
{
return velocity_.z_;
}

void vz(double vz)
{
velocity_.z_ = vz;
}

double m() const
{
return mass_;
}

std::string name() const
{
return name_;
}

virtual bool isCollided(boost::shared_ptr<ExistentotherEntity)
const = 0;
virtual CollisionType collisionType() const = 0;

private:
Point3D position_;
Velocity3D velocity_;

double mass_;

std::string name_;

};

class Particle : public Existent
{
public:
Particle(
Point3D const& initialPosition,
Velocity3D const& initialVelocity,
double radius,
double mass,
std::string const& name) :
Existent(initialPosition, initialVelocity, mass, name),
radius_(radius)
{}

double radius() const
{
return radius_;
}

virtual bool isCollided(boost::shared_ptr<ExistentotherEntity)
const
{
// a particle can only be a first entity if the second is also a
particle
if (distance(x() - otherEntity->x(), y() - otherEntity->y(), z() -
otherEntity->z()) <
(radius() + boost::static_pointer_cast<Particle>(otherEntity)->radius()))

{
if (collisionData && (name() == "0"))
std::cout << "particle on particle action" << std::endl;
return true;
}
return false;
}

virtual CollisionType collisionType() const
{
return particle;
}

private:
double radius_;

};

class EnclosingColumn : public Existent
{
public:
EnclosingColumn(double radius, double height) :
Existent(Point3D(), Velocity3D(), 0., "column"),
radius_(radius),
height_(height)
{}

virtual bool isCollided(boost::shared_ptr<ExistentotherEntity)
const
{
// otherEntity must always be a particle!
if (distance(otherEntity->x(), otherEntity->y()) (radius_ -
boost::static_pointer_cast<Particle>(otherEntity)->radius()))
{
if (collisionData && (otherEntity->name() == "0"))
std::cout << "collision with wall of column" << std::endl;
return true;
}
else if (otherEntity->z() (height_ -
boost::static_pointer_cast<Particle>(otherEntity)->radius()))
{
if (collisionData && (otherEntity->name() == "0"))
std::cout << "collision with ceiling" << std::endl;
return true;
}
else if (otherEntity->z() <
boost::static_pointer_cast<Particle>(otherEntity)->radius())
{
if (collisionData && (otherEntity->name() == "0"))
std::cout << "collision with floor" << std::endl;
return true;
}
return false;
}

virtual CollisionType collisionType() const
{
return column;
}

private:
double radius_;
double height_;

};

class PhysicalWorld
{
public:
typedef std::vector<boost::shared_ptr<Existent Existents;

Existents::iterator begin()
{
return existents_.begin();
}

Existents::iterator end()
{
return existents_.end();
}

void pushBack(boost::shared_ptr<Existentexistent)
{
existents_.push_back(existent);
}

private:
Existents existents_;

};

struct StrataProfile
{
StrataProfile() :
temperatureAccumulatorX_(),
temperatureAccumulatorY_(),
temperatureAccumulatorZ_(),
count_()
{}

void add(double tx, double ty, double tz)
{
temperatureAccumulatorX_ += tx;
temperatureAccumulatorY_ += ty;
temperatureAccumulatorZ_ += tz;

squareAccumulatorX_ += tx * tx;
squareAccumulatorY_ += ty * ty;
squareAccumulatorZ_ += tz * tz;

++count_;
}

double tx() const
{
return temperatureAccumulatorX_ / count_;
}

double ty() const
{
return temperatureAccumulatorY_ / count_;
}

double tz() const
{
return temperatureAccumulatorZ_ / count_;
}

double mean() const
{
return (tx() + ty() + tz()) / 3.;
}

double standardDeviation() const
{
return std::sqrt(((squareAccumulatorX_ + squareAccumulatorY_ +
squareAccumulatorZ_) / (3. * count_)) - mean() * mean());
}

double temperatureAccumulatorX_;
double temperatureAccumulatorY_;
double temperatureAccumulatorZ_;

double squareAccumulatorX_;
double squareAccumulatorY_;
double squareAccumulatorZ_;

unsigned count_;

};

class PhysicsEngine
{
public:
PhysicsEngine(PhysicalWorld & world, double final, double delta) :
world_(world),
time_(0.),
final_(final),
delta_(delta)
{}

double time() const
{ return time_; }

double delta() const
{ return delta_; }

void cycle()
{
time_ += delta_;
}

void run()
{
std::cout << "entering the run loop" << std::endl;

// full run statistics
StrataProfile top;
StrataProfile bottom;

// main event loop
while (time_ < final_)
{
std::cout << "^~^~^~^~^~^~^~^ loop time " << time_ << "
^~^~^~^~^~^~^~^" << std::endl;

// check for collisions first as initial adjustment of velocity
for (PhysicalWorld::Existents::iterator
initialIntersector(world_.begin());
initialIntersector != world_.end();
++initialIntersector)
{
if ((initialIntersector + 1) != world_.end())
{
//std::cout << "-" << std::flush;

for (PhysicalWorld::Existents::iterator
secondIntersector(initialIntersector + 1);
secondIntersector != world_.end();
++secondIntersector)
{
//std::cout << "+" << std::flush;

if (collision(initialIntersector, secondIntersector))
{
//std::cout << "collision" << std::endl;
adjustFromCollision(initialIntersector,
secondIntersector);
}
}
}
}

// then cycle through each and adjust their final positions and
force changes to velocity
for (PhysicalWorld::Existents::iterator
existent(world_.begin());
existent != world_.end();
++existent)
{
adjustFreeMoving(existent);
}

// and cycle the time
cycle();

// now we can snapshot the new state
// follow a particle
PhysicalWorld::Existents::iterator existent(world_.begin() + 1);

if (stateData)
std::cout << "particle 1's iterated state:"
<< "\n x: " << (*existent)->x()
<< "\n y: " << (*existent)->y()
<< "\n z: " << (*existent)->z()
<< "\n vx: " << (*existent)->vx()
<< "\n vy: " << (*existent)->vy()
<< "\n vz: " << (*existent)->vz() << std::endl;

// and build temperature profile
unsigned strata(5);
std::vector<StrataProfiletemperatures(strata);

while (existent != world_.end())
{
unsigned particularStrata(static_cast<unsigned>(((*existent )->z() * 5.0) / columnHeight));

if (particularStrata >= strata)
particularStrata = strata - 1;
if (particularStrata < 0)
particularStrata = 0;

double tx((*existent)->m() * (*existent)->vx() * (*existent)->vx() / boltzmann_k);

double ty((*existent)->m() * (*existent)->vy() * (*existent)->vy() / boltzmann_k);

double tz((*existent)->m() * (*existent)->vz() * (*existent)-
vz() / boltzmann_k);

temperatures[particularStrata].add(tx, ty, tz);

++existent;
}

for (unsigned stratum(0); stratum < strata; ++stratum)
{
if (temperatureStratumData)
std::cout << "in stratum " << stratum << " there were " <<
temperatures[stratum].count_ << " particles" << std::endl;

if (temperatures[stratum].count_)
{
if (temperatureStratumData)
std::cout << " tx: " << temperatures[stratum].tx()
<< " ty: " << temperatures[stratum].ty()
<< " tz: " << temperatures[stratum].tz()
<< " Tavg: " << temperatures[stratum].mean()
<< " std dev: +/-" <<
temperatures[stratum].standardDeviation() << std::endl;

if (0 == stratum)
bottom.add(temperatures[stratum].tx(),
temperatures[stratum].ty(), temperatures[stratum].tz());
else if ((strata - 1) == stratum)
top.add(temperatures[stratum].tx(),
temperatures[stratum].ty(), temperatures[stratum].tz());
}
else if (temperatureStratumData)
std::cout << "no temperature information possible" <<
std::endl;
}
}

// dump full run statistics
std::cout << "over the simulation we have"
<< "\ntop strata of the column - tx: " << top.tx() << " ty: " <<
top.ty() << " tz: " << top.tz()
<< " Tavg: " << top.mean() << " std dev: +/-" <<
top.standardDeviation()
<< "\nbottom strata of the column - tx: " << bottom.tx() << "
ty: " << bottom.ty() << " tz: " << bottom.tz()
<< " Tavg: " << bottom.mean() << " std dev: +/-" <<
bottom.standardDeviation()
<< std::endl;
}

private:
bool collision(PhysicalWorld::Existents::iterator object1,
PhysicalWorld::Existents::iterator object2)
{
return (*object1)->isCollided(*object2);
}

virtual void adjustFromCollision(PhysicalWorld::Existents::iter ator
object1, PhysicalWorld::Existents::iterator object2) = 0;
virtual void adjustFreeMoving(PhysicalWorld::Existents::iterato r
object) = 0;

PhysicalWorld & world_;

double time_;
double final_;
double const delta_;

};

class LinearGravityEngine : public PhysicsEngine
{
public:
LinearGravityEngine(PhysicalWorld & world, double final, double
delta) :
PhysicsEngine(world, final, delta)
{}

private:
virtual void adjustFromCollision(PhysicalWorld::Existents::iter ator
object1, PhysicalWorld::Existents::iterator object2)
{
if ((*object1)->collisionType() == particle)
{
if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "particles colliding:"
<< "\n 1 - x: " << (*object1)->x() << " y: " << (*object1)->y() << " z: " << (*object1)->z()

<< "\n 1 - vx: " << (*object1)->vx() << " vy: " <<
(*object1)->vy() << " vz: " << (*object1)->vz()
<< "\n 2 - x: " << (*object2)->x() << " y: " << (*object2)->y() << " z: " << (*object2)->z()

<< "\n 2 - vx: " << (*object2)->vx() << " vy: " <<
(*object2)->vy() << " vz: " << (*object2)->vz() << std::endl;

// calculate relative distances and speed
double deltaX((*object2)->x() - (*object1)->x());
double deltaY((*object2)->y() - (*object1)->y());
double deltaZ((*object2)->z() - (*object1)->z());
double deltaVX((*object2)->vx() - (*object1)->vx());
double deltaVY((*object2)->vy() - (*object1)->vy());
double deltaVZ((*object2)->vz() - (*object1)->vz());

double relativeDistance(distance(deltaX, deltaY, deltaZ));
double relativeVelocity(distance(deltaVX, deltaVY, deltaVZ));

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "relativeDistance: " << relativeDistance << "
relativeVelocity: " << relativeVelocity << std::endl;

// find relative angle
double theta(std::acos(deltaZ / relativeDistance));
double phi(((0 == deltaX) && (0 == deltaY)) ? 0. :
std::atan2(deltaY, deltaX));

if ((*object1)->name() == "0")
std::cout << "theta: " << theta << " phi: " << phi <<
std::endl;

// rotate to canonical coordinates
double rotatedVelocityX(- std::cos(theta) * std::cos(phi) *
deltaVX - std::cos(theta) * std::sin(phi) * deltaVY + std::sin(theta)
* deltaVZ);
double rotatedVelocityY(std::sin(phi) * deltaVX - std::cos(phi)
* deltaVY);
double rotatedVelocityZ(- std::sin(theta) * std::cos(phi) *
deltaVX - std::sin(theta) * std::sin(phi) * deltaVY - std::cos(theta)
* deltaVZ);

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "rotatedVelocityX: " << rotatedVelocityX << "
rotatedVelocityY: "
<< rotatedVelocityY << " rotatedVelocityZ: " <<
rotatedVelocityZ << std::endl;

// find relative velocity angles
double velocityTheta(std::acos(rotatedVelocityZ /
relativeVelocity));
double velocityPhi(((0 == rotatedVelocityX) && (0 ==
rotatedVelocityY)) ? 0. : std::atan2(rotatedVelocityY,
rotatedVelocityX));

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "velocityTheta: " << velocityTheta << "
velocityPhi: " << velocityPhi << std::endl;

// classic impact parameter
double impact(relativeDistance * std::sin(velocityTheta) /
(boost::static_pointer_cast<Particle>(*object1)->radius() +
boost::static_pointer_cast<Particle>(*object2)->radius()));

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "impact: " << impact << std::endl;

// reverse motion to collision time
double collisionTime((relativeDistance*std::cos(velocityT heta) -
(boost::static_pointer_cast<Particle>(*object1)->radius() +
boost::static_pointer_cast<Particle>(*object2)->radius()) *
std::sqrt(1. - impact * impact)) / relativeVelocity);

(*object1)->x((- deltaVX + (*object2)->vx()) * collisionTime +
(*object1)->x());
(*object1)->y((- deltaVY + (*object2)->vy()) * collisionTime +
(*object1)->y());
(*object1)->z((- deltaVZ + (*object2)->vz()) * collisionTime +
(*object1)->z());
(*object2)->x(deltaX + deltaVX * collisionTime + (*object1)->x());

(*object2)->y(deltaY + deltaVY * collisionTime + (*object1)->y());

(*object2)->z(deltaZ + deltaVZ * collisionTime + (*object1)-
z());

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "collisionTime: " << collisionTime << std::endl;

// calculate collision angles
double impactAngle(std::asin(-impact));
double velocityAngleTotal(std::tan(velocityTheta +
impactAngle));

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "impactAngle: " << impactAngle << "
velocityAngleTotal: " << velocityAngleTotal << std::endl;

// mass impact
double mu((*object2)->m() / (*object1)->m());
double diffZ(2. * (rotatedVelocityZ + velocityAngleTotal *
(std::cos(velocityPhi) * rotatedVelocityX +
std::sin(velocityPhi) * rotatedVelocityY)) /
((1 + velocityAngleTotal * velocityAngleTotal) * (1
+ mu)));

// boost coordinate frame for impact
double boostedVelocityX(velocityAngleTotal *
std::cos(velocityPhi) * diffZ);
double boostedVelocityY(velocityAngleTotal *
std::sin(velocityPhi) * diffZ);
double boostedVelocityZ(diffZ);

rotatedVelocityX -= mu * boostedVelocityX;
rotatedVelocityY -= mu * boostedVelocityY;
rotatedVelocityZ -= mu * boostedVelocityZ;

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "boostedVelocityX: " << boostedVelocityX << "
boostedVelocityY: "
<< boostedVelocityY << " boostedVelocityZ: " <<
boostedVelocityZ
<< "\n and updated rotatedVelocityX: " << rotatedVelocityX
<< " rotatedVelocityY: "
<< rotatedVelocityY << " rotatedVelocityZ: " <<
rotatedVelocityZ << std::endl;

// and finally transform velocities
(*object1)->vx(std::cos(theta) * std::cos(phi) *
rotatedVelocityX - std::sin(phi) * rotatedVelocityY
+ std::sin(theta) * std::cos(phi) *
rotatedVelocityZ + (*object2)->vx());
(*object1)->vy(std::cos(theta) * std::sin(phi) *
rotatedVelocityX + std::cos(phi) * rotatedVelocityY
+ std::sin(theta) * std::sin(phi) *
rotatedVelocityZ + (*object2)->vy());
(*object1)->vz(- std::sin(theta) * rotatedVelocityX +
std::cos(theta) * rotatedVelocityZ + (*object2)->vz());
(*object2)->vx(std::cos(theta) * std::cos(phi) *
boostedVelocityX - std::sin(phi) * boostedVelocityY
+ std::sin(theta) * std::cos(phi) *
boostedVelocityZ + (*object2)->vx());
(*object2)->vy(std::cos(theta) * std::sin(phi) *
boostedVelocityX + std::cos(phi) * boostedVelocityY
+ std::sin(theta) * std::sin(phi) *
boostedVelocityZ + (*object2)->vy());
(*object2)->vz(- std::sin(theta) * boostedVelocityX +
std::cos(theta) * boostedVelocityZ + (*object2)->vz());

if (particleCollisionCalculations && ((*object1)->name() ==
"0"))
std::cout << "particles leaving:"
<< "\n 1 - x: " << (*object1)->x() << " y: " << (*object1)->y() << " z: " << (*object1)->z()

<< "\n 1 - vx: " << (*object1)->vx() << " vy: " <<
(*object1)->vy() << " vz: " << (*object1)->vz()
<< "\n 2 - x: " << (*object2)->x() << " y: " << (*object2)->y() << " z: " << (*object2)->z()

<< "\n 2 - vx: " << (*object2)->vx() << " vy: " <<
(*object2)->vy() << " vz: " << (*object2)->vz() << std::endl;
}
else if ((*object1)->collisionType() == column)
{
if ((*object2)->z() < 0.)
{
// reflect off bottom
(*object2)->vz(-(*object2)->vz());
}
else if ((*object2)->z() columnHeight)
{
// reflect off top
(*object2)->vz(-(*object2)->vz());
}

if (distance((*object2)->x(), (*object2)->y()))
{
// reflect off sides
// calculate the collision theta
double theta(((*object2)->x() == 0 && (*object2)->y() == 0) ?
0. : std::atan2((*object2)->y(), (*object2)->x()));
double velocityTheta(((*object2)->vx() == 0 && (*object2)->vy() == 0) ? 0. : std::atan2((*object2)->vy(), (*object2)->vx()));

double velocity(distance((*object2)->vx(), (*object2)->vy()));

(*object2)->vx(velocity * std::cos(pi + 2 * theta -
velocityTheta));
(*object2)->vy(velocity * std::sin(pi + 2 * theta -
velocityTheta));
}
}
}

virtual void adjustFreeMoving(PhysicalWorld::Existents::iterato r
object)
{
// simple linear free with vertical gravity
(*object)->x((*object)->x() + (*object)->vx() * delta());
(*object)->y((*object)->y() + (*object)->vy() * delta());

(*object)->z((*object)->z() + (*object)->vz() * delta() + (1./2.)
* g * delta() * delta());
(*object)->vz((*object)->vz() + g * delta());
}

};

int main()
{
try
{
std::cout << "Functional Simulations Engine 0.39 - starting" <<
std::endl;
std::cout << "generated from source loschmidt.ml" << std::endl;

// build up the world
PhysicalWorld world;

std::cout << "created the world" << std::endl;

// add the column (radius 1
boost::shared_ptr<Existentcolumn(new
EnclosingColumn(columnRadius, columnHeight));
world.pushBack(column);

std::cout << "added the column" << std::endl;

// rng for simulations
boost::mt19937 rng;
rng.seed(static_cast<unsigned int>(std::time(0)));

// create particles
for (unsigned particleCounter(0); particleCounter <
numberOfParticles; ++particleCounter)
{
if (! particleCounter)
std::cout << "creating particle 1" << std::endl;

// find a random position in the column
// height in [0, columnHeight]
boost::uniform_real<possibleHeight(0., columnHeight);
boost::variate_generator<boost::mt19937 &, boost::uniform_real<>
heightGenerator(rng, possibleHeight);

double particleHeight(heightGenerator());

double particleX(0.);
double particleY(0.);

// find an x, y position in the column
// just loop until valid in a circle (to maintain distribution)
do
{
// build generator
boost::uniform_real<possibleXY(0., columnRadius);
boost::variate_generator<boost::mt19937 &,
boost::uniform_real< tranverseGenerator(rng, possibleXY);

// pull an x, y
particleX = tranverseGenerator();
particleY = tranverseGenerator();
}
while (distance(particleX, particleY) >= columnRadius);

// now get a velocity in the maxwellian-boltzmann distribution
for the temperature
// which is just a normal distribution
// with mean = 0
// variance sigma^2 = k T / m
boost::normal_distribution<possibleVelocity(0., sigma);
boost::variate_generator<boost::mt19937 &,
boost::normal_distribution< velocityGenerator(rng,
possibleVelocity);

double velocityX(velocityGenerator());
double velocityY(velocityGenerator());
double velocityZ(velocityGenerator());

if (! particleCounter)
std::cout << "initial state position: "
<< "\n x: " << particleX
<< " y: " << particleY
<< " z: " << particleHeight
<< "\n vx: " << velocityX
<< " vy: " << velocityY
<< " vz: " << velocityZ << std::endl;

std::stringstream converter;
converter << particleCounter;

// now build the particle
boost::shared_ptr<Existentparticle(new Particle(
Point3D(particleX, particleY, particleHeight),
Velocity3D(velocityX, velocityY, velocityZ),
particleRadius,
particleMass,
converter.str()));

world.pushBack(particle);
}

std::cout << "all particles created!" << std::endl;

// now that we have the world built
// build the physics engine
// attach the world
// and configure to run x deltas
LinearGravityEngine engine(world, simulationTime,
simulationDelta);
engine.run();
}
catch (std::exception & blowUp)
{
std::cout << "exception at lowest level: " << blowUp.what() <<
std::endl;
}
catch (...)
{
std::cout << "blowUps happen" << std::endl;
}

}

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 9 '07 #16
In comp.programming galathaea <ga*******@gmail.comwrote:
On Mar 8, 4:39 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
In comp.programming galathaea <galath...@gmail.comwrote:
collisions are accounted for
the reason they are "very rare"
is because i have been testing low particle numbers
( 1000 - 10000 )
in a large column (100m tall by 20m radius)
and the particles are very very small
( i use the atomic hydrogen radius 2.4e-11m )
Do you realize that that's about one particle within 1 to 10
cubic meters? That's a pretty good vacuum.
my first goal was to demonstrate the principle
in "any" regime of state space
i have run the simulation as long as 20 seconds
and in the regime's i was testing
this separated the stratification by 3 or more standard deviations
so there is evidence
i am allowing the systems to come to good equilibrium
but i can run the simulation for several minutes or longer
this may take several hours on my macbook
Look, "pretty good vacumm" was meant to be sarcastic. There is a
number of estimates about the density of particles in outer space
which tend to be in the order of one particle per cubic centimeter.
You seem to be doing "simulations" for a vacuum where there's about
one particle per cubic meter, i.e. your have a density that is one
millionth of that expected to exist in outer space (not like in
crowded places like in the solar system). And you expect to find
any effects after a time of 20 seconds? Wait some millions of years
(simulation time) before getting excited about any results. Remember
that thermodynamics work under the assumptions that you have a huge
number of particles and/or lots of time (and better lots of both) -
it's statistics. Your "simulation" has neither lots of particles nor
do you give it any reasonable amount of time. 20 seconds probably
wouldn't be enough to reach thermal equilibrium if you had a pot of
water where you start with e.g. a vertical temperature gradient of
a few degrees - and that at a density higher by about 30 orders of
magnitude and correspondingly much, much, much larger probabilities
of particle collisions than in your "simulation" (so you are correct
in disregarding particle collisions since basically none will happen
under the assumptions you make - ultra-low density, short time - but
then you aren't simulating anything resembling the reality you ob-
viously intend to simulate).
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Mar 10 '07 #17
On Mar 9, 5:50 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
In comp.programming galathaea <galath...@gmail.comwrote:
On Mar 8, 4:39 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
In comp.programming galathaea <galath...@gmail.comwrote:
collisions are accounted for
the reason they are "very rare"
is because i have been testing low particle numbers
( 1000 - 10000 )
in a large column (100m tall by 20m radius)
and the particles are very very small
( i use the atomic hydrogen radius 2.4e-11m )
Do you realize that that's about one particle within 1 to 10
cubic meters? That's a pretty good vacuum.
my first goal was to demonstrate the principle
in "any" regime of state space
i have run the simulation as long as 20 seconds
and in the regime's i was testing
this separated the stratification by 3 or more standard deviations
so there is evidence
i am allowing the systems to come to good equilibrium
but i can run the simulation for several minutes or longer
this may take several hours on my macbook

Look, "pretty good vacumm" was meant to be sarcastic.
[...]

i think you missed the statements
where i have now been able to do simulations
with much larger radii

but i have now done simulations for up to 120s
which only takes about two and a half hours running time
so i am starting to get some good statistics

in particular
i have one archived run i will use as a standard reference

in this run
there were 2000 particles
the time delta was 0.01
and the particles had radii 0.5m
with plenty of collisions

as i mentioned in a previous post
this simply scales the length parameters by the ratio
2.4e-11 : 0.5
so that instead of a 20m radius column 100m tall
i have a 9.6e-10m radius column 4.8e-9m tall

this gives a volume of 1.392e-26 m^3

here the density is then 2.4e5 kg/m^3
the temperature and gravity are also scaled

this is an interesting regime to watch
because the scales manifest large fluctuations
so there are a lot of structural statistics to verify

here
temperature fluctuations are typically such that
the standard deviation stays pretty large (~60K)
and there are regular temperature inversions

even in this regime
though
i find that the mean temperature on the bottom is 282 K
and the mean temperature on the top is only 271 K

statistically
the bottom is warmer than the top 70-80% of the time
and the data shows that despite inversions of 2-3s
temperature consistently prefers stratification favoring the bottom

it is clear
by graphing the proportion of time throughout the simulation
that the bottom dominates the top
that despite an early fluctuation
the bottom dominates early
and only moves furthur and furthur towards clear statistical
dominance

it rises quickly past 60% where it stays once past
and shortly later rises past 70%
and stays above that after the 30s mark

i am putting together some graphs that i will post tomorrow
and updating the generator with some optimising generation rules
( basically some precalculation )

i also am adding even more precision to the calculations
using an abolute collision coordinate rule
that will provide even more accuracy and confidence in results

but at this point
i think it is starting to be clear that there is an effect here
at least in thes classical models

all the other classical effects are accounted properly
including
if you check the output on particle numbers in strata
the classical pressure stratification in gravity
which every undergrad calculates in a 201 intro course

....

all simulations regularly and consistently are showing
the stratification predicted by loschmidt

this is very interesting
because there has been nothing added to the simulations
to "induce" this effect

in fact
i think the idea of code generating these simulations
provides a good safety net against any misfitism
and making it opensource verifies the results to others

it is interesting that no one has challenged the simulations so far
despite their consistently validating loschmidt...

********..%%%%%%%%%%%

i can email anyone who wishes to see my archived runs

also
since i have posted various stages of generated code
others can verify if they desire

tomorrow
the graphs

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 11 '07 #18
On Mar 9, 3:17 am, Jeff...Relf <Jeff_R...@Yahoo.COMwrote:
Hi Galathaea, I think your model is too myopic.

Photons are redshifted ( i.e. cooled )
as they climb out of the earth's ( or sun's ) gravity well,
and both the earth and the sun have been
cooled down by the net loss of photons and atoms.

As I told you in, "news:Je*********************@Cotse.NET":

By definition, the cosmos is a closed system
and the energy in it is continuously, spontaneously, irreversibly,
being spent. That's entropy, the second law of thermodynamics.

Many have speculated ( hoped, really )
that the known Universe is an open system
( " plugged into the wall ", so to speak )
but all empirical evidence suggests that this is not the case.

For example, 13.7 Giga_Years ago the CMB blackbody radiation
was 3 thousand Kelvin... today it's 3 Kelvin.
The energy of the known Universe is continually being consumed,
creating ' Life '.
it is interesting

you mention redshifting
but that would add another effect
to validate loschmidt ( not contradict )

i had not thought there might be many reasons
loschmidt could be validated
but looking at collisions like feynman diagrams
an interaction may involve a furthur energy shift
due to photon transfer in gravity

you did notice that redshifting
would add to the cooling affect to height
did you not?

if the model is myopic
it is only that it is too conservative
in predicting the effect

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 11 '07 #19
On Mar 9, 3:25 am, "The_Man" <me_so_hornee...@yahoo.comwrote:
On Mar 8, 9:40 pm, "galathaea" <galath...@gmail.comwrote:
On Mar 8, 4:39 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
In comp.programming galathaea <galath...@gmail.comwrote:
collisions are accounted for
the reason they are "very rare"
is because i have been testing low particle numbers
( 1000 - 10000 )
in a large column (100m tall by 20m radius)
and the particles are very very small
( i use the atomic hydrogen radius 2.4e-11m )
Do you realize that that's about one particle within 1 to 10
cubic meters? That's a pretty good vacuum.
my first goal was to demonstrate the principle
in "any" regime of state space
once that was done
and the simulation established
then i could expand into other regimes
and map the property space
but you are right that the full principle needs to be demonstrated
and i was cautious to immediately expand radii
because i didn't trust the particle on particle collision routine
it entrusted a lot of sophistication on the part of the generator
to handle complex translation and rotation matrices
in various three dimensional frames
(and i knew i hadn't spent much time there...)
it has turned out to have a few transformation bugs
which i have explored in this related discussion:
http://groups.google.com/group/sci.p...ba7853d?hl=en&
as it mentions towards the bottom
i have worked out now even the particle-particle collisions
and in these regimes it is still illustrating stratification
by enlarging radii in the simulation
the system can be reinterpreted as a
lower temperature
higher gravity
smaller volume
higher density
system of normal sized particles
its just a variable scaling
so now i am beginning to map a volume of phase space
that appears to obey loschmidt's law
Do you make an
estimate of how long a system under such conditions requires
to achieve thermal equilibrium (not that you can achieve that
at all if you do not take collisions into account - where else
would it result from)?
actually i haven't made hard bounds yet
because i wanted to examine the actual dynamic data
notice that i place the system
in the state proposed by boltzmann and maxwell
as _the_ equilibrium state
so it is interesting
that it naturally and regularly
deviates in favor of loschmidt's law
i have run the simulation as long as 20 seconds
and in the regime's i was testing
this separated the stratification by 3 or more standard deviations
so there is evidence
i am allowing the systems to come to good equilibrium
but i can run the simulation for several minutes or longer
this may take several hours on my macbook
i think you are absolutely correct that it is needed
to establish trust this is not a false equilibrium
Do yourself a favour and, just for a test, start your system
with a non-Maxwell-velocity-distribution (but were you know
the initial total energy) and check how long it takes, swit-
ching off gravity, to end up with a Maxwell-distribution (if
it does at all) and check if the energy didn't change more
than to be expected (due to just rounding errors) before you
try to draw any conclusions from your simulation under more
complicated conditions.
i think these are all very good tests to put the simulator through
and i thank you for all your suggestions
i do not have an agenda here
and only want to predict what actually occurs in experience
because that is the only source of valid technology
so i want to explore all regimes relevant to experience
i will post results as they are known
in the meantime
do yourself a favor and download "b@un(e"
the new musical accompaniment to particle collision simulators
at
http://www.garageband.com/artist/galathaea
=p
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

You can save yourself a lot of computational effort by omitting
collisions with the walls in the x and y axes. If you imagine that
your box is oriented so that the z axis is "up" (the one affected by
gravity), a good deal of your simulation is following the particles as
they bounce off the walls.
i agree i could save calculation effort

i could have used a rectangular box
and every collision would have been a compare and inversion
which would have been equivalent to the computation
for periodic boundaries

mostly
i chose the cylindrical shape of the container
to show off the capabilities of the generator
and force me to validate the geometric computations of the generator

that was the area i was working on
at the time i decided to test this generation
A way to have a more realistic simulation (and one that is more
typical of how physics simulations are usually run) is to use so-
called "periodic boundary conditions" for the x and y axes. Don;t use
them on the z axis, or you won;t have any information about the gavity
effect.

By perioidic bounary conditions I mean, that every time a particle
would "hit the wall" of the +x axis, a particle should emerge for the -
x axis, with the same velocity as the previous particle. These
conditions are necessary to remove "edge" effects. It also simplifies
the progrmming somewhat.
the calculation here would be (pseudocode)

if (outside boudary)
shift to within boundary

and the shift would be an addition or subtraction
just like reflection is
Another way to simplify the programming, while testing your code, is
to make the whole problem 1-dimensional. In this case, there is only 1
axis, the z axis. Start with a random distribution of points, with
random velocities. Now collisions are easier to predict, and determine
their effect, since there is only 1 dimension. Gravity affects along
the z axis.
i do like this suggestion
and i have started writing up a specification

tomorrow i will generate...

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 11 '07 #20
Hi Galathaea,
I noted that your computer simulation doesn't address redshifting,
so you asked me:
" You did notice that redshifting
would add to the cooling affect to height
did you not ? "

Yes, but the scope of your model isn't very " cosmic ".

While Newton ( 300 years ago ) had gravitational energy as
a function of mass and distance, Einstein's field equations have
gravitational energy as spacetime, a function of density and pressure.

Is it any wonder, then, that greater gravitational energy
implies greater " energy density " ( i.e. temperature ) ?

For example, the sun's gravitational energy matches its heat energy.
So-called black holes eject cosmic rays,
more energetic than ions from 24/7 solar flares.

Hmm... entropy is joules per kelvin, i.e. energy over energy density.
So entropy and GR are modeling the same thing, density and pressure,
because entopy is inversely related to gravity... How cosmic !
Mar 11 '07 #21

"Jens Thoms Toerring" <jt@toerring.dewrote in message
news:55*************@mid.uni-berlin.de...
In comp.programming galathaea <ga*******@gmail.comwrote:
>On Mar 8, 4:39 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
In comp.programming galathaea <galath...@gmail.comwrote:

collisions are accounted for
the reason they are "very rare"
is because i have been testing low particle numbers
( 1000 - 10000 )
in a large column (100m tall by 20m radius)
and the particles are very very small
( i use the atomic hydrogen radius 2.4e-11m )

Do you realize that that's about one particle within 1 to 10
cubic meters? That's a pretty good vacuum.
>my first goal was to demonstrate the principle
in "any" regime of state space
>i have run the simulation as long as 20 seconds
and in the regime's i was testing
this separated the stratification by 3 or more standard deviations
so there is evidence
i am allowing the systems to come to good equilibrium
>but i can run the simulation for several minutes or longer
this may take several hours on my macbook

Look, "pretty good vacumm" was meant to be sarcastic. There is a
number of estimates about the density of particles in outer space
which tend to be in the order of one particle per cubic centimeter.
You seem to be doing "simulations" for a vacuum where there's about
one particle per cubic meter, i.e. your have a density that is one
millionth of that expected to exist in outer space (not like in
crowded places like in the solar system). And you expect to find
any effects after a time of 20 seconds? Wait some millions of years
(simulation time) before getting excited about any results. Remember
that thermodynamics work under the assumptions that you have a huge
number of particles and/or lots of time (and better lots of both) -
it's statistics. Your "simulation" has neither lots of particles nor
do you give it any reasonable amount of time. 20 seconds probably
wouldn't be enough to reach thermal equilibrium if you had a pot of
water where you start with e.g. a vertical temperature gradient of
a few degrees - and that at a density higher by about 30 orders of
magnitude and correspondingly much, much, much larger probabilities
of particle collisions than in your "simulation" (so you are correct
in disregarding particle collisions since basically none will happen
under the assumptions you make - ultra-low density, short time - but
then you aren't simulating anything resembling the reality you ob-
viously intend to simulate).
Thermodynamics became *fun* when it came to stellar evolution. I have
recently lost the Schwartzschild text I would read occasionally. As a final
project in that class, we had to create a star. Gives you a bit of a god
complex.
--
LS
Mar 12 '07 #22
On Mar 11, 12:38 am, "galathaea" <galath...@gmail.comwrote:
On Mar 9, 5:50 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
In comp.programming galathaea <galath...@gmail.comwrote:
On Mar 8, 4:39 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
In comp.programming galathaea <galath...@gmail.comwrote:
collisions are accounted for
the reason they are "very rare"
is because i have been testing low particle numbers
( 1000 - 10000 )
in a large column (100m tall by 20m radius)
and the particles are very very small
( i use the atomic hydrogen radius 2.4e-11m )
Do you realize that that's about one particle within 1 to 10
cubic meters? That's a pretty good vacuum.
my first goal was to demonstrate the principle
in "any" regime of state space
i have run the simulation as long as 20 seconds
and in the regime's i was testing
this separated the stratification by 3 or more standard deviations
so there is evidence
i am allowing the systems to come to good equilibrium
but i can run the simulation for several minutes or longer
this may take several hours on my macbook
Look, "pretty good vacumm" was meant to be sarcastic.

[...]

i think you missed the statements
where i have now been able to do simulations
with much larger radii

but i have now done simulations for up to 120s
which only takes about two and a half hours running time
so i am starting to get some good statistics

in particular
i have one archived run i will use as a standard reference

in this run
there were 2000 particles
the time delta was 0.01
and the particles had radii 0.5m
with plenty of collisions

as i mentioned in a previous post
this simply scales the length parameters by the ratio
2.4e-11 : 0.5
so that instead of a 20m radius column 100m tall
i have a 9.6e-10m radius column 4.8e-9m tall

this gives a volume of 1.392e-26 m^3

here the density is then 2.4e5 kg/m^3
the temperature and gravity are also scaled

this is an interesting regime to watch
because the scales manifest large fluctuations
so there are a lot of structural statistics to verify

here
temperature fluctuations are typically such that
the standard deviation stays pretty large (~60K)
and there are regular temperature inversions

even in this regime
though
i find that the mean temperature on the bottom is 282 K
and the mean temperature on the top is only 271 K

statistically
the bottom is warmer than the top 70-80% of the time
and the data shows that despite inversions of 2-3s
temperature consistently prefers stratification favoring the bottom

it is clear
by graphing the proportion of time throughout the simulation
that the bottom dominates the top
that despite an early fluctuation
the bottom dominates early
and only moves furthur and furthur towards clear statistical
dominance

it rises quickly past 60% where it stays once past
and shortly later rises past 70%
and stays above that after the 30s mark

i am putting together some graphs that i will post tomorrow
and updating the generator with some optimising generation rules
( basically some precalculation )

i also am adding even more precision to the calculations
using an abolute collision coordinate rule
that will provide even more accuracy and confidence in results

but at this point
i think it is starting to be clear that there is an effect here
at least in thes classical models

all the other classical effects are accounted properly
including
if you check the output on particle numbers in strata
the classical pressure stratification in gravity
which every undergrad calculates in a 201 intro course

...

all simulations regularly and consistently are showing
the stratification predicted by loschmidt

this is very interesting
because there has been nothing added to the simulations
to "induce" this effect

in fact
i think the idea of code generating these simulations
provides a good safety net against any misfitism
and making it opensource verifies the results to others

it is interesting that no one has challenged the simulations so far
despite their consistently validating loschmidt...

********..%%%%%%%%%%%

i can email anyone who wishes to see my archived runs

also
since i have posted various stages of generated code
others can verify if they desire

tomorrow
the graphs
a graph of the temperature domminance can be seen here:

http://i17.tinypic.com/2zf37k0.png

the x coordinate
is the number of frames where the bottom
had a higher temperature than the top
divided by the total frames

the y coordinate is the time slices

this is a "running" or bayesian statistic
so that fluctuations will tend to dissipate
if there is true mean behavior

here we see it having early fluctations
and then sticking around 73%
( the middle line is the 50% predicted by 2nd law )

then

http://i16.tinypic.com/4hwsc2u.png

shows the actual temperatures over the 120s
red being bottom strata
green being top

the scale is from 220K to 320K

visually
the red clearly averages above the green
and the solid lines show the averages (271, 282)

i will extend the results
but already good data is accumulating...

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 12 '07 #23
Jeff.Relf wrote:
Hi Galathaea,
I noted that your computer simulation [..]
Would you please stop cross-posting this to comp.lang.c++?
It's not topical here. Thanks.
Mar 12 '07 #24
Victor Bazarov wrote:
Jeff.Relf wrote:
Hi Galathaea,
I noted that your computer simulation [..]

Would you please stop cross-posting this to comp.lang.c++?
It's not topical here. Thanks.

This is where being able to filter by crossposted newsgroups helps out.
I can knock out some of those I'm not likely to be interested in.


Brian
Mar 12 '07 #25
In comp.programming galathaea <ga*******@gmail.comwrote:
On Mar 11, 12:38 am, "galathaea" <galath...@gmail.comwrote:
On Mar 9, 5:50 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
In comp.programming galathaea <galath...@gmail.comwrote:
On Mar 8, 4:39 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
In comp.programming galathaea <galath...@gmail.comwrote:
collisions are accounted for
the reason they are "very rare"
is because i have been testing low particle numbers
( 1000 - 10000 )
in a large column (100m tall by 20m radius)
and the particles are very very small
( i use the atomic hydrogen radius 2.4e-11m )
Do you realize that that's about one particle within 1 to 10
cubic meters? That's a pretty good vacuum.
my first goal was to demonstrate the principle
in "any" regime of state space
i have run the simulation as long as 20 seconds
and in the regime's i was testing
this separated the stratification by 3 or more standard deviations
so there is evidence
i am allowing the systems to come to good equilibrium
but i can run the simulation for several minutes or longer
this may take several hours on my macbook
Look, "pretty good vacumm" was meant to be sarcastic.
[...]

i think you missed the statements
where i have now been able to do simulations
with much larger radii

but i have now done simulations for up to 120s
which only takes about two and a half hours running time
so i am starting to get some good statistics

in particular
i have one archived run i will use as a standard reference

in this run
there were 2000 particles
the time delta was 0.01
What's 0.01? Is that in seconds, nano-seconds, or something
else? And if it's seconds what are your reasons to choose such
a rather long time delta? How does it compare to the mean time
between collisions?
http://i17.tinypic.com/2zf37k0.png
the x coordinate
is the number of frames where the bottom
had a higher temperature than the top
divided by the total frames
the y coordinate is the time slices
This description is much too vague to make much sense. And,
BTW, there are no numbers or scales, there are just axes.

Can you give any convincing explanation why at first (for a
relatively short time) gets "warmer" at the bottom, then, for
some time things become "inverted", i.e. colder at the bottom,
and then slowly goes back to being "warmer"? Wouldn't you ex-
pect that, if there is the effect you are looking for, you'd
go more or less monotonically from your initial state (same
temperature everywhere) to the state you expect? Is the pat-
tern you got from that run repeated when you redo the run
several times with different starting values of the random
generator?
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Mar 12 '07 #26
Default User wrote:
Victor Bazarov wrote:
>Jeff.Relf wrote:
>>Hi Galathaea,
I noted that your computer simulation [..]

Would you please stop cross-posting this to comp.lang.c++?
It's not topical here. Thanks.


This is where being able to filter by crossposted newsgroups helps
out. I can knock out some of those I'm not likely to be interested in.
Well, good for you!
Mar 13 '07 #27
On Mar 12, 3:20 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
In comp.programming galathaea <galath...@gmail.comwrote:
On Mar 11, 12:38 am, "galathaea" <galath...@gmail.comwrote:
[...]
but i have now done simulations for up to 120s
which only takes about two and a half hours running time
so i am starting to get some good statistics
in particular
i have one archived run i will use as a standard reference
in this run
there were 2000 particles
the time delta was 0.01

What's 0.01? Is that in seconds, nano-seconds, or something
else? And if it's seconds what are your reasons to choose such
a rather long time delta? How does it compare to the mean time
between collisions?
..01 seconds was just an order of magnitude judgement
about when collisions would regularly be detected

at 0.5m radius particles
the interaction scale is ~2m
and with velocities regularly ~300m/s
i needed a timescale to bring distances to the order of a meter

..01s gives 6m
so we in the right order of magnitude
to be able to detect interactions

and this is verified as collisions now occur regularly

i do not know how common a practice this is
but it was commonly used when i was an undergraduate
by my senior advisor to get initial data

the idea was that parameters are easier to change than algorithms
if the need arises
so test early and often and verify when an effect arises

in this case i have an effect from basic collisions and gravity

i can increase the accuracy of the delta
but it is not immediately apparent
how that would change the qualitative effects already seen
http://i17.tinypic.com/2zf37k0.png
the x coordinate
is the number of frames where the bottom
had a higher temperature than the top
divided by the total frames
the y coordinate is the time slices

This description is much too vague to make much sense. And,
BTW, there are no numbers or scales, there are just axes.
i'm sorry
this is another habit from my scholastic simulations

this graph is defined so that
at each timeslice t
i calculate whether the bottom temperature
is greater than top
if so i add to a running sum "dominance"
and the total number of timeslices to that point is "trials"
and the graph is of dominance / trials

using this type of statistic
points early on only show the average over a few points
so you get a very good look at the fluctuation statistics

points from later on illustrate
the time scales that fluctuations take place on
and how quickly they dissolve into the mean behavior

eventually
if the statistics are normal
you get mean behavior steady

this what i meant by the graph being "bayesian"

i like to use these graphs
to convey all of this information succinctly

here
my advisor actually didn't like me using these graphs either
because he said that it is not commonly seen

the y axis is 0 to 1 (the ratio "successful" dominance)
the x axis is 0 to 120 seconds
Can you give any convincing explanation why at first (for a
relatively short time) gets "warmer" at the bottom, then, for
some time things become "inverted", i.e. colder at the bottom,
and then slowly goes back to being "warmer"? Wouldn't you ex-
pect that, if there is the effect you are looking for, you'd
go more or less monotonically from your initial state (same
temperature everywhere) to the state you expect? Is the pat-
tern you got from that run repeated when you redo the run
several times with different starting values of the random
generator?
the are regular fluctuations throughout the simulation
as predicted by statistical mechanics
and the bottom is sometimes cooler than the top

i hope with my explanation above
it is clearer then how to read the fluctuations early on

there is early on inversion
due to one of the fluctuations
followed by a brief period where the bottom dominates the top
followed by another fluctuation with inversion

it is natural to read off of the left side of the graph
that the time scales for these fluctuations are 5-15s
and it is clear from the trend moving to the right
that the bottom is maintaining a statistical dominance 70-80%

over the span of the graph
the "size" of the fluctuations decreases
to less than 5% their initial "small sample" size
indicating that the statistics are likely normal
and the trend developing is likely long term

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 13 '07 #28
On Mar 12, 3:20 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
In comp.programming galathaea <galath...@gmail.comwrote:
On Mar 11, 12:38 am, "galathaea" <galath...@gmail.comwrote:
[...]
but i have now done simulations for up to 120s
which only takes about two and a half hours running time
so i am starting to get some good statistics
in particular
i have one archived run i will use as a standard reference
in this run
there were 2000 particles
the time delta was 0.01

What's 0.01? Is that in seconds, nano-seconds, or something
else? And if it's seconds what are your reasons to choose such
a rather long time delta? How does it compare to the mean time
between collisions?
..01 seconds was just an order of magnitude judgement
about when collisions would regularly be detected

at 0.5m radius particles
the interaction scale is ~2m
and with velocities regularly ~300m/s
i needed a timescale to bring distances to the order of a meter

..01s gives 6m
so we in the right order of magnitude
to be able to detect interactions

and this is verified as collisions now occur regularly

i do not know how common a practice this is
but it was commonly used when i was an undergraduate
by my senior advisor to get initial data

the idea was that parameters are easier to change than algorithms
if the need arises
so test early and often and verify when an effect arises

in this case i have an effect from basic collisions and gravity

i can increase the accuracy of the delta
but it is not immediately apparent
how that would change the qualitative effects already seen
http://i17.tinypic.com/2zf37k0.png
the x coordinate
is the number of frames where the bottom
had a higher temperature than the top
divided by the total frames
the y coordinate is the time slices

This description is much too vague to make much sense. And,
BTW, there are no numbers or scales, there are just axes.
i'm sorry
this is another habit from my scholastic simulations

this graph is defined so that
at each timeslice t
i calculate whether the bottom temperature
is greater than top
if so i add to a running sum "dominance"
and the total number of timeslices to that point is "trials"
and the graph is of dominance / trials

using this type of statistic
points early on only show the average over a few points
so you get a very good look at the fluctuation statistics

points from later on illustrate
the time scales that fluctuations take place on
and how quickly they dissolve into the mean behavior

eventually
if the statistics are normal
you get mean behavior steady

this what i meant by the graph being "bayesian"

i like to use these graphs
to convey all of this information succinctly

here
my advisor actually didn't like me using these graphs either
because he said that it is not commonly seen

the y axis is 0 to 1 (the ratio "successful" dominance)
the x axis is 0 to 120 seconds
Can you give any convincing explanation why at first (for a
relatively short time) gets "warmer" at the bottom, then, for
some time things become "inverted", i.e. colder at the bottom,
and then slowly goes back to being "warmer"? Wouldn't you ex-
pect that, if there is the effect you are looking for, you'd
go more or less monotonically from your initial state (same
temperature everywhere) to the state you expect? Is the pat-
tern you got from that run repeated when you redo the run
several times with different starting values of the random
generator?
the are regular fluctuations throughout the simulation
as predicted by statistical mechanics
and the bottom is sometimes cooler than the top

i hope with my explanation above
it is clearer then how to read the fluctuations early on

there is early on inversion
due to one of the fluctuations
followed by a brief period where the bottom dominates the top
followed by another fluctuation with inversion

it is natural to read off of the left side of the graph
that the time scales for these fluctuations are 5-15s
and it is clear from the trend moving to the right
that the bottom is maintaining a statistical dominance 70-80%

over the span of the graph
the "size" of the fluctuations decreases
to less than 5% their initial "small sample" size
indicating that the statistics are likely normal
and the trend developing is likely long term

also
the trend is consistent across runs of the simulator

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
galathaea: prankster, fablist, magician, liar

Mar 13 '07 #29

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: lawrence | last post by:
Is there an easy way to sort a 2 dimensional array alphabetically by the second field in each row? Also, when I use sort() on a two dimensional array, it seems to work a lot like...
5
by: TG | last post by:
Conditions: Register globals is set to on. Parse html as php is set to on. I have two forms OrderTest1 and OrderTest2 and need to be able to validate the data from OrderTest1 before passing to...
0
by: Alex Martelli | last post by:
Greetings, fellow Pythonistas! We (Alex Martelli, David Ascher and Anna Martelli Ravenscroft) are in the process of selecting recipes for the Second Edition of the Python Cookbook. Please...
5
by: Tobiah | last post by:
What is the purpose of the second argument to super()? What is meant by the returning of an 'unbound' object when the argument is omitted. Also, when would I pass an object as the second...
13
by: Guy | last post by:
I would like to calculate the time it takes to load a picture in tenths of a seconds. So I get the current time, load the image, and once loaded I get the current time again. I would like to...
0
by: roberto3214 | last post by:
Hi Guys, How are you? I have recently begun some testing on IIS 6.0 in regards to an asp.net application. After lots of testing I decided to create a simple 1k page size webpage to find out...
0
by: -mat- filid brandy | last post by:
Hi, I collecting information about the <iframe>. I want to get a matrix of pro and contra. Cheers, -mat-
3
by: Grizlyk | last post by:
Hello. I am thinking: why if i will comment lines marked with '#' in the following example, all will be compiled, else will not: // *********************** typedef unsigned uint; ...
5
by: ram.rachum | last post by:
Hello! I am currently working on writing a simulation engine for special relativity physics. I'm writing it in Python, of course. I'm doing fine with the engine, but I want a GUI framework in which...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.