Friday, December 25, 2015

Nice Ice

Me and my brothers went to Rambergssjøen to play around on the ice and have some fun with the drone I am making in my startup. Merry christmas!

Nice Ice from Ola Lysgaard on Vimeo.

Sunday, June 29, 2014

VTOL, Vertical Takeoff, Flying Wing

Today I scrapped together some of my old parts to see if I could make something new, the result was this. The airframe is made of some scrap materials and it does not have a real airfoil. The powertrain comes from two brushless motors and accompanying speed controllers from an old scrapped 450 size quadcopter. The flight controller is an extremely cheap NanoWii MultiWii controller configured as a bicopter. I had serious doubts that it would even get off the ground but after a failed attempt with a two cell battery. I slapped a three cell on the plane, the result is below:

There is still a long way to go before this can be called successfull VTOL concept, but it would be really interesting to see how far it is possible to push this hybrid flying wing design.

Stay tuned!

Wednesday, January 29, 2014

Example Smoothed-particle hydrodynamics with C and OpenMP

I am interested in ways of approximating differential equations numerically. Yeasterday I read up on the basics of Smoothed-Particle Hydrodynamics, or SPH for short. It is a way of approximating a PDE using a finite set of particles that represent a quantity, eg. a fluid. To read more about the basics of the method take a look at this PDF.

The algorithm was first prototyped is Octave (Matlab) and found to slow. Then I coded a native C version with SDL graphics and OpenMP to speed up some of the calculations, it worked pretty well. The code is available at my GitHub. A video showing the live rendering is embedded below.

As the video shows the liquid is extremely pressure driven and thus does not represent incompressible liquids, like water. The physical correctness of this simulation as a whole has to be taken with a grain of salt because of the extremely simple implementation. But it serves as a very visual way of communicating how the method works and what strengths/weaknesses it has.
One nice property is that the method conserves mass.

Sunday, October 20, 2013

A fast, massively scalable, distributed and parallel solver for Poisson's equation

This semester I have been studying at Queensland in Australia, more specificly at Queensland University of Technology in Brisbane. Even though most of a semester abroad is about what happens outside school this post is focused on school.
I have taken a course in Parallel Computation at QUT. As a semester project I created a direct distributed memory solver for Poisson's equation. The solver is written in plain C taking use of technologies as OpenMP, BLAS and OpenMPI.
Compared to a naively written single core solver written in C my solution had a speedup of 200 on a 50 core cluster. Compared to a bleedingly optimized sequential implementation taking use of the Intel MKL library for hand tuned matrix multiply code a speedup of 20 was measured. The distributed nature of the solver can also cope with much bigger problems than the sequential implementation. One run was done over 64 nodes each using 8 cores, that is 512 cores. The problem was a finite difference discretization with 32000x32000 grid points. Calculating the solution took only 2 minutes. A sequential implementation would use take several days to finish. All the code is as usual available in my GitHub together with the report.

Sunday, April 21, 2013

Film job at ISFIT!

I had the pleasure of taking shots for the closing ceremony movie at ISFIT 2013. The shot's where taken by a GoPro Hero3 strapped to my quad. Movie below, my 5 seconds of fame starts at 6:00

ISFiT 2013 from ISFiT on Vimeo.

Thursday, January 31, 2013

FDM heat equation of isolated rod with dynamic end temparatures

To test my understanding of the FDM method I made a simple implementation of the Crank-Nickelson method applied on the heat equation. The physical intepretation is this: You have a perfectly insulated rod of length $l$. At time $t_0$ you know the temperature distribution in the rod, $f(x)$. You also know that each end of the rod will have a temperature that is a function of time, $g_0(t)$ and $g_1(t)$. Given this information, what will the temperature in the rod be at an arbitraray time $t$ and position $x$? This is what the heat equation tells you, the problem, as usual with partial differential equations is that you can't always solve them explicitly. This is where numerical techniques comes to play and saves the day. Below is the result of a numerical simulation of such a senario. For simplicity the rods length is $1$. $f(x) = (2+2 \sin(6 \pi x)) (1-|2(x-1)|), 0\leq x \leq1$ $g_0(x) = g_1(x) = \sin(t), 0 \leq t$ This gives rise to the following solution:
Here is the Octave code that calculates this plot, quite simple and self explanetory:
M = 401; % number of space nodes
h = 1/(M+1); % space step size

T = 40000;  % number of timesteps
t = 0.0000005; % time step size

%U0 = 1-abs(linspace(-1,1,M)); % initial data
U0 = (2+2*sin(linspace(0,6*pi,M))).*(1-abs(linspace(-1,1,M))); % initial data
G1 = sin(linspace(0,2*pi,T));
GM = G1;

r = t/h^2;

U = zeros(M,T);
U(:,1) = U0;

n = M;
e = ones(n,1);
A = spdiags([e, -2*e, e], -1:1, n, n);

lkern = eye(M) + (r/2)*A;
rkern = eye(M) - (r/2)*A;

%for y=1:100
U(:,1) = U0;
for i=1:T-1
U(:,i+1) = rkern\(lkern*U(:,i));
U(1,i+1) = G1(i+1);
U(M,i+1) = GM(i+1);
end
%end

downscale = 1000;

Y = zeros(M,T/downscale);
for i=1:T/downscale;
Y(:,i) = U(:,downscale*i);
end

tx = linspace(0,1,M);
tt = linspace(0,t*T,T/downscale);
hold off
mesh(tt,tx,Y);
%contour(U)
ylabel('space');
xlabel('time');