My question is to know if there is a torque or not, at start the object was small but some people don't see gravity effect. You can imagine an object big enough for have some gravity effect and small enough to be attach on Earth, 1km for example. A sphere with water inside, the air object seems to have a torque.
My program, the torque is big compared to water force:
#include <stdio.h>
#include <math.h>
//tab for contain all point, a point = a molecule of water for example
double t[1000][1000];
int main(void)
{
int i,j,x,y; // used for loops
double
d=0,
Fx=0, // local force x
Fy=0, // local force y
angle=0,
R=0, // radius
xx=0, // local x force
yy=0, // local y force
id=0, // simulate the gravity formula: 1/d²
// forces on water
TFx1=0, // Torque on left vertical line from direct force
TFy1=0, // Torque on left vertical line from pressure
TFx2=0, // Torque on right vertical line from direct force
// forces on air object
TFy2=0, // Torque on right vertical line from pressure
TFx3=0, // Torque on slope line from direct force
TFy3=0; // Torque on slope line from pressure
printf("\nStart\n"); // put 1 in tab t if there is a molecule of water
for(i=0;i<1000;i++)
{
for(j=0;j<1000;j++)
{
//in the circle put 1
if(((i-500)*(i-500)+(j-500)*(j-500))<=250000)
t[j]=1;
else // outside the circle put 0
t[j]=0;
// put 0 for the air block part of circle
if(((i-500)*(i-500)+(j-500)*(j-500))>=78400 && ((i-500)*(i-500)+(j-500)*(j-500))<=90000 && i>500 && i<750 && j>500)
{
t[j]=0;
}
}
}
// put 0 in the vertical volume
for(i=480; i<520; i++)
for(j=500; j<800;j++)
t[j]=0;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Caculate force and torque for x=480, y from 500 to 800
// this is the left vertical line
x=480;
for(y=500;y<800;y++)
{
Fx=0;Fy=0;
for(i=0; i<1000; i++)
{
for(j=999; j>=0;j--)
{
d=sqrt(pow(fabs(i-x),2.0)+pow(fabs(j-y),2.0));
if(d!=0)
{
id=(double)(t[j])/d/d;
angle=fabs(atan((fabs(j-y)/fabs(i-x))));
if(i>=x && j>=y)
{
xx=id*fabs(cos(angle));
yy=id*fabs(sin(angle));
}
else if(i<x && j>=y)
{
xx=-id*fabs(cos(angle));
yy=id*fabs(sin(angle));
}
else if(i<=x && j<y)
{
xx=-id*fabs(cos(angle));
yy=-id*fabs(sin(angle));
}
else if(i>x && j<y)
{
xx=id*fabs(cos(angle));
yy=-id*fabs(sin(angle));
} Fx+=xx;
Fy+=yy;
}
//printf("\nx=%i, y=%i, i=%i, j=%i, d=%f, id=%f, s=%f, xx=%f, yy=%f, angle=%f, Fx=%f, Fy=%f", x, y, i, j, d, id, s, xx, yy, angle, Fx, Fy);
//system("Pause");
}
// printf("\nx=%i, y=%i, i=%i, j=%i, d=%f, id=%f, s=%f, xx=%f, yy=%f, angle=%f, Fx=%f, Fy=%f", x, y, i, j, d, id, s, xx, yy, angle, Fx, Fy);
// system("Pause");
}
R=((double)y-500.0)/10000.0;
TFx1+=Fx*R;
TFy1=TFy1+(TFy1+Fy)*R;
//printf("\nFy=%f, R=%f, TFy=%f", Fy, R, TFy);
//system("Pause");
}
printf("\nTFx=%f, TFy=%f", TFx1, -TFy1);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Calculate forces and torque for x=520, y from 500 to 780
// This is the right vertical line
x=520;
for(y=500;y<780;y++)
{
Fx=0;Fy=0;
for(i=0; i<1000; i++)
{
for(j=999; j>=0;j--)
{
d=sqrt(pow(fabs(i-x),2.0)+pow(fabs(j-y),2.0));
if(d!=0)
{
id=(double)(t[j])/d/d;
angle=fabs(atan((fabs(j-y)/fabs(i-x))));
if(i>=x && j>=y)
{
xx=id*fabs(cos(angle));
yy=id*fabs(sin(angle));
}
else if(i<x && j>=y)
{
xx=-id*fabs(cos(angle));
yy=id*fabs(sin(angle));
}
else if(i<=x && j<y)
{
xx=-id*fabs(cos(angle));
yy=-id*fabs(sin(angle));
}
else if(i>x && j<y)
{
xx=id*fabs(cos(angle));
yy=-id*fabs(sin(angle));
} Fx+=xx;
Fy+=yy;
}
//printf("\nx=%i, y=%i, i=%i, j=%i, d=%f, id=%f, s=%f, xx=%f, yy=%f, angle=%f, Fx=%f, Fy=%f", x, y, i, j, d, id, s, xx, yy, angle, Fx, Fy);
//system("Pause");
}
// printf("\nx=%i, y=%i, i=%i, j=%i, d=%f, id=%f, s=%f, xx=%f, yy=%f, angle=%f, Fx=%f, Fy=%f", x, y, i, j, d, id, s, xx, yy, angle, Fx, Fy);
// system("Pause");
}
R=((double)y-500.0)/10000.0;
TFx2+=Fx*R;
TFy2=TFy2+(TFy2+Fy)*R;
// printf("\ny=%i, Fx=%f, Fy=%f", y, Fx, Fy);
// system("Pause");
}
printf("\nTFx=%f, TFy=%f", TFx2, TFy2);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// x=750, y from 126 to 165
// This is theslope right line of air block
x=750;
for(y=626;y<665;y++)
{
Fx=0;Fy=0;
for(i=0; i<1000; i++)
{
for(j=999; j>=0;j--)
{
d=sqrt(pow(fabs(i-x),2.0)+pow(fabs(j-y),2.0));
if(d!=0)
{
id=(double)(t[j])/d/d;
angle=fabs(atan((fabs(j-y)/fabs(i-x))));
if(i>=x && j>=y)
{
xx=id*fabs(cos(angle));
yy=id*fabs(sin(angle));
}
else if(i<x && j>=y)
{
xx=-id*fabs(cos(angle));
yy=id*fabs(sin(angle));
}
else if(i<=x && j<y)
{
xx=-id*fabs(cos(angle));
yy=-id*fabs(sin(angle));
}
else if(i>x && j<y)
{
xx=id*fabs(cos(angle));
yy=-id*fabs(sin(angle));
} Fx+=xx;
Fy+=yy;
}
//printf("\nx=%i, y=%i, i=%i, j=%i, d=%f, id=%f, s=%f, xx=%f, yy=%f, angle=%f, Fx=%f, Fy=%f", x, y, i, j, d, id, s, xx, yy, angle, Fx, Fy);
//system("Pause");
}
// printf("\nx=%i, y=%i, i=%i, j=%i, d=%f, id=%f, s=%f, xx=%f, yy=%f, angle=%f, Fx=%f, Fy=%f", x, y, i, j, d, id, s, xx, yy, angle, Fx, Fy);
// system("Pause");
}
R=((double)y-500.0)/10000.0;
TFx3+=Fx*R;
TFy3=TFy3+(TFy3+Fy)*R;
// printf("\nTFx=%f, TFy=%f, T=%f", TFx, TFy, T);
// system("Pause");
}
printf("\nTFx=%f, TFy=%f", TFx3, TFy3);
system("Pause");
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
return 0;
}