CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

rhoCentralFoam transport equation

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree14Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 6, 2012, 14:50
Default rhoCentralFoam transport equation
  #1
New Member
 
João Duarte Miranda
Join Date: Jan 2012
Posts: 13
Rep Power: 14
JoaoDMiranda is on a distinguished road
Hello everybody,

I am trying to put a new transport equation to see the mixture of flow (non-reactive) in rhoCentralFoam. I found a very simple model, http://openfoamwiki.net/index.php/Ho...sport_equation, but this does not work for rhoCentralFoam.

Has anyone implemented a transport equation for the purpouse of mixture in rhoCentralFoam?
Can you give me some advice on how to do it?

Thanks in advance for your help.

João
febriyan91 likes this.
JoaoDMiranda is offline   Reply With Quote

Old   December 7, 2012, 05:39
Default
  #2
Member
 
Join Date: Mar 2012
Location: Munich, Germany
Posts: 67
Rep Power: 14
treima is on a distinguished road
Hello,

I didn´t add a equation for mixture in rhoCentralFoam, but I´ve worked with this solver for some time.

In rhoCentralFoam you need a special discretisation of the equation, not the "simple one" which is described in the wiki. You can have a look at the paper form Greenshield, Weller, Gasparini and Reese,
"Implementation of semi-discrete, non-staggered central schemes in a colocated, polyhedral, finite volume framework, for high-speed viscous flows".
Perhaps this helps you. The discretisation is based on an upwind sheme form Kurganov, Noelle and Petrova.


regards

treima
treima is offline   Reply With Quote

Old   December 7, 2012, 11:01
Default
  #3
New Member
 
João Duarte Miranda
Join Date: Jan 2012
Posts: 13
Rep Power: 14
JoaoDMiranda is on a distinguished road
Thanks a lot! I will look into it!
JoaoDMiranda is offline   Reply With Quote

Old   December 5, 2013, 20:28
Default
  #4
New Member
 
Bryan Schmidt
Join Date: Sep 2013
Posts: 18
Rep Power: 12
Bryan S is on a distinguished road
Did you figure out a discretization of the transport equation that works with rhoCentralFoam? I'm trying to do the same thing. Thanks.
Bryan S is offline   Reply With Quote

Old   December 6, 2013, 08:03
Default
  #5
Member
 
Join Date: Nov 2012
Posts: 83
Rep Power: 13
Henning86 is on a distinguished road
i solved the problem for version 2.1.1 but it wont work on the new version.


i justed link the psireactionthermo libary in rhoCentralFoam. (see rhoreactionfoam for details)

this should be pretty easy in v2.2.x
Henning86 is offline   Reply With Quote

Old   December 6, 2013, 08:36
Default
  #6
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
Hi Henning,
I before added a transport equation to rhoCentralFoam that worked well but not a mixture one,could you tell us what equation you used and how?could you put the equation in this thread? that could be very helpful to OpenFOAMers.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   December 6, 2013, 10:59
Default
  #7
Member
 
Join Date: Nov 2012
Posts: 83
Rep Power: 13
Henning86 is on a distinguished road
This Implementation should work for v2.2.2 it was easier than i tought

in version 2.1.1 you have to create an new class
Attached Files
File Type: zip forwardStepReaction.zip (12.4 KB, 211 views)
File Type: zip rhoCentralReactionFoam.zip (33.9 KB, 359 views)
Henning86 is offline   Reply With Quote

Old   December 6, 2013, 14:42
Default
  #8
New Member
 
Bryan Schmidt
Join Date: Sep 2013
Posts: 18
Rep Power: 12
Bryan S is on a distinguished road
Thank you Henning, those are very helpful! I notice that the mass fraction of species 2 in the forward step case is greater than 1 in some places in the domain. Do you know the cause of this issue and if it can be fixed? Thanks!
-B
Bryan S is offline   Reply With Quote

Old   December 6, 2013, 18:53
Default
  #9
New Member
 
Bryan Schmidt
Join Date: Sep 2013
Posts: 18
Rep Power: 12
Bryan S is on a distinguished road
Actually never mind. I'm an experimentalist so I didn't realize that this can happen with linear equations like the scalar transport equation in certain numerical schemes. I had a colleague explain it to me and it all makes sense now. Thanks for your help!
-B
Bryan S is offline   Reply With Quote

Old   December 6, 2013, 19:02
Default
  #10
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
Henning,

Your Yeqn.H implementation is missing the central upwind scheme, you're going to notice some strange behavior in your solutions as a result. I've been using the following yeqn which works quite well (you're going to have to change the diffusion coefficient bits back to Schmidt number as this is developed for laminar diffusion problems.)

It's a bit of a mess as I've just finished developing it to fit my purposes and cut a good chunk of that stuff out before posting it... I haven't had time to clean it up as well, as a result there's some spurious comments that should be deleted/ignored. Credit for the original upwind scheme implementation to the yeqn should go to tatu, who provided it to me.
Attached Files
File Type: h YEqnNoEnth.H (2.5 KB, 280 views)

Last edited by ChrisA; December 7, 2013 at 01:49.
ChrisA is offline   Reply With Quote

Old   December 6, 2013, 19:09
Default
  #11
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
Quote:
Originally Posted by Bryan S View Post
Thank you Henning, those are very helpful! I notice that the mass fraction of species 2 in the forward step case is greater than 1 in some places in the domain. Do you know the cause of this issue and if it can be fixed? Thanks!
-B
This is an issue with the method being used. Mass conservation isn't satisfied with the way the Y equation is written. There are a couple solutions to this which are available in many combustion textbooks but the approach reactingfoam takes is to use an inert species, N2 for example, and have any errors be absorbed by that. This is done in the following lines:

Code:
     
Yt += Yi; (inside the loop species loop)

Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].max(0.0);
Basically you force conservation by taking Yinert = 1 - all other species, the error is then "absorbed" (mostly) by the inert species concentration. This is applicable for certain situations, others you will need to implement a proper transport equation formulation that satisfies mass conservation without this trick.
febriyan91 likes this.
ChrisA is offline   Reply With Quote

Old   December 6, 2013, 20:59
Default
  #12
New Member
 
Bryan Schmidt
Join Date: Sep 2013
Posts: 18
Rep Power: 12
Bryan S is on a distinguished road
Thanks Chris, I was wondering about that since the previous code submitted used the same discretization I was trying before with no success.

Could you please post a .zip file with all the files required for your solver? I am very interested in using it. I tried simply inserting your .H file into Henning's solver directory and recompiling, but your file includes a DijEqn.H file that I don't have. Thanks!
-B
Bryan S is offline   Reply With Quote

Old   December 6, 2013, 22:16
Default
  #13
New Member
 
Bryan Schmidt
Join Date: Sep 2013
Posts: 18
Rep Power: 12
Bryan S is on a distinguished road
Another issue that comes up with this is that I'd like to use a thermotype with hePsiThermo, multiComponentMixture, sutherlandTransport, hConstThermo, perfectGas, specie, and sensibleEnthalpy. This isn't one of the default supported options and there is a thread somewhere about how to create a new set of options and link that library to the solver, but I'm not clear on how to link libraries and compile a new thermo model etc. because as I mentioned I'm an experimentalist so I'm new to C++ and don't really know how to do this sort of thing.

Do any of you know of a nice set of step-by-step instructions for creating and compiling my own thermo model and then linking it to my solver? Thanks!
-B
Bryan S is offline   Reply With Quote

Old   December 7, 2013, 02:02
Default
  #14
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
Quote:
Originally Posted by Bryan S View Post
Thanks Chris, I was wondering about that since the previous code submitted used the same discretization I was trying before with no success.

Could you please post a .zip file with all the files required for your solver? I am very interested in using it. I tried simply inserting your .H file into Henning's solver directory and recompiling, but your file includes a DijEqn.H file that I don't have. Thanks!
-B
Ah, yes, Dijeqn.h was for calculating the laminar binary diffusion coefficient for a case I was running with binary laminar diffusion, not terribly interesting and not really ready for any sort of public viewing. Also, my full solver will likely be much more of a hindrance than a help in its current form, its very much coded for a niche situation currently.

I changed the original file I uploaded to use the standard turbulent Schmidt number formulation. That should work when combined with the other files hennings provided... I think, completely untested though (Sorry I haven't been able to go through it more thoroughly, busy busy)
ChrisA is offline   Reply With Quote

Old   December 9, 2013, 13:16
Default
  #15
New Member
 
Bryan Schmidt
Join Date: Sep 2013
Posts: 18
Rep Power: 12
Bryan S is on a distinguished road
Quote:
Originally Posted by ChrisA View Post
I changed the original file I uploaded to use the standard turbulent Schmidt number formulation. That should work when combined with the other files hennings provided... I think, completely untested though
It almost works with Henning's files, I think you must be calling some functions that aren't linked in the Make/options file or something. When I try to wmake I get the following errors:

Quote:
In file included from rhoCentralReactionFoam.C:247:0:
YEqn.H: In function â:
YEqn.H:9:9: error: â was not declared in this scope
YEqn.H:24:29: error: â was not declared in this scope
YEqn.H:26:35: error: â was not declared in this scope
YEqn.H:62:16: error: â was not declared in this scope
I'm not really sure what those mean, I tried looking at that file using a couple different editors but I can't figure out what function or functions it's talking about and if I knew I don't know how to fix the problem. Any advice? Thanks,
-B
Bryan S is offline   Reply With Quote

Old   December 9, 2013, 13:29
Default
  #16
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
That's and interesting and slightly uninformative error message that i've never seen before... not sure why it's not giving you actual functions and variable names. Anyway, based on the lines it trips up at it's missing a few declarations related to the multispecies bits. I took a quick look at henning's createFields.H, it looks like you're missing the following lines of code:

Code:
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;

forAll(Y, i)
{
    fields.add(Y[i]);
}
That should do it. Probably wouldn't have been an issue had I given you all my files but we can file this one under teach a man to fish and whatnot

Also, you can look at at reactingfoam and see what files it has linked, what initial headers are included at the top of the code and any general yeqn code differences. That's what the yeqn is based on with the addition of the central-upwind scheme so any additional headers and linked libraries that are required can be found there.
ChrisA is offline   Reply With Quote

Old   December 9, 2013, 14:09
Default
  #17
New Member
 
Bryan Schmidt
Join Date: Sep 2013
Posts: 18
Rep Power: 12
Bryan S is on a distinguished road
Thanks Chris, both tips were very helpful. The error message is frustratingly vague, and it turns out it's referring to several different undeclared functions but calling them all â. So that's fun. I've fixed a couple of them by adding lines to createFields.H based on what I saw in rhoReactingFoam.

I've gone down from 4 errors to 2, and they may be coming from the same thing. I'm pretty sure it involves the variable rhoY in YEqn.H, which I assume is a volScalarField that is just rho*Y. I tried declaring it like this:
Quote:
volScalarField rhoY
(
IOobject
(
"rhoY",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
rho*Y
);
but I get an error that says "invalid initialization of reference of type â from expression of type â" which I assume means that rhoY is supposed to be a list with 2 elements and I'm treating it like a single scalar value. How do I declare it properly? Thanks!
-B
Bryan S is offline   Reply With Quote

Old   December 9, 2013, 14:16
Default
  #18
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
Yeah, somethings wrong with your compiler's error messages, I've never ever seen that happen; and I've seen my fair share of errors :P.

So, the error here comes in because Y is a list (or a list of pointers? this is where my knowledge gets vague) containing mass fraction information for each individual species Y[i]. So Y is sort of a 4D array if you want to think of it like that, its a list of all the 3D arrays of species mass fraction. Anyway, rhoY needs to be a list as well, containing rho*Y[i], the following is the proper declaration for createFields.H:

Code:
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;

forAll (Y, i)
{
    fields.add(Y[i]);
}
PtrList<volScalarField> rhoY(Y.size());
forAll (Y, i)
{
         rhoY.set
         (
             i,
             new volScalarField
             (
                 IOobject
                 (
                     "rhoYi",
                     runTime.timeName(),
		     mesh,
                     IOobject::NO_READ,
                     IOobject::NO_WRITE
                 ),
                 rho*Y[i]
             )
         );
    	 fields.add(Y[i]);
}
Pretty sure the fields.add(Y[i]) is redundant but... yeah.. :P. Sorry for forgetting that part, that's what I get for not looking at my own code to fix your issue. But, now you know how to add lists of other things which comes in very handy when dealing with multispecies things!
caizun1989 and greguy06 like this.
ChrisA is offline   Reply With Quote

Old   December 9, 2013, 14:49
Default
  #19
New Member
 
Bryan Schmidt
Join Date: Sep 2013
Posts: 18
Rep Power: 12
Bryan S is on a distinguished road
Thanks Chris, that fixed it. Turns out the last error is independent from that one, it comes from using "reaction" in YEqn.H, which isn't declared in Henning's createFields.H file. I tried copying the lines from rhoReactingFoam and reactingFoam's createFields.H files, neither seems to work. I also made sure to include the necessary libraries and files in my Make/options file, but that's not helping. I realize I could just take the reactions bit out of the equation YEqn.H because I don't have a source term for the application I have in mind, but it might be nice to have that utility later on.

What do the first few lines of your createFields file look like? At the moment I have
Quote:
autoPtr<combustionModels::rhoCombustionModel> reaction
(
combustionModels::rhoCombustionModel::New(mesh)
);

rhoReactionThermo& thermo = reaction->thermo();
thermo.validate(args.executable(), "h", "e");
My Make/options file includes both -I$(LIB_SRC)/combustionModels/lnInclude and -lcombustionModels

Thanks,
-B
Bryan S is offline   Reply With Quote

Old   December 9, 2013, 14:58
Default
  #20
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
The first few lines are as follows:

Code:
autoPtr<combustionModels::psiCombustionModel> reaction
(
    combustionModels::psiCombustionModel::New(mesh)
);

psiReactionThermo& thermo = reaction->thermo();
thermo.validate(args.executable(), "h", "e");
basicMultiComponentMixture& composition = thermo.composition();
Which is similar to yours, just with psi combustion model instead of rho, it should work, I'm not sure why it isn't picking up on reaction being declared, it looks to be done correctly.
ChrisA is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Solving Transport equation for additional variable using CFX creddy_trddc CFX 11 April 2, 2015 22:07
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 07:27
error message cuteapathy CFX 14 March 20, 2012 07:45
UDF Transport equation for transition momentum thickness Reynolds number Wantami FLUENT 0 April 9, 2011 03:50
Is it possible to use divergence in the source term of an scalar transport equation? jannnesss CFX 0 January 8, 2010 20:53


All times are GMT -4. The time now is 02:39.