CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   To use or not to use linearValveLayersFvMesh (

marico March 11, 2009 05:18

Hi FOAMers, based on my s
Hi FOAMers,

based on my soliloquy,
I thought it would be useful to focus on the problem:

basically I need to simulate a reciprocating engine with one
piston and one valve. I HAVE TO add layers, because the valve
is closed in the beginning. So I chose the topoChangerFvMesh-class:


After comparing it with linearValveFvMesh (for which some tutorials
exist) I found out, that the main difference between both is (except
of layer addition/removal), HOW the Points are moved.
linearValveLayersFvMesh uses a more simple function "tnewpoints",
calculating the points out of the "pistonVelocity"-vector defined in
the dynamicMeshDict.
linearValveFvMesh instead uses a general motion solver (e.g.
velocityLaplacian). Correct me, if I'm wrong.

Both, piston and valve, move in my simulation according to an motionlaw
depending on time. Therefore the simple "pistonVelcity" in lVLayersFMesh
is not usable to me: I need to use the motion solver.

So I tried to add the motion solver called in lVFMesh to the lVLayersFMesh
library, removed the "tnewpoints"-function and did a small testcase
(executed with moveDynamicMesh).
The layer removal works, but if the criterion to ADD layers is reached,
the calculation stops with "floating point exception".

So my questions are:

1. Is it possible, to simply insert the motion solver in lVLayersFMesh,
as it is implemented in lVFMesh.

2. If true: how to do?

Here are the src-files: linearValveLayersFvMesh.H linearValveLayersFvMesh.C

and the testcase: testcase

(Info: I removed mesh because of filesize. After blockmesh you have to
run moveDynamicMesh and after it gives out an error, you have to copy
the meshModifiers-file into the polyMesh directory. That sounds stupid,
but I found no other way to realize it, because automatic meshModifiers
creation fails at the beginning.)

Thank You

marico March 12, 2009 05:35

Hi, maybe it would be also

maybe it would be also possible to use the standard linearValveLayersFvMesh and define an expression (time-dependent) for pistonVelocity.
Does anyone know how to do this?

Thank You

marico March 17, 2009 03:20

5 Attachment(s)
Hi All,

I have now extended the linearValveLayersFvMesh to apply layering and sliding interfaces to two (or more) different regions. Furthermore there is the standard piston movement function based on velocity implemented. (using 1.5-dev)
The library is here:

Attachment 12

I created a little testcase (Attachment 11) a the library worked (in both regions layers were added/removed and the slider worked, but I did only moveDynamicMesh). Now I created a bit more complicated case based on 10 blocks, but the dynamic mesh fails with the following error (even if the point movement of dx= 0 is applied):

Zero length edge detected. Probable projection error: slave patch probably does not project onto master. Please switch on enriched patch debug for more info

From function void enrichedPatch::calcCutFaces() const
in file polyMeshModifiers/slidingInterface/enrichedPatch/enrichedPatchCutFaces.C at line 248.

FOAM aborting

I searched in forums, but the instructions there did not help me. When using debug I can only find out that the problem occurs in the sliding interface. So probably it is a more general problem. Here are some pictures of my case, maybe someone can help me with that:

Mesh (symmetry used):
Attachment 13

Inner slider (5 patches):
Attachment 14

Outer slider (2 patches):
Attachment 15

Thank You

francesco March 19, 2009 04:40

If I'm right Marco. So far, you managed to run a case with layer addition and removal.

Your problem is when the sliding interface are playing a role?

francesco March 19, 2009 04:46


In the current 1.5-dev version (available here :

There is a reference to the class engineTopoChangerMesh which according to me and the implementation of the simpleEngine tutorial seems to deal with piston and valves.

marico March 20, 2009 03:11

Hi Francesco,

thanks for your reply. It was not my intention to write a new class, I just did not hear of engineTopoChangerMesh before. That seems to be the right thing but I found no tutorials, so can anyone help with that? Especially hat to call it in dynamicMeshDict and how to apply the motion?

Yes, the problem I am facing with my class seems to deal with sliding interfaces. The testcase I did before was 2D but both (layering AND sliding) worked!


RJ87 December 31, 2012 02:08

Hi Marco,

Hope you don't mind if I ask, what software did you use for your mesh generation?

sasanghomi July 5, 2013 02:37

Hi friends,
I have similar problems for using sliding interface for engine simulation..I am using sonicTurbDyMEngineFoam as a solver and simpleEngineTopoFvMesh class (I am using mesh modifiers ) Any body can help me?

best regards

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