http://summerofhpc.prace-ri.eu/code-test/
Monday, February 18, 2013
PRACE Summer of HPC
http://summerofhpc.prace-ri.eu/code-test/
Wednesday, January 30, 2013
ODE for Nutrition
Edit: Added some references to the numbers in the source code after a suggestion from a friend.
function Diet_PD
%Using the Mifflin-St.Jeor model for BMR, modified with a linear interpolation of metabolic adaptation rate for calory intake changes. Controller scheme used is the Proportional-Differential controller (widely used in engineering)
clear all; clc;
%User inputs
t = 0:1:1*365;
h = 165; %Height (cm)
a = 27; %Age (years)
s = 1; %Gender (1 - Male, 2 - Female)
m0 = 75; %Initial mass (kg)
mtar = 60; %Target mass (kg)
phys_frac = 1.3; %1.2 <= Physical activity fraction <= 1.9 (Default: 1.2 = Sedentary, 1.375 = Light activity, 1.55 = Moderate, 1.725 = Very active, 1.9 = Professional/Hard labour)
Tmin = 1000; %Minimum calorie intake per day
Tmax = 5000; %Maximum calorie intake per day
%Controller gain constants (Trial & Error/Tuning methods)
K1 = 2000; %Proportional Controller gain
K2 = 10; %Derivative Controller gain
%Do not mess with the values after this line if not familiar
%Initial metabolic adaptation fraction calculation (Numbers from Martin et al, Human Physiology, doi:
10.1038/oby.2007.354., 2007)
x0 = [m0 met_ad_frac];
a1 = 1-1437/1523;
a2 = 1-1484/1514;
dadt = (1437/1523-1484/1514)/90;
met_ad_frac = ((a1+a2)-(270*dadt))/2;
if(s==1)
gen = 5;
else
gen = -161;
end
x0 = [m0 met_ad_frac];
[mplot] = odeft(@deriv_RHS,t,x0,5,h,a,dadt,gen,phys_frac,Tmin,Tmax,K1,K2,mtar);
figure(1)
plot(t,mplot(:,1),'ok');
xlabel('Days'); ylabel('Mass (kg)');
source = max(Tmin,K1*(-mplot(:,1)+mtar) + K2*phys_frac*(10*mplot(:,1)+6.25*h-5*a+gen)/7700);
source = min(Tmax,source);
figure(2)
plot(t,source,'ok');
xlabel('Days'); ylabel('Energy Intake (kCal)');
return
function [wdot] = deriv_RHS(t,x0,h,a,dadt,gen,phys_frac,Tmin,Tmax,K1,K2,mtar)
T = K1*(-x0(1)+mtar) + K2*phys_frac*(10*x0(1)+6.25*h-5*a+gen)/7700;
if(T < Tmin)
T = Tmin;
elseif(T > Tmax)
T = Tmax;
end
if(x0(2)<=0)
x0(2)=0;
end
wdot(1,1) = T/7700 - (1-x0(2))*phys_frac*(10*x0(1)+6.25*h-5*(a+t/365)+gen)/7700;
wdot(2,1) = dadt;
end
end
Tuesday, November 27, 2012
Problem: No phones provided to the delivery guys.
Possible causes: Expensive (prone to stealing, company distrusts the delivery guys)
Solution: Provide basic smartphone/communication device to the delivery guys. (Raspberry PI can be modified to include a radio receiver/transmitter and a GPS unit). OS and firmware locked (remove super user account). Prior to dispatch, delivery guy syncs route data along with customer gps locations and contact details. When the unit is approximately 30 mins away from the location, the device sends an automated sms to the customer, alerting them. If the customer is not in, s/he can reschedule it via a number generated by the device.
Yeap, seems that's about it... Man, I must be on a bit of weed...
Monday, August 13, 2012
The Run
Thursday, June 28, 2012
Derek's in Kulim!
So, here's the lowdown on this quaint place in Kulim for a 80s kind of coffee house grub. For the past few days, I've been at a loss on good food options in my hometown. Due to a combination of desperation and Google, I found this link, which introduced me virtually to Derek's.
Since my curiosity was piqued, I tried it out today for lunch and am really happy that I did so. The place is indeed very hard to find so I will put in a geotag for my next visit there or you can visit the link for a rough location.
As I entered Derek's, I felt that the setting has a very simple, 80s like coffee house ambience to it. Pretty much no frills. There's only one server, who kind of does everything except cooking, so service can be slightly slow but still faster than a one-man restaurant in Barcelona. I helped myself to a seat near the window and after waiting a while, the server handed a menu card.
The menu consists of three soup choices, the ubiquitous mushroom, cauliflower and potato, and madras pumpkin. Tempted as I was to try the pumpkin soup, it was unfortunate as the soup of the day in the set was... you've guessed it... mushroom... Never mind! The main course options are also not that many but as a rough idea of the choices available, there is a dory fish and chips, spaghetti vongole, and barbecued lamb shanks. In total the number of main courses is about 15ish. If one goes for the set meal, one can get a soup of the day, two scoops of ice cream or a slice of fruit, and a hot beverage (coffee or tea).
I went with a set meal of pan fried chicken breasts. The mushroom soup was decent, not too thick, with a distinct mushroom aftertaste and a slight hint of tarragon. Not too creamy but at times there are some small blobs of salty starch which is kind of what one would expect in the soups of an 80s diner. The bread roll is not really worth mentioning except that it comes hot and is accompanied by a small bowl of butter. Yes, a BOWL of butter, free for you to spread on anything... You hardly see this anywhere else nowadays.
The chicken main course was very good. The dish came with two pieces of pan fried breasts, a boiled cauliflower and broccoli, and a big blob of mashed potatoes. Taste wise it was excellent with enough herbs, mainly marjoram, and thyme, and also the lemon butter was quite, shall I say, authentic? The breasts were not dry but as always with a single cooking preparation, the crusts were crispy but the meat themselves were not melt in your mouth tender like those prepped via sous-vide style. The boiled veggies were not over cooked and that bowl of butter helped in augmenting the flavors. The mashed potato was decent with enough fat and herbs. The chopped garlic bits add bite and flavor to the mash. I do have to add that the mash could've used an old style hand mashing/ricer instead of the blades of the food processor as the texture was not smooth and velvety but more like wallpaper paste. Overall, it was a very good plate of main course.
The dessert part was the ice cream topped with crushed peanuts. Standard coffee house fare but I like the crushed peanuts as it tasted fresh, unlike the ones you get in Malaysian/Singaporean mall "restaurants" where the nuts are usually rancid. Coffee was horrible though, but no complaints as it's the same anywhere else in Penang or Singapore outside of specialized cafes. For the record, I love kopi-o sold in those old 70s kind of coffee shops (kopitiams). The way the beans are roasted with sugar, gives it a unique and complex flavor profile due to the Maillard reaction. Much better than Americanos from Shittybucks. Marketing ideas people!
On the whole, I like this place and the food served here. What was most surprising to me was that Derek's is found in my small hometown, and believe it or not, the food served here puts many mall restaurants to shame. The whole meal only set me back by 25 MYR which is roughly 12.50 SGD.
8.5/10
Sunday, December 4, 2011
PID controller for FLUENT
Friday, November 4, 2011
If (by Rudyard Kipling)
If you can keep your head when all about you
Are losing theirs and blaming it on you;
If you can trust yourself when all men doubt you,
But make allowance for their doubting too;
If you can wait and not be tired by waiting,
Or, being lied about, don't deal in lies,
Or, being hated, don't give way to hating,
And yet don't look too good, nor talk too wise;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts your aim;
If you can meet with triumph and disaster
And treat those two imposters just the same;
If you can bear to hear the truth you've spoken
Twisted by knaves to make a trap for fools,
Or watch the things you gave your life to broken,
And stoop and build 'em up with wornout tools;
If you can make one heap of all your winnings
And risk it on one turn of pitch-and-toss,
And lose, and start again at your beginnings
And never breath a word about your loss;
If you can force your heart and nerve and sinew
To serve your turn long after they are gone,
And so hold on when there is nothing in you
Except the Will which says to them: "Hold on";
If you can talk with crowds and keep your virtue,
Or walk with kings - nor lose the common touch;
If neither foes nor loving friends can hurt you;
If all men count with you, but none too much;
If you can fill the unforgiving minute
With sixty seconds' worth of distance run -
Yours is the Earth and everything that's in it,
And - which is more - you'll be a Man my son!