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

Characteristic penalization implemented in fvOptions

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 22, 2020, 11:17
Default Characteristic penalization implemented in fvOptions
  #1
New Member
 
Giorgio Negrini
Join Date: Feb 2020
Location: Milan
Posts: 13
Rep Power: 6
alfiogn is on a distinguished road
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:
\frac{1}{\epsilon} ( u - \bar{u})
where u is my unkown variable, \bar{u} is the viariable field that I want to impose and \epsilon 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_));
}
Chi_ is a characteristic function, Ubar_ is the imposed value.
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.
alfiogn is offline   Reply With Quote

Old   March 23, 2020, 05:44
Default
  #2
New Member
 
Giorgio Negrini
Join Date: Feb 2020
Location: Milan
Posts: 13
Rep Power: 6
alfiogn is on a distinguished road
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_));

}
alfiogn 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
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


All times are GMT -4. The time now is 23:50.