How to define a very large number of boundary conditions (example 100 nozzles) without have to manually create each in CFX-PRE?


You could create one in CFX-PRE and then edit the CCL file (CFX Command Language) to add a perl loop to generate the actual number of boundary conditions, which are generated at the start of the run. The following example shows how to setup multiple nozzles using perl scripted CCL. The example requires CFX-Multiphase license but users can follow the approach for any similar case.

Example:

Create multiple WALL BCs where Lagrangian particle injection is defined to simulate nozzles. For this method to work efficiently you should have a set of 'Composite regions' named like Nozzle1, Nozzle2, Nozzle3 etc`

Instructions:

1) Create a new simulation in CFX-PRE. Setup domains, boundary conditions and properties as required. In this case you will include on 'Particle' phase.
2)Define a Wall B.C with particle injection defined. This B.C is called Nozzle1 and is set on location 'Nozzle1'. (Location Nozzle1, Nozzle2, etc.. is created in the Mesh Generator). Create only one wall B.C. This is a dummy definition, so we can get the required CCL for modification later.
3)Set appropriate solver controls and initial guess
4)Write a solver 'definition' file - in this case NozzleTest.def.
5) From the CFX-5 Launcher (make sure the working directory is set correctly), go to Tools>Command Line.
6) At the DOS prompt, enter the following command:

cfx5cmds -read -def NozzleTestTwo.def -text NozzleTestTwo.ccl

This will extract a text file 'NozzleTestTwo.ccl' in your working folder.

7) Open the text file in Wordpad and look for the following section:

BOUNDARY: Nozzle1
Boundary Type = WALL
Location = Nozzle1
BOUNDARY CONDITIONS:
WALL INFLUENCE ON FLOW:
Option = No Slip
END
WALL ROUGHNESS:
Option = Smooth Wall
END
END
FLUID: Water at 25 C
BOUNDARY CONDITIONS:
MASS AND MOMENTUM:
Normal Speed = 300 [m s^-1]
Option = Normal Speed
END
PARTICLE MASS FLOW RATE:
Mass Flow Rate = 1e-4 [kg s^-1]
END
PARTICLE POSITION:
Number of Positions = 50
Option = Uniform Injection
Particle Locations = Equally Spaced
ENDVELOCITY:
Option = Restitution Coefficient
Parallel Coefficient of Restitution = 1.0
Perpendicular Coefficient of Restitution = 1.0END
END
END
END

In this case all we have to do is to create a perl loop around this section to create the required 'nozzles' at the respective locations.


9) Modify the above section as follows and save it as NozzleTestTwoModified.ccl

########## Modify CCL to include multiple nozzle BCs ####################
!$nnozzle = 4;
! for ($i=0; $i<=$nnozzle-1; $i++) {
! $pn = $i+1;
BOUNDARY: Nozzle$pn
Boundary Type = WALL
Location = Nozzle$pn
BOUNDARY CONDITIONS:
WALL INFLUENCE ON FLOW:
Option = No Slip
END
WALL ROUGHNESS:
Option = Smooth Wall
END
END
FLUID: Water at 25 C
BOUNDARY CONDITIONS:
MASS AND MOMENTUM:
Normal Speed = 300 [m s^-1]
Option = Normal Speed
END
PARTICLE MASS FLOW RATE:
Mass Flow Rate = 1e-4 [kg s^-1]
END
PARTICLE POSITION:
Number of Positions = 50
Option = Uniform Injection
Particle Locations = Equally Spaced
END
VELOCITY:
Option = RestitutionCoefficient
Parallel Coefficient of Restitution = 1.0
Perpendicular Coefficient of Restitution = 1.0END
END
END
END
!}
##########END Modification#####################################################

NOTE the 'BOUNDARY' and 'LOCATION' specification - the names have been modified with a perl variable.

This will create Nozzle1, Nozzle2, Nozzle3 and Nozzle4 during the start of the run, at the respective location. Make sure the loop ends after the correct END CCL statement.'#' is a comment in CCL. NOTE: The 'Locations' or 'composite regions' should exist in the mesh for this method to work.

10) Save the NozzleTestTwoModified.ccl file. From command line execute the following command from the command line:

cfx5cmds -write -def NozzleTestTwo.def -text NozzleTestTwoModified.ccl

This will input the new CCL to the solver definition file.

11) Start the run in the Solver manager. The new nozzles will be created at the start of run.

12) Alternatively you can open the modified def file in PRE to check if everything worked. BUT DO THIS ONLY IF YOU HAVE A SMALL NUMBER OF NOZZLES. Since CFX-PRE will execute the perl statements when opening the def file, it will create all the new nozzles. If you have 100, it will make PRE slow. To open a Def file in PRE go to File>Open and change the filter to 'def files' and select the def file. You use this method as a debugging tool, by defining a small number of nozzles to see if the perl statements are working as you intended it to.





Show Form
No comments yet. Be the first to add a comment!