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

Problems about compile my own k-epsilon model

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 24, 2014, 06:46
Default Problems about compile my own k-epsilon model
  #1
COC
New Member
 
tim
Join Date: Jul 2013
Posts: 5
Rep Power: 5
COC is on a distinguished road
Hello

I'm a beginner of OF, I am doing some simulation about car. When I want to add a extra term to calculate the mesh near car boundary, then I tried to use the code as follows to compile.
Code:
 aic_ = dimensionedScalar("aic",aic_.dimensions(),0.0);
    forAll(mesh_.boundaryMesh(), patchI)
    {
        const polyPatch& meshPatch = mesh_.boundaryMesh()[patchI];
        if(meshPatch.name==“traffic”)
        {
            fvPatchScalarField& aicPf = aic_.boundaryField()[patchI];
            const fvsPatchScalarField& magSfPf = mesh_.magSf().boundaryField()[patchI];
            const labelList& pfaceCells = mesh_.boundary()[patchI].faceCells();
            if(!isA<emptyPolyPatch>(meshPatch) && !mesh_.magSf().boundaryField()[patchI].coupled()) 
            {
                const labelList& pfaceCells = mesh_.boundary()[patchI].faceCells();               
                forAll(meshPatch, pfaceI)
                {
                    scalar prj=magSfPf[pfaceI]/mesh_.V()[pfaceCells[pfaceI]];
                    aic_[pfaceCells[pfaceI]]=prj;
                    aicPf[pfaceI]=prj;
                }
            }
        }
    }
Then I got this error message

Code:
SOURCE=mykEpsilon/mykEpsilon.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/usr6/13M29408/OpenFOAM/OpenFOAM-2.0.1/src/turbulenceModels -I/home/usr6/13M29408/OpenFOAM/OpenFOAM-2.0.1/src/transportModels -I/home/usr6/13M29408/OpenFOAM/OpenFOAM-2.0.1/src/finiteVolume/lnInclude -I/home/usr6/13M29408/OpenFOAM/OpenFOAM-2.0.1/src/meshTools/lnInclude -IlnInclude -I. -I/home/usr6/13M29408/OpenFOAM/OpenFOAM-2.0.1/src/OpenFOAM/lnInclude -I/home/usr6/13M29408/OpenFOAM/OpenFOAM-2.0.1/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/mykEpsilon.o
mykEpsilon/mykEpsilon.C:342: error: stray ‘\342’ in program
mykEpsilon/mykEpsilon.C:342: error: stray ‘\200’ in program
mykEpsilon/mykEpsilon.C:342: error: stray ‘\234’ in program
mykEpsilon/mykEpsilon.C:342: error: stray ‘\342’ in program
mykEpsilon/mykEpsilon.C:342: error: stray ‘\200’ in program
mykEpsilon/mykEpsilon.C:342: error: stray ‘\235’ in program
mykEpsilon/mykEpsilon.H: In constructor ‘Foam::incompressible::RASModels::mykEpsilon::mykEpsilon(const Foam::volVectorField&, const Foam::surfaceScalarField&, Foam::transportModel&, const Foam::word&, const Foam::word&)’:
mykEpsilon/mykEpsilon.H:92: warning: ‘Foam::incompressible::RASModels::mykEpsilon::Fic_’ will be initialized after
mykEpsilon/mykEpsilon.H:87: warning:   ‘Foam::volScalarField Foam::incompressible::RASModels::mykEpsilon::nut_’
mykEpsilon/mykEpsilon.C:54: warning:   when initialized here
mykEpsilon/mykEpsilon.C: In member function ‘virtual void Foam::incompressible::RASModels::mykEpsilon::correct()’:
mykEpsilon/mykEpsilon.C:342: error: ‘traffic’ was not declared in this scope
mykEpsilon/mykEpsilon.C:346: warning: unused variable ‘pfaceCells’
make: *** [Make/linux64GccDPOpt/mykEpsilon.o] Error 1
I think I should define 'traffic'. but I don't know the code to solve this problem.
Anyone can help me ?
Thanks!
Best Regards.
COC is offline   Reply With Quote

Old   November 24, 2014, 07:00
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,590
Rep Power: 26
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

Quotes around traffic look strange (looks like you've copy-pasted them from web, where they were typographically transformed from straight quotes to opening and closing), so compiler thinks "traffic" is not a string but variable inside strange symbols (about which it complains with "mykEpsilon/mykEpsilon.C:342: error: stray ‘\342’ in program"). So change this typographic quotes to ordinary ones.
alexeym is offline   Reply With Quote

Old   November 24, 2014, 07:25
Default
  #3
COC
New Member
 
tim
Join Date: Jul 2013
Posts: 5
Rep Power: 5
COC is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,

Quotes around traffic look strange (looks like you've copy-pasted them from web, where they were typographically transformed from straight quotes to opening and closing), so compiler thinks "traffic" is not a string but variable inside strange symbols (about which it complains with "mykEpsilon/mykEpsilon.C:342: error: stray ‘\342’ in program"). So change this typographic quotes to ordinary ones.
Hi

Thank you very much. The ordinary code is
Code:
forAll(mesh_.boundaryMesh(), patchI)
    {
        fvPatchScalarField& aicPf = aic_.boundaryField()[patchI];
        const polyPatch& meshPatch = mesh_.boundaryMesh()[patchI];
        const fvsPatchScalarField& magSfPf = mesh_.magSf().boundaryField()[patchI];
        const labelList& pfaceCells = mesh_.boundary()[patchI].faceCells();

        if(!isA<emptyPolyPatch>(meshPatch) && !mesh_.magSf().boundaryField()[patchI].coupled()) 
        {
            const labelList& pfaceCells = mesh_.boundary()[patchI].faceCells();               
            forAll(meshPatch, pfaceI)
            {
                scalar prj=magSfPf[pfaceI]/mesh_.V()[pfaceCells[pfaceI]];
                aic_[pfaceCells[pfaceI]]=prj;
                aicPf[pfaceI]=prj;
            }
        }
    }
I just want to use this code for 'traffic' boundary, so I add
Code:
 if(meshPatch.name==“traffic”)
to direct. my question is how to define the traffic boundary to let the compiler discriminate ?

Thanks!
COC is offline   Reply With Quote

Old   November 24, 2014, 07:43
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,590
Rep Power: 26
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

as I said, this

Code:
if(meshPatch.name==“traffic”)
should be

Code:
if(meshPatch.name=="traffic")
Also instead of manually iterating over patch names, you can use findPatchID(http://foam.sourceforge.net/docs/cpp...c972523ac09e94) method of boundary mesh object, to find ID of the patch by its name, and then use that ID to get constant reference to the patch object.
alexeym is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
K - epsilon VS SST turbulence model Maicol Main CFD Forum 0 November 30, 2012 17:25
Help regarding K Epsilon model go2saqi Main CFD Forum 2 January 23, 2012 12:59
Turbulence Model Problems ttlg FLUENT 3 May 3, 2010 04:26
k epsilon model constants for specific application Flavio Main CFD Forum 0 February 5, 2009 05:43
How to define Epsilon in RSM model? David FLUENT 0 March 17, 2004 10:39


All times are GMT -4. The time now is 12:15.