simulkade / FVTool

Finite volume toolbox for Matlab/Octave
http://fvt.simulkade.com
BSD 2-Clause "Simplified" License
99 stars 56 forks source link

Changing bounds of mesh #19

Closed SA8416 closed 5 years ago

SA8416 commented 5 years ago

Hi

Is it possible to change the bounds of a mesh? For instance in: m = createMeshCylindrical2D(Nr, Nz, Lr, Lz)

Setting the values for Lr and Lz cause the mesh to extend from "0 to Lr" and "0 to Lz". Is it possible to change this so that the mesh extends from, say, "x to Lr" and "y to Lz" ? Thanks in advance!

SA8416 commented 5 years ago

And to add, is there a way to extract the gradients of a distribution along with the distribution itself?

simulkade commented 5 years ago

Hi @SA8416 It is possible to shift the origin:

m = createMeshCylindrical2D(Nr, Nz, Lr, Lz);
m.cellcenters.x=m.cellcenters.x+x0
m.facecenters.x=m.facecenters.x+x0
m.cellcenters.y=m.cellcenters.y+y0
m.facecenters.y=m.facecenters.y+y0

It is a bit cumbersome and ugly. I'll add a function to do it automatically.

I don't quite understand the second question. Do you want to get the gradient of a cell value? You can always use gradientTerm and gradientCellTerm functions.

SA8416 commented 5 years ago

Thank you for the swift reply! I'd like to get the gradient at each face of a cell (north south east and west for 2D), including cells at the domain's boundaries.

simulkade commented 5 years ago

Then you should use gradientTerm function.

On Fri, 4 Jan 2019, 11:08 SA8416 <notifications@github.com wrote:

Thank you for the swift reply! I'd like to get the gradient at each face of a cell (north south east and west for 2D), including cells at the domain's boundaries.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/simulkade/FVTool/issues/19#issuecomment-451403281, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy1xiNVQVysEJ7rNi0L8EJR-UF_gkiQks5u_ygGgaJpZM4Zo9yV .