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

Including Enthalpy Transport

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 15, 2013, 20:42
Default Including Enthalpy Transport
  #1
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
This is looking a bit hard to comprehend without proper symbols but I've done my best to make it clear...

I'm trying to include an enthalpy transport term in my solver with binary diffusion, that term being:

divergence(sum_over_all_species(enthalpy_species_i * diffusion_mass_flux_species_i))

diffusion mass flux for species i is defined as :

rho * binary_diffusion_coefficient * gradient(species_concentration_i)

what I've done so far to try to implement this is store the enthalpy of each chemical species into fields then sum the laplacian that arrises from combining the top two things:

sum_over_all_species( laplacian ( rho*binary_diffusion_coefficient*enthalpy_specise_ i, species_concentration_i))

this compiles fine but when I try to solve I get an error that OF cannot sum over two different species concentration fields:

--> FOAM FATAL ERROR:
incompatible fields for operation
[N2] += [Kr]

From function checkMethod(const fvMatrix<Type>&, const fvMatrix<Type>&)
in file /opt/openfoam211/src/finiteVolume/lnInclude/fvMatrix.C at line 1303.

FOAM aborting

Is there anyway around this? I tried using mag(Yi) in my laplacian but that throws a different error. Some way to remove the species tag when I take the laplacian?
ChrisA is offline   Reply With Quote

Old   February 16, 2013, 13:00
Default
  #2
Senior Member
 
mkraposhin's Avatar
 
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21
mkraposhin is on a distinguished road
Can you post mathematical formulation in a) differential form, b) integral form and c) numerical integral form?
mkraposhin is offline   Reply With Quote

Old   February 19, 2013, 12:59
Default
  #3
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
The term I'm trying to implement is somewhat from the fluent user manual:

https://www.sharcnet.ca/Software/Flu...th/node128.htm

neglecting the thermal diffusion effects. The enthalpy transport term I'm trying to include in the energy equation is:

Enthalpytrans.PNG

where Ji is the mass flux of species i given by:

Massflux.PNG

Where:
hi is the enthalpy of species i
Di,m is the diffusion coefficient of species i in the mixture
rho is the density
Yi is the mass fraction of species i

I should note that the base energy equation I'm adding this to is essentially the rhoCentralFoam energy equation (re-written for sensible enthalpy of course) and reactingFoam's species equation with the relevant diffusion coefficient modeling implemented.

I can solve for each value of the summation fine, as mentioned above, but when I try to sum the resulting laplacians (if you substitute Ji into the top equation) I get the error mentioned.
ChrisA is offline   Reply With Quote

Old   February 20, 2013, 13:58
Default
  #4
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
I was able to get it to solve by commenting out the relevant check method... (not exactly the proper way to do it) but I'm getting some interesting behavior at the boundaries. At any boundary with a uniform species concentration equal to 1 (not sure if its specific to 1, probably not) the enthalpy field drops to zero. If it's in a small region, the simulation is able to recover and the enthalpy field returns to normal. At least I think it does, I don't have a simulation run to steady state yet but when I last looked at it the region in question was returning to normal.

A zeroGradient boundary condition does not exhibit this behavior, it seems to be unique to the uniform boundary condition. This seems odd because the gradient of the species concentration should be/is zero for a uniform boundary condition and so the enthalpy transport term should also drop to zero.

It would seem that the issue is that the enthalpy transport term for the boundary during the first (few?) time steps is roughly equal to the negative total enthalpy on the boundary for a uniform boundary condition. I think it might be due to the 2nd derivative of species concentration not being available for the first timestep? Does anyone else have any theories to why I'm seeing this behavior and/or a way around it in case I end up with a simulation where it can't recover.

My implementation is the following:

outside of my species equation loop I find the inertIndex (index of the inert species) then initialize a temporary fvscalarmatrix:

tmp<fvScalarMatrix> hsJ(fvm::laplacian(-rho*Dij*hs*Y[inertIndex],Y[inertIndex])

then inside my species equation loop, under the if(Y[i].label != inertSpecies) I sum the other species terms

hsJ() += fvc::laplacian(-rho*Dij*hs*Y[i],Y[i])

The hsJ term is then added to the enthalpy corrector equation in the main code.

I don't have access to my code at the time of writing so this is from memory, I'll post my Yeqn.h at my next opportunity.
ChrisA is offline   Reply With Quote

Old   February 20, 2013, 14:05
Default
  #5
Senior Member
 
mkraposhin's Avatar
 
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21
mkraposhin is on a distinguished road
You have error in dimensions, but i can't find it still, i need some time to switch to your case
mkraposhin is offline   Reply With Quote

Old   February 20, 2013, 14:55
Default
  #6
Member
 
Chris
Join Date: Aug 2012
Location: Calgary, Alberta, Canada
Posts: 77
Rep Power: 13
ChrisA is on a distinguished road
Thanks for taking a look at the issue.

If it helps, the only dimensions I specified are for the diffusion coefficient when I initialized the field, actually its rho*Dij initialized as rhoDij, with the following dimensions:

dimensionedScalar("rhoDij", dimensionSet(1,-1,-1,0,0), 0.0)

which should be consistent with rho (kg/m^3) multiplied by D (m^2/s). The rest are defaults from the original code.

Although, given the error, and the section of the checkMethod function it seems like physical dimensions are not the issue, it's looking at the psi fields:

if (&fvm1.psi() != &fvm2.psi())

what does fvm.psi() call?

Edit:

I also think I've figured out the enthalpy dropping to zero issue, I found the solution here:

http://www.cfd-online.com/Forums/ope...larfields.html

looks like I wasn't giving the diffusion coefficient a face value for the boundary condition, leading to incorrect (large) enthalpy transport at the boundary.

Edit2:

I think I shouldn't have been using fvm::laplacian and an fvmatrix for my enthalpy transport term as hs is not the laplacian variable, therefore the enthalpy transport term boils down to a source/sink term for each cell. I have it as a volScalarField with fvc::laplacian solving the terms. Can anyone confirm if this is correct? This is getting into the realm of calculus where my memory is a bit fuzzy.

Last edited by ChrisA; February 20, 2013 at 18:32.
ChrisA is offline   Reply With Quote

Old   June 13, 2016, 06:56
Default
  #7
New Member
 
Wang Wei
Join Date: Apr 2016
Posts: 11
Rep Power: 9
Wang Wei is on a distinguished road
Quote:
Originally Posted by ChrisA View Post
The term I'm trying to implement is somewhat from the fluent user manual:

https://www.sharcnet.ca/Software/Flu...th/node128.htm

neglecting the thermal diffusion effects. The enthalpy transport term I'm trying to include in the energy equation is:

Attachment 19176

where Ji is the mass flux of species i given by:

Attachment 19177

Where:
hi is the enthalpy of species i
Di,m is the diffusion coefficient of species i in the mixture
rho is the density
Yi is the mass fraction of species i

I should note that the base energy equation I'm adding this to is essentially the rhoCentralFoam energy equation (re-written for sensible enthalpy of course) and reactingFoam's species equation with the relevant diffusion coefficient modeling implemented.

I can solve for each value of the summation fine, as mentioned above, but when I try to sum the resulting laplacians (if you substitute Ji into the top equation) I get the error mentioned.
Hi, Chris, I also want to add the enthalpy transport term in energy equation. But I don't know how to get the enthalpy of species i. Can you give me some suggestions?
Wang Wei is offline   Reply With Quote

Old   May 4, 2018, 16:28
Default
  #8
New Member
 
David Sommer
Join Date: Mar 2015
Posts: 2
Rep Power: 0
demsomme is on a distinguished road
Quote:
Originally Posted by Wang Wei View Post
Hi, Chris, I also want to add the enthalpy transport term in energy equation. But I don't know how to get the enthalpy of species i. Can you give me some suggestions?
Can you use:
Code:
hk = Yk * thermo.he();
where Yk is the mass fraction of species k and thermo.he() returns the enthalpy field (absolute or sensible depending on your thermo model) ??

I'd be interested in any progress anyone has made on including the enthalpy diffusion term -- I'm also trying to include it.
demsomme is offline   Reply With Quote

Reply


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
Sensible Enthalpy vs. Total enthalpy Sethi OpenFOAM Programming & Development 3 March 23, 2017 21:48
Tcp transport error Adriana FLUENT 1 December 21, 2012 05:31
meaning static enthalpy and total enthalpy mspark Siemens 1 April 1, 2004 06:20
Re: Can I simulate sediment transport with FLUENT li li FLUENT 0 October 21, 2003 20:42
Including heat of reaction in enthalpy John McKelliget FLUENT 0 December 28, 1999 12:20


All times are GMT -4. The time now is 12:08.