Intelligent Design

Standard

I’ve just released my latest game, Intelligent Design, check it out!

Tasked with bringing life to a barren world can you intelligently design a balanced ecosystem? It is up to you to create species of plants, herbivores and carnivores but ultimately how much control do you really have in an ever evolving ecosystem?

Intelligent Design is a simulation sandbox god game with fully simulated genetics and evolution. You control a futuristic drone from an unremarkable cubicle in an unremarkable office building. Send requests for new species and buildings to help develop an ecosystem on the landscape in front of you.

Features

Fully modeled genetics which govern creatures behaviors
Genetic crossover through breeding
Genetic mutation caused by radiation
A climate model which tests the robustness of your plants
Genetically engineer your own species
Designed from the ground up to be a leaned back controller experience, relax and watch your ecosystem develop
Share on RedditTweet about this on TwitterShare on Google+Share on FacebookShare on TumblrDigg thisShare on LinkedInShare on StumbleUponPin on Pinterest

Reaching Wider Summer University 2015

Standard

Here are all the resources for the first two weeks of Engineering Reaching Wider Summer University…

Day 1 powerpoint – Overview of course and some specifications of the rocket motors

Check list of tasks each group needs to complete

Physics Toolbox Presentation

C6-3 Rocket Specification Sheet

AeroDoodle – On-line fluid dynamics simulator

On-line database of aerofoils and their lift coefficients

IMG_20140725_112216
Share on RedditTweet about this on TwitterShare on Google+Share on FacebookShare on TumblrDigg thisShare on LinkedInShare on StumbleUponPin on Pinterest

A parallel-ish version of modified cuckoo search

Standard

I’ve had some requests for a parallel version of the MATLAB implementation of my optimisation algorithm modified cuckoo search. Since google project hosting is closing down soon I need to post it here, you can download it at the bottom of the post. In
the near future I’ll be migrating the code over to something hosted by the Zienkiewicz Centre for Computational Engineering.

So, a quick how to for the parallel bit of the code. I wrote this for a project I’m doing with Dr. Ben Evans late last week. Basically I’ve taken the standard code, which you can find on the google code page, and separated out the objective function evaluations into a function ‘evaluate_all’ starting on line 758. That function, unmodified, loops through the nests one by one evaluating the objective function. All you need to do is edit that part of the code to evaluate your function in parallel for each of the different nests. I figured it made sense for people to do this themselves because how you want to do this is probably very problem specific.

Any questions ask away, otherwise enjoy!

Download the code here
Share on RedditTweet about this on TwitterShare on Google+Share on FacebookShare on TumblrDigg thisShare on LinkedInShare on StumbleUponPin on Pinterest

ACME 2015 – Generating Dual Orthogonal Meshes Suitable for Co-Volume Techniques

Standard

This past week I presented some of my mesh generation research at the 23rd Conference of the Association of Computational Mechanics in Engineering (ACME-UK 2015). The conference was held in Swansea and was a great event. I promised that I would put my slides on this blog at the end of my talk, so here they are. Click inside the embedded window to zoom in and out.


Download the PDF file .


The full conference proceedings can be downloaded here, my paper starts on page 297. You can find all my other papers on my Google scholar page.

A paper I cite quite a lot in my presentation is Xie et al. 2010 Tailoring unstructured meshes for use with a 3D time domain co-volume algorithm for computational electromagnetics.
Share on RedditTweet about this on TwitterShare on Google+Share on FacebookShare on TumblrDigg thisShare on LinkedInShare on StumbleUponPin on Pinterest

Teaching discovery

Standard

On my way into work this morning I was listening to the infinite monkey cage Radio 4 podcast and the topic was serendipity in science. They talked a lot about how big discoveries have been made by accident experimenting and exploring with no clear aim, graphene was an example they mentioned.  Eventually the topic was discussed on whether or not science education in schools convey this idea very well.  More often than not practical lessons in schools are used to teach theory and so have a correct and incorrect outcome leaving little room for exploration.  This was a topic I studied for my dissertation when I competed my teaching degree, so I could talk for hours on the subject.  Instead I’m going to share the outcome of that work which is some resources you can use for teaching or outreach.  Recently I did this with some primary school children for Reaching Wider Swansea

I wanted to create a experiment which had no correct outcome because I don’t know the answer.  This was done by telling the students to imagine they are working for a soap box derby car race team.



At the start of the session I played the above video which explains what soap box cars are, cars without engines which run down hills.  The task I gave the group was to plan and perform experiments so that you can give me some advice on how to build my race car…  but I stressed that I needed evidence for this.  Each group had a shoe box, some dowel and wheels, zip lock bags with rice if they wanted to investigate mass as a factor and just whatever else you think might be cool.  I simply gave them this work sheet and let them at it.

2015-02-12 12.01.12

Like most workshops, and if I’m honest lessons, I run the day turns into an organised chaos.  The less I influence the direction each group takes the better.  It gives the students a chance to be creative and I’m not going to have any reason to tell them they are wrong at the end.  After the dust settles at the end of the day each group talks in front of everyone else explaining what they found.  I’ve always found it works well, the key is to let go a little and let the students find their own path.  Surprising to me is that this seems to also have a confidence building effect in some children, I usually do this with 11 years and below.   Give it a try, all you need is the worksheet above and a tower of shoe boxes…

2015-02-12 12.01.26
Share on RedditTweet about this on TwitterShare on Google+Share on FacebookShare on TumblrDigg thisShare on LinkedInShare on StumbleUponPin on Pinterest

Mesh smoothing and data structure in MATLAB – a semi-live blog

Standard

MATLAB is a really great tool for quickly prototyping an idea and there are lots of nice meshing data structures built in which many people don’t know about. I’m currently working on a problem where I’m trying to fit functions to a surface mesh.  My mesh is defined by a set of nodes in the matrix X, where each row gives you (x,y,z) for a node, and the connectivity matrix tri in which each row gives you the the node numbers for each triangular element. In MATLAB I can plot this mesh like so…

trisurf(tri,X(:,1),X(:,2),X(:,3));
daspect([1 1 1]);

surfa

The daspect command is an important one a lot of people forget about when plotting meshes. It simply corrects the aspect ratio of the plot. As you can see that mesh is very crinkly and I want to smooth it out. My idea is to try Laplace smoothing which, in its simplest form, works by taking each node and moving it towards the centroid of the nodes connected to it. It might not work with a surface mesh, I’ve read a few articles where they have used it but not tried it myself. I’m writing this blog post literally as I’m coding and I’m going to post the results whatever they turn out to be!

To do this I’m going to write a function [ X ] = surfLaplace( tri,X, alpha ) which takes in the current connectivity and node positions and outputs the new ones. The value alpha will control how far to move the nodes towards the centroid of it’s neighbours, 0 means it won’t move, 0.5 means half way towards the centroid and 1 means all the way.

The first thing I need to do is identify the boundary nodes since we don’t want these to move. This is where MATLAB’s TriRep class comes in handy. Once we construct it the TriRep representation of our mesh will contain all sorts of handy data structures we can exploit. Construct a TriRep simply with the command TR = TriRep(tri, X);.

In a triangular mesh the boundary is the set of edges which only belong to a single triangle. MATLAB has a function to find this set using a TriRep called freeBoundary. If we run the code…
FF = freeBoundary(TR);
trisurf(FF, X(:,1),X(:,2),X(:,3));

…we get the following plot…
surfb
…because the array FF is a list of the boundary edges of our mesh. For the Laplace algorithm we don’t really care about the edge information we just want the node indices. We can get a list of those with some MATLAB aerobics…
BN = [FF(:,1);FF(:,2)];
BN = unique(BN);
NN = length(X);
isBound = zeros(1,NN);
isBound(BN) = 1;
%Just to check
hold
trisurf(tri,X(:,1),X(:,2),X(:,3));
scatter3(X(BN,1),X(BN,2),X(BN,3));
daspect([1 1 1]);

surfc

Now, if we want to know if index i is on the boundary we just inspect the value of isBound(i). In my case my array of nodes X actually has more than one surface in it, so I’ve also got to generate an array isSurf which tells me if a node is in the surface or not.

With this information we can start traversing the mesh and smoothing. For each node we will need to know the neighboring nodes. I can’t find a function that does this directly so I use the function SI = vertexAttachments(TR). Here SI is a cell array with an entry for each node, which are lists of all the triangular elements which are connected to those nodes. With that list we can then collect all the nodes which are in those elements and find the unique values in that list like so for node ip…
attachElem = SI{ip};
numElem = length(attachElem);
neigh = tri(attachElem(1),:);
for ie = 2:numElem
neigh = [neigh tri(attachElem(ie),:)];
end
neigh = unique(neigh);

To prove it works here is a plot of the nodes neigh for a particular ip.
surfd
We need to remember that the node ip is itself in the list neigh. Now we have the list it is just a simple case of looping round each node and moving it towards the centroid of its neighbours. There might be a more efficient way of writing this but since this is a quick prototype…
numNeigh = length(neigh);
xnode = -1*X(ip,1);
ynode = -1*X(ip,2);
znode = -1*X(ip,3);
for ineigh = 1:numNeigh
xnode = xnode + X(neigh(ineigh),1);
ynode = ynode + X(neigh(ineigh),2);
znode = znode + X(neigh(ineigh),3);
end
Xnew(ip,1) = X(ip,1) + alpha*((xnode/numNeigh)-X(ip,1));
Xnew(ip,2) = X(ip,2) + alpha*((ynode/numNeigh)-X(ip,2));
Xnew(ip,3) = X(ip,3) + alpha*((znode/numNeigh)-X(ip,3));


Running the smoothing function with alpha = 0.1 ten times on the surface mesh seems to work pretty well…
surfe
The mesh on the left is where we started and the one on the right is where we finished. I’m not entirely sure it is going to work well for all cases, but it might be a good first step. Check the MATLAB documentation for more useful mesh related data structures and any comments post here or talk to me on twitter @DrSeanWalton
Slight caveat to this post is that I’m using MATLAB version 7.8.0 which uses the TriRep class which is going to be removed and replaced with the triangulation class in a future version.  It seems to have all the same functionality but with a different name.
Share on RedditTweet about this on TwitterShare on Google+Share on FacebookShare on TumblrDigg thisShare on LinkedInShare on StumbleUponPin on Pinterest