Stagnation flow

149 views
Skip to first unread message

Vikram

unread,
Jan 29, 2013, 3:00:41 PM1/29/13
to canter...@googlegroups.com
Dear Cantera users, I am trying to solve a stagnation flow problem using the file StagnationFlow.py (cantera/interfaces/python/Cantera/OneD/), I want to make a few changes to the equations being solved in this file, where I do make these changes?. So far, I figured out the corresponding cpp file is StFlow.cpp (cantera/src/oneD), am I right?

Thanks in advance,
Vikram.

Ray Speth

unread,
Jan 30, 2013, 2:55:55 PM1/30/13
to canter...@googlegroups.com
Hi Vikram,

Yes, the StFlow::eval method in StFlow.cpp is what you should be looking at. Depending on what your goal is, I would suggest either (a) creating a new class derived from StFlow that overrides the eval method with your new equations or (b) modifying the implementation of StFlow::eval. I would avoid (b) unless the modifications you are introducing reduce to the original equations for some choice of parameters. 

If you choose to create a new class or need to introduce additional functions to set parameter values, you will probably find it easiest to work directly with the C++ interface. You could also expose any new functions via the new Cython package without too much difficulty, assuming a little bit of experience with Cython. However, if you want to use any new functionality from the old Python interface or Matlab, you're looking at a fairly significant effort requiring fairly extensive knowledge of the C APIs for those packages.

Regards,
Ray

Vikram

unread,
Jan 31, 2013, 6:37:39 PM1/31/13
to canter...@googlegroups.com
Dr. Ray, thank you very much for your reply, actually, I am trying to add angular momentum equation to the set of equations. What would you suggest in this context?

Thanks,
Vikram


On Tuesday, January 29, 2013 3:00:41 PM UTC-5, Vikram wrote:

Ray Speth

unread,
Feb 1, 2013, 3:11:52 PM2/1/13
to canter...@googlegroups.com
Vikram,

I think there are tradeoffs to both approaches in this case.

Given that your system reduces to the currently implemented case when the tangential velocity is zero, you could implement this by adding a new set of equations to the existing system of equations. The extra effort required to solve this equation in the degenerate case is probably not that large, and so wouldn't have that much impact on the cases where the angular momentum term isn't needed.

On the other hand, you could guarantee that the current case is unaffected by doing your implementation in a separate derived class, but this might be a little more difficult to implement cleanly.

In either case, you will also need to make modifications to some of the classes derived from Inlet1D, e.g. to account for the angular momentum of the incoming flow. Also, just from looking at the code, I see a number of places where there are some assumptions made about the number of variables that need to be solved for at each grid point (currently 4 + number of species). It will take a bit of careful work to eliminate that assumption so that different subclasses of StFlow can work with different numbers of independent variables.

If you're able to get this working on the C++ and wanted to get it incorporated back into Cantera, I'd be willing to get it integrated with at least the  Cython interface. I know this question about rotating flows has come up before, so there are other users who would be interested in this capability as well.

Regards,
Ray

Vikram

unread,
Feb 4, 2013, 10:52:55 AM2/4/13
to canter...@googlegroups.com
Dr. Ray, thank you, I will let you know if I make any progress.


On Tuesday, January 29, 2013 3:00:41 PM UTC-5, Vikram wrote:
Reply all
Reply to author
Forward
0 new messages