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

Equation implementation in IcoFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By brunomramoa

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 13, 2021, 12:08
Default Equation implementation in IcoFoam
  #1
New Member
 
Raoul
Join Date: Apr 2021
Posts: 16
Rep Power: 5
rol97 is on a distinguished road
Hi everyone, I have recently started working with OpenFoam for my master's thesis. I am also new to C++ (I have already read the documentation up to the classes and done some exercises but obviously there are a lot of things I don't know). It is now quite clear to me how OpenFoam works (especially IcoFoam, that is the solver I have to work with). My problem is that I am not able to find any documentation related to the syntax of complex equations.
For example I am currently trying to substitute the standard momentum equation with the Stokes equation (not a complex one yet):

\nabla \cdot [-pI + \eta (\nabla \vec{u} + \nabla \vec{u}^T) ] = 0

however I don't know how to do that. I would write:

- fvm::laplacian(nu, U) - fvm::laplacian(nu, U.T())

(the minus is just so that I don't have to modify anything in the PISO loop) and obviously this does not compile. Is there any good guide/documentation that I can refer to in order to learn the syntax for the equations?
I have also already performed the tutorials about adding the energy equation or the scalar passive transport equation but they were useless (strictly talking about the syntax learning).

Thank you in advance.
rol97 is offline   Reply With Quote

Old   April 13, 2021, 12:24
Default
  #2
New Member
 
Bruno Ramoa
Join Date: Jul 2019
Posts: 18
Rep Power: 6
brunomramoa is on a distinguished road
Quote:
Originally Posted by rol97 View Post
Hi everyone, I have recently started working with OpenFoam for my master's thesis. I am also new to C++ (I have already read the documentation up to the classes and done some exercises but obviously there are a lot of things I don't know). It is now quite clear to me how OpenFoam works (especially IcoFoam, that is the solver I have to work with). My problem is that I am not able to find any documentation related to the syntax of complex equations.
For example I am currently trying to substitute the standard momentum equation with the Stokes equation (not a complex one yet):

\nabla \cdot [-pI + \eta (\nabla \vec{u} + \nabla \vec{u}^T) ] = 0

however I don't know how to do that. I would write:

- fvm::laplacian(nu, U) - fvm::laplacian(nu, U.T())

(the minus is just so that I don't have to modify anything in the PISO loop) and obviously this does not compile. Is there any good guide/documentation that I can refer to in order to learn the syntax for the equations?
I have also already performed the tutorials about adding the energy equation or the scalar passive transport equation but they were useless (strictly talking about the syntax learning).

Thank you in advance.

Hi,

I asked something similar to this recently @ Accessing and clarificaiton of the terms in turbulence.divDevRhoReff(U). However, I did not get any reply.



I would say that you should implement this as:


Code:
      +( - fvc::div(nu* fvc::grad(U)().T()  )
          - fvm::laplacian(nu, U)
        )
Best regards
rol97 likes this.
brunomramoa is offline   Reply With Quote

Old   April 14, 2021, 04:32
Default
  #3
New Member
 
Raoul
Join Date: Apr 2021
Posts: 16
Rep Power: 5
rol97 is on a distinguished road
Thank you very much for you answer, the implementation that you suggested works.

I am now trying to modify that to understand what I can and cannot do and it looks like that whenever I have to perform some kind of operation concatenation (for example transposing a vector inside another operator) I must write it as "fvc" despite it being an unknown, and to rely on the convergence of the overall solving routine.
rol97 is offline   Reply With Quote

Reply

Tags
equation implementation

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Source Term due to evaporation in energy transport equation styleworker OpenFOAM Programming & Development 3 September 7, 2022 03:09
Radiation Models in General and the P1 implementation Tobi OpenFOAM Running, Solving & CFD 8 September 21, 2021 05:59
Adjoint Implementation Equation FlyBob91 OpenFOAM Programming & Development 0 December 1, 2016 09:50
Equation discretisation in icoFoam kar OpenFOAM Running, Solving & CFD 3 February 10, 2008 06:34


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