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

codeStream cannot perform

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 8, 2022, 07:59
Default codeStream cannot perform
  #1
New Member
 
mill
Join Date: Feb 2021
Posts: 9
Rep Power: 5
mill is on a distinguished road
Hi, All
I want to set denisty varying with depth. I use codeStream in the 0/alpha.water.org.Then I meet this error ,how can I fixed this problem.

Code:
Using #codeStream at line 18 in file "/home/zhang/OpenFOAM/zhang-9/run/ISWtp24Exchange_con/0/alpha.water"
Using #codeStream with "/home/zhang/OpenFOAM/zhang-9/run/ISWtp24Exchange_con/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_fa6bcb9352550c3007ffd513d48777a6a88042f2.so"
Creating new library in "dynamicCode/_fa6bcb9352550c3007ffd513d48777a6a88042f2/platforms/linux64GccDPInt32Opt/lib/libcodeStream_fa6bcb9352550c3007ffd513d48777a6a88042f2.so"
"/home/zhang/OpenFOAM/OpenFOAM-9/etc/codeTemplates/dynamicCode/codeStreamTemplate.C" "/home/zhang/OpenFOAM/zhang-9/run/ISWtp24Exchange_con/dynamicCode/_fa6bcb9352550c3007ffd513d48777a6a88042f2/codeStreamTemplate.C"
Invoking "wmake -s libso /home/zhang/OpenFOAM/zhang-9/run/ISWtp24Exchange_con/dynamicCode/_fa6bcb9352550c3007ffd513d48777a6a88042f2"
wmake libso /home/zhang/OpenFOAM/zhang-9/run/ISWtp24Exchange_con/dynamicCode/_fa6bcb9352550c3007ffd513d48777a6a88042f2
    ln: ./lnInclude
    wmkdep: codeStreamTemplate.C
    Ctoo: codeStreamTemplate.C
    ld: /home/zhang/OpenFOAM/zhang-9/run/ISWtp24Exchange_con/dynamicCode/_fa6bcb9352550c3007ffd513d48777a6a88042f2/../platforms/linux64GccDPInt32Opt/lib/libcodeStream_fa6bcb9352550c3007ffd513d48777a6a88042f2.so
codeStream : dictionary:"/home/zhang/OpenFOAM/zhang-9/run/ISWtp24Exchange_con/0/alpha.water" master-only-reading:0

on processor 0 have masterSize:181672 and localSize:181672

on processor 0 after waiting: have masterSize:181672 and localSize:181672
Opening cached dictionary:"/home/zhang/OpenFOAM/zhang-9/run/ISWtp24Exchange_con/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_fa6bcb9352550c3007ffd513d48777a6a88042f2.so"
codeStream : dictionary:"/home/zhang/OpenFOAM/zhang-9/run/ISWtp24Exchange_con/0/alpha.water" master-only-reading:0


--> FOAM FATAL IO ERROR: 
expected keyword 'uniform' or 'nonuniform', found codeInclude

file: /home/zhang/OpenFOAM/zhang-9/run/ISWtp24Exchange_con/0/alpha.water from line 15 to line 35.

    From function Foam::Field<Type>::Field(const Foam::word&, const Foam::dictionary&, Foam::label) [with Type = double; Foam::label = int]
    in file /home/zhang/OpenFOAM/OpenFOAM-9/src/OpenFOAM/lnInclude/Field.C at line 218.

FOAM exiting

the code is

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       volScalarField;
    object      alpha.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions      [0 0 0 0 0 0 0];


internalField #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);
		const fvMesh& mesh = refCast<const fvMesh>(d.db());
		scalerField alpha(mesh.nCells(), 0);
		
		scaler h1 = 0.24;//
		scaler h2 = 0.4;//
		scaler ht = 0.48;//
		scaler delta = 0.01;//
		forAll(alpha,i)
		{
			const scaler x = mesh.C()[i][0];
			const scaler y = mesh.C()[i][1];
			const scaler z = mesh.C()[i][2];
		
			if (x <= 0.4)
			{
				alpha[i] = 0.5 - 0.5*tanh(( -ht + y + h1)/delta);
			}
			else
			{
				alpha[i] = 0.5 - 0.5*tanh(( -ht + y + h2)/delta);
			}
		}
		//alpha.write();//
		writeEntry(os, "",alpha);
		
	#};
	}	
}



boundaryField
{
    leftWall
    {
        type            zeroGradient;
    }

    rightWall
    {
        type            zeroGradient;
    }

    lowerWall
    {
        type            zeroGradient;
    }
    
    upWall
    {
        type            zeroGradient;
    }
    

    defaultFaces
    {
        type            empty;
    }
}





// ************************************************************************* //
mill is offline   Reply With Quote

Old   July 8, 2022, 09:55
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
You have a stray '}' that will be a problem.
For this type of setup, it would make much more sense to use setFields or setExprField as a pre-processing step.
olesen is offline   Reply With Quote

Old   July 10, 2022, 23:28
Default
  #3
New Member
 
mill
Join Date: Feb 2021
Posts: 9
Rep Power: 5
mill is on a distinguished road
Quote:
Originally Posted by olesen View Post
You have a stray '}' that will be a problem.
For this type of setup, it would make much more sense to use setFields or setExprField as a pre-processing step.
Thank you for your reply.This is not the main problem. After check the code,i find the error caused by the wrong word.It's "scalar" instead of "scaler".

Thank you!
mill is offline   Reply With Quote

Reply

Tags
codestream;setfields


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
OF9, Error after #codeStream internalField Dicanic OpenFOAM 18 July 13, 2024 11:16
CodeStream Error EzgiCFD OpenFOAM Running, Solving & CFD 0 January 31, 2022 13:38
PROBLEMS DEFINING A LIST USING #CODESTREAM !! Help please !! angatri_14 OpenFOAM Programming & Development 1 August 21, 2020 17:16
Read .csv ffile in codeStream Akshay_11235 OpenFOAM Running, Solving & CFD 0 December 22, 2018 19:02
How to create the internalField with #codeStream chun OpenFOAM Running, Solving & CFD 3 May 6, 2017 10:35


All times are GMT -4. The time now is 20:54.