CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   3D engine simulation & error (https://www.cfd-online.com/Forums/openfoam/115313-3d-engine-simulation-error.html)

mturcios777 April 11, 2013 16:28

If you take the derivative of the lift profile you will get the velocity profile, then just format it as a table and input it in the boundary conditions file.

The piston is handled automatically through the engineGeometry file. As far opening and closing the valve, it involves having different meshes where some have the port geometry and some don't. You will need to map the field between the different meshes using mapFields. A bash script (look it up, there are many tutorials) would help you automate this. You can also look at the Allrun scripts that exist on many of the tutorials to find out how they work.

sasanghomi April 11, 2013 16:49

Thanks for your reply marco ,
I really appreciate your help..
it means that I must create four different mesh for 4 strokes...it is right?
for example after end of induction I should use mapfields(inconsistent) for continuing the simulation.. am I right?
Also I must stitch mesh in the sliding interface..and the mesh should be one region.
another question: engineFoam have some files about combustion but I want to simulate cold flow how can I inactive them?
Also what is the boundary condition for piston in the pointMotionUx file?

thank you very much dear marco
best regards
sasan.

mturcios777 April 11, 2013 16:53

piston can have fixedValue (0 0 0). The way fvMotionSolver works is that first the piston points are moved explicitly according to the engineGeometry file (RPM and connecting rod length, etc). Then the motionSolver moves the points according to pointMotionU and the velocity of the piston points.

I would recommend having all the boundaries except the liner and valves be fixedValue (0 0 0). The valves should have a velocity profile, and the liner should be slip type (at least that works best for me).

sasanghomi April 11, 2013 16:57

thank you very much marco,

engineFoam have some files about combustion but I want to simulate cold flow how can I inactive them?

best regards

mturcios777 April 11, 2013 16:59

Sorry I forgot to address that one. Just turn off ignition in combustionProperties.

sasanghomi April 11, 2013 17:03

thank you very much marco,
I will try to do it and I report the result.
thank you very much again.

best regards,
sasan

sasanghomi April 13, 2013 13:50

Hi Dear Marco,

a good day to you.
I have some questions :

1)You said that I should use map field so I should generate some different geometry. For example in my case the intake valve closed at CAD=200 (this position is not BTD) So I have a geometry untill CAD=200 and for continuing the simulation I should create a new geometry without any valves But I don't have the position of piston at this CAD..How can I find the position of piston at this CAD for generating a new geometry??

2) please take a look at the dynamicMeshDict and engineGeometry...are they correct?

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM Extend Project: Open Source CFD        |
|  \\    /  O peration    | Version:  1.6-ext                              |
|  \\  /    A nd          | Web:      www.extend-project.de                |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      binary;
    class      dictionary;
    location    "constant";
    object      dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

motionSolver          velocityLaplacian ;

diffusivity    uniform;


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

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM Extend Project: Open Source CFD        |
|  \\    /  O peration    | Version:  1.6-ext                              |
|  \\  /    A nd          | Web:      www.extend-project.de                |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "constant";
    object      engineGeometry;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

engineMesh    fvMotionSolver;
motionSolver        z ;  //What is this???
ignite              no;

conRodLength    conRodLength [0 1 0 0 0 0 0] 132.56459;

bore            bore [0 1 0 0 0 0 0] 100;

stroke          stroke [0 1 0 0 0 0 0] 92;

clearance      clearance [0 1 0 0 0 0 0] 7.126193;

rpm            rpm [0 0 -1 0 0 0 0] 1500;


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

what is the motion solver in the enginGeometry?? If I set it aaa the openfoam doesn't know it as an invalid type and it needs pointMotionUaaa in the 0 directory.For example I set it z So I must have a pointMotionUz file in the 0 directory for running...
and when I create a pointMotionUz in this file all boundary condition should be scalar and fixedvalue (0 0 0) is an invalid type...why??

3) I have some problems for boundary condition for valve in the pointMotionU..
I set it as a table that the left side is CAD and the right side is velocity of valve but it is mistake :

valve1
{
CAD velocity of valve
. .
. .
. .
. .
}

How can I create this profile?why this form is mistake?

please guide me.
I appreciate your help.
Thank you very much.
best regards,
Sasan.

mturcios777 April 15, 2013 12:45

In the engineMesh solver output, the pistion position is output (pistonPosition= ) and is the z coordinate of the highest point of the piston patch. You can always start a run and wait for the message to be output and quit.

It is a little confusing of how the motion solver is specified. For the velocityLaplacian motionSolver in dynamicMeshDict, use "laplacian" as the motionSolver in engineGeometry.

The velocity profile is in the typical Foam table format. You first specify the number of entries and then the table of values. A sample profile can look like this:

Code:

4
(
(0 (0 0 0))
(1 (0 0 1))
(2 (0 0 2))
(3 (0 0 3))
)

Hope this helps!

sasanghomi May 13, 2013 15:03

Hi Marco,
A good day to you ;)
I am trying to simulate an engine without changing topology. But I have some problems !
Please take a look at my case (I uploaded it https://mega.co.nz/#!VtIkxbiA!VNAilH...-p7-schAOzCJLw). Can you correct it?
I think some things in this case is wrong. I can't use pointMotionU as a Vectorfield and I don't know about motionSolver in engineGeometry ( it must be X or Y or Z . Why?)
Actually in this case piston doesn't move.
what is the type of boundary condition for valve in pointMotionU ? I want to set a profile for movement of valve.
Please help me.
I appreciate your help
Thanks and best regards,
Sasan.

P.S. I used coldEngineFoam as a solver.

mturcios777 May 13, 2013 18:10

Hi Sasan,

I would recommend using moveEngineMesh first to fully check the mesh motion. In your case, in engineGeometry, motionSolver should be "laplacian". In dynamicMeshDict, solver should be velocityLaplacian. To specify motion, the file in 0 directory should be pointMotionU and it should be a pointVectorField.

To specify valve motion you need to give the velocity profile (which is the derivative of the lift profile) and it must be specified as a vector (I noticed you are mixing having vectors and scalars in your boundary and initial conditions; they should all be vectors). Or you can switch the solver to displacementLaplacian in dynamicMeshDict (I've never had good experience with that one though, as the displacement has to be absolute I think).

You don't need to specify piston motion, as this is handled by how you have set your engine geometry settings in engineGeometry.

Hope this helps,
Marco

RJ87 May 14, 2013 04:48

Quote:

Originally Posted by mturcios777 (Post 427279)
Hi Sasan,

I would recommend using moveEngineMesh first to fully check the mesh motion. In your case, in engineGeometry, motionSolver should be "laplacian". In dynamicMeshDict, solver should be velocityLaplacian. To specify motion, the file in 0 directory should be pointMotionU and it should be a pointVectorField.

To specify valve motion you need to give the velocity profile (which is the derivative of the lift profile) and it must be specified as a vector (I noticed you are mixing having vectors and scalars in your boundary and initial conditions; they should all be vectors). Or you can switch the solver to displacementLaplacian in dynamicMeshDict (I've never had good experience with that one though, as the displacement has to be absolute I think).

You don't need to specify piston motion, as this is handled by how you have set your engine geometry settings in engineGeometry.

Hope this helps,
Marco

First of all, sorry for hijacking your thread sasan.

Marco, I wonder if you are willing to share your case setup folder using fvMotionSolverEngineMesh? I'm doing something almost similar to sasan. I manage to work my case with sprayEngineFoam with OpenFoam2.2.x. Now, I would like to include intake and exhaust simulation but I have completely no idea where to start with fvMotionSolverEngineMesh. My email is rj_5847@hotmail.com.

Regards
RJ

mturcios777 May 14, 2013 11:37

Sasan's is a good place to start, with the corrections I have suggested. I can't share any cases as it is work for my employer.

sasanghomi May 14, 2013 14:04

@RJ HO : That's ok . I am trying to create a test case with fvMotionSolver.
@Mrco :
Thank you very much Marco for your guidance .
Actually I changed the case according to your advice. ( I uploaded ithttps://mega.co.nz/#!QhZUQKbY!T_jZej...0-anJa9pbED4tI )
when I run the case I have an error :
Code:

--> FOAM FATAL IO ERROR:
cannot open file

file: /home/sasan/Desktop/engine-cold/0/pointMotionUlaplacian at line 0.

    From function regIOobject::readStream()
    in file db/regIOobject/regIOobjectRead.C at line 62.

FOAM exiting

I changed the name of pointMotionU to pointMotionUlaplacian and after that I had another error :
Code:

--> FOAM FATAL IO ERROR:
unexpected class name pointVectorField expected pointScalarField
    while reading object pointMotionUlaplacian

file: /home/sasan/Desktop/engine-cold/0/pointMotionUlaplacian at line 14.

    From function regIOobject::readStream(const word&)
    in file db/regIOobject/regIOobjectRead.C at line 110.

FOAM exiting

Please take a look at the boundary condition for valve in pointMotionU. I used excel for getting derivative of valvelift profile. So I have a lot of data.But I think I need to have velocity versus time am I right? So I think I should convert the crank angle to time (by dividing to RPM)(CAD=RPM*Time) and for getting velocity I should multiply another variable to RPM.[ dx/d(wt) =(1/w)dx/dt ] (x=valvelift ; w=RPM ; t=time)
please correct me if I am wrong . Also I don't know for sure about type of this boundary condition . It should be Time varying ?:confused: Can you write an example of this boundary condition here?

I appreciate your help,
Thanks and best regards,
Sasan.

mturcios777 May 14, 2013 14:31

1 Attachment(s)
Hi Sasan,

I don't have a copy of 1.6-ext running on my machine so it may be that pointMotionU should be a pointScalarField. I don't remember which type of boundary condition pointScalarFields take, but it should be something like

Code:

valve
{
    type    timeVaryingUniformValue;  //time varying boundary condition
    outOfBounds  clamp;  //what to do when the end of the list is reached, clamp uses keeps using the last value (since we end with zero velocity, this is what we want)
  fileName    "valve.txt" //create a file that contains the table with the velocity profile; the filepath is relative to the current case folder, so just put it there. I've attached it for you
}

Using these settings I was able to get moveEngineMesh working in 2.0.x. Something similar should work in 1.6-ext, with the change to pointScalarField (you will need to change the velocity profile to only specify the z component, maybe keep two copies so you can try both versions).

sasanghomi May 14, 2013 14:49

Dear Marco ,
thanks for your quick reply.
Please tell me my expression is correct ? ( about converting CAD to time and ....)
I should insert velocity versus time in the valve.txt am I right?
Did the last test case that I upload work on your machine ?( it means this case works on 2.0.x? )

Thanks and best regards
Sasan.

mturcios777 May 14, 2013 14:59

Quote:

Originally Posted by sasanghomi (Post 427523)
Dear Marco ,
thanks for your quick reply.
Please tell me my expression is correct ? ( about converting CAD to time and ....)
I should insert velocity versus time in the valve.txt am I right?
Did the last test case that I upload work on your machine ?( it means this case works on 2.0.x? )

Thanks and best regards
Sasan.

You don't need to convert to time in seconds, since the engine solvers use engineTime, which measures time in CAD (still time, just different units). For future reference, converting from CAD to time is done by:

time = CAD/RPM/6 (as you need to convert from minutes to seconds and from revolutions to degrees.

I was able to get your test case working in 2.0.x (moveEngineMesh at least) by making the change in the valve BC as I mentioned in my previous post.

sasanghomi May 15, 2013 18:17

Hi Marco ,
Thank you very much for your help.
I compiled version 2.0.x and I had a similar error :
Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.0.x                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.0.x-97cf67d69932
Exec  : moveEngineMesh
Date  : May 16 2013
Time  : 02:11:40
Host  : sasan-Inspiron-N5110
PID    : 19959
Case  : /home/sasan/OpenFOAM/sasan-2.0.x/run/engine-cold
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create engine time

Create mesh for time = 0

Selecting engineMesh fvMotionSolver
deckHeight: 0
piston position: -10


--> FOAM FATAL IO ERROR:
unexpected class name pointVectorField expected pointScalarField
    while reading object pointMotionUlaplacian

file: /home/sasan/OpenFOAM/sasan-2.0.x/run/engine-cold/0/pointMotionUlaplacian at line 14.

    From function regIOobject::readStream(const word&)
    in file db/regIOobject/regIOobjectRead.C at line 136.

FOAM exiting

Are you sure that you didn't change anything in source codes ?

Thanks and best regards,
Sasan.

mturcios777 May 15, 2013 18:26

Quote:

Originally Posted by sasanghomi (Post 427842)
Hi Marco ,
Thank you very much for your help.
I compiled version 2.0.x and I had a similar error :
Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.0.x                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.0.x-97cf67d69932
Exec  : moveEngineMesh
Date  : May 16 2013
Time  : 02:11:40
Host  : sasan-Inspiron-N5110
PID    : 19959
Case  : /home/sasan/OpenFOAM/sasan-2.0.x/run/engine-cold
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations
 
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create engine time
 
Create mesh for time = 0
 
Selecting engineMesh fvMotionSolver
deckHeight: 0
piston position: -10
 
 
--> FOAM FATAL IO ERROR:
unexpected class name pointVectorField expected pointScalarField
    while reading object pointMotionUlaplacian
 
file: /home/sasan/OpenFOAM/sasan-2.0.x/run/engine-cold/0/pointMotionUlaplacian at line 14.
 
    From function regIOobject::readStream(const word&)
    in file db/regIOobject/regIOobjectRead.C at line 136.
 
FOAM exiting

Are you sure that you didn't change anything in source codes ?

Thanks and best regards,
Sasan.

I don't recall changing anything, but lets not worry too much about it. If it asks for a pointScalarField, then use a pointScalarField and make sure all your entries are scalar. Try it and see if it works, though if you are not using a component solver I don't see why it isn't asking for a pointVectorField.

sasanghomi May 15, 2013 18:51

I changed all entries (related to pointMotionUz) to scalar and now the case runs but in paraview the grid doesn't move and the grid is fix . I don't know why !!
I uploaded the case (https://mega.co.nz/#!t4YwjCxT!BT3cNT...7qqaDVQAU5FLVk )

I appreciate any help from you,
Thanks and best regards,
Sasan.

sasanghomi July 4, 2013 10:12

1 Attachment(s)
Hi Dear Marco,

I have some questions about using fvmotion solver . Please guide me.
1) you said to me that I should set the pointMotionUz for piston uniform 0 . But by doing this action the piston doesn't move .Any idea ?? I think I should set a time varying boundary condition for piston (an equation between velocity of piston and Time ). I want to know that is it possible to define a time varying boundary condition in pointMotionUz file ??:confused:

2)what about valveStem (for pointMotionU) ? if I set uniform 0 for valveStem the geometry will degenerate when the mesh starts to moving .

3) after 12 degrees I get below error . Do you know what is the origin of this error?
Code:

Courant Number mean: 0.00731579 max: 2.9446 velocity magnitude: 29623.1
Crank angle = 12 CA-deg
deltaZ = -0.109588
DICPCG:  Solving for cellMotionUz, Initial residual = 0.000334198, Final residual = 9.41647e-06, No Iterations 9
clearance: 9.17415
Piston speed = -1972.58 m/s
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for Ux, Initial residual = 0.0431167, Final residual = 4.43141e-09, No Iterations 2
DILUPBiCG:  Solving for Uy, Initial residual = 0.0145968, Final residual = 6.96134e-10, No Iterations 2
DILUPBiCG:  Solving for Uz, Initial residual = 0.0295304, Final residual = 9.55942e-06, No Iterations 1
DILUPBiCG:  Solving for h, Initial residual = 0.0145461, Final residual = 3.94577e-08, No Iterations 3

    From function specieThermo<thermo>::T(scalar f, scalar T0, scalar (specieThermo<thermo>::*F)(const scalar) const, scalar (specieThermo<thermo>::*dFdT)(const scalar) const) const
    in file /home/sasan/OpenFOAM/OpenFOAM-1.6-ext/src/thermophysicalModels/specie/lnInclude/specieThermoI.H at line 73
    Maximum number of iterations exceeded.  Rescue by HJ

    From function specieThermo<thermo>::T(scalar f, scalar T0, scalar (specieThermo<thermo>::*F)(const scalar) const, scalar (specieThermo<thermo>::*dFdT)(const scalar) const) const
    in file /home/sasan/OpenFOAM/OpenFOAM-1.6-ext/src/thermophysicalModels/specie/lnInclude/specieThermoI.H at line 73
    Maximum number of iterations exceeded.  Rescue by HJ

the pointMotionUz file is as below. (I set a constant number for valve and piston because I wanted to see how does the grid move by using fvMotionSolver.
Code:

dimensions      [0 1 -1 0 0 0 0];

internalField  uniform 0;

boundaryField
{
   
    piston         
    {
        type            fixedValue;
        value          uniform -1500;
    }
  intakePort         
    {
      type            fixedValue;
        value        uniform 0;
    }
  valveStem1         
    {
        type            fixedValue;
        value          uniform -1000;
    }
    symetry         
    {
        type            symmetryPlane;
    }
    presin         
    {
        type            fixedValue;
        value          uniform 0;
    }

  liner         
    {
        type            slip ;
    }

    cylinderHead   
    {
        type            fixedValue;
        value          uniform 0;
    }
 valve   
    {
        type            fixedValue;
        value          uniform -1000;

  }

   
}

I appreciate any help from you.
Thanks and best regards,
Sasan.


All times are GMT -4. The time now is 08:05.