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

Curl function in Matlab

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 7, 2017, 02:20
Default Curl function in Matlab
  #1
Member
 
Aru
Join Date: Feb 2012
Location: Chennai, India
Posts: 40
Rep Power: 14
arunsmec is on a distinguished road
Hi

I am trying to find the curl of a 3D vector field using the Matlab function curl. However, I get only -Inf and Inf in the output.
The data I have is the velocity field in 3 different 3d arrays U, V and W and the grid points as one-dimensional monotonic arrays x, y and z. I do the following operation to find the curl.

Code:
[Y,X,Z]=meshgrid(y,x,z)
[Wx,Wy,Wz,omega]=curl(X,Y,Z,U,V,W)
I am unable to figure out what causes division by zero.
arunsmec is offline   Reply With Quote

Old   June 7, 2017, 03:11
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
curl requires first the velocity field, then the grid, see: https://it.mathworks.com/help/symbol...id=gn_loc_drop
FMDenaro is offline   Reply With Quote

Old   June 7, 2017, 03:22
Default
  #3
Member
 
Aru
Join Date: Feb 2012
Location: Chennai, India
Posts: 40
Rep Power: 14
arunsmec is on a distinguished road
I was referring to this function.
https://in.mathworks.com/help/matlab/ref/curl.html

Quote:
Originally Posted by FMDenaro View Post
curl requires first the velocity field, then the grid, see: https://it.mathworks.com/help/symbol...id=gn_loc_drop
The function which you have mentioned works with symbolic variables.
arunsmec is offline   Reply With Quote

Old   June 7, 2017, 03:27
Default
  #4
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by arunsmec View Post
I was referring to this function.
https://in.mathworks.com/help/matlab/ref/curl.html



The function which you have mentioned works with symbolic variables.

I suggest to start first a check by using successive 2D planes. For example for several Z values you can first check if the vector plot in each plane is correct and then compute the 2D curl.
FMDenaro is offline   Reply With Quote

Old   June 7, 2017, 04:07
Default
  #5
Member
 
Aru
Join Date: Feb 2012
Location: Chennai, India
Posts: 40
Rep Power: 14
arunsmec is on a distinguished road
Thank you for your suggestion.
I have found out that the problem is associated with employing the meshgrid function. It has been sorted out by resizing the velocity arrays.
arunsmec is offline   Reply With Quote

Reply

Tags
matlab coding


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
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 02:36
[blockMesh] Errors during blockMesh meshing Madeleine P. Vincent OpenFOAM Meshing & Mesh Conversion 51 May 30, 2016 10:51
[swak4Foam] installation problem with version 0.2.3 Claudio87 OpenFOAM Community Contributions 9 May 8, 2013 10:20
[blockMesh] non-orthogonal faces and incorrect orientation? nennbs OpenFOAM Meshing & Mesh Conversion 7 April 17, 2013 05:42
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50


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