CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

How to define inlet boundary condition using perl or ccl or cel?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes
  • 1 Post By ghorrocks
  • 1 Post By ghorrocks
  • 1 Post By Opaque

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 22, 2023, 09:01
Default 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
xiaolong.li is on a distinguished road
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!
xiaolong.li is offline   Reply With Quote

Old   January 23, 2023, 01:39
Default
  #2
Senior Member
 
Daniel
Join Date: Feb 2017
Location: Germany
Posts: 165
Rep Power: 9
zacko is on a distinguished road
You can edit your CCL file automatically with a script (Python) and start the simualtion using normal batch files. That would be my approach.
zacko is offline   Reply With Quote

Old   January 23, 2023, 08:47
Default
  #3
New Member
 
xiaolong li
Join Date: Jan 2023
Posts: 13
Rep Power: 3
xiaolong.li is on a distinguished road
Thanks very much, have you done this task? Can you give me the detailed information to finish this. Hope can gain your reply!
xiaolong.li is offline   Reply With Quote

Old   January 23, 2023, 16:51
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
zacko likes this.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   January 26, 2023, 01:34
Default
  #5
New Member
 
xiaolong li
Join Date: Jan 2023
Posts: 13
Rep Power: 3
xiaolong.li is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
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.
Thanks for your suggewtion. You mean that ccl counld achieve loop and if?
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.
xiaolong.li is offline   Reply With Quote

Old   January 26, 2023, 01:54
Default
  #6
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   January 27, 2023, 05:31
Default
  #7
New Member
 
xiaolong li
Join Date: Jan 2023
Posts: 13
Rep Power: 3
xiaolong.li is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
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.
Thanks very much, professor. You are so willing to help me.

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!
xiaolong.li is offline   Reply With Quote

Old   January 27, 2023, 18:06
Default
  #8
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   January 28, 2023, 07:06
Default
  #9
New Member
 
xiaolong li
Join Date: Jan 2023
Posts: 13
Rep Power: 3
xiaolong.li is on a distinguished road
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
xiaolong.li is offline   Reply With Quote

Old   January 28, 2023, 18:58
Default
  #10
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   January 29, 2023, 19:57
Default
  #11
New Member
 
xiaolong li
Join Date: Jan 2023
Posts: 13
Rep Power: 3
xiaolong.li is on a distinguished road
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.
xiaolong.li is offline   Reply With Quote

Old   January 29, 2023, 20:05
Default
  #12
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
zacko likes this.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   January 30, 2023, 08:56
Default
  #13
Senior Member
 
Join Date: Jun 2009
Posts: 1,858
Rep Power: 33
Opaque will become famous soon enough
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.
Opaque is offline   Reply With Quote

Old   January 30, 2023, 09:20
Default
  #14
New Member
 
xiaolong li
Join Date: Jan 2023
Posts: 13
Rep Power: 3
xiaolong.li is on a distinguished road
ok, i will try, thanks.
xiaolong.li is offline   Reply With Quote

Old   July 27, 2023, 06:48
Default ccl file addition in cfx5solve
  #15
New Member
 
prashant godse
Join Date: Jul 2023
Posts: 10
Rep Power: 3
prashant9397 is on a distinguished road
how to add ccl file to .def using perl in cfx5solve
prashant9397 is offline   Reply With Quote

Old   July 27, 2023, 11:38
Default
  #16
Senior Member
 
Join Date: Jun 2009
Posts: 1,858
Rep Power: 33
Opaque will become famous soon enough
cfx5cmds -help
zacko likes this.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
Opaque is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 23:22.