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

problem when decomposing the velocity flux according to the x, y and z directions..

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 24, 2011, 06:48
Default [solved]problem when decomposing velocity flux according to the x, y and z directions
  #1
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18
Cyp is on a distinguished road
Hi!

I would like to decompose the velocity flux phi into 3 flux, one for each direction:

Code:
phi = phi_x + phi_y + phi_z
To do that, I defined phi_x, phi_y and phi_z as:
Code:
surfaceScalarField phi_x = linearInterpolate(U.component(vector::X)*vector(1,0,0)) & mesh.Sf();
surfaceScalarField phi_y = linearInterpolate(U.component(vector::Y)*vector(0,1,0)) & mesh.Sf();
surfaceScalarField phi_z = linearInterpolate(U.component(vector::Z)*vector(0,0,1)) & mesh.Sf();
Then I update these fields at each time step with the above definition. However, the field
Code:
phiTest = phi - (phi_x+phi_y+phi_z)
is not equal to "zero". Which (I suppose) yields in divergence for my applications...

Is someone know how to do such a thing ?

I was wondering is there is a way to get these fields from the fvScalarMatrix pEqn exactly in the same manner we update the phi flux field :
In OpenFOAM, we get the phi flux from the pEqn matrix:
Code:
fvScalarMatrix pEqn
(
    fvm::laplacian(-M,p)
);
pEqn.setReference (....);
pEqn.solve();
phi = pEqn.flux();
I was wondering is there is a way to get these fields (phi_x, phi_y, phi_z) from the fvScalarMatrix pEqn in similar manner ??

Best regards,
Cyp

PS: in my example, M is a volTensorField

Last edited by Cyp; January 25, 2011 at 06:33.
Cyp is offline   Reply With Quote

Old   January 24, 2011, 15:46
Default
  #2
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18
Cyp is on a distinguished road
I found a solution : from phi = pEqn.flux() I can create phix, phiy and phiz.


First, I defined a flux phi_ex with 1 on the faces concerning x and 0 elsewhere. I can create this flux with this snippet:

Code:
    volVectorField E
    (
        IOobject
        (
            "E",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh,
       dimensionedVector ("E",dimensionSet(0,0,0,0,0),vector::zero)
    );
    E = vector(1,0,0);
    surfaceScalarField phi_ex = linearInterpolate(E) & mesh.Sf() / mesh.magSf();
then I can get phix from phi using :
Code:
phix = phi * phi_ex;
And I repeat the operation for y and z.

However, I still have problem on my outlet BC....
Cyp is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Velocity profiles problem behind the elbow (3D problem) kabat73 FLUENT 8 May 9, 2010 05:26
Plot a graph of velocity & boundary condition problem wanie Fluent UDF and Scheme Programming 0 December 11, 2009 11:40
Multi step transient UDF velocity profile problem William177 FLUENT 1 February 3, 2008 07:47
unsteady state velocity problem Vedavyasa M FLUENT 0 June 28, 2007 07:33
problem for UDF velocity Geremi FLUENT 0 April 19, 2005 03:13


All times are GMT -4. The time now is 09:49.