CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

Accessing Velocity Components

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   June 30, 2011, 17:47
Default Accessing Velocity Components
Join Date: Sep 2010
Posts: 31
Rep Power: 7
anfho is on a distinguished road
Dear All,

How can I access the components of volVecorField U ?

Meaning: u, v, w component.

Thanks for the help.
anfho is offline   Reply With Quote

Old   June 30, 2011, 19:21
Join Date: Sep 2010
Posts: 31
Rep Power: 7
anfho is on a distinguished road
I've been doing trial and error for a while, but at the end it wasn't as complicated as I thought, if I do:

      double lesCllCtrDomSze  = U.size();
      double ules[lesCllCtrDomSze];
      double vles[lesCllCtrDomSze];
      double wles[lesCllCtrDomSze];
      OFstream uvw_velocities ( "uvw_velocities" );
      for(int i=0; i<lesCllCtrDomSze; i++)
        Vector<double> Uvector = U[i];
        ules[i] = Uvector.x();
        vles[i] = Uvector.y();
        wles[i] = Uvector.z();

        uvw_velocities <<ules[i]<<", " <<vles[i]<<", " <<wles[i] <<endl;
everything works perfectly fine.

This link was helpful:
Accessing a vector in a volVectorField by cell label
anfho is offline   Reply With Quote


Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Results of CFX Simulations Sof_70_Usthb CFX 3 July 9, 2011 06:15
Emergency:UDF for a time dependent parabolic velocity zumaqiong Fluent UDF and Scheme Programming 12 March 25, 2010 13:00
Velocity Components in foamDataToFluent flavio_pergolesi OpenFOAM Post-Processing 1 November 9, 2009 10:27
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 02:15
How to specify velocity components in UDF Ynot FLUENT 1 March 11, 2006 14:53

All times are GMT -4. The time now is 12:28.