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

How to use pressure to judge boundary conditions

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 7, 2022, 02:50
Default How to use pressure to judge boundary conditions
  #1
New Member
 
Join Date: May 2022
Posts: 2
Rep Power: 0
studentchen is on a distinguished road
Dear friends
I want use codestream to realize it,but the error : ‘p’ was not declared in this scope


Code:
type            fixedValue; 
	value           #codeStream
	{
	    codeInclude
            #{
              #include "fvCFD.H"
	      #include "pressureFvPatchScalarField.H"
            #};

           codeOptions
           #{
            -I$(LIB_SRC)/finiteVolume/lnInclude \
            -I$(LIB_SRC)/meshTools/lnInclude
           #};
	
	   codeLibs
           #{
            -lmeshTools \
            -lfiniteVolume
           #};
	   code
	#{
		const IOdictionary& d = static_cast<const IOdictionary&>
   	 	(
        	dict.parent().parent()
    		);
		const fvMesh& mesh = refCast<const fvMesh>(d.db());
		const label id = mesh.boundary().findPatchID("inlet");
		const fvPatch& patch = mesh.boundary()[id];
		scalarField TT(patch.size(), scalar(360));
		const volScalarField& p = mesh.lookupObject<volScalarField>("p"); //doen't work

		const scalar pcr=10e5*pow(2/(1.4+1),1.4/(1.4-1));

		forAll(TT, i)
		{
			
			if(p<10e5) 
			  {
				if(p<=pcr)
				        {
					TT[i]=360*pow(pcr/10e5,(1.4-1)/1.4);
					}
					else
					{
					TT[i]=360*pow(p/10e5,(1.4-1)/1.4);
					}
			  }
							
		else	  
			{
			TT[i]=TT[i];
			} 
		}
		writeEntry(os, "", TT);

	#};
	};
Could anyone give me some help?
Thanks a lot!
studentchen 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
Fail to converge when solving with a fabricated solution zizhou FLUENT 0 March 22, 2021 06:33
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 05:21
Basic Nozzle-Expander Design karmavatar CFX 20 March 20, 2016 08:44
Problem in setting Boundary Condition Madhatter92 CFX 12 January 12, 2016 04:39
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00


All times are GMT -4. The time now is 01:38.