CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

codedMixed condition - not applied

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By oswald

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 31, 2020, 08:11
Default codedMixed condition - not applied
  #1
New Member
 
S
Join Date: Jul 2020
Posts: 1
Rep Power: 0
s.blaise is on a distinguished road
Hi All,

I am trying to build a heat transfer case with chtMultiRegionSimpleFoam and use the codedMixed boundary condition below.

The code compiles fine and produces a .so. However, it seems that it is never called. The default refValue, refGradient and valueFraction are applied, and whatever I change in the code (provided that it compiles) does not affect the boundary value. None of my prints shows in the log.

Is there anything wrong with my boundary? The p boundary file has the following entry:
Code:
    Bottom
    {
    
    
        type codedMixed;
        refValue uniform 0;
        refGradient uniform 0;
        name hydrostaticBottomGradient;
        valueFraction uniform 1;
        code
        #{
            printMessage("CODED MIXED IN");
            Info << "CODED MIXED IN" <<  endl;    
            const fvPatch& boundaryPatch = patch();
            const fvBoundaryMesh& boundaryMesh = boundaryPatch.boundaryMesh();
            const fvMesh& mesh = boundaryMesh.mesh();
            const label patchid =  mesh.boundary().findPatchID(this->patch().name());
            const volScalarField& rho(mesh.lookupObject<volScalarField>("rho"));
            const auto& rhoPatchField = rho.boundaryField()[patchid];
            scalarField& val = this->refValue();
            scalarField& grad = this->refGrad();
            scalarField& frac = this->valueFraction();
            const vectorField& Cf = patch().Cf(); // Get centre coordinate (we don't use it actually);
            forAll(Cf, facei) // face loop
            {
                grad[facei] = 9.81 * rhoPatchField[facei];
                val[facei] = 200000.;
                frac[facei] = 1;
                Info << "Set val to: " << val[facei] << " for face " << facei <<  endl;

            }

        #};
        
    }
Thanks for any help!
s.blaise is offline   Reply With Quote

Old   September 3, 2020, 05:54
Default
  #2
Member
 
Join Date: Sep 2010
Location: Leipzig, Germany
Posts: 96
Rep Power: 16
oswald is on a distinguished road
Have you tried working with something like

Code:
this->refGrad() = 9.81 * rho.boundaryField()[patchid];
?


And at the moment you are prescribing a fixedValue only, meaning all values will be set to 200000. Is this intended? To use fixedGradient, you have to set valueFraction to 0.
parthigcar likes this.
oswald 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
CFX fails to calculate a diffuser pipe flow shenying0710 CFX 7 March 26, 2013 05:13
Boundary condition clarification shaswat CFX 1 April 8, 2012 05:06
Airfoil boundary condition Frank Main CFD Forum 1 April 21, 2008 19:36
Pressure Boundary Condition Matt Umbel Main CFD Forum 0 January 11, 2002 11:06
The Boundary Condition about the Flat Plate boing Main CFD Forum 1 January 6, 2002 17:53


All times are GMT -4. The time now is 19:02.