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

Accessing boundary patch face coordinates for codeStream BC

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 18, 2024, 08:22
Default Accessing boundary patch face coordinates for codeStream BC
  #1
New Member
 
talop
Join Date: Feb 2023
Posts: 8
Rep Power: 3
talop is on a distinguished road
Good day,

I am trying to simulate natural convection from a hot cavity in air using incompressible ideal gas model. Unfortunately, simulations crash or give unrealistic flow fields such as thin jets of air flowing in from the outlet patch. I think the initial pressure field "p" is the suspect and managed to initialize the internal field with hydrostatic effects (p = p_ref + rho*delta_h). The gravity acts along the -y direction.

For the boundary patches, I have tried the following BC:

Code:
outlet_1
{
    type            calculated;	
    value           #codeStream
    {
         codeInclude
         #{ #include "fvCFD.H" #};

         codeOptions
         #{
               -I$(LIB_SRC)/finiteVolume/lnInclude \
               -I$(LIB_SRC)/meshTools/lnInclude
         #};

         //libs needed to visualize BC in paraview
         codeLibs
         #{
               -lmeshTools \
               -lfiniteVolume
          #};

         code
         #{     
                const IOdictionary& d = static_cast<const IOdictionary&>
		(
                    dict.parent().parent()                  
                );
                const fvMesh& mesh = refCast<const fvMesh>(d.db());
                // const surfaceVectorField& Cf = mesh.Cf(); 				
			
		const label id_o1 = mesh.boundary().findPatchID("outlet_1");
                const fvPatch& patch_o1 = mesh.boundary()[id_o1];
                const vectorField& Cf= patch_o1.Cf();				
                
		scalarField p_Outlet_1(patch_o1.size(), 100000.0);

                scalar p_Atm   = 100000.0;
	        scalar rho_Atm = 1.3772; // = 100000/(287*253)
	        scalar delta_h = 0.8;	
                
                forAll(p_Outlet_1, j)
		{
         	    const scalar y = Cf()[j][1];
                    p_Outlet_1[j] = p_Atm + (delta_h - y)*rho_Atm*9.81;
                }
				
                writeEntry(os,"", p_Outlet_1);
        #};
    };	
}
Then running decomposePar or buoyantFoam gives "error: no match for call to ..." from the line
Code:
const scalar y = Cf()[j][1];
Another minor issue is that I am unable to loop over the patch names so I wrote similar codedStream BCs for all 12 patches seperately. The 0/p file became large ~650 lines.

Running the code for one patch and initializing the others as type calculated and value uniform 100000.0 did not change the problem.

I am using OpenFOAM v10 (from the foundation)
Attached Files
File Type: zip p.zip (1.9 KB, 1 views)
talop is offline   Reply With Quote

Reply

Tags
boundary condition, codedstream, face center coordinate


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
[snappyHexMesh] sHM layer process keeps getting killed MBttR OpenFOAM Meshing & Mesh Conversion 4 August 15, 2016 04:21
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 19:57
[blockMesh] non-orthogonal faces and incorrect orientation? nennbs OpenFOAM Meshing & Mesh Conversion 7 April 17, 2013 06:42
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 06:50
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


All times are GMT -4. The time now is 08:55.