CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Setting specific values to a vector field component

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 30, 2015, 11:07
Default Setting specific values to a vector field component
  #1
New Member
 
...
Join Date: Jun 2013
Posts: 19
Rep Power: 12
manalis is on a distinguished road
Hello to everyone,

As a beginner in OpenFOAM, I have a problem in compiling a modified version of a standard solver. Specifically, I have created a "volVectorField" in the respective "CreateFields.H" file, which is actually a velocity field. My problem is that I can't set the "Uy" component of this vector to a value that comes from a scalar variable Vcalc, which is calculated before. In other words I would like to set
Code:
Uy = Vcalc
.

I tried to find similar topics in the forum but I couldn't (or at least I didn't realize it!). Any help would be very appreciated.

Best regards.
manalis is offline   Reply With Quote

Old   October 1, 2015, 15:40
Default
  #2
New Member
 
James Montague
Join Date: Jan 2014
Location: Vermont, United States
Posts: 7
Rep Power: 12
Montague is on a distinguished road
When constructing your vector field you can construct a temporary volVectorField and multiply it by your scalar or scalarField. This would be done in the solver file E.G. icoFoam.c Vcalc must have the same dimensions as myU since your temp variable will be dimensionless.

In createFields.H you will have to initialize myU following the same convention as the other variables. You will also have to supply myU to the '0' folder with appropriate boundary conditions.

Code:
volVectorField temp
    (
    	IOobject
		(
			"temp",
			runTime.timeName(),
			mesh,
			IOobject::NO_READ,
			IOobject::NO_WRITE
		),
	        mesh,
		vector(0,1,0)
    );
myU = temp*Vcalc;
Hope this helps ,
Jim
Montague is offline   Reply With Quote

Old   October 9, 2015, 13:03
Default
  #3
New Member
 
...
Join Date: Jun 2013
Posts: 19
Rep Power: 12
manalis is on a distinguished road
Thank you James. It helped a lot!

Best regards
manalis is offline   Reply With Quote

Reply


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
ATTENTION! Reliability problems in CFX 5.7 Joseph CFX 14 April 20, 2010 15:45
Two-Phase Buoyant Flow Issue Miguel Baritto CFX 4 August 31, 2006 12:02
Printing Values on a Specific Surface Matthew FLUENT 1 February 8, 2006 08:15
Setting pressure value for specific cells, UDF Amir FLUENT 2 September 1, 2005 18:59
setting a volumetric flow rate at a specific place Rage CFX 0 July 25, 2003 16:07


All times are GMT -4. The time now is 00:33.