Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 7, No. 3, 2023 118 Stress Calculation of Key Parts of Evaporator Based on Secondary Development of ANSYS Chaoyang Qu1, Guangzhong Hu1, 2, *, Ping Wang1, 2, Xiangdong Xue1 1School of Mechanical Engineering, Sichuan University of Science and Engineering, Yibin, Sichuan 644000, China 2Key Laboratory of Process Equipment and Control Engineering in Sichuan Universities, Yibin, Sichuan 644000, China * Corresponding author Abstract: The design process of steam generators is complex and involves a significant workload for analysis and design. To streamline this process, we have developed stress calculation software for key parts of the steam generator. The software utilizes a combination of the Qt (C++) programming language and parametric design language (APDL). By automatically generating the APDL command flow file, the software calls ANSYS for background operations and displays the results in a cloud diagram. This approach simplifies the design process and ensures accuracy in stress calculations. The tool allows users to input relevant parameters and obtain accurate calculation results, greatly reducing the complexity of ANSYS usage and enhancing design efficiency. Keywords: ANSYS secondary development; APDL; Steam generator; C++; Stress calculation. 1. Introduction Steam generator equipment is extensively utilised in the refrigeration industry and plays an indispensable function in various sectors of the economy and national security. Due to the nature of steam generators, which carry the risk of leaks and explosions, special attention must be paid when working with this equipment.[1] Steam generators present potential hazards such as leakage and explosion, while their structures are complex, making it challenging to carry out the traditional finite element analysis promptly and efficiently. Therefore, a parametric finite element analysis of key components is crucial to simplify design steps and manage analytical workload. ANSYS secondary development involves encapsulating the entire ANSYS analysis process using a parametric design language. This approach simplifies the process, resulting in more efficient and effective analysis. It's crucial to employ a logical flow of information with causal connections between statements while avoiding biased or emotional language and complex terminology. Standard language, clear structure with logical progression, and technical term abbreviations are essential to enhance comprehensibility and grammatical accuracy. Besides, adhering to style guide rules, using consistent citation, and precise word choice ensures clarity and balanced observations.[2] The APDL, or Parametric Design Language, is a technique for secondary development that ANSYS provides. It can parameterize the modeling, load application, solution, and post-processing stages, effectively producing APDL parametric language.[3] APDL parameterisation language can be used to automatically implement ANSYS solutions and display them through writing the language into macro files recognised by the ANSYS software.[4] The solution and display of ANSYS can be automated by writing APDL parameterization languages into macro files, which are recognized by ANSYS software. Qt is a C++ software development platform that boasts of abundant graphic and application libraries, as well as exceptional cross-platform capabilities.[5] Therefore, this paper utilises the combination of Qt (C++) programming language and parametric design language (APDL) to create an analysis and calculation software. The software has the capacity to input parameters and display analysis cloud diagrams for four key structures: the steam generator cylinder, heat exchanger tube, discharge pipe, and outlet pipe. The aim of this development is to simplify the design process and reduce user workload, ultimately increasing design efficiency. 2. Program Flow and Main Functions 2.1. Main workflow of the program Set the path and project name Enter model size parameters Select the part to analyze. Input working condition parameters Call ANSYS background calculation Show results end Strength requirement start N Y Figure 1. Flowchart of program development 119 The main workflow of the program is divided into four steps: (1) At the top of the software interface, users establish the software path, work path, and project name before selecting the four key parts they wish to analyze. They input the dimensional and working condition parameters of the model and then click the Calculate button. (2) The software generates an APDL command flow file according to user-entered parameters and automatically initiates ANSYS background calculations[6] (b); (3) ANSYS reads the command stream for APDL from the file in a top-to-bottom sequence.[7] After the completion of modelling, loading, solving and post-processing, the ANSYS software will automatically produce the result file, and subsequently close. (4) The C++ programme exhibits the stress distribution diagram on the user interface. The operator can adjust the parameters to recalculate based on the computation outcomes. The software's development process is depicted in Figure 1. 2.2. Program Functions The paper utilises four structures, namely the steam generator cylinder, heat exchanger tube, discharge pipe, and outlet pipe, as instances for developing calculation software. Figure 2, Figure 3, Figure 4, and Figure 5 depicts the structure of each component. Figure 2. Schematic diagram of the cylinder structure Figure 3. Schematic diagram of heat exchanger tube structure Figure 4. Schematic diagram of discharge pipe structure Figure 5. Schematic diagram of outlet receiver structure The software introduced in this study is divided into two distinct sections: the path setting component and the calculation portion, as illustrated in Figure 6. Figure 6. Main interface of the software In the path setting section, "Software Path" denotes the ANSYS software startup path utilised by the C++ program to carry out automatic calculations. Meanwhile, "Work Path" designates the calculation software work path used for storing the generated command flow files, calculation files and result files. "The 'Work Path' specifies the directory for the calculation software, where the command flow file, calculation file, and result file are automatically saved. The 'Project Name' refers to the name of the calculation file." Figure 7. Part calculation section In the part calculation section, four types of parts are available for selection. Abbreviations for technical terms are explained upon first use. Upon selecting a part, the part calculation area divides into two smaller interfaces. On the left-hand side, there is the "Geometric Parameters" setting interface, while the right-hand side offers the "2D Cloud" and "3D Cloud" viewing interfaces. On the left-hand side of the 120 screen, the interface displays the "Geometric Parameters" setting, the "2D Cloud" viewing and the "3D Cloud" viewing options. On the right-hand side, you can access the "Load Condition" setting and the "Calculate" button. In Figure 7, you can see the interface for part calculation. The "Geometric Parameters" interface allows users to input or modify the dimensional parameters of the part. Upon inputting the values, clicking on the "Calculate" button will trigger automatic building or modification of the model based on user input.[8] The software will automatically construct or revise the model based on the user's specified dimensional parameters. The "Load Condition" interface is primarily for users to input pertinent details of the load conditions, like deviation, heat transfer coefficient, and transient condition data. After entering and clicking the "Calculate" button, the program will automatically amend or append the load condition parameters in ANSYS system. The "2D cloud" display interface is primarily utilized to showcase corresponding components of the 2D stress cloud to the user. ANSYS computations are automatically generated once the stress cloud is completed. The software retrieves the graphic file of the calculated results based on the conditions of the portion from the work directory and presents it on the "2D cloud" display interface. The same applies to the "3D cloud diagram". Refer to Figures 8 and 9 for illustration. Figure 8. 2D cloud map Figure 9. 3D cloud map After the "Calculate" button is clicked, the software will automatically complete the model, apply loads, solve all the analysis processes, and post-process the results, saving the batch file (*.bat), result file (*.rst), picture file (*.jpg), and macro file (*.inp) in the work path. 3. Program Realization Process 3.1. Generating a Command Flow File The challenge of this software development lies in the parameterisation of all models and applied loads, particularly in the mastery of the parametric design language APDL and the preparation of command flow files to meet the specific requirements. Achieving this requires a logical progression of information with causal connections between statements, as well as concise and objective language without filler words or ornamental expressions. Precision in word choice and adherence to grammatical correctness are also crucial for clarity and comprehension. The software generates command flow files, such as macro files (*.inp), batch files (*.bat), etc., which ANSYS software can read directly.[9] . All the files automatically generated by the program are shown in Figure 10. Figure 10. Documents generated by the program The modelling process entails identifying the model's main points before connecting them into surfaces, and then finally conducting rotations and other operations. The coordinates serve as the model's key reference points. [10] The key points are primarily established by means of coordinates, which allows for easier modifications at a later stage. After parameterising all models, the C++ programme will automatically generate command flow files in the selected working directory. For instance, in the case of the construction of a cylinder model, the C++ code will automatically generate the command flow file. QStringbatname=ui->txtworkdic->text().append("/ansys.b at"); QFile bat(batname); //write ansys.bat file QTextStream batout(&bat); batout<<'"'<txtansysexe->text()<<'"'<<"-pane3fl- dir"<<'"'<txtworkdic-> text()<<'"'<<"- j"<<'"'<txtjobname->text()<<'"'<<"-sread-len-us-b- i"<<'"'<& lt;ui->txtworkdic->text().append("/").append(ui->txtfilein->t ext())<<'"'<<"-o"<<'"'< txtworkdic->text().append("/").append(ui->txtfileout->text() )<<'"'; bat.close(); // Close the file QStringfilename=ui->txtworkdic->text(); filename.append("/"); filename.append(ui->txtfilein->text()); // Write APDL command flow files T1=ui->txtT1->text().toDouble(); T2=ui->txtT2->text().toDouble(); 121 T3=ui->txtT3->text().toDouble(); T4=ui->txtT4->text().toDouble(); T5 = ui->txtT5->text().toDouble(); T6 = ui->txtT6->text().toDouble(); //Transient operating conditions key time points SGT1=ui->txtSGT1->text().toDouble(); SGT2=ui->txtSGT2->text().toDouble(); SGT3=ui->txtSGT3->text().toDouble(); SGT4=ui->txtSGT4->text().toDouble(); SGT5=ui->txtSGT5->text().toDouble(); SGT6=ui->txtSGT6->text().toDouble(); // Heat transfer coefficient D1= ui->txtD1->text().toDouble(); D2= ui->txtD2->text().toDouble(); D3 = ui->txtD3->text().toDouble(); D4 = ui->txtD4->text().toDouble(); //Cylinder Diameter L1 = ui->txtL1->text().toDouble(); L2 = ui->txtL2->text().toDouble(); L3 = ui->txtL3->text().toDouble(); //Cylinder length R1 = ui->txtR1->text().toDouble(); //Cylinder internal rounded corners R2 = ui->txtR2->text().toDouble(); //Cylinder outer fillet QFile file(filename). QTextStream out(&file); out << tr("finish") << endl; out << tr("/clea") << endl. ...... out << tr("FINISH! Exit normal postprocessor") << endl; out << tr("") << endl; out << tr("SAVE! Save file") << endl; out << tr("EXIT, NOSAV! Exit ANSYS") << endl; file.close(); //close the file The C++ programme will create a command flow document at runtime that encompasses command flow modelling, load command flow application, command flow solving, and post-processing of command flow. The construction process involves creating a finite element model through the establishment of pivotal nodes, followed by executing actions like linking and rotating. Additionally, the loading process serves to characterize the part cell type, specify material attributes, establish model boundary restrictions, define the loading conditions, and delimit the mesh, among other things. The command flow for solving the model is executed followed by the post-processing command flow. The latter is responsible for reading the loads, specifying picture information, and setting the background color. The stress cloud is saved in the work path using the /SHOW command to set the cloud size. The same post-processing command flow is used to specify picture information, set the background color, and save the stress cloud in the work path. All the data adheres to conventional formats and grammatical correctness. 3.2. Calculation and display of results After generating the command flow file in the working directory, the C++ program will initiate background calculations with ANSYS. Below is the implementation of ANSYS background calculation calls using QProcess command in C++ code. QProcess ansys. ansys.start(ui->txtworkdic->text().append("/ansys.bat")); QMessageBox *m_box = new QMessageBox(QMessageBox::Information,QString("Promp t"),QString("Calculating, please wait")); QTimer::singleShot(5000,m_box,SLOT(accept()));//Wait for 5000 milliseconds for the prompt box to disappear automatically m_box->exec(); ansys.waitForFinished();//calculation completed close ANSYS After the automatic calculation by ANSYS is completed by the C++ program, the program will automatically generate 2D and 3D stress picture files in the work path and display them to the corresponding interface of the software.The code of C++ to retrieve the 2D and 3D stress pictures is as follows: QImage image2D. if(!image2D.load(ui->txtworkdic->text().append("/2D.jpg "))) { QMessageBox::information( this,tr("hint"),tr("2D stress map not found"));; } QPixmappixmap2D=QPixmap::fromImage(image2D); ui->image2D->setScaledContents(true); ui->image2D->setPixmap(pixmap2D); QImage image3D. if(!image3D.load(ui->txtworkdic->text().append("/3D.jpg "))) { QMessageBox::information( this,tr("hint"),tr("3D stress map not found"));; } QPixmappixmap3D=QPixmap::fromImage(image3D); ui->image3D->setScaledContents(true); ui->image3D->setPixmap(pixmap3D); QMessageBox::information( this,tr("Prompt"),tr("Calculat ion complete"));; 4. Conclusion In this paper, we combine the Qt (C++) programming language with the parametric design language (APDL) to create an automated parametric modelling system. We analyse the four main components of the steam generator, apply loads, solve problems and post-process. Our system encapsulates the entire analytical process and generates an analysis and calculation software that users can use to input parameters and display the analysis cloud diagram. This solution addresses the issues faced by ANSYS users who lack proficiency in designing steam generators. It effectively streamlines the design process and improves design efficiency, alleviating the extensive steps and significant workload faced by unskilled ANSYS users when designing steam generators. Acknowledgment Funded by The Innovation Fund of Postgraduate, Sichuan University of Science & Engineering(D10501548). Open Fund for the Key Laboratory of Process Equipment and Control Engineering in Sichuan Universities (GK202205); Open Fund for the Key Laboratory of Advanced Manufacturing Technology in Panzhihua City (2022XJZD01). Advanced Manufacturing Technology Key Laboratory Open Fund (2022XJZD01). 122 References [1] CHEN Xuedong, FAN Zhichao, CUI Jun, et al. Progress of high-performance manufacturing technology for pressure vessels in China[J]. Pressure Vessel, 2021,38(10):1-15. [2] YANG Yiyao, QIAN Caifu. Efficient calculation of strength of mobile pressure vessel based on secondary development of ANSYS[J]. Journal of Beijing University of Chemical Technology (Natural Science Edition), 2019,46(01):91-97. [3] HOU Shitong, WANG Ying. Visualization technology of fatigue life and failure probability of large-span bridges based on secondary development of ANSYS[J]. Journal of Jiangsu University (Natural Science Edition), 2017,38(03):349-354. [4] CHENG Xiaomin, JIANG Lijing. Secondary development of ANSYS for temperature field simulation of phase change materials[J]. Journal of Wuhan University of Technology (Information and Management Engineering Edition), 2012, 34(05): 535-538. [5] YAN Huailei, JIN Zhijiang, JIANG Chenghang. Development of safety assessment system for pressure pipelines with unwelded defects based on Qt and ANSYS[J]. Chemical Machinery, 2013,40(01):38-42. [6] SHE Zhanjiao, LIU Guangqing, YAO Fenglin, et al. Development of telescopic boom stability calculation platform based on VB and Ansys[J]. Crane and Transportation Machinery, 2020(10):35-39. [7] TANG Bi-Qiang, ZHANG Yan, WANG Hu, et al. Development of a coupled heat engine analysis system for internal combustion engine cylinder liners [J]. Mechanical Design and Manufacturing, 2020(09):284-286. [8] ZHENG Xiaowen, SUN Yufei, LI Jintao, et al. Research on the design of disk brake based on the joint secondary development of SolidWorks and ANSYS[J]. Coal Mine Machinery, 2020,41(07):166-169. [9] Li Qiyang, Nano Peng. C#.NET-based ANSYS secondary development optimization design technology and application[J]. Petrochemical Equipment, 2013,42(01):85-89. [10] Deng Caiyan, Zhao Junmei, Wang Dongpo, et al. Stress and deformation analysis system of cladding welding based on secondary development of ANSYS[J]. Journal of Tianjin University (Natural Science and Engineering Technology Edition), 2016,49(12):1330-1334. [11] WU Hai-Ping, JIANG Ye-Feng, WU Xing-Sheng, et al. Research on CAE auxiliary analysis system of escalator based on VC and ANSYS[J]. Mechanical Manufacturing and Automation, 2019,48(06):134-136.