How to describe the movement of a piston?
Hello everyone,
I am currently working on my masters thesis which is about writing a code in Matlab to describe the simulation of a gas exchange in an hydrogen combustion engine. I am at the beginning of my studies and I am using lid driven cavity as an example to write the code. But I found some questions:How do I describe the movement of the piston in the code written in matlab? And what are the main equations I have to use to describe the gas (NS equation, convectiondiffusion equation)? When I use the NS equation to describe the flow of the gas, I find it difficult to describe the convective diffusion equation at the same time? I would be very grateful if you could give me some advice :) 
This is a complicated question, as your research topic is advanced.
I'm giving a very brief answer. It's not very detailed, so ask if you have more queries. In my opinion, matlab may be slow if you have a very computationally intensive code. You would have to use vectorization and Intel's MKL library in matlab to get good performance.I say this, because if your code uses the basic do/for loops in matlab, it would be slow. If the code isn't computationally intensive, you can use matlab without any issue. (EDIT : Forgot to answer your question before. A moving piston is basically a boundary condition that you can apply to your mesh. For example. it would be something as, the lid of your lid driven cavity moving down instead of sideways. The boundary condition on the lid would prevent any mass to go out of the domain, and it will push the mass inward and compress it. You would need to model the force with which the piston moves down, and the force of compressed gases that work to push it up. The net force will determine the final direction of movement.) For a moving boundary simulation (as the piston essentially changes the domain volume completely), you have different options available to represent such a system.
I'm not too experienced to answer this questions. Almost all of discretization in CFD comes down to using Taylor series expansion equations to convert your PDE/ODE into a linear equation. I have only solved inviscid compressible NS equations, so it's a little bit different from your use case. You would need a pressurevelocity coupling using SIMPLE, SIMPLER or such other algorithms. You would also need a staggered grid, but that might be easier for you as you're already modifying a liddriven cavity code. 
Since I don't do research in IC engine, so my answers were somewhat speculative. If you truly need the best answer, I would highly recommend you to search for CFD papers for modelling IC engines and papers on writing CFD codes for modelling IC engines. Find a good paper, study how they do it, then based on that, you can implement your code.
All of your research problems have already been solved by someone else. Just follow their work as inspiration :) 
Quote:
1) the lid driven cavity is a good testcase to develop and testing a simple CFD code but it is for incompressible flows. In your case you have compression and expansion, therefore you need to solve the compressible form of the equations. 2) The movement of a piston can be either prescribed or consequent to the flow dynamics, what is your case? 3) The modern trend of the CFD code is to use the immersed boundary method. Thins, You have the moving boundary on a fixed background grid. Several approaches can be adopted and you will find a lot of literature. 4) Whan do you mean for "I find it difficult to describe the convective diffusion equation at the same time" 
Quote:

Quote:

Quote:
Did you write simple 1D, 2D solvers for convection and diffusion before? I just had a recent discussion here on how much majority of the students have difficulty understanding CFD because they have never been taught to develop the simpler solvers. 
Quote:
Yes, understanding CFD is also difficult for me, I had not studied it before, but I need to complete the Master's thesis. Can you give me some advice for my situation? I appreciate your help. 
Quote:
Honestly, if you have less than 1.5 years of time left, it might be better to use commerical codes like ANSYS or OpenFOAM or SU2 to do your research instead of developing a solver yourself. I don't mean to be discouraging, and CFD is easy to learn once we know the basics, but learning the basics take some time. That can be done easily in 2 month, if you have a guided learning path. But since your research topic is in combustion CFD, and you mean to write your own solver, it becomes much more challenging. Combustion CFD requires you to know the basics of CFD + advanced combustion models. Learning advanced combustion models might take 7 or more months if your guiding professor is an expert in combustion CFD. If you plant to learn on your own, it would take a few years. Only take this opportunity if your professor is also an expert in combustion CFD. Otherwise he/she won't be able to guide you or correct your mistakes. however I don't mean to be discouraging. You could do your research that you want. However anyone would highly recommend you to use commerical CFD solvers like ANSYS/COMSOL etc. instead of writing your own code. 
Quote:
Generally, a CFD student does practice first with simple exercises like those in the book of Ferziger, Peric and Street. Only after some months he can approach the methods for solving NSE. That while assuming he has already a good background in fluid mechanics. What is your present educational background? 
Quote:
However, @Harlotte would be best prepared to complete their combustion CFD solver in 2 years *only and only if* their guiding professor has also written combustion CFD solvers before. I could be wrong, but that's the most probable outcome. 
Quote:
I am a current master in Germany and the Master's theses take 8 months in Germany. My supervisor asked me to write a simple solver in Matlab. This solver should at least include the intake and exhaust ports, but the Ignition can be ignored in this model(I think that the combustion can be ignored). In this way, is it possible to simplify this solver? 
Quote:

Quote:
I had no basic knowledge of CFD before that and I had also not tried to write some CFD code before. I just learn CFD by myself t in the last two months. 
Quote:
Although you need more restrictions. Is it 2D or 3D? What is the geometry of the combustion chamber? Will this geometry changed and will you need to use your code for analysing multiple different geometries? Will the Piston move? How much accuracy in results do you require? Do you need to simulate the full cycle, or can you just simulate parts of the cycle, like gas expansion or compression? What's going to be entering into the camber? Is it only air, or air+fuel mixture? Try to come up with the more restrictions, so the solver is simple. Clarify it with your professor, and ensure that's enough for the project. Never complicate things. 
Quote:
Thanks again for the advice you gave me, it helps me a lot! 
Quote:
Look up old CFD papers on simulating piston engines. They are simpler to understand and replicate. 
Quote:

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