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

Modifying Velocity Boundry Field

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 7, 2013, 17:11
Default Modifying Velocity Boundry Field
  #1
Member
 
Chris L
Join Date: Sep 2012
Posts: 53
Rep Power: 13
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: 53
Rep Power: 13
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


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
A Question About Setting Whole Velocity Field Using "Proflie" in FLUENT adsl17754 FLUENT 5 July 31, 2018 04:29
dambreak tutorial's weird velocity field. sharonyue OpenFOAM 8 October 18, 2016 14:57
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 06:42.