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

Decomposing a codeStream BC gives token error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 11, 2022, 10:42
Default Decomposing a codeStream BC gives token error
  #1
New Member
 
Dan Padrao
Join Date: Jun 2020
Posts: 14
Rep Power: 6
DanPad07 is on a distinguished road
Hi Foamers,

I've got an interesting problem. I want to implement a non-uniform heat flux to the surface of my model to heat up the fluid. To do this, I used a codeStream, with an excerpt of the changeDictionary dict shown below:

Code:
T
{
    internalField   uniform 323;

    boundaryField
    {
        ".*"
        {
            type            zeroGradient;
            value           $internalField;
        }
        "procBoundary.*"
        {
            type            processor;
        }
        "block_to_.*"
        {
            type            compressible::turbulentTemperatureCoupledBaffleMixed;
            Tnbr            T;
            kappaMethod     solidThermo;
            value           $internalField;
        }
		"maxZ"
		{
			type            externalWallHeatFluxTemperature;
			mode            flux;
			q               nonuniform #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()
								); // access current directory
								
								const fvMesh& mesh = refCast<const fvMesh>(d.db()); // access mesh database
								const label id = mesh.boundary().findPatchID("maxZ"); // label id of patch
								const fvPatch& boundaryPatch = mesh.boundary()[id]; // access boundary mesh information using label id
								const vectorField& Cf = boundaryPatch.Cf(); // access coordinates of cells
								scalarField q(boundaryPatch.size(), 0); // initialise q field
								
								const scalar c0 = 0.015; // definition of the centre x coordinate
								const scalar c1 = 0.045; // definition of the centre y coordinate
								const scalar rpipe = 0.015;
								const scalar Qeff = 1e6; // Effective incident heat flux (W/m2)
								
								forAll(Cf, faceI) // loop over all the patch faces
								{
									scalar x = Cf[faceI].x(); // x coordinate of the faces i
									scalar y = Cf[faceI].y(); // y coordinate of the faces i
									scalar radius = pow(pow(x-c0,2)+pow(y-c1,2), 0.5); // compute radius on face i.
									
									q[faceI] = scalar ( Qeff*(0.5+pow(radius/rpipe,2)) ); // define heat flux value value on the face i. This is a test equation.
								}
								
								os << q;
							#};
			};
			thicknessLayers ();
			kappaLayers     ();
			kappaMethod     solidThermo;
			value           $internalField;
		}
    }
}
When solving the model in series it works fine. The issue is if I want to use multiple processors, where I get the following error when decomposing the mesh prior to using the solver:

Code:
Number of processor faces = 81286
Max number of cells = 24355 (21.72641087% above average 20007.98333)
Max number of processor patches = 6 (48.76033058% above average 4.033333333)
Max number of faces between processors = 3552 (31.09268509% above average 2709.533333)

Time = 0
Using #codeStream at line 53 in file "/Specimen_1p00/parallel/0/block/T.boundaryField.maxZ"
Using #codeStream with "/Specimen_1p00/parallel/dynamicCode/platforms/linux64Gcc63DPInt32Opt/lib/libcodeStream_7d92f667a36b3b9d505ee89b569a984a51b7824e.so"


--> FOAM FATAL IO ERROR: 

    token following 'nonuniform' is not a compound
    on patch maxZ of field T in file "/Specimen_1p00/parallel/0/block/T"

file: /Specimen_1p00/parallel/0/block/T.boundaryField.maxZ

    From function Foam::genericFvPatchField<Type>::genericFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = double]
    in file genericFvPatchField/genericFvPatchField.C at line 117.

FOAM exiting
I've tried removing nonuniform, but then the heat flux is not applied to the model. I've tried adding List<scalar> and other variations but to no avail. Does anyone have any tips or can catch out an error? I'm currently using OpenFOAM v1812.

Thanks in advance!
DanPad07 is offline   Reply With Quote

Old   May 19, 2024, 12:15
Default
  #2
New Member
 
Yueyun Xi
Join Date: Nov 2022
Posts: 14
Rep Power: 4
yueyun is on a distinguished road
Hi Dan,

I am using OF10 and I just encountered the same problem. I am afraid this reply is too late but I hope it could be helpful for others having the same problem.

I think this is because the write function of a scalarList has a different behavior. For example, if we print a scalarList, we get "n (a0 a1 ... an-1)". While if we print a vectorList, we get "List<vector> n (v0 v1 .. vn-1)".

So, please try to replace the "os << " nonuniform " << q;" with "os << " nonuniform List<scalar> " << q;" in your codeStream.

Best wishes,
Yueyun
yueyun is offline   Reply With Quote

Reply

Tags
codestream, parallel, tokenerror


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
long error when using make-install SU2_AD. tomp1993 SU2 Installation 3 March 17, 2018 07:25
error compiling modified applications yvyan OpenFOAM Programming & Development 21 March 1, 2016 05:53
OpenFOAM without MPI kokizzu OpenFOAM Installation 4 May 26, 2014 10:17
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50
Compiling problems with hello worldC fw407 OpenFOAM Installation 21 January 6, 2008 18:38


All times are GMT -4. The time now is 05:34.