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

Help with linear boundary condition

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 14, 2024, 09:56
Question Help with linear boundary condition
  #1
New Member
 
Mateus Marques Brainer
Join Date: Mar 2024
Posts: 2
Rep Power: 0
mat_brain is on a distinguished road
Hello, everyone.
I'm new to OpenFOAM and i'm trying to make a linear function as a boundary condition, something like
T = 100 - x
I tried this, but it doesn't work:
Code:
patch1
{
        type            fixedValue;
	value           #codeStream
	{
		codeInclude	#{
			#include "fvModels.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("patch1");								
			const fvPatch& patch = mesh.boundary()[id];											
			scalarField T(patch.size(), 0.);													
								
			forAll(T, i)																		
			{
				const scalar x = patch.Cf()[i].x();												
									
				T[i] = 100 - x; 																
			}
								
			writeEntry(os, "", T);
		#};
	};
}
It's probably very simple, but i don't know what's wrong with that.
I'm looking for a cube with 2 faces with fixed values: 100 and 0 and the lateral faces using this function.
Any help is welcome.
mat_brain is offline   Reply With Quote

Reply

Tags
boundary condition, openfoam 11


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
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
Optimal tolerance and variables scaling settings 4513645ygq Main CFD Forum 0 July 28, 2020 09:56
Basic Nozzle-Expander Design karmavatar CFX 20 March 20, 2016 09:44
Radiation interface hinca CFX 15 January 26, 2014 18:11
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 08:00


All times are GMT -4. The time now is 13:35.