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

Interfoam UEqn.H, where to add additional terms?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 22, 2023, 09:04
Default Interfoam UEqn.H, where to add additional terms?
  #1
New Member
 
Luke Hirl
Join Date: Jul 2023
Location: Gießen
Posts: 16
Rep Power: 3
Luke99 is on a distinguished road
Disclaimer: probably already discussed somerwhere can´t find anything though, link would be enough


So I would like to add a electrostatic force term


Code:
- fvc::interpolate(rhoE)*fvc::snGrad(Ue) - scalar(0.5)* fvc::interpolate(EE)*fvc::snGrad(eps)
to the UEqn in interfoam and I looked at examples online. Some of them only seem to add it in the momentum predictor and others only in the fvVectorMatrix UEqn part or do i only need to add it in fvoptions or in both? Obviously not fvoptions and as a term in the same equation.
I know that if I add it to the momentum predictor only it needs to be turned on.



Code:
MRF.correctBoundaryVelocity(U);

    fvVectorMatrix UEqn
    (
        fvm::ddt(rho, U) + fvm::div(rhoPhi, U)
      + MRF.DDt(rho, U)
      + turbulence->divDevRhoReff(rho, U)


      to add here?



     ==
        fvOptions(rho, U)
    );

    UEqn.relax();
    
    volScalarField EE = magSqr(fvc::grad(Ue));

    fvOptions.constrain(UEqn);

    if (pimple.momentumPredictor())
    {
        solve
        (
            UEqn
         ==
            fvc::reconstruct
            (
                (
                    mixture.surfaceTensionForce()
                  - ghf*fvc::snGrad(rho)
                  - fvc::snGrad(p_rgh)
                  

                   or here?



                ) * mesh.magSf()
            )
        );

        fvOptions.correct(U);
    }
Luke99 is offline   Reply With Quote

Old   August 23, 2023, 10:18
Default
  #2
Member
 
yijin Mao
Join Date: May 2010
Location: Columbia, MO
Posts: 64
Rep Power: 16
alundilong is on a distinguished road
Quote:
Originally Posted by Luke99 View Post
Disclaimer: probably already discussed somerwhere can´t find anything though, link would be enough


So I would like to add a electrostatic force term


Code:
- fvc::interpolate(rhoE)*fvc::snGrad(Ue) - scalar(0.5)* fvc::interpolate(EE)*fvc::snGrad(eps)
to the UEqn in interfoam and I looked at examples online. Some of them only seem to add it in the momentum predictor and others only in the fvVectorMatrix UEqn part or do i only need to add it in fvoptions or in both? Obviously not fvoptions and as a term in the same equation.
I know that if I add it to the momentum predictor only it needs to be turned on.



Code:
MRF.correctBoundaryVelocity(U);

    fvVectorMatrix UEqn
    (
        fvm::ddt(rho, U) + fvm::div(rhoPhi, U)
      + MRF.DDt(rho, U)
      + turbulence->divDevRhoReff(rho, U)


      to add here?



     ==
        fvOptions(rho, U)
    );

    UEqn.relax();
    
    volScalarField EE = magSqr(fvc::grad(Ue));

    fvOptions.constrain(UEqn);

    if (pimple.momentumPredictor())
    {
        solve
        (
            UEqn
         ==
            fvc::reconstruct
            (
                (
                    mixture.surfaceTensionForce()
                  - ghf*fvc::snGrad(rho)
                  - fvc::snGrad(p_rgh)
                  

                   or here?



                ) * mesh.magSf()
            )
        );

        fvOptions.correct(U);
    }
Luke99,
do you think pEqn should be changed accordingly?
if you've known how U and pEqn come, you will see what and where changes should be imposed.
alundilong is offline   Reply With Quote

Old   August 28, 2023, 17:34
Default
  #3
New Member
 
Luke Hirl
Join Date: Jul 2023
Location: Gießen
Posts: 16
Rep Power: 3
Luke99 is on a distinguished road
Hi Alundilong,
so I read a bit further into the solver.
Correct me if I am wrong but as far as I understand it the Navier-Stokes Equation is solved as follows:
In the UEqn.H I first construct the U vector Matrix and then have the option to use the momentum predictor to kind off precalculate the velocity field. But the final calculation of the velocity field happens in pEqn.H after I iteratively solved the pressure Equation.
So therefore as you already said I should either implement it in the U vector Matrix or the pressure Equation and in the latter case if I want to use the momentum predictor there as well.
Luke99 is offline   Reply With Quote

Old   August 29, 2023, 04:26
Default
  #4
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
You can use source function object to specify a momentum source term.

See e.g. https://www.openfoam.com/documentati...s-sources.html .
dlahaye is offline   Reply With Quote

Reply

Tags
electrohydrodynamic, interfoam, modify solver, term, ueqn.h


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
how to add additional species diffusion term in FLUENT Sowmiya FLUENT 3 March 28, 2021 14:34
Modeling Additional source terms Abed Main CFD Forum 0 November 24, 2007 07:17
how to add source terms to a cell? lily FLUENT 5 May 24, 2006 05:38
Source terms for additional variable transport eqn Nandini Rohilla CFX 0 February 6, 2004 14:38
Additional terms in Differential Stress Model Fabio Kasper CFX 1 February 9, 2000 03:39


All times are GMT -4. The time now is 17:56.