CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

recompiling moveEngineMesh

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 15, 2013, 06:21
Default recompiling moveEngineMesh
  #1
New Member
 
klemen
Join Date: Aug 2012
Location: Slovenia
Posts: 21
Rep Power: 4
fogl is on a distinguished road
I would like to recompile the moveEngineMesh solver/utility. I made a copy and changed its name (to moveEngineMeshKD1), recompile and run. Everything went smooth. Then i also made a copy of engineMesh.H/C and changed its name to engineMeshKD1.H/C.

Then i did a small modification of my copy of engineMeshKD1.H/C - i changed the names of boundaries (pistonHead, linear and piston). I modified the #include line in the top of moveEngineMeshKD1.c to include the new modified file. I added the file path to options. I recompiled and then run. The new solver/utility showed an error:

--> FOAM FATAL ERROR:
cannot find piston patch
From function engineMesh::engineMesh(const IOobject& io)
in file engineMesh/engineMesh/engineMesh.C at line 79.
FOAM exiting


It seems my modified engineMeshKD1 was not included. I have no idea why is that. I did not include the engineMesh.h, i changed it to engineMeshKD1.h. Any idea what am i doing wrong? I attached the code changes below.

Regards,
Klemen


------------------ wmake ------------------
Making dependency list for source file moveEngineMeshKD1.C
SOURCE=moveEngineMeshKD1.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam220/src/finiteVolume/lnInclude -I/opt/openfoam220/src/engine/lnInclude -I/home/klemen/OpenFOAM/klemen-2.2.0/applications/utilities/engineMeshKD1 -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/moveEngineMeshKD1.o
g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam220/src/finiteVolume/lnInclude -I/opt/openfoam220/src/engine/lnInclude -I/home/klemen/OpenFOAM/klemen-2.2.0/applications/utilities/engineMeshKD1 -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linuxGccDPOpt/moveEngineMeshKD1.o -L/opt/openfoam220/platforms/linuxGccDPOpt/lib \
-lfiniteVolume -lengine -ldynamicMesh -lOpenFOAM -ldl -lm -o /home/klemen/OpenFOAM/klemen-2.2.0/platforms/linuxGccDPOpt/bin/moveEngineMeshKD1
klemen@klemen-VirtualBox:~/OpenFOAM/klemen-2.2.0/applications/utilities/moveEngineMeshKD1$

------------------ moveEngineMeshKD1 ------------------
#include "fvCFD.H"
#include "engineTime.H"
#include "engineMeshKD1.H" // CHANGE

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
# include "setRootCase.H"

# include "createEngineTime.H"
# include "createEngineMesh.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nStarting time loop\n" << endl;

while (runTime.loop())
{
Info<< "Time = " << runTime.theta() << " CA-deg\n" << endl;

mesh.move();

runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

Info<< "End\n" << endl;

return 0;
}


------------------ engineMeshKD1.c ------------------
#include "engineMeshKD1.H"
#include "dimensionedScalar.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
defineTypeNameAndDebug(engineMesh, 0);
defineRunTimeSelectionTable(engineMesh, IOobject);
}


// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

Foam::engineMesh::engineMesh(const IOobject& io)
:
fvMesh(io),
engineDB_(refCast<const engineTime>(time())),
pistonIndex_(-1),
linerIndex_(-1),
cylinderHeadIndex_(-1),
deckHeight_("deckHeight", dimLength, GREAT),
pistonPosition_("pistonPosition", dimLength, -GREAT)
{
bool foundPiston = false;
bool foundLiner = false;
bool foundCylinderHead = false;

forAll(boundary(), i)
{
if (boundary()[i].name() == "compPistonHead") // CHANGE
{
pistonIndex_ = i;
foundPiston = true;
}
else if (boundary()[i].name() == "compLiner") // CHANGE
{
linerIndex_ = i;
foundLiner = true;
}
else if (boundary()[i].name() == "compCylinderHead") // CHANGE
{
cylinderHeadIndex_ = i;
foundCylinderHead = true;
}
}

reduce(foundPiston, orOp<bool>());
reduce(foundLiner, orOp<bool>());
reduce(foundCylinderHead, orOp<bool>());

if (!foundPiston)
{
FatalErrorIn("KD: engineMesh::engineMesh(const IOobject& io)")
<< "KD cannot find patch"
<< exit(FatalError);
}

if (!foundLiner)
{
FatalErrorIn("KD: engineMesh::engineMesh(const IOobject& io)")
<< "KD cannot find patch"
<< exit(FatalError);
}

if (!foundCylinderHead)
{
FatalErrorIn("KD: engineMesh::engineMesh(const IOobject& io)")
<< "KD cannot find patch"
<< exit(FatalError);
}

{
if (pistonIndex_ != -1)
{
pistonPosition_.value() = -GREAT;
if (boundary()[pistonIndex_].patch().localPoints().size())
{
pistonPosition_.value() =
max(boundary()[pistonIndex_].patch().localPoints()).z();
}
}
reduce(pistonPosition_.value(), maxOp<scalar>());

if (cylinderHeadIndex_ != -1)
{
deckHeight_.value() = GREAT;
if (boundary()[cylinderHeadIndex_].patch().localPoints().size())
{
deckHeight_.value() = min
(
boundary()[cylinderHeadIndex_].patch().localPoints()
).z();
}
}
reduce(deckHeight_.value(), minOp<scalar>());

Info<< "deckHeight: " << deckHeight_.value() << nl
<< "piston position: " << pistonPosition_.value() << endl;
}
}


// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

Foam::engineMesh::~engineMesh()
{}
fogl 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
Problem in recompiling a turbulence model in OpenFoam 2.1.1 pascool OpenFOAM Programming & Development 6 October 3, 2012 13:03
adding a turbulence model without recompiling the core sebastianweiper OpenFOAM Programming & Development 2 February 19, 2011 15:04
Error encounterd while recompiling the solver m.maneshi OpenFOAM Running, Solving & CFD 0 October 21, 2010 17:17
Error in recompiling the solver m.maneshi OpenFOAM Running, Solving & CFD 0 August 28, 2010 15:14
Please help - error after recompiling thermophysical models Axel_T OpenFOAM 1 January 5, 2010 09:24


All times are GMT -4. The time now is 06:56.