|
[Sponsors] |
January 6, 2016, 03:20 |
Add a source term to UEqn.H
|
#1 |
Member
Join Date: Jul 2015
Posts: 33
Rep Power: 11 |
Dear Sir,
I'm trying to add a source term to the UEqn.H, which is named "ASm". ASm = C * ∂q/∂t, which is a tensol and is calculated in advance (C is a constant coefficient). Then, I want to add ASm * U as a source term, but it is a product of tensol and vector. What should I describe this product to the UEqn.H source code? I checked "DarcyForchheimer", which also calculate a product of a tensol and U, but I don't understand how to do. Could you advise me, please. KeiJun |
|
January 7, 2016, 20:13 |
|
#2 |
Member
Join Date: Jul 2015
Posts: 33
Rep Power: 11 |
Dear Sir,
I keep trying making my solver, but cannot compile. I want to add a new source term to UEqn.H, which is ASm * U. ASm is C * ∂q/∂t, in which C is a constant (scalar) and ∂q/∂t is calculate by another equation (in qEqn.H) in advance. q is the reaction amount per catalyst weight (the unit is mol/kg), so ∂q/∂t is the reaction rate. Then, is the type of calculated ∂q/∂t fvScalarMatrix? If so, is the type of ASm also fvScalarMatrix? And then, is the type of new source term I want to add, ASm * U, defined as volVectorField? (which is inner product of fvScalarMatrix and volVectorField, and described as ASm & U.) When I compile this solver, the error message: no match for 'operator&' (operand types are 'Foam::fvScalarMatrix {aka ~}' and 'Foam::volVecorField {aka ~}') has come. I have no idea why this error occurs. Could you advise me how to descibe this new source term. I am really looking forward to your reply. Sincerely, KeiJun |
|
January 8, 2016, 09:06 |
|
#3 |
Senior Member
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21 |
Hi,
when you are adding source term to any equation, you must decid on how this term will be discretized: in explicit or implicit way? If you want to discretize you source in explicit way, then you must create volVectorField for UEqn, with dimensions equal to density*acceleration: Code:
solve ( fvm::ddt(rho,U) + fvm::div(phi,U) == SourceU ); If you know, that your source field depends on velocity and you can write it like next expression: SourceU = C*U, then you can discretize source in implicit way: Code:
solve ( fvm::ddt(rho,U) + fvm::div(phi,U) == fvm::Sp(C,U) ); operator fvm::Sp(C,U) will return fvVectorMatrix. It is a good practice to be sure that C field is negative in implicit formulation Next, if you know that field C can be positive, then it means that it's values will be subtracted from the diagonal, and this will lead to ill-conditioned matrix. Then, you can make semi-implicit formulation, which switches betweeb implicit/explicit depending on sign of C: Code:
solve ( fvm::ddt(rho,U) + fvm::div(phi,U) + fvm::SuSp(-C,U) );
__________________
MDPI Fluids (Q2) special issue for OSS software: https://www.mdpi.com/journal/fluids/..._modelling_OSS GitHub: https://github.com/unicfdlab Linkedin: https://linkedin.com/in/matvey-kraposhin-413869163 RG: https://www.researchgate.net/profile/Matvey_Kraposhin |
|
November 5, 2021, 19:48 |
|
#4 |
Member
Join Date: Feb 2020
Posts: 90
Rep Power: 6 |
Hi,
Sorry is this is too basic, but is the there any difference if the explicit/ or any of the other sources is made as: Code:
solve ( fvm::ddt(rho,U) + fvm::div(phi,U) - SourceU ); instead of Code:
solve ( fvm::ddt(rho,U) + fvm::div(phi,U) == SourceU ); |
|
November 6, 2021, 10:17 |
|
#5 |
Senior Member
Matvey Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 355
Rep Power: 21 |
Yes '==' is just an alias to '-'
__________________
MDPI Fluids (Q2) special issue for OSS software: https://www.mdpi.com/journal/fluids/..._modelling_OSS GitHub: https://github.com/unicfdlab Linkedin: https://linkedin.com/in/matvey-kraposhin-413869163 RG: https://www.researchgate.net/profile/Matvey_Kraposhin |
|
July 3, 2022, 15:45 |
|
#6 | |
Member
Uttam
Join Date: May 2020
Location: Southampton, United Kingdom
Posts: 35
Rep Power: 6 |
Quote:
__________________
Best Regards Uttam ----------------------------------------------------------------- “When everything seem to be going against you, remember that the airplane takes off against the wind, not with it.” – Henry Ford. |
||
December 3, 2022, 00:55 |
|
#7 |
New Member
shouvik ghorui
Join Date: Oct 2019
Posts: 15
Rep Power: 7 |
Hi,
How to hendle if the source term is (gammaPsi)*grad(C), where equation is fvm::ddt(C) +fvm::div(phiup,C) -fvm::laplacian(gammaPsi,C) Thanks |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] How to use finite area method in official OpenFOAM 2.2.0? | Detian Liu | OpenFOAM Meshing & Mesh Conversion | 4 | November 3, 2015 04:04 |
[foam-extend.org] problem when installing foam-extend-1.6 | Thomas pan | OpenFOAM Installation | 7 | September 9, 2015 22:53 |
add source term in energy equation | chaolian | OpenFOAM Programming & Development | 4 | November 8, 2012 23:22 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 18:51 |
Add source term in species equation | zhou1 | FLUENT | 1 | October 21, 2003 07:28 |