CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Finite Volume Method in 2D

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 30, 2023, 07:31
Default Finite Volume Method in 2D
  #1
Senior Member
 
Matthew
Join Date: Mar 2022
Location: United Kingdom
Posts: 184
Rep Power: 4
hunt_mat is on a distinguished road
I am thinking about the finite volume in 2D. Suppose I have a rectangle, A with vertices:
(X,Y),\quad (X+\delta X,Y),\quad (X=\delta X,Y+\delta Y),\quad (X,Y+\delta Y)
One of the equations I have to solve is:
\frac{\partial D}{\partial X}-\frac{\partial C}{\partial Y}=0
So the usual way is to integrate around the rectangle I mentioned and I get the following calculation:
\int_{A}\nabla\cdot\mathbf{F}dXdY = \oint_{\partial A}\mathbf{F}\cdot\hat{\mathbf{n}}ds
=\int \mathbf{F}_{e}\cdot\hat{\mathbf{n}}_{e}ds+\int \mathbf{F}_{n}\cdot\hat{\mathbf{n}}_{n}ds+\int \mathbf{F}_{w}\cdot\hat{\mathbf{n}}_{w}ds+\int \mathbf{F}_{w}\cdot\hat{\mathbf{n}}_{w}ds
=\int_{Y}^{Y+\delta Y}D(X+\delta X,s)ds+\int_{X+\delta X}^{X}C(s,Y+\delta Y)ds
-\int_{X+\delta X}^{X}D(X,s)ds-\int_{X}^{X+\delta X}C(s,Y)dx
=0
So far this makes sense to me as to what I'm doing. I can then use the midpoint rule to approximate the integral. Is what I'm doing correct?
hunt_mat is offline   Reply With Quote

Old   October 30, 2023, 08:46
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Before the last line you need to declare/decide/invoke a discretization scheme for each face flux Fe,Fw,Fn,Fs. The surface integrals will become a summation naturally
LuckyTran is offline   Reply With Quote

Old   October 30, 2023, 08:52
Default
  #3
Senior Member
 
Matthew
Join Date: Mar 2022
Location: United Kingdom
Posts: 184
Rep Power: 4
hunt_mat is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
Before the last line you need to declare/decide/invoke a discretization scheme for each face flux Fe,Fw,Fn,Fs. The surface integrals will become a summation naturally
I haven't done any approximation yet, everything is exact so far.
hunt_mat is offline   Reply With Quote

Old   October 30, 2023, 09:33
Default
  #4
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
The usual way is to consider the cell centered values the primitive variables. So by writing D(X+dx) etc you are invoking an discretization scheme since face fluxes are determined by the discretization scheme.


Well fine, then write down what exactly is D(X+dx)


The integral is no issue, it's just face flux that you sum over cells. No fancy midpoint integration rules needed to approximate the integral. The approximation is frontloaded on the discretization scheme.
LuckyTran is offline   Reply With Quote

Old   October 30, 2023, 10:39
Default
  #5
Senior Member
 
Matthew
Join Date: Mar 2022
Location: United Kingdom
Posts: 184
Rep Power: 4
hunt_mat is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
The usual way is to consider the cell centered values the primitive variables. So by writing D(X+dx) etc you are invoking an discretization scheme since face fluxes are determined by the discretization scheme.


Well fine, then write down what exactly is D(X+dx)


The integral is no issue, it's just face flux that you sum over cells. No fancy midpoint integration rules needed to approximate the integral. The approximation is frontloaded on the discretization scheme.
All I'm doing is taking a rectangle with points as I initially gave the vertices of and integrating over that. I'm using the rectangle as a domain of integration, no approximation has been made. The function D, is in general D=D(X,Y), so I can evaluate it wherever I like.

I could choose any points for my rectangle.
hunt_mat is offline   Reply With Quote

Old   October 30, 2023, 11:47
Default
  #6
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Some observations:


1) define e vector f having cartesian components (fx=D, fy=-C).


2) the volume integral of the divergence is equal to the surface integral of the normal component of f:


Int[Y; Y+dY] [fx|x+dx -fx|x ]dy +Int[X; X+dX] [fy|y+dy -fx|y ]dx=0


This equation is exact.



3) Now, the task of the discretization requires to define how do you colocate the variable on a computational grid. There are different choices, what do you want to use? I suppose your variable is at (X+dX/2, Y+dY/2), right?
FMDenaro is offline   Reply With Quote

Old   October 30, 2023, 12:06
Default
  #7
Senior Member
 
Matthew
Join Date: Mar 2022
Location: United Kingdom
Posts: 184
Rep Power: 4
hunt_mat is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
Some observations:


1) define e vector f having cartesian components (fx=D, fy=-C).


2) the volume integral of the divergence is equal to the surface integral of the normal component of f:


Int[Y; Y+dY] [fx|x+dx -fx|x ]dy +Int[X; X+dX] [fy|y+dy -fx|y ]dx=0


This equation is exact.



3) Now, the task of the discretization requires to define how do you colocate the variable on a computational grid. There are different choices, what do you want to use? I suppose your variable is at (X+dX/2, Y+dY/2), right?
That's what I said. Are you agreeing with me?
hunt_mat is offline   Reply With Quote

Old   October 30, 2023, 12:12
Default
  #8
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by hunt_mat View Post
That's what I said. Are you agreeing with me?

I agree but then the discretization is not unique, what do you want to apply, a second order central discretization? There are two possible ways.
FMDenaro is offline   Reply With Quote

Old   October 30, 2023, 19:39
Default
  #9
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Yeah the discretization is not unique. You must choose something. In this case the choice is quite intuitive. But from your previous posts, I get that you are not following the logical steps and so that's why I'm asking you to pick a discretization scheme and be aware that you are picking one.

What I don't want to hear, is after blindly applying a discretization scheme without realizing it, you claim that the subsequent equations are "exact."


You cannot simple evaluate D(X+dx,Y+dy) wherever you like for arbitrary dx and dy. Do a taylor series about the cell centered values... Unless your radius of convergence is infinite, your taylor series is guaranteed to converge only at dx=0,dy=0. See's taylor's theorem. At any other dx, dy, there is a potential error and therefore your face fluxes are never exact.
LuckyTran is offline   Reply With Quote

Old   October 31, 2023, 06:35
Default
  #10
Senior Member
 
Matthew
Join Date: Mar 2022
Location: United Kingdom
Posts: 184
Rep Power: 4
hunt_mat is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
I agree but then the discretization is not unique, what do you want to apply, a second order central discretization? There are two possible ways.
I've not thought about discretisation yet. I was going to just get this far and then think about it as the next step. Second order seems like the thing to do though. The goal is to get something working and then think about how to make it more accurate/faster.
hunt_mat is offline   Reply With Quote

Old   October 31, 2023, 06:48
Default
  #11
Senior Member
 
Matthew
Join Date: Mar 2022
Location: United Kingdom
Posts: 184
Rep Power: 4
hunt_mat is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
Yeah the discretization is not unique. You must choose something. In this case the choice is quite intuitive. But from your previous posts, I get that you are not following the logical steps and so that's why I'm asking you to pick a discretization scheme and be aware that you are picking one.

What I don't want to hear, is after blindly applying a discretization scheme without realizing it, you claim that the subsequent equations are "exact."


You cannot simple evaluate D(X+dx,Y+dy) wherever you like for arbitrary dx and dy. Do a taylor series about the cell centered values... Unless your radius of convergence is infinite, your taylor series is guaranteed to converge only at dx=0,dy=0. See's taylor's theorem. At any other dx, dy, there is a potential error and therefore your face fluxes are never exact.
All I have done, is turn differential equations into integral equations over a small area. I haven't needed to choose a discretisation scheme YET. They are still mathematical functions of X and Y.
hunt_mat is offline   Reply With Quote

Old   October 31, 2023, 07:05
Default
  #12
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
You've chosen D(X+dx) to evaluate your face fluxes (which is a corner node, not a face center nor a cell center). That is a discretization scheme. And you something think this is mathematically exact... exactly as I feared. Your title suggests you are doing FVM. So I'm expecting FVM and discete, non-continuous math.
LuckyTran is offline   Reply With Quote

Old   October 31, 2023, 07:16
Default
  #13
Senior Member
 
Matthew
Join Date: Mar 2022
Location: United Kingdom
Posts: 184
Rep Power: 4
hunt_mat is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
You've chosen D(X+dx) to evaluate your face fluxes (which is a corner node, not a face center nor a cell center). That is a discretization scheme. And you something think this is mathematically exact... exactly as I feared. Your title suggests you are doing FVM. So I'm expecting FVM and discete, non-continuous math.
The FVM is based upon the integral version of the governing differential equations.
hunt_mat is offline   Reply With Quote

Old   October 31, 2023, 07:19
Default
  #14
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
I think that the meaning of the original post is only to write the exact surface integral of the normal component of the flux, that is



Int[S] n.f dS


on a generic 2D Cartesian volume. And yes, that results in an exact equation.

Discretization starts when we discuss the discrete counterpart of the integral and the discrete counterpart of the flux reconstruction from the primitive variables.
FMDenaro is offline   Reply With Quote

Old   October 31, 2023, 07:26
Default
  #15
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Quote:
Originally Posted by hunt_mat View Post
The FVM is based upon the integral version of the governing differential equations.

These are not the integral forms of the governing equations, please don't mix them up. What you have done is taken the PDE, integrated them over the control volume, and applied the Gauss Divergence theorem.
LuckyTran is offline   Reply With Quote

Old   October 31, 2023, 07:31
Default
  #16
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by LuckyTran View Post
These are not the integral forms of the governing equations, please don't mix them up. What you have done is taken the PDE, integrated them over the control volume, and applied the Gauss Divergence theorem.
This is the inverse process that sometimes is reported. People is not fully aware that the only physical conservation law is the integral one and that one can obtain (under suitable regularity hypothesis) the differential form.
However, we can assume valid in this discussion both way.

The key is that the equation discussed in this post is not derived as conservation form.
FMDenaro is offline   Reply With Quote

Old   October 31, 2023, 07:48
Default
  #17
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Looking at the original post again I see that Divergence theorem is not being applied but rather it is Green's theorem. So this approach would not result in the typical FVM
LuckyTran is offline   Reply With Quote

Old   October 31, 2023, 08:32
Default
  #18
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,896
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by LuckyTran View Post
Looking at the original post again I see that Divergence theorem is not being applied but rather it is Green's theorem. So this approach would not result in the typical FVM



no problem, it is practically the same


https://en.wikipedia.org/wiki/Divergence_theorem


The only note is the in the FVM you divide for the measure of the volume, this way for |V|->0 you get the differential form.
FMDenaro is offline   Reply With Quote

Old   October 31, 2023, 09:09
Default
  #19
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,761
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Ok I see now the equivalency for the special case of 2D.
LuckyTran is offline   Reply With Quote

Old   November 1, 2023, 12:54
Default
  #20
Senior Member
 
Matthew
Join Date: Mar 2022
Location: United Kingdom
Posts: 184
Rep Power: 4
hunt_mat is on a distinguished road
I think I am pretty comfortable with what I've done. Constructing the fluxes for the main equations will be messy, but not anything that I can't overcome.
hunt_mat is offline   Reply With Quote

Reply

Tags
finite volume method


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
finite volume method and finite difference method harishkamat100 FLUENT 3 December 22, 2020 00:52
Finite element method ANSYS CFX tomd97 CFX 2 April 4, 2018 05:10
Mesh; wall function for element based finite volume method sheaker CFX 2 January 25, 2018 18:36
ALE in finite volume method littlelz Main CFD Forum 5 June 21, 2003 13:50
finite volume method for CFD analysis of 2D blunt body Aditya Vaze Main CFD Forum 1 January 19, 2000 14:55


All times are GMT -4. The time now is 11:49.