|
[Sponsors] |
Characteristic penalization implemented in fvOptions |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 22, 2020, 11:17 |
Characteristic penalization implemented in fvOptions
|
#1 |
New Member
Giorgio Negrini
Join Date: Feb 2020
Location: Milan
Posts: 13
Rep Power: 6 |
Hi,
I'm trying to implement an fvOption to add a new source to my solver without implementing a new solver. In particular, what I want to do is applying a Brinkman penalization term to impose velocity or temperature in a certain cellSet like a Dirichlet condition. (I want to do it also for a Neumann condition but it is a further step). It's something like an immersed boundary. I've to implement it for my phd studies. Analytically the term is represented by: where u is my unkown variable, is the viariable field that I want to impose and is the penalization coefficient (10^-6 ~ 10^-12). I also want to treat u implicitly. I've implemented an fvOption template for scalar and vector variables. The key part is the following: Code:
template<class Type> void Foam::fv::PenalizationSource<Type>::addSup ( fvMatrix<Type>& eqn, const label fieldi ) { const volFieldType& psi = eqn.psi(); eqn += (fvm::Sp(Chi_/epsilon_, psi) - fvc::Sp(Chi_/epsilon_, Ubar_)); } volFieldType is a typedef for a GeometricField<Type>. What happens during simulations is that the velocity field explodes but I cannot imagine how to fix this problem. Maybe my code is wrong. I think that the problem is in the summation of the fvm and fvc terms to my equation but I didn't figured out why. Can someone help me? Thanks in advance Giorgio UPDATE: Maybe I found out the issue: the fvc term is added well, but the fvm one is not added to the equation. In this way I have an unbalanced source term (10^10 in rhs and the normal matrix in lhs). However I don't know how to fix it. Last edited by alfiogn; March 23, 2020 at 02:49. |
|
March 23, 2020, 05:44 |
|
#2 |
New Member
Giorgio Negrini
Join Date: Feb 2020
Location: Milan
Posts: 13
Rep Power: 6 |
I feel stupid but I don't understand the reason why now the code is working perfectly. I just changed the sign of the fvm and fvc term.
Can someone explain me what is the difference between now and before? Code:
template<class Type> void Foam::fv::PenalizationSource<Type>::addSup ( fvMatrix<Type>& eqn, const label fieldi ) { const volFieldType& psi = eqn.psi(); eqn -= (fvm::Sp(Chi_/epsilon_, psi) - fvc::Sp(Chi_/epsilon_, Ubar_)); } And it is NOT working if I write Code:
template<class Type> void Foam::fv::PenalizationSource<Type>::addSup ( fvMatrix<Type>& eqn, const label fieldi ) { const volFieldType& psi = eqn.psi(); eqn -= (-fvm::Sp(Chi_/epsilon_, psi) + fvc::Sp(Chi_/epsilon_, Ubar_)); } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
fvOptions limitTemperature crashing in compressibleInterFoam | JM27 | OpenFOAM Running, Solving & CFD | 38 | November 29, 2023 03:55 |
Can I use fvOptions to couple a solid region and a fluid region? | titanchao | OpenFOAM Running, Solving & CFD | 4 | January 14, 2022 07:55 |
Configuration of boundary conditions and fvOptions file | Raza Javed | OpenFOAM Running, Solving & CFD | 16 | May 3, 2019 16:35 |
New output variable for source term in fvoptions - without changing the solver | vincent.clary | OpenFOAM Programming & Development | 2 | June 26, 2018 05:21 |
Origin of rotorDiskSource implemented in fvOptions | raye_xie | OpenFOAM Programming & Development | 2 | April 20, 2018 02:27 |