Would you like to react to this message? Create an account in a few clicks or log in to continue.

Who likes programming?

5 posters

 :: Okami :: Okami :: Guild Chat

Go down

Who likes programming? Empty Who likes programming?

Post  Solent Sun Jan 17, 2010 2:22 pm

Fancy finishing off my script? =]

% SAWT.m
% CEdunno,Autumn
% Small Amplitude Wave Theory
% Robert Claridge, December, 2009
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
clear all;
close all;
clc;
%--------------------------------------------------------------------------

% Known Data
g=9.81;

% Variables
a=input('amplitude');
T=input('period');
z=linspace(-250, a, 250);

w=(2*pi)/T;
k=(w^2)/g;

% SAWT
u=a*w*exp(k*z);
umax=max(u);
fprintf(1,'velocity of u [SAWT] %6.3f [m/s]\n',umax);

% Second Order Stokes
usos=a*g*(k/w)*exp(k*z);
umaxsos=max(usos);
fprintf(1,'velocity of u [SOS] %6.3f [m/s]\n',umaxsos);
% N.B. as second term=0, the u is the same as the SAWT

% 5th Order Soution
eps=a*k;
% eps=(H/2)*k Assume a=H/2 here
u5=((g/k^3)^0.5)*k*(eps*exp(k*z)-(((eps^3)*exp(k*z))/2)+((eps^4)*exp(2*k*z))-((37/24)*(eps^5)*exp(k*z))+((eps^5)*exp(3*k*z)/4));
u5max=max(u5);
fprintf(1,'velocity of u [5th Order] %6.3f [m/s]\n',u5max);

% LRWT
Flrwt=[0.01:0.01:0.5];
alpha=[0.50;
1.05;
1.55;
-0.6;
-1.1;
0.1;
0.09;
-0.22;
0.05;
-0.38;
-0.15;
0.55;
0.55;
0.7;
0.2;
0;
-1.1;
-0.3;
-0.5;
0.49;
0.51;
0.05;
1.43;
-1.5;
-0.85;
-1.2;
-1.25;
-0.48;
-0.7;
-0.05;
-0.43;
-0.49;
-0.4;
-0.3;
-0.22;
-0.18;
-0.01;
-0.05;
0.1;
0.1;
0.18;
0.18;
0.22;
0.23;
0.12;
0.25;
0.24;
0.25;
0.4;
0.3;]';

Hlrwt=[0.3;
0.2;
0.18;
0.09;
1.58;
5.59;
7.58;
4.90;
3.30;
1.95;
0.60;
1.00;
1.60;
1.53;
1.18;
0.90;
0.40;
0.20;
0.50;
0.50;
0.70;
0.20;
0.20;
0.38;
0.10;
0.30;
0.08;
0.10;
0.10;
0.02;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;]';

for i = 1:length(alpha)
km(i) = ((2.*pi.*Flrwt(i)).^2)/9.81;
end
x=linspace(-500, 500, 250);
for i = 1:length(x);
for j = 1:length(z);
for m = 1:length(alpha)
output(m) =(Hlrwt(m)/2) * (2*pi*Flrwt(m)) * exp(km(m)*z(j)) * cos(km(m)*x(i)+alpha(m));
output2(m) = (Hlrwt(m)/2) * cos(km(m)*x(i) + alpha(m));
end
ulrwt(i,j) = sum(output);
italrwt(i) = sum(output2);
end
end

ulrwtmax=max(max(ulrwt));
fprintf(1,'velocity of u [LRWT] %6.3f [m/s]\n',ulrwtmax);

% Wheeler Stretching of LRWT
zstar=z+italrwt((length(x)/2)+1);

% Velocity Graph
figure
plot(u,z,'r',usos,z,'k',u5,z,'g',ulrwt(length(x)/2,Smile,z,'b',ulrwt((length(x)/2)+1,Smile,zstar,'m'); % For LRWT one wants to plot the speeds purely under the maximum crest rather than all the velocities of all the wave components
xlabel('[m/s]');
ylabel('Depth from Crest[m]')
title('SAWT');
legend('SAWT','SOS','5th Order','LRWT','LRWT+W','location','best');
grid on;
Solent
Solent
Team Mabrox Member
Team Mabrox Member

Number of posts : 1507
Age : 35
Location : Lymington:England
Ki : 10219
Registration date : 2007-12-14

http://kamisama.tk

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Mozillo Sun Jan 17, 2010 10:32 pm

When this works do we get credited on your paper? So when you become a big Engineering Super Star, Do they get their name in small print? THIS SMALL!

And no, I have absolute no knowledge on that sort of thang....
Mozillo
Mozillo
Fucking Awesome

Number of posts : 4235
Age : 30
Location : Upon my pirate ship of swashbucklingness
Ki : 1743
Registration date : 2008-02-03

https://www.youtube.com/MozilloGames

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Solent Mon Jan 18, 2010 2:41 am

Mozillo wrote:When this works do we get credited on your paper? So when you become a big Engineering Super Star, Do they get their name in small print? THIS SMALL!

And no, I have absolute no knowledge on that sort of thang....

Of course =]

new edited script (that now doesn't work =_=)

% SAWT.m
% CEdunno,Autumn
% Small Amplitude Wave Theory
% Robert Claridge, December, 2009
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
clear all;
close all;
clc;
%--------------------------------------------------------------------------
% Known Data
g=9.81;

% Variables
a=input('amplitude');
T=input('period');
z=linspace(-250, a, 250);

w=(2*pi)/T;
k=(w^2)/g;

%--------------------------------------------------------------------------
% SAWT
u=a*w*exp(k*z);
umax=max(u);
fprintf(1,'velocity of u [SAWT] %6.3f [m/s]\n',umax);

%--------------------------------------------------------------------------
% Second Order Stokes
usos=a*g*(k/w)*exp(k*z);
umaxsos=max(usos);
fprintf(1,'velocity of u [SOS] %6.3f [m/s]\n',umaxsos);
% N.B. as second term=0, the u is the same as the SAWT

%--------------------------------------------------------------------------
% 5th Order Soution
eps=a*k;
% eps=(H/2)*k Assume a=H/2 here
u5=((g/k^3)^0.5)*k*(eps*exp(k*z)-(((eps^3)*exp(k*z))/2)+((eps^4)*exp(2*k*z))-((37/24)*(eps^5)*exp(k*z))+((eps^5)*exp(3*k*z)/4));
u5max=max(u5);
fprintf(1,'velocity of u [5th Order] %6.3f [m/s]\n',u5max);

%--------------------------------------------------------------------------
% LRWT
Flrwt=[0.01:0.01:0.5];
alpha=[0.50;
1.05;
1.55;
-0.6;
-1.1;
0.1;
0.09;
-0.22;
0.05;
-0.38;
-0.15;
0.55;
0.55;
0.7;
0.2;
0;
-1.1;
-0.3;
-0.5;
0.49;
0.51;
0.05;
1.43;
-1.5;
-0.85;
-1.2;
-1.25;
-0.48;
-0.7;
-0.05;
-0.43;
-0.49;
-0.4;
-0.3;
-0.22;
-0.18;
-0.01;
-0.05;
0.1;
0.1;
0.18;
0.18;
0.22;
0.23;
0.12;
0.25;
0.24;
0.25;
0.4;
0.3;]';

Hlrwt=[0.3;
0.2;
0.18;
0.09;
1.58;
5.59;
7.58;
4.90;
3.30;
1.95;
0.60;
1.00;
1.60;
1.53;
1.18;
0.90;
0.40;
0.20;
0.50;
0.50;
0.70;
0.20;
0.20;
0.38;
0.10;
0.30;
0.08;
0.10;
0.10;
0.02;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;
0;]';

for i = 1:length(alpha)
km(i) = ((2.*pi.*Flrwt(i)).^2)/9.81;
end
x=linspace(-500, 500, 250);
for i = 1:length(x);
for j = 1:length(z);
for m = 1:length(alpha)
output(m) =(Hlrwt(m)/2) * (2*pi*Flrwt(m)) * exp(km(m)*z(j)) * cos(km(m)*x(i)+alpha(m));
output2(m) = (Hlrwt(m)/2) * cos(km(m)*x(i) + alpha(m));
end
ulrwt(i,j) = sum(output);
italrwt(i) = sum(output2);
end
end

ulrwtmax=max(max(ulrwt));
fprintf(1,'velocity of u [LRWT] %6.3f [m/s]\n',ulrwtmax);

% Wheeler Stretching of LRWT
zstar=z+italrwt((length(x)/2)+1);

%--------------------------------------------------------------------------
% LRWT without contamination : Get rid of data with frequency higher than
% 0.18
Flrwt2=[0.01:0.01:0.18];
alpha2=[0.50;
1.05;
1.55;
-0.6;
-1.1;
0.1;
0.09;
-0.22;
0.05;
-0.38;
-0.15;
0.55;
0.55;
0.7;
0.2;
0;
-1.1;
-0.3]';

Hlrwt2=[0.3;
0.2;
0.18;
0.09;
1.58;
5.59;
7.58;
4.90;
3.30;
1.95;
0.60;
1.00;
1.60;
1.53;
1.18;
0.90;
0.40;
0.20]';

for i = 1:length(alpha2)
km2(i) = ((2.*pi.*Flrwt2(i)).^2)/9.81;
end

for i = 1:length(x);
for j = 1:length(z);
for m = 1:length(alpha2)
output3(m) =(Hlrwt2(m)/2) * (2*pi*Flrwt2(m)) * exp(km2(m)*z(j)) * cos(km2(m)*x(i)+alpha2(m));
output4(m) = (Hlrwt2(m)/2) * cos(km2(m)*x(i) + alpha2(m));
end
ulrwt2(i,j) = sum(output3);
italrwt2(i) = sum(output4);
end
end

ulrwtmax2=max(max(ulrwt2));
fprintf(1,'velocity of u [LRWT-Cut1] %6.3f [m/s]\n',ulrwtmax2);

% Wheeler Stretching of LRWT-C1
zstar2=z+italrwt2((length(x)/2)+1);

% Linear Extrapolation of LRWT-C1
dudz=gradient(ulrwt2(length(x)/2,Smile,z);
z0=find(abs(z-0) == min(abs(z-0)));
dudz0=dudz(z0);
ulrwt0=ulrwt2(length(x)/2,z0);
if z(i)>0
ulrwt2=ulrwt0+(z(i)*dudz0);
else
ulrwt2;
end

%--------------------------------------------------------------------------
% Attempt Cut from 0.04-0.11 Hz
Flrwt3=[0.04:0.01:0.11];
alpha3=[-0.6;
-1.1;
0.1;
0.09;
-0.22;
0.05;
-0.38;
-0.15]';

Hlrwt3=[
0.09;
1.58;
5.59;
7.58;
4.90;
3.30;
1.95;
0.60]';

for i = 1:length(alpha3)
km3(i) = ((2.*pi.*Flrwt3(i)).^2)/9.81;
end

for i = 1:length(x);
for j = 1:length(z);
for m = 1:length(alpha3)
output5(m) =(Hlrwt3(m)/2) * (2*pi*Flrwt3(m)) * exp(km3(m)*z(j)) * cos(km3(m)*x(i)+alpha3(m));
output6(m) = (Hlrwt3(m)/2) * cos(km3(m)*x(i) + alpha3(m));
end
ulrwt3(i,j) = sum(output5);
italrwt3(i) = sum(output6);
end
end

ulrwtmax3=max(max(ulrwt3));
fprintf(1,'velocity of u [LRWT-Cut2] %6.3f [m/s]\n',ulrwtmax3);
% Velocity of this cut heavily underpredicts w.r.t 5th Order, Hence Wheeler
% stretching will only make it worse
%--------------------------------------------------------------------------

% Velocity Graph
figure
plot(u,z,'r',usos,z,'k',u5,z,'g',ulrwt(length(x)/2,Smile,z,'b',ulrwt((length(x)/2)+1,Smile,zstar,'m',ulrwt2((length(x)/2)+1,Smile,z,'y-',ulrwt2((length(x)/2)+1,Smile,zstar2,'y');
% For LRWT one wants to plot the speeds purely under the maximum crest rather than all the velocities of all the wave components
xlabel('[m/s]');
ylabel('Depth from Crest[m]')
title('SAWT');
legend('SAWT','SOS','5th Order','LRWT','LRWT+W','LRWT+C1','LRWT+C1+W','location','best');
grid on;

% Surface Profile Graph
figure
plot(x,italrwt,'k',x,italrwt2,'r');
xlabel('x[m]');
ylabel('ita')
title('Surface Profile Plot');
legend('LRWT','LRWT+C','location','best');
grid on;
Solent
Solent
Team Mabrox Member
Team Mabrox Member

Number of posts : 1507
Age : 35
Location : Lymington:England
Ki : 10219
Registration date : 2007-12-14

http://kamisama.tk

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Whillikers Mon Jan 18, 2010 7:47 pm

What does it do >.>
Whillikers
Whillikers
Jesus

Number of posts : 2327
Age : 113
Location : Bushes near Marv's window.
Ki : 944
Registration date : 2007-12-16

http://applejuicer.wordpress.com/

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Mozillo Mon Jan 18, 2010 8:07 pm

I would believe that it is most likely a way of testing this small amplitude wave theory. By a........... test programme thing. You know, he codes for it all, then the programme will show him if it works or not.... or something....
Mozillo
Mozillo
Fucking Awesome

Number of posts : 4235
Age : 30
Location : Upon my pirate ship of swashbucklingness
Ki : 1743
Registration date : 2008-02-03

https://www.youtube.com/MozilloGames

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Solent Mon Jan 18, 2010 8:40 pm

Mozillo wrote:I would believe that it is most likely a way of testing this small amplitude wave theory. By a........... test programme thing. You know, he codes for it all, then the programme will show him if it works or not.... or something....

Essentially we have to formulate a code capable of plotting a wave profile and finding the velocity profile under the water surface.
When you think how complicated a sea wave is explained in pure maths, you understand my pain D:

I'm sure you've heard of the fourier series and how you can add many sin waves together to compose a more complex set =]

(I think we kinda did it at GCSE physics, and then again at A-level)
Solent
Solent
Team Mabrox Member
Team Mabrox Member

Number of posts : 1507
Age : 35
Location : Lymington:England
Ki : 10219
Registration date : 2007-12-14

http://kamisama.tk

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Mozillo Mon Jan 18, 2010 9:52 pm

Yeah, our physics teacher showed us that a bit when doing waves and stuff in A-level, never got told what it was, just looked nice....

Wow, that sounds.... REALLY important.... o.o maybe?
I do like how all the Tenshiis* in the guild are WELL smart!

*well, most anyway
Mozillo
Mozillo
Fucking Awesome

Number of posts : 4235
Age : 30
Location : Upon my pirate ship of swashbucklingness
Ki : 1743
Registration date : 2008-02-03

https://www.youtube.com/MozilloGames

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Whillikers Mon Jan 18, 2010 10:06 pm

Mozillo wrote:
*well, most anyway

And what exactly are you implying here? Razz
Whillikers
Whillikers
Jesus

Number of posts : 2327
Age : 113
Location : Bushes near Marv's window.
Ki : 944
Registration date : 2007-12-16

http://applejuicer.wordpress.com/

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Solent Mon Jan 18, 2010 10:41 pm

From what I've seen, all the tenshii's really are smart!

It's like an underlying criteria to become one in my opinion XD
Solent
Solent
Team Mabrox Member
Team Mabrox Member

Number of posts : 1507
Age : 35
Location : Lymington:England
Ki : 10219
Registration date : 2007-12-14

http://kamisama.tk

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Whillikers Mon Jan 18, 2010 11:13 pm

That's cause stupid people are unpleasant to talk to so we simply don't get to know them.

They could be nice people, but when they're stupid, its hard to pay attention to them!
Whillikers
Whillikers
Jesus

Number of posts : 2327
Age : 113
Location : Bushes near Marv's window.
Ki : 944
Registration date : 2007-12-16

http://applejuicer.wordpress.com/

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Kamatari Tue Jan 19, 2010 1:35 am

He was probably implying Ryan. Not that Ryan isn't smart.
Kamatari
Kamatari
Jesus

Number of posts : 1901
Age : 33
Location : I NEED MORE BLEACH
Ki : 526
Registration date : 2008-01-03

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Whillikers Tue Jan 19, 2010 7:23 pm

Kamatari wrote:He was probably implying Ryan. Not that Ryan isn't smart.

Yeah that's what I thought.

Just it's so obvious that he meant that there's really no point in implying it.

Just say it out straight Chris!
Whillikers
Whillikers
Jesus

Number of posts : 2327
Age : 113
Location : Bushes near Marv's window.
Ki : 944
Registration date : 2007-12-16

http://applejuicer.wordpress.com/

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Sheepkilla Tue Jan 19, 2010 11:18 pm

I'm smart 0.0. What are you smoking Chris?
Sheepkilla
Sheepkilla
MUDKIP, I CHOOSE YOU

Number of posts : 1010
Age : 27
Location : Danbury, Connecticut
Ki : 926
Registration date : 2008-02-17

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Whillikers Wed Jan 20, 2010 12:07 am

Most likely pot.

Oh Chris, you're such a stoner.
Whillikers
Whillikers
Jesus

Number of posts : 2327
Age : 113
Location : Bushes near Marv's window.
Ki : 944
Registration date : 2007-12-16

http://applejuicer.wordpress.com/

Back to top Go down

Who likes programming? Empty Re: Who likes programming?

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 :: Okami :: Okami :: Guild Chat

 
Permissions in this forum:
You cannot reply to topics in this forum