CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   surfaceVectorField (http://www.cfd-online.com/Forums/openfoam-programming-development/116266-surfacevectorfield.html)

liuke870915 April 16, 2013 06:39

surfaceVectorField
 
:confused: how to transformed a surfaceVectorField variable into volVectorField variable .
or transformed a surfaceVectorField variable into surfaceScalarField variable

fumiya April 16, 2013 08:41

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

fredo490 April 16, 2013 12:23

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.

liuke870915 April 17, 2013 08:12

to fumiya
 
Quote:

Originally Posted by fumiya (Post 420911)
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 April 17, 2013 08:15

to fredo490
 
Quote:

Originally Posted by fredo490 (Post 421001)
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.


:confused: can the function mag() do this conversion?

fredo490 April 17, 2013 09:31

it might work, I don't know if the volume vector field has this member. You can write it and try to compile.

liuke870915 April 17, 2013 20:07

Quote:

Originally Posted by fredo490 (Post 421236)
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 !:)


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