Obtaining velocity components
This is rather trivial, but for some reason i can't seem to get this line to work.
volScalarField vx = U.x();
The compilation error i get is
error: 'struct Foam::volVectorField' has no member named 'x'
Could someone tell me the right way to get velocity components?
Srinath, You could try
You could try
Hi, could I ask the way I set:
Hi, could I ask the way I set: partial(Ux)/partial(x) is right?
Thanks Kieran That worked f
That worked for the expression
But i get a runtime error if i do this
volVectorField newphiU = phiU
newphiU.componet(0) = f(scalars).
The error i get is
--> FOAM FATAL ERROR : attempted to assign to a const reference to constant object#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) in "/home/srinath/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/srinath/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libOpenFOAM.so"
Could someone tell me the 'correct way' to assign components of a volVector field?
Srinath, I believe that (in
I believe that (in most cases) you should be able to find a way to deal with vectors as a whole, and not with individual components. This will keep code more compact and readable.
Maybe it is worth trying.
Dear Luca Suppose i have a
Suppose i have a matrix A times vector B
A is 5*5, B is 5*1
i want to group rhoU from the central 3 components
What do you mean by central co
What do you mean by central components? C_2,C_3 and C_4?
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0].
If not, post the complete example code, because your questions hardly make sense.
Nadine Since i didn't know
Since i didn't know how to assemble a 5 component pseudoVector in OpenFoam, i explicitly carried out the multiplication A*B
Right now, i have C(1), C(2)....C(5).
If i could group these entries into a pseudovector C, i could do what u suggest.
I am trying to solve dw/dt + A\Sigma F.\Delta S = 0
\Sigma F\Delta S is computed previously and plays the role of B.
I know it's components B(1), [B(2), B(3),B(4)],B(5).
I have copied and pasted the relevant portion of the code with some comments
----------Here is B----------------------------
volScalarField res_rho = fvc::div(phi_rho);
volVectorField res_rhoU = fvc::div(phi_rhoU);
volScalarField res_rhoE = fvc::div(phi_rhoE);
--------Entries of A are computed(I don't assemble them together as A---------------
-------I explicitly calculate C=A*B------------
volScalarField newphi_rho = .....ugly stuff....
volScalarField newphi_rhoU1 = ..........
volScalarField newphi_rhoU2 = ......
volScalarField newphi_rhoU3 = .......
volScalarField newphi_rhoE = ........
I don't know how to group the scalars newphi_* into a vector C to do rhoU = D*C
---I then proceed to say------------
solve(fvm::ddt(rho) == - newphi_rho)
solve(fvm::ddt(rhoU) == -newphi_rhoU)->Cant assemble from newphi_rhoU1 etc
solve(fvm::ddt(rhoE) == -newphi_rhoE
If this isn't clear i can mail you the code.
I tried pasting it, but i don't think it would be relevant to post 200 other lines doing other stuff in between.
If you think your code is not
If you think your code is not relevant, then I think your question isn't either.
I don't want to make more guesses how your "volScalarField newphi_rho = .....ugly stuff...." looks in detail, if you provide information bit by bit. You could easily have attached the full 200 lines of code, while pointing out the relevant portions in the body of your post.
You could also put your problem in a more general context, so that somebody could recognize a problem that has a standard solution, but your
simply looks like an ordinary differential equation.
Issue is resolved. Used the
Issue is resolved.
Used the following command to replace scalar fields in a volVectorField
Srinath, I still suggest yo
I still suggest you that you don't need to explicitely use components.
vx*res_rhoU.component(0) + vy*res_rhoU.component(1) + vz*res_rhoU.component(2))
==> U & res_rhoU
Similarly you can formulate the three scalar equations for newphi_rhoU1, ..U2, ..U3 into a single vector equation for newphi_rhoU: just have a carefull look at them and collect all the terms appropriately. Than, it will look much nicer.. http://www.cfd-online.com/OpenFOAM_D...part/happy.gif
Hello All, A new question w
A new question which seems to fit here:
I want to combine 3 scalarFields into 1 vectorField:
scalarField Xdot(vectOmega & (pointCentres ^ vectX) );
scalarField Ydot(vectOmega & (pointCentres ^ vectY) );
scalarField Zdot(vectOmega & (pointCentres ^ vectZ) );
vectX = (1,0,0), vectY=(0,1,0), vectZ=(0,0,1)
omega is a vector and pointCentres is a pointField defined as:
pointCentres = mesh.boundaryMesh()[patchI].localPoints();
Now I need a vectorField which looks likehttp://www.cfd-online.com/OpenFOAM_D...lipart/sad.gifXdot, Ydot, Zdot).
Any ideas how to accomplish this task? Does anyone see a possibility to define such a vectorField with one description, as Luca suggests?
does anyone know, how to overwrite a single component of a vector? For example: I have two dimensionedVectors V1 & V2 with same dimensions. And I want to set the Z-Component of the V2 to the Z-value of the V1. What i tried is:is:
I have tried this code for the velocity component, but i get the error-
ycleAvg.C:57:21: error: expected initializer before ‘.’ token
Could you solve this problem? because I have a very similar problem like this.
I need to construct a volVectorField from three volScalarField, I have tried but got no success.
|All times are GMT -4. The time now is 16:54.|