|
[Sponsors] |
Fourth Order Central Differencing of Flow Field Data? (Post-Processing) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 3, 2019, 15:21 |
Fourth Order Central Differencing of Flow Field Data? (Post-Processing)
|
#1 |
New Member
Join Date: Dec 2019
Posts: 13
Rep Power: 7 |
Hi all!
I have been tasked with using a Fourth Order Central Differencing scheme to compute the z-vorticity component (Wz = dv/dx - du/dy) within Matlab; given 3D flow field data for velocities (u,v,w) in a 64^3 point domain plus 4x halo / ghost nodes (2x at the start and 2x at the end) for each dimension. This problem stems from a 3D Taylor Green Vortex simulation for a cube of size 0<x0,x1,x2<2pi with periodic boundary conditions applied in all directions (time-step of dt=0.005s). I understand the general concept of central differencing but I do not understand the application to this particular task and the appropriate Matlab syntax so any help would be greatly appreciated. |
|
December 3, 2019, 15:33 |
|
#2 |
Member
Join Date: Aug 2018
Posts: 77
Rep Power: 8 |
Start by looking up a 4th order accurate finite difference stencil. It will involve e.g. points at i,i-1,i+1,... just apply it atvery grid point to approcimate the gradients you need.
|
|
December 3, 2019, 15:39 |
|
#3 | |
New Member
Join Date: Dec 2019
Posts: 13
Rep Power: 7 |
Quote:
I have the stencil: df/dx ~ {(fi-2)-(8fi-1)+(8fi+1)-(fi+2)}/(12dx). It is the application of this (and the central differencing methodology) to this problem and within Matlab that I am struggling with... |
||
December 3, 2019, 15:42 |
|
#4 |
Member
Join Date: Aug 2018
Posts: 77
Rep Power: 8 |
this is already a central difference, so no need to worry about that aspect anymore. What exactlyare you struggling with? Do you understand how to apply a FD to compute a derivate in 1D?
|
|
December 3, 2019, 15:54 |
|
#5 |
New Member
Join Date: Dec 2019
Posts: 13
Rep Power: 7 |
I'm unsure how to apply this scheme to my data (velocity flow field in 3D) to achieve the Z vorticity field. I'm assuming the method is to derive velocity gradient at each node using the scheme (dv/dx and du/dy) but I'm uncertain how to initialise and compute this in Matlab given the information above.
|
|
December 3, 2019, 15:59 |
Fourth Order Central Differencing of Flow Field Data? (Post-Processing)
|
#6 |
Member
Join Date: Aug 2018
Posts: 77
Rep Power: 8 |
yes, just compute dv/dx by applying it to the field in the x-direction and to u in the y-direction. just loop over all points, you have a structured grid so this is really easy... still not sure what you are struggling with...
example: outer loop over all ijk, inner loop 1: i-2 to i+2, compute dv/dx inner loop 2: j-2 to j+2, compute du/dy add at each ijk done |
|
December 3, 2019, 16:08 |
|
#7 | |
New Member
Join Date: Dec 2019
Posts: 13
Rep Power: 7 |
Quote:
Do I not need to initialise the boundary conditions before looping the scheme through the points? Is the scheme calculating the velocity gradient from upwind / downstream velocity components (which I already have) or the neighbouring gradients calculated through the loop? |
||
December 3, 2019, 16:11 |
|
#8 |
Member
Join Date: Aug 2018
Posts: 77
Rep Power: 8 |
sure. you should fill the ghostcells first, so you can apply the stencil at the boundary points. not sure what you mean by the second part...
|
|
December 4, 2019, 04:49 |
|
#9 |
Senior Member
|
You have all the pieces, what we could add is just actually doing it for you... but this looks a lot like a homework. And even if it isn't, you really need to figure this out by yourself.
Still... you need to first copy your periodic data in the right ghost cells. For example, the data in the plane at nx+1 needs to be copied in the plane at 0. Those in the plane at nx+2 has to be copied in the plane at -1. Same for the other directions. I obviously don't know the actual indexing of your ghost planes in the code, so you need to figure out this by yourself, mine was just an example. Once this is done, you can loop on all interior i,j,k (no ghosts) and straighforwardly use the derivative formula. Actually, in MATLAB there are more correct ways to do that, involving vectorization, and are also trivial for this structured case. But would leave that for the future. |
|
December 5, 2019, 18:45 |
|
#10 |
Member
Join Date: Aug 2018
Posts: 77
Rep Power: 8 |
did you figure it out?
|
|
December 6, 2019, 01:57 |
|
#11 | |
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,290
Rep Power: 34 |
Quote:
Construct proper number of points at the boundary. For fourth order you will need two points at the boundary. Since you are in periodic condition, fill these two points values by copy from the other side of domain. Now using fourth order central differencing formula compute the gradients. Using these gradients compute the term that you need to compute. PS: if you are asked to use 4rth order compact then you would have to solve tri diagonal equations obtaining these gradients (look in literature). |
||
December 6, 2019, 13:23 |
|
#12 |
New Member
Join Date: Dec 2019
Posts: 13
Rep Power: 7 |
||
December 6, 2019, 13:24 |
|
#13 |
Member
Join Date: Aug 2018
Posts: 77
Rep Power: 8 |
great, glad to help!
|
|
Tags |
central difference, central differencing, matlab code, matlab coding, post-processing |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CFD by anderson, chp 10.... supersonic flow over flat plate | varunjain89 | Main CFD Forum | 18 | May 11, 2018 08:31 |
[General] Advice on post processing compressor blade data in paraview | Jack001 | ParaView | 0 | February 4, 2016 18:16 |
[General] 2 datas on one plot | Akuji | ParaView | 46 | December 1, 2013 15:06 |
post processing field average in cht | moritzhoefert | OpenFOAM Pre-Processing | 0 | January 11, 2012 11:41 |
fluid flow fundas | ram | Main CFD Forum | 5 | June 17, 2000 22:31 |