CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   dieselEngineDyMFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/83668-dieselenginedymfoam.html)

Peter_600 January 6, 2011 16:12

dieselEngineDyMFoam
 
Hi Foamers,

Does anyone of you know how to make from dieselengineFoam ->dieselEngineDyMFoam?
I woul like to use the mesh strategies from the engineTopoChangerMesh class.

Thx
Peter

u22 November 21, 2012 00:02

I have same question. How to modify dieselEngineFoam to work with layer addition and removal ? I use 1.6-ext...

Peter_600 November 21, 2012 06:35

Hi,

you have to include following header files in your solver before the main part will be executed.

#include "engineTopoChangerMesh.H instead of #include "dynamicFvMesh.H"

change mesh.move() to mesh.update()

Furthermore, you have to link the compiler to this lib with
-ltopoChangerFvMesh

in EXE_LIBS

cheers Peter

u22 November 22, 2012 05:06

Thanks, Peter!

Already figured out the issue. I did some change in code similar to the sonicTurbDyMEngineFoam.C

Here is diff dieselEngineDyMFoam.C dieselEngineFoam.C
35,37c35
< #include "engineTopoChangerMesh.H"
---
> #include "engineMesh.H"
55,56c53
< # include "createEngineDynamicMesh.H"
---
> # include "createEngineMesh.H"
>
82,83c79
< mesh.update();
---
> mesh.move();

And make diff options is
18,21d17
< -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \
< -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \
< -I$(LIB_SRC)/dynamicMesh/topoChangerFvMesh/lnInclude \
< -I$(LIB_SRC)/meshTools/lnInclude
41,45c37
< -llduSolvers \
< -ldynamicFvMesh \
< -ldynamicMesh \
< -ltopoChangerFvMesh \
< -lmeshTools
---
> -llduSolvers

u22 December 12, 2012 05:06

engineGeometry
 
1 Attachment(s)
Hello, foamers!

Mоdified solver dieselEngineDyMFoam removes layers correсtly, but crashes in first layer addition.
Please explain purpose of the coordinate system (how it should be oriented for a piston patch? what means origin, direction and axis? ), as well as other parameters in engineGeometry dict.

I use
engineTopoChangerMesh layerAR;
minLayer 0.002;
maxLayer 0.005;
delta 0.001;
offSet 0.002 // i gues, it means "work area" for add/removal. In which direction?? And offset from which point??

My mesh is 0.005 m in Z directions...

piston
{
patch piston;

coordinateSystem
{
// type Cartesian;
type cylindrical;
origin (0 0 0);
axis (0 0 1);
// direction (0 1 0);
direction (1 0 0);
}
minLayer 0.002;
maxLayer 0.005;
}

mturcios777 December 12, 2012 12:28

I'll tackle this one as layer addition/removal is something I managed to get working after a long struggle.

Offset is how far away from the highest z value of the piston patch you want to start looking for your add/remove surface. So if your piston patch has max z coordinate of -0.02 m, establishing the add/remove surface will begin looking there. If offset = 0, then the faces of the piston patch itself will be used (unless your piston patch is reasonably flat, don't do this)

delta is the range where you want to look for faces to make the add/remove surface. if delta is 0.001 m, then all faces in the range [-0.021, -0.019] will be eligible for being part of the add/remove surface.

Its always good to check the pistonLayerFaces faceZone that is created to ensure that the resulting faceZone is a singly connected surface, and that there aren't any faces whole normal deviates much from the z direction (if you create the surface with offset > 0, this should be okay).

Coordinate system is for the creation of the piston (which is a member of the layerAR class). As long as the coordinate system is aligned with your simulation domain (which looks like what you have done).

Hope this helps! Note that the entire engine library can be ported to work with 2.1.x.

u22 December 13, 2012 04:10

2 Attachment(s)
mturcios777, thanks for your comment!

So, my setup in engineGeometry looks reasonable for me. But i still get FPE in layer addition. And no printStack output...

I attached a mesh and pistonLayer facezone pictures for last saved CAD (deformAngle=20)

Why OpenFoam does not produce printStack output in that case?

How to debug what goes wrong with layer addition?

---After a while----

I discover, that moveDyMEngineMesh works fine when it start adding layers after deformAngle CAD.

And dieselEngineDyMFoam crashes in layerAR.C, in

autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh();

....

mturcios777 December 13, 2012 12:26

Ok, I'm assuming that the flat faces above your piston patch are the faceZone, so they look good. Not sure why the stack trace isn't output, though since the error looks like its occurring inside layerAR, you should probably turn on the debug options for polyTopoChange, polyTopoChanger, layerAdditionRemoval and dynamicMesh.

I would also recommend removing the cell/face/pointZones and meshModifiers file in your starting mesh every time until you are sure that the problem isn't from the mesh. It doesn't take that long to regenerate them when you start the simulation, plus if you've made changes to the layerAR in engineGeometry, it won't be updated until you delete all those files (have a look at addLayerARMeshModifiers.C).

Also, try switch to a cartesian coordinate system. You'll definitely need to remove the zones and modifiers to see the change (if any).

u22 December 14, 2012 05:35

Marco, thanks for help again.

1. I run simulation from -180 with cartesian CS and get same error
2. I compiled OF 1.6-ext with DEBUG , but didn't get no additional output in log file
how to switch on debug for polyTopoChange and etc.? I see many of "if(debug) ..." lines there

3. moveDyMEngineMesh works fine for my case. WHY? This is realy bother me.

4. May be, I need some additonal changes in dieselEngineFoam.C, not only replacing mesh.move() by mesh.Update().

code in sonicTurbDyMEngineFoam looks more sofisticated then just "mesh.Update".

Could you share your version of dieselEngineDyMFoam please...? Or working cases for this solver..

mturcios777 December 14, 2012 12:18

There are additional debug flags in the etc/controlDict file. As for moveDyMEngineMesh, remember that only the mesh is being changed, so its possible that the crash is ocurring after the mesh has been changed.

I don't have dieselDyMEngineFoam, but I was working on a sprayDyMFoam, which pretty much has the same changes that you need to make. Its posted on the Mantis site:

http://www.openfoam.org/mantisbt/view.php?id=672

Good luck!

u22 December 17, 2012 01:26

Thanks, Marco! I enable additional debug flags in etc/controlDict. There is tail of log output:
------------------------------------------------------------
polyTopoChanger::changeMesh
(
const polyTopoChange& ref
) : completed topological change.

void polyTopoChanger::update(const mapPolyMesh& m) : Updating mesh modifiers
layerAdditionRemoval::updateMesh(const mapPolyMesh&) for object pistonLayer : Clearing addressing on external request. Pointers not set.

void polyMesh::setInstance(const fileName& inst) : Resetting file instance to "22.93"
void polyMesh::setMotionWriteOpt(IOobject::writeOption) Setting motion writeOpt to 0
void polyMesh::setTopoWriteOpt(IOobject::writeOption) Setting topo writeOpt to 0
Updating object pointMesh
Updating object volPointInterpolation
volPointInterpolation::makeWeights() : constructing weighting factors
volPointInterpolation::makeWeights() : 1
volPointInterpolation::makeWeights() : 2
Floating point exception
------------------------------------------------------------
So, FPE generated in volPointInterpolation::makeWeights(), in following code
(i think, divide by zero). May be an error in my case setup? Is it mesh related problem?

------------------------------------------------------------
if (debug) Info<< "volPointInterpolation::makeWeights() : 2" << endl;

// Calculate inverse distances between cell centres and points
// and store in weighting factor array
forAll(points, pointi)
{
scalarList& pw = pointWeights_[pointi];
const labelList& pcp = pointCells[pointi];

forAll(pcp, pointCelli)
{
pw[pointCelli] =
1.0/mag(points[pointi] - cellCentres[pcp[pointCelli]]);

sumWeights[pointi] += pw[pointCelli];
}
}
------------------------------------------------------------

mturcios777 December 17, 2012 12:21

The divide by zero makes sense as far as where the error is ocurring. Not sure as to why, but most likely a mesh generation error. I can't remember the last time (or if ever) I tried layerAR on a sector mesh with periodic boundaries (it may be possible it doesn't work).

Could you make a simple flat piston mesh (use same angle for sector mesh) and try layerAR there with offset = 0? Then try it full cylinder with the same flat piston. Based on these tests we can figure out what the problem is. I'll see if I have an old cylinder mesh somewhere, but it may be faster for you to make your own.

Also, please send me a picture of the faceZone that is being used to create the layers.

u22 December 18, 2012 22:37

3 Attachment(s)
Dear Marco,

I construct cylindrical mesh for 45 degree sector and full 3d without cyclic BC.
Unfortunately, I got same errors. I enlarge the clearance and use zero offset. Here is pictures for last saved CA (23 degree). Piston patch looks equal pistonLayer faceZone...

There is post by Abhishekd18 with the same error volPointInterpolation::makeWeights() : constructing weighting factors http://www.cfd-online.com/Forums/ope...ng-layers.html

I guess, he used same "scania" case as I (by N. Nordin, without layerAR) and case conversion to 1.6 ext was not completed in right way...

May you have a look on case files??

This error not only IC-related, Look at here http://www.cfd-online.com/Forums/ope...tml#post398179

mturcios777 December 19, 2012 12:38

Thanks for the files, but your points file appears to be missing; can you double check your case and re-submit it?

u22 December 20, 2012 00:23

Hello Marco,

There is small file limit on the forum, i put files on file hosting here

u22 December 23, 2012 21:49

So, one of possible solutions been found Next step - to check whether the solver with layerAR to work in parallel.

seju August 11, 2014 11:27

Quote:

Originally Posted by u22 (Post 398839)
So, one of possible solutions been found Next step - to check whether the solver with layerAR to work in parallel.

hi
I wanna compile dieselEngineDyMFoam .
plz help me how can I do it?
best regards
Sajad

zhangyan January 15, 2017 03:14

Hi,
I also met the same FPE problem after the first layer addition.
Have you got a solution?

zhangyan March 24, 2017 10:13

Quote:

Originally Posted by zhangyan (Post 633320)
Hi,
I also met the same FPE problem after the first layer addition.
Have you got a solution?

YES!

https://www.cfd-online.com/Forums/op...tml#post398179

zhouqy1994 July 10, 2017 02:22

Quote:

Originally Posted by u22 (Post 397305)
mturcios777, thanks for your comment!

So, my setup in engineGeometry looks reasonable for me. But i still get FPE in layer addition. And no printStack output...

I attached a mesh and pistonLayer facezone pictures for last saved CAD (deformAngle=20)

Why OpenFoam does not produce printStack output in that case?

How to debug what goes wrong with layer addition?

---After a while----

I discover, that moveDyMEngineMesh works fine when it start adding layers after deformAngle CAD.

And dieselEngineDyMFoam crashes in layerAR.C, in

autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh();

....



Hi u77

Since I post the message on the cfd online app, I cannot see you full name... sorry for calling you nickname...
I read your post, and have several questions

My layerAR can run smoothly with full cylinder simulation on foam-extend 4.0,and the results are acceptable. But you know, simulating the full cylinder is really costly, so I try to use the engine sector

The boundary for two sides of the sector is cyclic Ggi (my combustion chamber geometry is a little complex, so cyclic is not suitable...) when define the cyclicGgi boundary conditions, the facezones of the two sides are needed. But after that, the layerAR will skip adding zones since there are already two facezones. As a result, the simulation will crash since no pointzone and pistonlayer zone have been defined.

However, your post is a sector with layerAR, so I want to seek some advice from you about using layerAR with cyclicGgi boundary conditions

Thanks in advance



Sent from my iPhone using CFD Online Forum mobile app


All times are GMT -4. The time now is 03:25.