Closed hkishnani closed 4 months ago
Could you please include your data_1.5.txt file so that I can run the script on my machine? Peter J.
sure, here it is. data_1.5.txt
The underlying issue for the error message was that your definitions of line_outlet and line_symm were back-to-front. This generates a grid. MOC_nozzle.lua.txt run-test.sh.txt
peterj@helmholtz ~/work/eilmer4/hkishnani-2024-04-13 $ ./run-test.sh Eilmer 4.0 compressible-flow simulation code. Revision-id: 76530d03e Revision-date: Wed Apr 10 12:30:05 2024 +1000 Compiler-name: ldc2 Build-date: Sun 14 Apr 2024 09:22:43 AEST Build-flavour: debug Profiling: omitted Capabilities: multi-species-gas multi-temperature-gas MHD turbulence. Parallelism: Shared-memory Begin custom script processing using user-supplied script. A a3= Vector3(2.35183, 1.17611, 0) a4= Vector3(2.35183, 0, 0) wall_spline at 0= Vector3(0, 1, 0) at 1= Vector3(2.35183, 1.17611, 0) Done.
There is yet another problem that you will notice when you look at the image of the grid. The spline is defined by points that are numerous and, with that starting point at (0,1) not close to being uniformly distributed. You should use a set of fewer points to define your spline. Maybe fit those new points using least-squares to the MOC data points.
Also, if you continue to define your spline with so many MOC data points, you will eventually see (in a highly-resolved flow field) all of the small wobbles generating Mach waves. These will be ugly but not a problem for the bulk flow.
Thanks so much. Problem got solved. Also, I will take care of not using too many points for spline. In the code where I generate these points using MOC, I have added a few lines which will give uniformly spaced points on a spline.
Thank you a lot for this critical input.
Hi, I tried to fit new points using PCHIP interpolation and evenly space the points and then use those uniformly spaced points as input to Spline2 in the script. The problem as shown by P.A.Jacobs still exist. So, I tried AOPatch and this is the result, which is much better than CoonsPatch.
Some error at the same point still exist but that's okay, I think...
Please let me know, what else can I do to get an even better structured mesh.
Ooh, that is an annoying glitch in the grid and it should not be there. Can you send me your current points and script so that I can try it out again? I have an idea of what might be the problem but I would not be surprised to be wrong. Thanks.
Yes sir. Below is the code attached for generating grid and there are two point files attached. One has the points from original solution of MOC (data_1.5.txt) and another is that of a uniformly distributed points on a PCHIP spline fitted on data points taken from MOC. The python script for PCHIP interpolation is also attached. Thank you so much for your help. MOC_nozzle.txt
Also here are some plots:
1.) PCHIP interpolated data fitted on true MOC points
2.) Wall contour using MOC (generated from custom code)
Here I have been looking at M = 1.5 case
OK, easy fix this time...
Although you plotted the uniformly distributed interpolation points, you wrote the original points (with the big gap for the straight section) to the text data file. I have adjusted your spline-fitting script to write a new data file with fewer spline points and include pictures of the new points and the associated grid. I am happy with this grid.
data_reg_1.5.txt
new_spline.py.txt
Thanks a ton!! This is the best I could think about. I am also Happy with the mesh.
Hi, I simulated the MOC nozzle. The exit mach number matches the design M. are these results ok?
Case with M_exit = 1.5
Look fine to me but, of course, I would be biased :) The Mach wave off the initial expansion seems to arrive at the end-point of the nozzle wall and the Mach number between that wave and the exit seems uniform, as you MOC calculation says it should be.
The noise in the total-enthalpy and total-pressure plots comes from the top-left-corner cell that has been asked to do the impossible: resolve a centered expansion fan with a single data point. A good thing to do now is to refine the mesh, probably finer in the axial direction, and see if the noise diminishes.
Whether the solutions are accurate enough for you is something that you will have to determine. Decide on a measure that you care about and see if that measure is good enough. For example, you could get the deviations of Mach number and flow angle across the exit plane of the nozzle and decide if those deviations are small enough for your need.
Thanks a lot! This is such a great insight... I don't know how to put it in words. Since yesterday, I was thinking about the noise in total Pressure which should not be there according to setup. I will run some more tests on this case. Infact, this is such a common problem of nozzle design, that it could be included in 2D examples of next ver. of Eilmer... It will help others. thanks a lot for all the help.
Hi, I am trying to make structured grid for a Contour nozzle using points for wall contour from a .txt file
In the geometry manual it has been given that we can use Spline2 for creating a spline by reading points from a file. In the code attached below, when I run this to make the CoonsPatch from the obtained spline and line elements. The output in terminal shows this
`-- MOC nozzle
-- To get co-ordinates for top wall from data_%f.txt
M_exit = 1.5 sp_file = "data_1.5.txt" mesh_file = "Nozzle_1.5.vtk"
--Define geometry -- From example in geometry guide (Page - 11) a0 = Vector3:new{x = 0.0, y = 0.0} a1 = Vector3:new{x = 0.0, y = 1.0}
if (M_exit==1.5) then a3 = Vector3:new{x = 2.35183, y = 1.17611} a4 = Vector3:new{x = 2.35183, y = 0.0}
elseif (M_exit == 2.0) then a3 = Vector3:new{x = 4.83027, y = 1.68726} a4 = Vector3:new{x = 4.83027, y = 0.0}
elseif (M_exit == 2.5) then a3 = Vector3:new{x = 9.16659, y = 2.63609} a4 = Vector3:new{x = 9.16659, y = 0.0}
elseif (M_exit == 3.0) then a3 = Vector3:new{x = 16.90194, y = 4.23319} a4 = Vector3:new{x = 16.90194, y = 0.0} end
wall_spline = Spline2:new{filename=sp_file} line_inlet = Line:new{p0=a0,p1=a1} line_outlet = Line:new{p0=a3,p1=a4} line_symm = Line:new{p0=a4,p1=a0}
nozzle = Polyline:new{segments={line_inlet, wall_spline, line_outlet, line_symm}}
nx = 100 ny = 100
patch = CoonsPatch:new{west=line_inlet,north=wall_spline, east=line_outlet,south=line_symm}
grid = StructuredGrid:new{psurface=patch, niv=nx, njv=ny} grid:write_to_vtk_file(mesh_file)`
Run via: '$ e4shared --custom-post --script-file="MOC_nozzle.lua" '