Tuesday, July 30, 2013

Python Software Foundation - SfePy : GSoC 2013 : Week 6


Hi Pythonistas,

This week I spent coupling steady Navier Stokes Equation with the Energy Equation.
First Navier-Stokes Eq is solved to get the velocity field then this result is used to calculate the temperature field.

Code:



Sunday, July 28, 2013

The Flip Side #2 : The Fourth Estate



Thomas Carlyle in his book On Heroes and Hero Worship:
Burke said there were Three Estates in Parliament; but, in the Reporters' Gallery yonder, there sat a Fourth Estate more important far than they all.

It was 1980s when journalism actively emerged in India. From creating the first and most influential piece on the Bofurs gun scandal which involved the then Prime Minister Gandhi who was accused of receiving kickbacks from the Bofurs Company to the story of the Fodder scam which involved embezzlement from the treasury of the Indian state of Bihar. There was a time when the fourth estate played a prominent role in enlightening the commons. But it seems those days are gone - be it a national daily or an international newsroom, shoddy journalism is at its peak and it is degrading further every day. You can find a transcript below which provides a flip side of the fourth estate.


Shoddy Journalism [1]

Appalling journalism. Absolute blasphemy! As I watch the news from home, I am dumbfounded to see Barkha Dutt of NDTV break every rule of ethical journalism in reporting the Mumbai mayhem.

Take a couple of instances for example:
  • In one instance she asks a husband about his wife being stuck, or held as a hostage. The poor guy adds in the end about where she was last hiding. Aired! My dear friends with AK-47s, our national news is helping you. Go get those still in. And be sure to thank NDTV for not censoring this bit of information.
  • In another instance, a General sort of suggests that there were no hostages in Oberoi Trident. (Clever.) Then, our herione of revelations calls the head of Oberoi, and the idiot confirms a possibility of 100 or more people still in the building. Hello! Guys with guns, you’ve got more goats to slay. But before you do, you’ve got to love NDTV and more precisely Ms. Dutt. She’s your official intelligence from Ground zero. You do not need to be a journalist to understand the basic premise of ethics, which starts with protecting victims first; and that is done by avoiding key information from being aired publicly — such as but not limited to revealing the number of possible people still in, the hideouts of hostages and people stuck in buildings.

Imagine you’re one of those sorry souls holed-up in one of those bathrooms, or kitchens. A journalist pulls your kin outside and asks about your last contact on national television, and other prying details. In a bout of emotion, if they happen to reveal more details, you are sure going to hell. Remember these are hotels, where in all likelihood, every room has a television. All a terrorist needs to do is listen to Ms. Barkha Dutt’s latest achievement of extracting information from your relative, based on your last phone-call or SMS. And you’re shafted —courtesy NDTV.

If the terrorists don’t manage to shove you in to your private hell, the journalists on national television will certainly help you get there. One of the criticisms about Barkha Dutt on Wikipedia reads thus:
During the Kargil conflict, Indian Army sources repeatedly complained to her channel that she was giving away locations in her broadcasts, thus causing Indian casualties.
Looks like the idiot journalist has not learnt anything since then. I join a number of bloggers pleading her to shut the f*** up.

Update: In fact, I am willing to believe that Hemant Karkare died because these channels showed him prepare (wear helmet, wear bullet-proof vest.) in excruciating detail live on television. And they in turn targeted him where he was unprotected. The brave officer succumbed to bullets in the neck.
Update 2 [28.Nov.2300hrs]: Better sense appears to have prevailed in the latter half of today— either willfully, or by Government coercion2, and Live broadcasts are now being limited to non-action zones. Telecast of action troops and strategy is now not being aired live. Thank goodness for that.
Update 3 [30.Nov.1900hrs]: DNA India reports about a UK couple ask media to report carefully:
The terrorists were watching CNN and they came down from where they were in a lift after hearing about us on TV.
— Lynne Shaw in an interview.

1. Oh, they have a lame excuse pronouncing that the television connections in the hotel has been cut, and therefore it is okay to broadcast. Like hell!
2. I’m thinking coercion, since Government has just denied renewing CNN’s rights to air video today; must’ve have surely worked as a rude warning to the Indian domestic channels.
Instead of apologizing, and introspecting on how to improve, this is the kind of crap we get in response to shoddy journalism.
Radhika Sahasranaman rips the guts of that response on a 3000 strong, and growing Facebook group, whose title couldn't have sent signals any clearer:

NDTV's response is in itself a giveaway of misplaced notions: "In the absence of any instructions on site and in the absence of any such framework we broke NO rules" ("convenient transference of responsibility" or what?); and the entire argument, she concludes, amounts to "which television journalist tops the charts or falls to the bottom" (is that how they keep score?). It is important that we don't shoot the messenger but when the messenger loses the message, there is something to be done. Which is why, for once, I will take Barkha's advice. Use the remote control when emote control doesn't work

-Radhika Sahasranaman

Here's another:
TV news would no doubt argue that most other critiques of 26/11 coverage have been answered, too. Shoving mikes in front of distressed people? They wanted to share. Too close to the theatre of operation? If someone told us we would have moved away. And just in case anyone still has doubts,
Narayana Murthy and Suketu Mehta, among many others, rated 26/11 coverage as first class.
Maybe the Government goofed up not laying down rules of coverage. Does that end all questions on journalistic responsibility? Think about it. If journalists, especially senior editors, say they need the government to tell them how to do their business, they are opening a door many politicians would love to never shut again.
— Saubhik Chakrabarti on Indian Express

The choice could not have been simpler: you either kick the idiocy, and if that does not work, then
kick the idiot out.
Update: Oh, by the way, there is a framework (Self-Regulation Guidelines for the Broadcasting
Sector [pdf]) for anyone who cares— and has been in existence for more than a year.
Update 2: NSG says media got in the way, wants guidelines.
Update 3: Presstalk: In the name of fair and balanced.
Update 4: The Hoot: "Those who argue that viewers can use the remote to not watch what they find
unethical or irresponsible should note that many in India did, people went to offices and went to
vote but the TV all the same managed to give important information to the backers of the terrorists
who were glued to their screens. The remote is not the solution to such irresponsibility."
Harini Calamur: "Week 1-Post 26/11-Quo Vadis News Media?"
The above transcript you read was written by Chetan Kunte on his blog and within a few days he was silenced where NDTV probably sent Kunte a legal notice, asking him to pull the post down, apologize, never write about them again, and pay an absurdly massive amount of money.

The percentage of truth in this post is surely questionable, but I wonder why Barkha Dutt and NDTV took it so seriously. After all he was just another common man who posted it in his personal blog.
Why?

To answer this question you need to look into Dr Nayef R.F. Al-Rodhan's paper[2]
where he talks about the concept of The Fifth Estate :
In the past fifteen years, the spread of the Internet and other advanced technologies has had a dramatic effect on the way people access and perceive information. One of the most revolutionary technological novelties that characterizes the modern "digital revolution" has been the explosion of weblogs. Blogs have impacted numerous facets of international politics including elections, media reporting from zones of conflict, and corporate and congressional policies. They also have potentially significant implications for policy making of the future and for national and global security. This has led to the claim that blogs deserve the title of the "fifth estate," following an analogy with the other four estates that influence modern policy shaping: executive, legislative, and judicial branches of the state and the media.
Today blogs have become the reality check for policy makers, opinion shapers, and interest groups. With the fall of the reliability on the Fourth Estate today a Fifth Estate led by the commons have started to play a major role in making an impact in this society. With its disturbingly alarming growth we still can't predict whether it will be good for our society in the long run or not, but the real question is - Do we have any option?   


PS. After writing this post I realised that the latest film on Wikileaks is also named The Fifth Estate.

Monday, July 22, 2013

Python Software Foundation - SfePy : GSoC 2013 : Week 4&5


Hi Pythonistas,

Week 4&5 went of really well.

- Firstly after huge amount of discussions we finalised the Navier-Stokes solver and have started development on it.

- In parallel, working on the coupled convective-diffusive problem that I have selected: Laminar Heat Transfer to a Steady Couette Flow
between parallel plates. Where first the Navier Stokes Equation will be solved to determine the velocity and pressure field and then that will be used to determine the temperature field using the Energy Equation.

- I have also added new examples:

  • Steady Axial convection and diffusion in parabolic flow with maximum velocity U in an insulated pipe.


Commit - 1 2

  • Also benchmarked our solver based on the four cases mentioned in the paper Laminar Heat Transfer to a Steady Couette Flow
    between parallel Plates
    • Case A


    •  Case B

  
 
    • Case C


    • Case D



Except for one plot in Case D (Psi = 0.200) all other graphs obtained were in accordance with the paper.

Commit -  Link

This week I will focus on obtaining the result of coupling the equations.
Adios!


Tuesday, July 16, 2013

Compass Box Killer



'Akurle is just the first to die.
To find out who is next, find me first.'

One muggy afternoon in Mumbai, a senior police officer is found murdered at his desk. When Inspector Virkar from the Crime Branch arrives at the scene, he finds a cryptic note that spills out of a student’s compass box. Then begins a series of killings and in each, a tell-tale compass box reveals more clues.

Accompanied by the attractive, ambitious TV reporter, Raashi Hunerwal, Virkar has to race against time to catch the killer before the bodies pile up. As the investigation shuttles from Mumbai to Khandala to Belgaum, Virkar is taken deep into a labyrinth of backroom deals that lead to shocking revelations about the ruthless killer’s motives. Slick plot twists and high-adrenaline action mark the story where Virkar finally confronts the killer himself.

Piyush Jha's films are noted for the unconventionality of the subject matter and treatment. For instance, Chalo America is about young college boys and emigration. Similarly, Sikandar has young teenagers as the leads, while King of Bollywood has a British Documentary filmmaker through whose eyes the story unfolds.

Similarly, his book also unfolds the story in a rather unconventional manner. It is a remarkable crime thriller story set with Mumbai as its backdrop, but I felt it lacked depth in the plot/characters/emotions. It is a fascinating read, but it won't leave you craving for more. None of the characters are so well developed to make you fall in love with them, except Inspector Virkar who is tough, daring and relentless in his pursuit of justice, a policeman one wishes every city had.




**SPOILER BEGINS**

I wish the author had spent some more time on refining his work emotionally by sharing some more flashback sequences showing the development of bond between Tracy and Hari. That way the readers might have connected to Hari emotionally to understand his feelings.

**SPOILER ENDS**



It is fast paced and gripping one time read.
You can definitely visualize the entire story unfolding in front of you as a Mumbaistan movie.
 


The book was received as part of Reviewers Programme on The Tales Pensieve.

Tuesday, July 9, 2013

I Saw, I Learnt

When I was a kid my mother used to switch off the lights and fans of the rooms we were not using. I used to wonder what is the big deal if we switch it off for an hour and two. Then one day she made me calculate the hours we save in a year and then I realised the importance of saving the resources we take for granted. Slowly I developed this habit and learnt my lesson.



My dad is a doctor and when I was a kid I used to ask him why doesn't he worship God like others do.
Do you not believe in him?
He told me he does and that he worships his work. Being a doctor the best worship you can do is my saving lives and he did it everyday.
That day I learnt a great lesson.




I am sharing what 'I Saw and I Learnt' at BlogAdda.com in association with DoRight.in.

Sunday, July 7, 2013

Python Software Foundation - SfePy : GSoC 2013 : Week 3



Hi Pythonistas,

This week kicked off with the hunt for a robust Navier-Stokes solver for SfePy.
I went through huge amount of resources.

To summarise the journey:

For our Navier-Stokes currently we use the Newton method with backtracking line-search. in OpenFoam and most of the CFD code the linearization approach is based on Patankar's SIMPLE algorithm.[1][2]
I talked to my professor who told me that SIMPLE is used in commercial softwares like FLUENT too.

I found few papers which tells us some other approaches:

[1]: http://www.cfd-online.com/Forums/openfoam-solving/60167-how-nonlinear-discretised-equations-linearised-openfoam.html
[2]: http://web.cecs.pdx.edu/~gerry/class/ME448/notes/pdf/SIMPLEslides.pdf


I did some more digging from the implementation point of view and came across some interesting things:

This tutorial demonstrates the solution of Incompressible Navier-Stokes Equations using Fenics. it uses Chlorin's method[3] to solve the problem.
http://fenicsproject.org/documentation/dolfin/1.2.0/python/demo/pde/navier-stokes/python/documentation.html

Other Implementations:

Here is a list of Open Source CFD codes. Maybe we can fork a repo and use it or learn from it:
http://www.cfd-online.com/Wiki/Codes

According to people iNavier and dolphyn are promising:
http://www.cfd-online.com/Forums/main/13529-colver-code-c-c.html

Someone was using PyAMG to develop Jacobian-Free Newton-Krylov code to solve the Navier Stokes equations : https://groups.google.com/forum/#!topic/pyamg-user/HXrXTyvXPpw

[3] http://en.wikipedia.org/wiki/Projection_method_%28fluid_dynamics%29

This is everything I could harness this week. There is a lot of things to take care to lock the final solver to be used which I would do the current week. Also I am currently narrowing down and rigorously searching a way to implementing SIMPLE in the FE context.

On a side note I have also been working on a SfePy version for Python 3 and benchmarking the simulation results.

This journey is surely turning out to be awesome!

Cheers!

Tuesday, July 2, 2013

Python Software Foundation - SfePy : GSoC 2013 : Week 2



Hi Pythonistas,

After developing more understanding of SfePy I moved towards implementation.
The first phase of my project involved implementation of convective-diffusive equations.

So with the help of my mentor R (Robert. He is awesome!), energy equations were implemented.

The sample problem taken was:

r"""
Steady Axial convection and diffusion in slug flow with velocity :math:`U _0`
in an insulated pipe.
It is subjected to specified temperature at the entry and exit lengths -
:math:`T _0 for x \leqslant 0`
:math:`T _1 for x \geqslant L`
:math:`\alpha \frac {\partial T}{\partial n} = 0 on the lateral surface of the pipe`
Find :math:`T` such that:
.. math::
        \int_{\Omega} c \nabla v \cdot \nabla T =
        - \int_{\Omega_L} (\vec{u} \cdot \nabla T) v
"""

Now the results were pretty interesting :




The results were in accordance with the Peclet number graph which predicts the Temperature distribution in a convective-diffusive case. 

We have realised that a robust Navier-Stokes solver is necessary for the project compared to the present solver so our next task is to get that in place and then move ahead with the coupling of the two equations.

Cheers!

Up Next: Navier-Strokes Eq. Solver

Python Software Foundation - SfePy : GSoC 2013 : Week 1



Hello Pythonistas,

I am Ankit and this week I kickstarted my GSoC 2013 Project - Enhancing the solver to simulate solid-liquid phase change phenomenon in convective-diffusive situations. I am a dual-degree undergrad pursuing my masters in phase-change material simulation.


Previously I had worked on the post processor of Abaqus, a commercial software, in my internship and always dreamed of working on a solver. Surely it was an honour when I was given a chance to work on SfePy as my GSoC project.

This project is pursued under :



"Briefly, SfePy is a software for solving systems of coupled partial differential equations (PDEs) by the finite element method in 2D and 3D. It can be viewed both as black-box PDE solver, and as a Python package which can be used for building custom applications. The word 'simple' means that complex FEM problems can be coded very easily and rapidly."

This week ended with:
  • Finalizing the weak form of the equations to be implemented.
  • Tinkering with the examples and code-base to know the entire architecture which is very modular and powerful.
I realised that lots of challenges are awaiting ahead, but the interesting part is that SfePy falls under the umbrella organisation - Python Software Foundation 

And you know I Love Python!

So the adventure has already begun ... 

Up Next: Energy Equation Implemented