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

Modifying Velocity Boundry Field

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 7, 2013, 17:11
Default Modifying Velocity Boundry Field
  #1
Member
 
Chris L
Join Date: Sep 2012
Posts: 33
Rep Power: 3
vbchris is on a distinguished road
Hi all,

I am looking for help with the following code problem.
I'd like the ability to adjust the boundary fields in code without using swak4foam.

I've added the following snippet of code to bubbleFoam (OF v2.0):
Code:
label outletPatchID = mesh.boundaryMesh().findPatchID("outletBottom");   
Ua.boundaryField()[outletPatchID] = Uabar/
                    gSum(
                    mesh.magSf().boundaryField()[outletPatchID] *
                    alpha.boundaryField()[outletPatchID]) / 
                    gSum(
                    mesh.magSf().boundaryField()[outletPatchID]
                    );


Info<< nl << "Corrected Boundry Velocity = " << 
                    Uabar/
                    gSum(
                    mesh.magSf().boundaryField()[outletPatchID] *
                    alpha.boundaryField()[outletPatchID]) / 
                    gSum(
                    mesh.magSf().boundaryField()[outletPatchID]
                    )
                    << endl;

Info<< "Current Boundry Field = " << endl << Ua.boundaryField()[outletPatchID] << nl << endl;
However it runs with the following console output:
Code:
Courant Number mean: 0.00492361038 max: 0.025444501
deltaT = 0.01

Corrected Boundry Velocity = (0 -0.144231961 0)
Current Boundry Field = 
type            fixedValue;
value           uniform (0 -0.05 0);
UaBar is a vector(0 -0.01 0)

I would have expected both the outputs for current/corrected boundary to be the same value. However, as the debug info shows Ua.boundryField[] doesn't change after I assign it a new value.

Any help would be appreciated.
vbchris is offline   Reply With Quote

Old   March 7, 2013, 17:21
Default
  #2
Member
 
Chris L
Join Date: Sep 2012
Posts: 33
Rep Power: 3
vbchris is on a distinguished road
Just as a follow-up

I was mimicking this snippet of code also found in bubbleFoam, which allows explicit declaration of boundry field values using the method .boundaryField()[patchi].

Code:
// PEqn.H snippit

    forAll(p.boundaryField(), patchi)
    {
        if (isA<zeroGradientFvPatchScalarField>(p.boundaryField()[patchi]))
        {
            phiDraga.boundaryField()[patchi] = 0.0;
            phiDragb.boundaryField()[patchi] = 0.0;
        }
    }
vbchris 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
A Question About Setting Whole Velocity Field Using "Proflie" in FLUENT adsl17754 FLUENT 4 Yesterday 07:42
dambreak tutorial's weird velocity field. sharonyue OpenFOAM 7 January 27, 2013 08:48
velocity field Faiz Ahmed Main CFD Forum 0 March 5, 2006 10:11
Variables Definition in CFX Solver 5.6 R P CFX 2 October 26, 2004 02:13
transient temperature field with constant velocity Törnquist CFX 0 September 16, 2003 04:22


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