Assign one vector to another - still a field?
Hi Foamers,
I have some problems with a vector assignment. To do some further computations, I need the unit normal vector of a patch stored as a vector. My command for this is Code:
vector unitNormalVector; Code:
error: no match for call to ‘(Foam::vector) (Foam::tmp<Foam::Field<Foam::Vector<double> > >)’ I'm a beginner with C++, so I ask someone more experienced to tell me what I'm doing wrong. :) Regards, David |
Hey there fellow David G,
boundaryField()[patchi] is not a single control face - it is an entire patch, made up of several faces. I think you can access it a bit more directly: wallshearstress4Rho.boundaryField()[patchi].nf() I believe this returns a vector field of all the normal vectors on the patch faces. As for finding the exact centre unit vector, I'm not sure. Maybe look at an fvPatchField that you guess would need to know its unit vector, and see how they do it. |
Hi David,
thanks for pointing that out, I was really on the wrong track. The line you posted didn't work for me, maybe I missed something before. But the assignment works, if I define unitNormalVector as a vectorField (like I learned now), and add an "&": Code:
unitNormalVector& At the moment, my code does compile, but ends with a segmentation fault while running. I'll see if I can fix this. nice weekend, David //Edit: 1 month later: the above is NOT an assignment, but I believe a multiplication. A good way to find out if everythings right is to use the Info output, e.g. Info<< "Cell number = " << number << endl; |
I track down segmentation faults by compiling in debug mode, and using gbd...
gdb solverName >run -Crashes >bt (backtrace - it shows where in the code it crashed) |
All times are GMT -4. The time now is 13:07. |