# surfaceVectorField

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

 April 16, 2013, 06:39 surfaceVectorField #1 New Member   liuke Join Date: Apr 2013 Posts: 20 Rep Power: 5 how to transformed a surfaceVectorField variable into volVectorField variable . or transformed a surfaceVectorField variable into surfaceScalarField variable

April 16, 2013, 08:41
#2
Senior Member

Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 196
Rep Power: 9
Quote:
 how to transformed a surfaceVectorField variable into volVectorField variable .
The function fvc::reconstruct() can do this conversion.

Quote:
 or transformed a surfaceVectorField variable into surfaceScalarField variable
From vector to scalar?

Best regards,
Fumiya

 April 16, 2013, 12:23 #3 Senior Member   HECKMANN Frédéric Join Date: Jul 2010 Posts: 237 Rep Power: 9 Code: `how to transformed a surfaceVectorField variable into volVectorField variable .` You can also use the interpolation tool. You can use the search function of the forum to find examples. I guess it should be something like "faceToCell". Code: `or transformed a surfaceVectorField variable into surfaceScalarField variable` Simply declare a surfaceScalarField, loop over all your patch, compute your Vector Magnitude for example and then put it into your surfaceVectorField. Code: ```label patchWall = mesh.boundaryMesh().findPatchID("wall"); //patchID = id of the patch wall const fvPatch& cPatch = mesh.boundary()[patchWall]; forAll(cPatch, facei) //facei = id of the face { ScalarVar.boundaryField()[patchWall][facei] = VectorVar.boundaryField()[patchWall][facei].component(0) + VectorVar.boundaryField()[patchWall][facei].component(1) + VectorVar.boundaryField()[patchWall][facei].component(3); }``` Ps. I'm too lazy to write the magnitude formula.

April 17, 2013, 08:12
to fumiya
#4
New Member

liuke
Join Date: Apr 2013
Posts: 20
Rep Power: 5
Quote:
 Originally Posted by fumiya The function fvc::reconstruct() can do this conversion. thank you! From vector to scalar? Best regards, Fumiya

The function fvc::reconstruct() is for surfaceScalarField not surfaceVectorField,I have do this many times.

April 17, 2013, 08:15
to fredo490
#5
New Member

liuke
Join Date: Apr 2013
Posts: 20
Rep Power: 5
Quote:
 Originally Posted by fredo490 Code: `how to transformed a surfaceVectorField variable into volVectorField variable .` You can also use the interpolation tool. You can use the search function of the forum to find examples. I guess it should be something like "faceToCell". Code: `or transformed a surfaceVectorField variable into surfaceScalarField variable` Simply declare a surfaceScalarField, loop over all your patch, compute your Vector Magnitude for example and then put it into your surfaceVectorField. Code: ```label patchWall = mesh.boundaryMesh().findPatchID("wall"); //patchID = id of the patch wall const fvPatch& cPatch = mesh.boundary()[patchWall]; forAll(cPatch, facei) //facei = id of the face { ScalarVar.boundaryField()[patchWall][facei] = VectorVar.boundaryField()[patchWall][facei].component(0) + VectorVar.boundaryField()[patchWall][facei].component(1) + VectorVar.boundaryField()[patchWall][facei].component(3); }``` Ps. I'm too lazy to write the magnitude formula.

can the function mag() do this conversion?

 April 17, 2013, 09:31 #6 Senior Member   HECKMANN Frédéric Join Date: Jul 2010 Posts: 237 Rep Power: 9 it might work, I don't know if the volume vector field has this member. You can write it and try to compile.

April 17, 2013, 20:07
#7
New Member

liuke
Join Date: Apr 2013
Posts: 20
Rep Power: 5
Quote:
 Originally Posted by fredo490 it might work, I don't know if the volume vector field has this member. You can write it and try to compile.

thank you !

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post latvietis OpenFOAM Running, Solving & CFD 1 March 20, 2012 12:19 lulo OpenFOAM 0 August 15, 2011 08:17 nimasam OpenFOAM 7 May 9, 2011 16:06 ARTem OpenFOAM Programming & Development 0 March 16, 2011 05:18

All times are GMT -4. The time now is 05:15.