|
[Sponsors] |
How to define inlet boundary condition using perl or ccl or cel? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 22, 2023, 09:01 |
How to define inlet boundary condition using perl or ccl or cel?
|
#1 |
New Member
xiaolong li
Join Date: Jan 2023
Posts: 13
Rep Power: 3 |
Hi, It is my first day on the forum, hope i can post the question correctly.
I am simulatiing an axial compressor cascade which works under transonic inflow conditions(inlet mach number is 0.8~1.2). The setup of inlet boundary condition is difficult because of the restrian of "unique incidence". Alternatively, the mach number and flow direction are high dependented. To get a correct value of mach number, i need moditied the inlet boundary condition manually. So i wander if i can edit the inlet boundary condition using perl or cel or ccl to achieve this goal automatically. Does anyone know how to help me? Thank you! |
|
January 23, 2023, 01:39 |
|
#2 |
Senior Member
Daniel
Join Date: Feb 2017
Location: Germany
Posts: 165
Rep Power: 9 |
You can edit your CCL file automatically with a script (Python) and start the simualtion using normal batch files. That would be my approach.
|
|
January 23, 2023, 08:47 |
|
#3 |
New Member
xiaolong li
Join Date: Jan 2023
Posts: 13
Rep Power: 3 |
Thanks very much, have you done this task? Can you give me the detailed information to finish this. Hope can gain your reply!
|
|
January 23, 2023, 16:51 |
|
#4 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144 |
From the CFX Launcher start a command line. Then use the command "cfx5cmds -read -def [def file name] -text [ccl file name]" to generate a ccl file. Edit the CCL to what you want and use the command "cfx5cmds -write -def [def file name] -text [ccl file name]" to put the ccl in your def file. You can then run it as normal.
You can also add a new ccl snippet when you run the solver, but I prefer the method I described previously as it generates a full ccl file which can be kept as a record of the settings for that run.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
January 26, 2023, 01:34 |
|
#5 | |
New Member
xiaolong li
Join Date: Jan 2023
Posts: 13
Rep Power: 3 |
Quote:
My difficulty is that i dont know how to do the loop which can modify the boundary conditions automatically acording to the if condition. My previous method is using the perl, but it failed. |
||
January 26, 2023, 01:54 |
|
#6 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144 |
CEL has an "if" statement. But be wary using it in defining boundary conditions for steady state runs, it is likely to make the simulation hard to converge. There is no looping functionality in CCL or CEL.
Reading your first post, what you propose to do sounds unusual and is likely to not be a good way of doing it. Please explain what you are trying to do and the output file of a simulation where you attempt to do it so we can understand what you are trying to do.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
January 27, 2023, 05:31 |
|
#7 | |
New Member
xiaolong li
Join Date: Jan 2023
Posts: 13
Rep Power: 3 |
Quote:
Ok, i try my best to explain what i want to do. I want to simulate the compressor cascade in CFX. The hard thing is that the inlet boundry condition is not constant. In other words, the inlet Mach number and inlet flow angle are highly dependent. So if i want to achieve a target Mach number, i must modify the inlet flow angle manually. Therefore, i want find a method do this work automatically. Previously, i use the perl script and cel, but fariled. I search this in many website including the help document, still not find. Then, i come this forum to find the help. Best regards! |
||
January 27, 2023, 18:06 |
|
#8 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144 |
By the way, I am not a professor
What you describe you want to do on the inlet sounds very unusual. Also, because you propose to change the inlet boundary condition during the run and this means you are going to have problems with convergence (if this is a steady state run). Almost always when somebody asks how to do an unusual thing in CFX what they are asking to do is a poor way of doing it and some totally different method is far better and avoids the original problem completely. Can you attach your failed attempts at doing this in perl or CEL/CCL? Then we might understand what you are trying to do a bit better.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
January 28, 2023, 07:06 |
|
#9 |
New Member
xiaolong li
Join Date: Jan 2023
Posts: 13
Rep Power: 3 |
OK, the following is my test script.
COMMAND FILE: CFX Pre Version = 18.1 END >load filename=D:/Gama29.cfx, mode=cfx, overwrite=yes > update LIBRARY: CEL: EXPRESSIONS: Ma=massFlowAve(Mach Number)@inlet END END END > update FLOW: Flow Analysis 1 DOMAIN: cascade BOUNDARY: inlet Boundary Type = INLET Interface Boundary = Off Location = ROW 1 _INFLOW BOUNDARY CONDITIONS: FLOW REGIME: Option = Mixed Blend Mach Number Type = Normal Speed END #FLOW REGIME: HEAT TRANSFER: Option = Total Temperature Total Temperature = 285 [K] END #HEAT TRANSFER: TURBULENCE: Option = Low Intensity and Eddy Viscosity Ratio END #TURBULENCE: END #BOUNDARY CONDITIONS: END #BOUNDARY:inlet END #DOMAIN:cascade END #FLOW: > update !$target_MachNumber = 0.86; !$inflowAngle = 29; !$Vel = 290; !while(1){ !if(abs(Ma-$target_MachNumber)>0.001){ BOUNDARY:inlet BOUNDARY CONDITIONS: MASS AND MOMENTUM: Option = Cartesian Velocity Components and Total Pressure Relative Total Pressure = 164162 [Pa] U = 0[m s^-1] V =$Vel*(sin(($inflowAngle+0.1)/180))[m s^-1] W =$Vel*(cos(($inflowAngle+0.1)/180))[m s^-1] END #MASS AND MOMENTUM END END }!else{ !last; } !} >writeCaseFile filename=D:/Gama29.def,operation=\ write def file > update |
|
January 28, 2023, 18:58 |
|
#10 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144 |
Are you trying to adjust the flow angle as the run progresses? Or just define it at the start of the run and it is fixed as the simulation proceeds. If you ae trying to adjust the flow angle inside the run this approach will never work because perl is evaluated once at the start of the run only. So your perl will not be updated as the run progresses, just once at the start of the simulation.
And in general, this is a poor way of doing it. It introduces problems of numerical stability and convergence. A MUCH better way of doing it is to do a series of simple simulations at a range of flow angles which are fixed as the simulation progresses. Then you take the results of these simulations and draw a performance vs flow angle curve and you can interpolate to the performance or flow angle you want. This is MUCH easier.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
January 29, 2023, 19:57 |
|
#11 |
New Member
xiaolong li
Join Date: Jan 2023
Posts: 13
Rep Power: 3 |
Yes, i understand you. But i have a lot of case to calculate. In your method, it will take much time. Thus, i try to make a script to release myself.
|
|
January 29, 2023, 20:05 |
|
#12 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144 |
Trust me, doing it at some fixed angles and interpolating will be MUCH faster and easier than doing it inside the simulation as you propose. In fact I bet you never get it working inside the simulation at all, so it is the difference between getting a result and getting nothing.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
January 30, 2023, 08:56 |
|
#13 |
Senior Member
Join Date: Jun 2009
Posts: 1,858
Rep Power: 33 |
If you are trying to obtain a performance curve/map for your model, you can use the "operating points" feature. It should be a trivial exercise of setting which parameters you want to study, a set of values of interest and the software will do all the simulation in one go for you.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
January 30, 2023, 09:20 |
|
#14 |
New Member
xiaolong li
Join Date: Jan 2023
Posts: 13
Rep Power: 3 |
ok, i will try, thanks.
|
|
July 27, 2023, 06:48 |
ccl file addition in cfx5solve
|
#15 |
New Member
prashant godse
Join Date: Jul 2023
Posts: 10
Rep Power: 3 |
how to add ccl file to .def using perl in cfx5solve
|
|
July 27, 2023, 11:38 |
|
#16 |
Senior Member
Join Date: Jun 2009
Posts: 1,858
Rep Power: 33 |
cfx5cmds -help
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using UDF to define velocity gradient boundary condition (not velocity inlet profile) | uconcorde | Fluent UDF and Scheme Programming | 3 | December 11, 2023 12:56 |
CFD analaysis of Pelton turbine | amodpanthee | CFX | 31 | April 19, 2018 18:02 |
Low Mixing time Problem | Mavier | CFX | 5 | April 29, 2013 00:00 |
Installing OF 1.6 on Mac OS X | gschaider | OpenFOAM Installation | 129 | June 19, 2010 09:23 |
Missing math.h header | Travis | FLUENT | 4 | January 15, 2009 11:48 |