Getting started with Fluent (6.3) batch files

If you have to do any serious amount of CFD work with Fluent you will probably do a lot of repetitious stuff, especially so in parametric studies with Fluent. E.g. if you have to simulate a flow and get the results for each of the turbulence models (that are available in Fluent) and find out which turbulence model gives better results. Doing this from Fluent GUI repeatedly would be really frustrating, not to mention, time consuming. One way to automate Fluent might be to use the journal files (to record and play back) but the journal files are too fragile. What I mean by that is, it breaks down too easily, like, when one of the models diverges. Then you have to figure out how to continue from there.

Fortunately, to solve these problems, Fluent has a really cool Command Line Interface (CLI). The CLI uses, and is written in a dialect of Lisp called Scheme. Not familiar with Scheme? Don’t sweat it. CLI is simple and inCLItive enough to grok quickly. You can run the CLI commands by opening Fluent and typing them at the command prompt or you can create a script/batch file containing all the CLI commands and run it for repetitive tasks. All right, enough talk, let’s see some examples.

Let’s start by reading a case file into fluent using CLI.

/file/read-case example.cas ‘reads the case file named example.cas

Want to read a case and the associated data file? No problem.

/file/read-case-data example.cas ‘reads example.cas and example.dat

While the above commands work perfectly fine, fluent has a really smart pattern matching in CLI. i.e you can abbreviate the CLI commands and Fluent will try to understand it based on pattern matching, which will be clear in a minute.

/file/rc example.cas
/file/rcd example.cas

Or, taking it further,
rc example.cas
rcd example.cas

To change the turbulence model to RSM
/define/models/viscous/reynolds-stress-model yes
Or, just,
/def/mod/vis/rsm y

Note that the yes (or y) is an argument for the /def/mod/vis/rsm command, to confirm the enabling of the RSM model. In CLI, each command might have zero, one or multiple command arguments. The arguments might need to be numbers or character strings or Boolean or a list of values. More on this later.

To enable enhanced wall treatment,
/define/models/viscous/near-wall-treatment/enhance-wall-treatment yes
Or, just,
/def/mod/vis/nwt/ewt y
All right, I’ll stop beating the abbreviation hammer now.
To run a 1000 iterations,
/solve/iterate 1000

As you can see from the above examples, the CLI command should be very inCLItive from the way you’d accomplish the same task through the menu bar in the GUI. And you don’t have to remember all these commands and their arguments. You can just explore it by firing up fluent GUI and pressing enter at the command prompt. The character ‘>’ is the command prompt in Fluent GUI. You can see how one could find the command to set the turbulence model in the figure below.


Now that you got your feet wet, let’s see a complete batch file that can be used to run a case file (init.cas in this example) with various turbulence models.
*************************batch.jou******************************
/file/rc init.cas
/solve/initialize/compute-defaults/velocity-inlet inlet
/solve/initialize/initialize-flow
/solve/iterate 5000
/plot/plot yes "Nu1-ske-ewt.xy" yes no no nusselt no no x-over-w bot_wall_1 bot_wall_2 ()
/file/wcd flatplate1-ske-ewt.cas

/define/model/viscous/ke-rng y
/solve/iterate 5000
/plot/plot yes "Nu1-rngke-ewt.xy" yes no no nusselt no no x-over-w bot_wall_1 bot_wall_2 ()
/file/wcd flatplate1-rngke-ewt.cas

/define/model/viscous/ke-realizable y
/solve/iterate 5000
/plot/plot yes "Nu1-realke-ewt.xy" yes no no nusselt no no x-over-w bot_wall_1 bot_wall_2 ()
/file/wcd flatplate1-realke-ewt.cas

/define/model/viscous/kw-standard y
/define/model/viscous/kw-shear-correction y
/solve/iterate 5000
/plot/plot yes "Nu1-skw-sfc.xy" yes no no nusselt no no x-over-w bot_wall_1 bot_wall_2 ()
/file/wcd flatplate1-skw-sfc.cas

/define/model/viscous/kw-sst y
/solve/iterate 5000
/plot/plot yes "Nu1-sst.xy" yes no no nusselt no no x-over-w bot_wall_1 bot_wall_2 ()
/file/wcd flatplate1-sstkw.cas

/define/model/viscous/rsm y
/define/model/viscous/rsmlps y
/define/model/viscous/rsm-solve-tke y
/define/model/viscous/rsm-wall-echo y
/define/model/viscous/nwt/ewt y
/solve/iterate 5000
/plot/plot yes "Nu1-lpsRSM-ewt.xy" yes no no nusselt no no x-over-w bot_wall_1 bot_wall_2 ()
/file/wcd flatplate1-lpsRSM-ewt.cas

/define/model/viscous/rsm-omega-based y
/solve/iterate 5000
/plot/plot yes "Nu1-lrso-sfc.xy" yes no no nusselt no no x-over-w bot_wall_1 bot_wall_2 ()
/file/wcd flatplate1-lrso-sfc.cas
exit

****************************batch.jou******************************
Once you have this file created, you can create a case file init.cas with everything other than turbulence model set. Then all you have to do is run

$ fluent 2d –g -i <batch.jou> output &
$

This will read the init.cas file set the turbulence model, run a few iterations and save the result. This will be repeated for various turbulence models as specified in the batch.jou file.This is only the tip of the iceberg. You can do some funky stuff with the scheme constructs like looping, etc. you can use shell scripting too to generate the fluent batch files. E.g in situations where you want to run all the case files in a specific directory, u can use shell scripting to loop through all the case files in the directory and generate the CLI code for running them in fluent. I’ll try to write another blog post on some advanced scenarios. Hope this helps.

Some football talk

Folks,
The crimson tide has officially hit the rock bottom, by loosing to some obscure college in Louisina. As huge a bama fan as I'm, it's hard not to criticize the players on the offensive side of the football. The defense didn't look good either. Sure, we didn't have two starters on the offensive line, didn't have the running back that can actually escape tackles, but come on, this is Lousiana Monroe, we lost to. I still think saban is one heck of a coach and I believe in the "process". The only silver bullet as of now is that the 2008 class committed to alabama is ranked third in the nation (courtesy, http://www.rivals.com).
Speaking of football, this college football season has been totally crazy. I can't remember a saturday in this football season without a major upset game somewhere in the nation. I'm guessing that quite a few coaches will get fired/retired at the end of the season.
anyway, I just had to blog today to get the bama loss out my system.

I turn 25

Folks, I've turned 25 yesterday and the only singnificance of it I can think of is the lower auto insurance rates :-). I'm not a big birthyday celebratin' kinda guy and I don't usually take the time to wish someone on their birthday (say, on orkut). So, I certainly appreciate all the b'day wishes pouring in on my scrapbook. Thanks to all those who did take the time to wish me. It sure made me feel good.

Oh my goodness, gracious. This is gonna be huge!

Scott guthrie just blogged here about releasing .net 3.5 base class libraries' source code , along with the release of visual studio 2008. So, now you can download the symbols from the Microsoft's symbols server and step right into the .NET framework source code while debugging. That means, there will be no more of, "Oh, crap. I don't know what the hell is gridview doing internally". This is gonna be a huge improvement in any .NET developer's life. I commend Microsoft for taking such an initiative.

I can't seem to get this song out of my head

If you've seen the recent Nissan Altima ad on the TV, you gotta wonder what the song was in the background. Well, I did, and turns out the song is called "Pride and Joy" by Stevie Ray Vaughn (SRV). Ever since I first heard that song, I've been playing it all week long. if you are curious, go ahead and play the song below and don't forget to blast your speakers with it.

I won ! I won !!

For the non .NET folks out there, there is a podcast called dotNetRocks which is very popular among the .NET community. I'm a huge fan of this podcast and any one who has been a roommate of mine in the last couple of years know that I listen to something (this podcast) as I go to bed.
Anyway, They have an ongoing contest in which they ask some question and you need to submit the answer on their website. So, last week I just registered on their website and answered a question and guess what, Today in show #273 they announced that I won.
So folks, go to http://www.dotnetrocks.com/default.aspx?showNum=273 and listen around 8:00 mins into the show.
P.S.: You'll also hear a silly little joke on tuscaloosa which you probably never heard of.

SqlDataSource: The bad and the ugly.

Note: If you are not an asp.net developer, this post may not make much sense.
When I was a newbie in asp.net, I actually used sqldatasource control on all my web pages. It didn't take much long for me though, to realize the problems with sqldatasource, which should be obvious to developers with any amount of experience. Sqldatasource control tightly couples the presentation layer with the data access layer. With any changes to your database, you may have to make changes in a number of places. I was like, "what were the Microsoft people thinking, when they created sqldatasource ?".
Anyway, here is a best practice for newbies.

Don't use SqlDataSource. Just don't.

No more Start -> All Programs -> .... for me.

We all know how frustrating it is to click through start->programs->.......to finally launch the program we want. And that's why this nifty little tool called launchy comes in so handy.
All you have to do is press alt+space and u get this little box shaped window in the middle of ur screen.




Now you can just start typing the name of the program you want to launch and launchy will automatically display the relevant programs after a few keystrokes.


e.g.


One of the side benefits of this tool is that now, when I install new programs, I disable creating a shortcut on desktop or on the quick launch. So, my desktop is a lot less cluttered now. Apparently, there are quite a lot of similar tools out there but launchy is open source and written C#. So, as a .NET developer it's an added benefit for me.

The word that irks me

As beautiful as the Telugu language is, it has a word that really irks me.
The word is meeru , equivalent to aap in Hindi or vaguely equivalent to ya'll in English.

The problem for me is, in Telugu, you ought to use meeru even if you are talking to just one person. Supposedly, that's a sign of respect and I fail to understand how talking to one person as if he/she is multiple people is a sign of respect.
If anything, it's a sign of vision problems where you see multiple people in place of one. Or it’s a sign that the person you are talking to is way too fat that you ought to talk to him/her as if it’s multiple people.

Once at a wedding, one guy I just met, asked me something while referring to me as meeru and I immediately said, “How many people are you talking to?”. Needless to say it was a pretty awkward moment.

Fortunately, you don't see that happen in English. You just say 'you’ in English even if you are talking to the American president.

Note: I'm pretty sure this post doesn't make any sense to most people. If it somehow does, I'm also sure, most people would disagree with me, but hey, that's my opinion and it's my blog.

Arrested Development

Arrested Development is one of my favorite comedy tv series of all time. It's about the story of a wealthy family of weirdos and the one son who happens to be normal. For the three seasons the show ran, it has received six emmy awards, one golden globe and a bunch of other awards. The show attained critical acclaim and a cult fan base.

The sad part though is that for some reason, the show failed to attract a large viewership and because of that, Fox network had to pull the plug on the show just after three seasons. As a tribute to the show, I'm doing my part of spreading the word around. You can watch the first two seasons on MSN at http://arresteddevelopment.msn.com/.
I suggest watching the pilot episode on MSN to see if you like it and if you do, trust me, it's worth buying the DVD (ya, ok, it's worth downloading off of torrents).


Disclaimer: I do not encourage or take responsibility for others downloading content illegally through bit torrents based on my blog.

Rupee appreciation: Some ramblings

if you are an NRI, you must have noticed the drastic appreciation of the rupee in the recent months. While it does hurt all the NRIs transferring money to india, I think it may actually be good for the indian economony in the long run.
Let's go through some basics. Rupee appreciation implies that imports will be cheaper and exporters will get less number of rupees for their goods (unless exporters have rupee-based contracts, which is a rare case). so, the exporters' profit margin will diminish. If the rupee appreciates enough, exporters will have two options to remain in business. They can either raise the price of their products, which will likely make them priced out of competition, or squeeze in more efficiency to keep their profit margin. In some situations, exporters won't be able to raise the price at all and so the only way for them to survive is to increase their efficiency.
It is expected that the recent appreciation in rupee will lead to the loss of about 200,000 jobs in india. I still believe that the appreciation is good as it forces the exporting companies to become more efficient. e.g. in the IT industry, companies will be forced to move up the value chain. This is really good because, if we don't move up the value chain, it won't be long before countires like china, russia and philippines, etc. catch up with india in the outsourcing game.
Besides, rupee value should be determined by market forces alone, and keeping it artificially low forever won't do much good. I think the RBI has done a great job of controlling short term volatility yet letting the rupee value move according to the market forces. The key is to let the rupee raise in a slow and consistent fashion.

Joost

Joost is the next killer product from the creators of skype. Joost is basically free TV on the internet. It's not just watching TV though. You also get all the great internet features like, instant messaging, built right into the app. So, I can see myself watching a football game on joost while chatting with friends about specific plays. Joost is currently invitation-only and has a limited tv content. I don't have access to joost yet, but I'm really looking forward to trying it.

Joost will, similar to skype, work on a p2p network. That means, the more people use joost, the faster will be the tv stream that you can get. if you are interested to know more about how it works, watch this video from the joost's own network architect.

P.S. : If anyone has a spare joost invitation, please send me one.

Woo Hoo!

I finally entered the blogosphere. Although, the enthusiasm died down quickly after trying to figure out what to write on my blog. A lot of topics come to mind but I don't know if they are good (or generic) enough for most of my friends. Hopefully I will come up with a real first blog post soon.