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

Error in codeStream @ openFoam v10

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By Tobermory
  • 1 Post By Tobermory
  • 1 Post By Mohammadmz

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 16, 2023, 16:10
Smile Error in codeStream @ openFoam v10
  #1
New Member
 
Mohammad Mesgar
Join Date: Jul 2021
Posts: 13
Rep Power: 5
Mohammadmz is on a distinguished road
Hi

I have error in codeStream at openFoam v10

Error:

error: ‘Foam::scalarField’ {aka ‘class Foam::Field<double>’} has no
member named ‘writeEntry’
make: *** [/opt/openfoam10/wmake/rules/General/transform:26:
Make/linux64GccDPInt32Opt/codeStreamTemplate.o] Error 1

I searched it, this error about syntax of "writeEntry()", this syntax is changed in new versions but i can't found it.

please help me to solve it.

Last edited by Mohammadmz; February 17, 2023 at 02:36.
Mohammadmz is offline   Reply With Quote

Old   February 18, 2023, 03:24
Default
  #2
New Member
 
Mohammad Mesgar
Join Date: Jul 2021
Posts: 13
Rep Power: 5
Mohammadmz is on a distinguished road
please help me. i need it.
Mohammadmz is offline   Reply With Quote

Old   February 18, 2023, 07:29
Default
  #3
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 745
Rep Power: 14
Tobermory will become famous soon enough
It's difficult, my friend, to help you without more information! Please attach the codestream and then we can maybe comment?
Mohammadmz likes this.
Tobermory is offline   Reply With Quote

Old   February 19, 2023, 08:38
Default the codeStream, inlet in boundaryField
  #4
New Member
 
Mohammad Mesgar
Join Date: Jul 2021
Posts: 13
Rep Power: 5
Mohammadmz is on a distinguished road
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 10
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object alpha.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 0 0 0 0 0 0];

internalField uniform 0;

boundaryField
{

inlet
{
type fixedValue;
value #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("inlet");
const fvPatch& patch = mesh.boundary()[id];
scalarField a(patch.size(), scalar(0));
const scalar h = 3;
forAll(a, i) //equivalent to for (int i=0; patch.size()<i; i++)
{
const scalar z = patch.Cf()[i][2];
if(z<h)
a[i] = scalar(1);
}
a.writeEntry("", os);
#};
};
}
outlet
{
type zeroGradient;
}
cylinder
{
type zeroGradient;
}
walls
{
type zeroGradient;
}
bed
{
type zeroGradient;
}
atm
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
}

// ************************************************** *********************** //
Mohammadmz is offline   Reply With Quote

Old   February 20, 2023, 04:45
Default
  #5
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 745
Rep Power: 14
Tobermory will become famous soon enough
Check your syntax: I think that the correct writeEntry method is in dictionaryTemplates.C (line 210 - you can find this by using Doxygen and seraching on the overloaded method version with the right parameters):

Code:
 template<class EntryType>
 void Foam::writeEntry
 (
     Ostream& os,
     const word& entryName,
     const EntryType& value
 )
 {
     writeKeyword(os, entryName);
     writeEntry(os, value);
     os << token::END_STATEMENT << endl;
 }
and the call to it should be written as:
Code:
writeEntry(os, "", a);
Try this instead, and see if it compiles.
Mohammadmz likes this.
Tobermory is offline   Reply With Quote

Old   February 22, 2023, 02:24
Default
  #6
New Member
 
Mohammad Mesgar
Join Date: Jul 2021
Posts: 13
Rep Power: 5
Mohammadmz is on a distinguished road
It solved.
Thanks & Regards.
Tobermory likes this.
Mohammadmz is offline   Reply With Quote

Reply

Tags
codestream, openfoam


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
Frequently Asked Questions about Installing OpenFOAM wyldckat OpenFOAM Installation 3 November 14, 2023 12:58
How to develop OpenFOAM with CMake and popular IDEs cosscholar OpenFOAM Programming & Development 0 March 16, 2022 16:17
Solvers in OpenFOAM for LES + heat transfer arun1994 Main CFD Forum 1 November 26, 2021 08:57
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 cfd.direct OpenFOAM Announcements from Other Sources 2 August 31, 2015 14:36
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 19:07


All times are GMT -4. The time now is 11:04.