
[Sponsors] 
How to describe the movement of a piston? 

LinkBack  Thread Tools  Search this Thread  Display Modes 
October 20, 2021, 09:25 
How to describe the movement of a piston?

#1 
New Member
Gao Shangya
Join Date: Oct 2021
Posts: 18
Rep Power: 2 
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 

October 20, 2021, 10:21 

#2 
Senior Member
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 440
Rep Power: 6 
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. 

October 20, 2021, 10:31 

#3 
Senior Member
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 440
Rep Power: 6 
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 

October 20, 2021, 12:31 

#4  
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,146
Rep Power: 66 
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" 

October 25, 2021, 03:02 

#5  
New Member
Gao Shangya
Join Date: Oct 2021
Posts: 18
Rep Power: 2 
Quote:


October 25, 2021, 03:11 

#6  
New Member
Gao Shangya
Join Date: Oct 2021
Posts: 18
Rep Power: 2 
Quote:


October 25, 2021, 22:41 

#7  
Senior Member
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 440
Rep Power: 6 
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. 

October 26, 2021, 01:15 

#8  
New Member
Gao Shangya
Join Date: Oct 2021
Posts: 18
Rep Power: 2 
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. 

October 26, 2021, 08:07 

#9  
Senior Member
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 440
Rep Power: 6 
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. 

October 26, 2021, 08:22 

#10  
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,146
Rep Power: 66 
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? 

October 26, 2021, 08:34 

#11  
Senior Member
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 440
Rep Power: 6 
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. 

October 26, 2021, 08:46 

#12  
New Member
Gao Shangya
Join Date: Oct 2021
Posts: 18
Rep Power: 2 
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? 

October 26, 2021, 09:00 

#13  
New Member
Gao Shangya
Join Date: Oct 2021
Posts: 18
Rep Power: 2 
Quote:


October 26, 2021, 09:06 

#14  
New Member
Gao Shangya
Join Date: Oct 2021
Posts: 18
Rep Power: 2 
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. 

October 26, 2021, 12:50 

#15  
Senior Member
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 440
Rep Power: 6 
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. 

October 26, 2021, 22:44 

#16  
New Member
Gao Shangya
Join Date: Oct 2021
Posts: 18
Rep Power: 2 
Quote:
Thanks again for the advice you gave me, it helps me a lot! 

October 27, 2021, 13:46 

#17  
Senior Member
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 440
Rep Power: 6 
Quote:
Look up old CFD papers on simulating piston engines. They are simpler to understand and replicate. 

October 27, 2021, 21:38 

#18  
New Member
Gao Shangya
Join Date: Oct 2021
Posts: 18
Rep Power: 2 
Quote:


Tags 
engine cylinder head, matlab codes for cfd 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
UDF piston movement problem  Dozer_94  Fluent UDF and Scheme Programming  2  December 26, 2016 09:56 
Simple piston movement in cylinder fluid models  arun1994  CFX  4  July 8, 2016 02:54 
Movement of piston in a cylinder with fluent?  Whitworth  ANSYS  5  March 3, 2015 23:50 
Simple piston movement simulation  ReVl27  FLUENT  1  February 20, 2015 08:28 
UDF for Piston movement  Harish  FLUENT  2  July 23, 2004 06:13 