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

coded average in mappedPatch

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By PanPeter

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 30, 2018, 08:25
Default coded average in mappedPatch
  #1
Member
 
Fynn
Join Date: Feb 2016
Posts: 48
Rep Power: 10
PanPeter is on a distinguished road
Hi,

I interested in the flow- and heat distribution in a channel and fail to map the temperature back to the inlet.
The flow field is periodic, the pressure drops and the temperature increases downstream (channel wall heating).

These are my boundary conditions:
Inlet:
U=mapped U(outlet)
p=zeroGradient
T=mapped T(outlet), average = f(T(outlet))
Outlet:
U=zeroGradient
p=zeroGradient, reference pressure set at some face
T=zeroGradient
The temperature field is not periodic because of its build-up along the wall. But as described in http://heattransfer.asmedigitalcolle...icleid=1436662, the dimensionless temperature
\Theta=\frac{T(x,y)-T_w}{T_x^*-T_w}
is periodic. T_w, T_x^* are the constant wall temperature and a local reference temperature, respectively.

Now, I want to map the profile, while setting the average such that the dimensionless temperature is kept constant.
- I thought of using swak but it doesn't look like direct mapping and averaging is supported.
- So I thought of codeStreams next, to return an expression for the average option in the mapped BC. In the attached temperature BC for the inlet a dummy value is returned in the forth-last line. The problem arises already in the fith-last line. I'm looking up a patchField of the outlet temperature. Here the program crashes with the error message hanging pointer at index 1 (size 10), cannot dereference.
Does anybody have an idea what went wrong here or how this could be fixed?
Cheers
Fynn

Code:
 X0
    {
	type                mapped;
        value               uniform 0.01;
        interpolationScheme cell;
        setAverage          true;
        average             #codeStream
	{
	    codeInclude
		#{
			#include "fvCFD.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("X1");
	        const fvPatch& patch = mesh.boundary()[id];
	    	const fvPatchScalarField& T = patch.lookupPatchField<volScalarField, scalar>("T");
		os<<0.0027;                       //dummy value
		#};
	};
    }
fumiya and BlnPhoenix like this.
PanPeter is offline   Reply With Quote

Reply

Tags
averaging, codestream, mappedpatch


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
y+ and u+ values with low-Re RANS turbulence models: utility + testcase florian_krause OpenFOAM 114 August 23, 2023 06:37
Floating point exception error Alan OpenFOAM Running, Solving & CFD 11 July 1, 2021 22:51
How to obtain turbulent kinetic energy data from LES model of Ansys CFX? rsin CFX 19 December 29, 2018 05:43
Near wall treatment in k-omega SST Arnoldinho OpenFOAM Running, Solving & CFD 38 March 8, 2017 14:48
coded function object and field average matthias OpenFOAM Post-Processing 3 June 30, 2014 05:52


All times are GMT -4. The time now is 16:00.