- **OpenFOAM Programming & Development**
(*http://www.cfd-online.com/Forums/openfoam-programming-development/*)

- - **starting off with OpenFOAM**
(*http://www.cfd-online.com/Forums/openfoam-programming-development/84707-starting-off-openfoam.html*)

starting off with OpenFOAMHI GUYS
I am a new user of OpenFOAM and would like to solve an unsteady energy equation for a compressible gas through a porous media. I have basic knowledge of C++ prograqming, please help. thanx in advance |

Hi semaviso,
have a look into the rhoReactingFoam application to see how its done there. This is the general way to go. Look whether theres something you need. Best Kathrin |

thanx Kathrin
I checked it out and now I want to understand the meaning of: 00008 volScalarField rUA = 1.0/UEqn.A(); 00009 U = rUA*UEqn.H(); from rhoReactingFoam/pEqn.H How can I write Darcy's formula (U_gas = (-permK/mu)*grad(p) ) U_gas being the gas flux or velocity in m/s in OpenFOAM to use with the mass transport equation. thanx again for your help.:) |

1. Question
This is part of the pressure velocity coupling see: http://powerlab.fsb.hr/ped/kturbo/Op...jeJasakPhD.pdf for details. What is done: UEqn.A() gives you the central coefficient of the the fvMatrix (fv=finiteVolume) UEqn. UEqn.H() gives you the H operator which is basically H(UEqn)=source(UEqn)-diagonal(UEqn)U in that way the velocity is evaluated by U = rUA*UEqn.H(); ok? 2. Question I'm not really sure what your trying to do. Can you specify a little? Do you want to use your U_gas in the continuity equation? Why? Best Kathrin |

Hi semaviso!
There are several way to solve your problem: - either your add a source term in an existing momentum equation (for example rhoReactingFoam as suggested by Kathrin, or may be rhoPisoFoam will be easier to begin) : Code:
` fvVectorMatrix UEqn` Code:
`solve` Regards, Cyp |

Maybe you want to have a look into rhoPorousFoam. I never worked with it. But it sounds promising.
Best Kathrin |

thanx guys it worked.
another question is, how do I add a source term to an energy balance equation if the source term is as follows: [deltaH - T(Cp_ss - Cp_s)] deltaH : Heart of reaction Cp_ss : saturated solid (porous media) heat capacity Cp_s : solid (porous media) heat capacity |

Which variable are you solving for in your energy equation T or h?
Best Kathrin |

Hi Kathrin
I want "T" but I had used the energy equation with "h". since h = Cp*T. thanx in advance |

could you post the equation you have?
Do you reconstruct the Temperature from the energy? Best Kathrin |

the equation is from http://onlinelibrary.wiley.com/doi/10.1002/er.919/pdf
equation 1 of this publication. I have decided to use h becouse i found a lot of hEqn.H file that I think have something almost similar to this equation. |

Hi semaviso!
You should try something like that: Code:
`fvm::ddt(rho*Cpg,T)` Code:
`surfaceScalarField phi = rho*Cpg*linearInterpolate(U)&mesh.Sf();` Code:
`surfaceScalarField phi = fvc::interpolate(rho)*fvc::interpolate(Cpg)*linearInterpolate(U)&mesh.Sf();` Cyp |

thank you a lot,
I have been tryin to modify the porousExplicitSourceReactingParcelFoam to solve for a compressible gas inside a porous reactor. Regards, SBU |

All times are GMT -4. The time now is 18:29. |