some Words about Physics, Python, Apple and everything else

Power to Gas in Africa

You may know this famous image illustrating that we would only need a "tiny" fraction of the desert in Africa to be fitted with solar thermal power plants to meet the electricity demand of the world (diploma thesis). Problem is how to get the energy from there to the world. If only there would be a high energy density storage medium that is easy utilize and transport.

Well, you see there is. Gas. Methane gas for example. While some try to get methane gas from the bottom of the ocean, there is technology to produce it from water. In essence you first split water in hydrogen and oxygen and then combine the hydrogen with CO2 to get methane. More or less the only other thing you need to do that, is electricity, which is why this technique is called power to gas.

The problem with power to gas is, that it has a very bad energy efficiency when you compare what you put in to what you get out. For high compression (200 bar), which you need in order for easy transport, you only get about 49% efficiency. In other words less then half of the electricity put in to the process would not end up in the produced gas. To put that in perspective a coal plant reaches about 33%, a gas plant about 60% and a diesel engine up to 50% (1,2). That in turn means that for the whole process of harvesting energy in Africa and using it for transportation and electricity we might and up with only 30% efficiency. Terrible isn‘t it?

No it isn‘t. Because the solar energy which radiates on Africa at the moment is not used at all. But we should compare it to other measures of energy production, and efficency wise they are probably ahead. But keep in mind that once installed you would get solar energy allmost for free with no environmental demage done while harvesting it. No nuclear waste, no added CO2 – you only have the investment cost and the maintainance costs of the plants.

Ok, back to the idea. Imagine we would build a lot of solar-thermal power plants in Africa and produce methane gas with them. We could provide the world with energy and the world would not even have to change! Well it would shake up the political landscape. Maybe. A little bit. We can use the gas for heating, for mobility and for producing electricity. All CO2 neutral with an allmost infinite supply for the future. And all the technology to do it allready exists.

The worlds energy demand should be about 20,000 TWh/y. To produce that in methane gas we would need about three times of that in electricity, assuming that allmost all is needed as electricity (which it isn‘t but it is the worst case). That makes 60,000 TWh/y. Assuming the same things as in the image above that would mean a square with an edge length of 500km. Or four times the size of the biggest square in the image.

So what would it cost? Let‘s do a very rough estimation here: The Ivanpah Solar Power Facility is the biggest solar thermal power plant today. It it cost $ 2.2 billion and produces about 1 TWh/y. This would mean the total cost for building the power plants would be about $132 trillion. Let‘s work with that, even though the true cost of building 60,000 power plants would for sure be different because of scaling effects and infrastructure that would be needed besides the plants.

How much are $132 trillion? That is about 2 times the global GDP. A lot. But if you consider that this would solve the energy problem of the world – it might be cheap. In a rough estimate the US energy consumption amounts to allmost 1 trillion dollar per year alone. Solving the worlds energy problem with the all the worlds money in 2 years. Seams worth it.

Would‘t this be Desertec all over again? Somehow. The biggest problems Desertec had were political. You can not simply force Africa to be a stable part of your electricity grid. The problem with power grids is that they are much more unstable then they look like, so extending them geographically and making their stability dependent on a far away region is not a good idea.

The difference with gas would be that it is easy to integrate, as we would not need new powerlines. And while we would still be dependent on Africa to sell us gas (as we are now from Russia for gas and Saudi Arabia for oil) we can much more easily store gas for emergencies (as we do now). If we would couple our grid instead the shutdown would be immediate. Back to the bright side…

Isn‘t that amazing: we could meet the worlds energy demand with easy to utilize gas. For the rest of the lifetime of the sun. By only using a fraction of the land available in Africa.

The depressing thing is what we do instead…

Making (very good) Salmon Burger

This is very much inspired by Finland: Salmon, dill and beetroot.


The Buns


So credit where it‘s due, here is the recepie - in German. So what do you need for about 6 buns:

The important trick is to preheat butter and milk in a water bath to about handwarm. Then you mix everything dry. Afterwards you add the wet stuff and mix until it seems to be a dough.


And now what these things need to become is really nice and fluffy, is a lot of time for the yeast to do its thing. About 1 hour everything together. Then another 45 minutes after you formed the buns. Finally you bake them for 15 minutes at 175°C.

The Salmon


This is the center peace of the burger, but still quite easy to make. As with most fish and meat, quality of raw material makes the biggest difference. The nice thing about this kind of salmon burger is that you do not need a lot of things other than salmon:

Thats about it. You then half the salmon and cut one half in rough pieces which you use to produce a very fine salmon paste. The other half you slice in very fine pices. Then you mix both together and spice them. Do not forget to clean your knive and board after you cut the fish and sprinkle a layer of breadcumps on it, this will prevent the paddies from sticking on the wood.


There are a lot of possible spice combinations for salmon, I prefer to just use some dill, salt, pepper and a little bit if chilli. But you could also go the Asian route and use some sesame, soy souce, teriyaki and spring onions or the English version with some mustard. Either way, after you mix everything, you can form the paddies as you would with any miced meat and store them on the breadcrump covered board. Then you sprinkle some more breadcumps on top and the salmon and it is ready for the pan. If you have the feeling that everything holds really badly together and you would need some more salmon paste then just take a handful of the fracmented mix and put it in the mixer again, but not to much since the chunks of salmon are what makes these great.

If you like to you can add some cheese on top at the end. I think blue cheese would also fit very well if you are in to it.


The Cauliflower


I think this makes it all come together.

Cut the florets from the stem of the cauliflower until you have small pieces. Cook them in saltwater for about 5 minutes and let them cool a bit. Then they will get crumped in the usual way. Finally you backe them in the oven spinkeled with some oil until they are golden. This is much better than french fries as a company for the salmon burger.

All the rest

You can certainly vary here but I prefer it this way:

Also everyone seems to tell you otherwise but making mayo is quite simple, you need:

One of the things everyone tells you is that the ingredients have to be the same temperature, but my eggs and mustard are usually in the fridge while the oil is not. So what I do is I put the egg yolk and the mustard in bowel together with a pinch of salt and mix them for some time so they can heat up a bit. Then I start to add the oil by literally drizzling it in until I think it is enough mayonnaise. Add some pepper and dill, done.

The beetroot. I like them – well at least nowadays – and they are a big thing here in Finland. Just peel them, cut into slices and cook them in the water after the cauliflower is done. For some reason gherkins are also a big thing here.

And then you put it all together.


mpi4py Allgatherv Example

My current work involves some agent based simulation written in Python. I now wanted teach it some new tricks including running on multiple cores. While my normal approch for multithreading in Python is to just run several simulations in parallel to get some average, I decided it would now make sense to also have single simulations run on multiple cores. One reason for that was to make it scale more easily on the computing cluster, the other was that I assumed it would be quite easy with the agent based stucture.

For the same reasons I decided to use MPI (mpi4py): it seamed like a good fit for an agent based model (agents sending messages around) and it was available on the computing cluster. It turned out that in the end I did not use any mpi code in the agents to keep them more flexible.

Anyway, the simulations is structured in the following way: on each core/process a controller is initalized which handels not only the communication but is also in charge of the agents. This is a good fit because the simulations involves global state as base of the agents decisions.

I decide in the beginning which controller controlls which agents. This might lead to some unused processing time during the sync between the controllers because they might have to wait to get the globals state. But since each agent has a lot of data attatched, I assumed it would not make sense to depatch the agents to a different process every timestep. This would mean to shuffle around big python objects and therefore presumeably slow.

Instead only the global state is shared between the controllers. I am not sure if this is the best solutions since I did not try any other but it turned out to have a nice structure and work quite well.

One problem I sumbled upon was the that I could not gurante that each group of agents would be the same size, because when you want to simulate 100 agents on 16 cores it does not add up. This meant I could not use the normal allgather methods of MPI to collect the state but had to use allgatherv which can deal with the different sizes. Sadly there is no documentation about allgatherv in MPI4PY. With some googling I worked out an example of how it works I wanted to share so here it is:

from mpi4py import MPI
import numpy as np

rank = comm.Get_rank()
mpi_size = comm.Get_size()

# work_size = 127  # arbitrary prime number
work_size = 100  
work = np.zeros(work_size)

base = work_size / mpi_size
leftover = work_size%mpi_size

sizes = np.ones(mpi_size)*base
offsets = np.zeros(mpi_size)

start = offsets[rank]
local_size = sizes[rank]
work_local = np.arange(start,start+local_size,dtype=np.float64)

print "local work: {} in rank {}".format(work_local,rank)

summe = np.empty(1,dtype=np.float64)


print "work {} vs {} in rank {}".format(np.sum(work),summe,rank)    

 page 1 / 8  older