CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

surfaceVectorField

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 16, 2013, 07:39
Default surfaceVectorField
  #1
New Member
 
liuke
Join Date: Apr 2013
Posts: 17
Rep Power: 3
liuke870915 is on a distinguished road
how to transformed a surfaceVectorField variable into volVectorField variable .
or transformed a surfaceVectorField variable into surfaceScalarField variable
liuke870915 is offline   Reply With Quote

Old   April 16, 2013, 09:41
Default
  #2
Senior Member
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 162
Rep Power: 6
fumiya is on a distinguished road
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
fumiya is offline   Reply With Quote

Old   April 16, 2013, 13:23
Default
  #3
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 235
Rep Power: 7
fredo490 is on a distinguished road
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.
fredo490 is offline   Reply With Quote

Old   April 17, 2013, 09:12
Smile to fumiya
  #4
New Member
 
liuke
Join Date: Apr 2013
Posts: 17
Rep Power: 3
liuke870915 is on a distinguished road
Quote:
Originally Posted by fumiya View Post
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.
liuke870915 is offline   Reply With Quote

Old   April 17, 2013, 09:15
Default to fredo490
  #5
New Member
 
liuke
Join Date: Apr 2013
Posts: 17
Rep Power: 3
liuke870915 is on a distinguished road
Quote:
Originally Posted by fredo490 View Post
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?
liuke870915 is offline   Reply With Quote

Old   April 17, 2013, 10:31
Default
  #6
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 235
Rep Power: 7
fredo490 is on a distinguished road
it might work, I don't know if the volume vector field has this member. You can write it and try to compile.
fredo490 is offline   Reply With Quote

Old   April 17, 2013, 21:07
Default
  #7
New Member
 
liuke
Join Date: Apr 2013
Posts: 17
Rep Power: 3
liuke870915 is on a distinguished road
Quote:
Originally Posted by fredo490 View Post
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 !
liuke870915 is offline   Reply With Quote

Reply

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
volVectorField -> surfaceVectorField latvietis OpenFOAM Running, Solving & CFD 1 March 20, 2012 13:19
surfaceVectorField lulo OpenFOAM 0 August 15, 2011 09:17
laplacian nimasam OpenFOAM 7 May 9, 2011 17:06
fvc::div for surfaceVectorField ARTem OpenFOAM Programming & Development 0 March 16, 2011 06:18


All times are GMT -4. The time now is 08:29.