Please help me to solve this problem!

1 回表示 (過去 30 日間)
Rizwana
Rizwana 2014 年 2 月 11 日
編集済み: Randy Souza 2014 年 2 月 13 日
I have been asked to calculate vorticity of three velocity components u, v & w. I have attached .txt file for the same. As I knew curl does the same in MATLAB. Hence i tried these lines of code:
u=VarName1;
>> v=VarName2;
>> w =VarName3;
>> Ulin =linspace(min(u),max(u),33);
>> Vlin =linspace(min(v),max(v),33);
>> Wlin =linspace(min(w),max(w),33);
>> [U,V,W]=meshgrid(Ulin,Vlin,Wlin);
>> [CURLX, CURLY, CURLZ, CAV] = curl(U,V,W);
But when I type CURLX all are showing zero values...

回答 (2 件)

Jos (10584)
Jos (10584) 2014 年 2 月 11 日
Did you check the contents of each variable?

Roger Stafford
Roger Stafford 2014 年 2 月 11 日
By the way you have defined U, V, and W, they must have a curl of identically zero. There can be no vorticity. That is because U = (max(u)-min(u)/32*x, V = (max(v)-min(v)/32*y, and W = (max(w)-min(w)/32*z, so all the partial derivatives that go to make up the curl must be zero: dU/dy = dU/dz = dV/x = dV/dz = dW/dx = dW/dy = 0.
  3 件のコメント
Rizwana
Rizwana 2014 年 2 月 12 日
I have u ,v and w in data set which is varying in values. I cannot meshgrid it because iam running out of memory. Hence using linspace space command
Roger Stafford
Roger Stafford 2014 年 2 月 13 日
You will need to use the 'curl' function in the form
[curlx,curly,curlz] = curl(X,Y,Z,U,V,W);
unless your X, Y, and Z are unit-spaced (see the documention.) The X, Y, Z need to be monotonic and in a form as if produced by 'meshgrid' though the spacing can be variable. These represent positions in the field, while U, V, and W represent the corresponding x, y, and z components of the vector field at these positions.
If your points are so numerous that you are running out of memory, you will have to do the computation in small enough sections of the field that you don't run out of memory. However, be aware that since the curl of the field is also a vector field, it will occupy just as much memory as the three arrays U, V, and W do.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by