Difference between revisions of "Fadil Naufal Wahas"

From ccitonlinewiki
Jump to: navigation, search
 
(24 intermediate revisions by the same user not shown)
Line 213: Line 213:
  
  
== Paper Draft ==
+
=== Paper Draft ===
  
 
Grid Independency Study on the Turbulence of Lid Driven Cavity using DAI5 Framework
 
Grid Independency Study on the Turbulence of Lid Driven Cavity using DAI5 Framework
Line 221: Line 221:
  
  
== Mid Test with ChatGPT ==
+
=== Mid Test with ChatGPT ===
  
  
Line 449: Line 449:
  
  
=== Discussion with ChatGPT: Numerical Methods ===
+
=== Discussion with ChatGPT: Continuum Mechanics ===
  
  
 
{| class="wikitable" style="width: 99%;"
 
{| class="wikitable" style="width: 99%;"
| style="text-align: center;" colspan="3" | '''Mid Test with ChatGPT'''
+
| style="text-align: center;" colspan="3" | '''Continuum Mechanics'''
 +
|-
 +
|-
 +
| style="width: 20%;"|
 +
| style="width: 80%;text-align:left; color:#ffffff; background-color:#232323; padding: 10px;" colspan="2"| USER
 
|-
 
|-
 +
| style="width: 80%;text-align:left; color:#ffffff; background-color:#232323; padding: 10px;" colspan="2"| AI
 +
| style="width: 20%;"|
 
|-
 
|-
 
| style="width: 20%;"|  
 
| style="width: 20%;"|  
| style="width: 80%;text-align:left;" colspan="2"| USER
+
| style="width: 80%;text-align:left; color:#ffffff; background-color:#232323; padding: 20px;" colspan="2"| Can you give a practical example (along with a simple calculator for a 1D problem) in engineering where continuum mechanics treats materials as continuous, focusing on the integration of an uninterrupted 'conscious continuum' into the DAI5 framework.
 
|-
 
|-
| style="width: 80%;text-align:left;" colspan="2"| AI
+
| style="width: 80%;text-align:left; color:#ffffff; background-color:#232323; padding: 20px;" colspan="2"| Certainly! Continuum mechanics simplifies the study of materials by assuming they are continuous and devoid of voids, even though materials are composed of discrete particles. This assumption allows engineers to use mathematical tools, such as differential equations and integration, to analyze stresses, strains, and material behavior. Let’s create a practical example in engineering:
 +
 
 +
Problem: 1D Axial Deformation of a Rod
 +
A steel rod of length L=1.0m, cross-sectional area A=0.01m², and Young's modulus E=200GPa is subjected to a tensile force F=10,000N. The goal is to calculate the elongation ΔL of the rod using continuum mechanics and integrate it with the DAI5 framework as an uninterrupted "conscious continuum."
 +
 
 +
Continuum Mechanics Solution:
 +
Using the 1D axial deformation formula:
 +
 
 +
ΔL=FL/AE
 +
 
 +
where F = Applied force, L = Original length, A = Cross-sectional area, E = Young's modulus
 +
 
 +
DAI5 Framework Integration:
 +
 
 +
Intention: Understand how a tensile force deforms a continuous rod in 1D.
 +
 
 +
Initial Thinking: Assume a linear elastic behavior where stress and strain follow Hooke's Law. Define the rod as a continuum, ignoring atomic-scale irregularities.
 +
 
 +
Idealization: Use the governing equation derived from Hooke’s Law, treating material properties as constant and uniformly distributed.
 +
 
 +
Instruction Set: Write a program to calculate the elongation and visualize its dependence on F, A, E, and L.
 +
 
 +
 
 +
Python Calculator:
 +
 
 +
F = 10000  # Force in Newtons
 +
 
 +
L = 1.0    # Length in meters
 +
 
 +
A = 0.01  # Cross-sectional area in square meters
 +
 
 +
E = 200e9  # Young's modulus in Pascals
 +
 
 +
delta_L = (F * L) / (A * E)
 +
 
 +
print(f"Elongation (ΔL): {delta_L:.6f} m")
 +
 
 
| style="width: 20%;"|  
 
| style="width: 20%;"|  
 
|}
 
|}
Line 465: Line 507:
  
  
=== Reduced-Order Model (ROM) using Python: 1D Conduction ===
+
=== Reduced-Order Model (ROM) ===
 +
 
 +
 
 +
A Reduced-Order Model (ROM) is a simplified version of a high-fidelity mathematical or computational model, designed to retain the essential features and dynamics of the original system while significantly reducing its computational complexity and resource requirements. This reduction is achieved through reducing the dimension of the matrix equivalent to the physics phenomena at hand by means of the Proper Orthogonal Decomposition (POD) and Singular Value Decomposition (SVD).
 +
 
 +
There are numerous framework already developed to do ROM, one of which is ITHACA-FV developed to perform reduce order modeling of OpenFOAM CFD simulation. Other than that, there is a Python numerical framework NumPy to conduct ROM.
 +
 
 +
 
 +
 
 +
=== Tugas Besar: Grid Independency Study on the PWR Hot Leg using DAI5 Framework ===
 +
 
 +
 
 +
This is the final project of the CFD Application Class. The project studied the grid independency of PWR Hot Leg geometry when subjected to the two-phase fluid flow.
 +
 
 +
The paper draft can be found here: [https://drive.google.com/file/d/1D9PbAFgUEoTYG2faOlncjIZjflKIGYKO/view?usp=sharing Google Drive]
 +
 
 +
 
 +
 
 +
=== The 33 DAI5 Implementation Evaluation Criteria ===
 +
 
 +
The 33 DAI5 Implementation Evaluation Criteria on the Project
 +
 
 +
"Grid Independency Study on the PWR Hot Leg using DAI5 Framework"
 +
 
 +
 
 +
'''I. Deep Awareness (of) I (DAI)'''
 +
 
 +
1. Consciousness of Purpose: In the broader scheme, the study aims to better understand The Creator by understanding the nature of physics and engineering through the study of two-phase liquid-gas flow and grid independency in PWR hot leg simulations, reflecting a deliberate and purposeful approach.
 +
 
 +
2. Self-awareness: The research demonstrates awareness of the researcher's role as a seeker of knowledge and the project's contribution to the broader field of physics and computational fluid dynamics.
 +
 
 +
3. Ethical Considerations: Ethical principles are observed by ensuring accuracy and transparency in the methodologies and findings, with the Creator’s presence considered into account.
 +
 
 +
4. Integration of CCIT (Cara Cerdas Ingat Tuhan): The study explicitly integrates the remembrance of the Creator, connecting scientific inquiry to spiritual awareness by synergizing the Creator and the creations (us).
 +
 
 +
5. Critical Reflection: The project reflects critically on the significance of grid refinement and its implications for computational efficiency.
 +
 
 +
6. Continuum of Awareness: Continuous awareness is evident through systematic adherence to the scientific writing method and DAI5 framework stages.
 +
 
 +
 
 +
'''II. Intention'''
 +
 
 +
7. Clarity of Intent: The project clearly states its objectives: understanding grid refinement and ensuring reliable CFD simulations.
 +
 
 +
8. Alignment of Objectives: The goals align with practical CFD applications and the broader mission of advancing reactor safety.
 +
 
 +
9. Relevance of Intent: The intent addresses a crucial gap in understanding grid dependency for complex PWR hot leg geometries.
 +
 
 +
10. Sustainability Focus: The study promotes computational efficiency, reducing unnecessary resource use.
 +
 
 +
11. Focus on Quality: High-quality simulation results are prioritized through detailed analysis and physics-oriented verification.
 +
 
 +
 
 +
'''III. Initial Thinking (about the Problem)'''
 +
 
 +
12. Problem Understanding: The complexity of simulating PWR hot leg flow is thoroughly analyzed, with grid size and velocity identified as a key challenge.
 +
 
 +
13. Stakeholder Awareness: The research considers the needs of reactor designers, CFD practitioners, and safety analysts. This can further benefits the industry as well as the scientific field.
 +
 
 +
14. Contextual Analysis: The study situates itself within the broader context of computational advancements.
 +
 
 +
15. Root Cause Analysis: Grid dependency is identified as one of the root cause of inaccuracies and uncertainties in CFD solutions
 +
 
 +
16. Relevance of Analysis: The analysis directly informs the refinement of grid resolutions represented by the key factor of velocity for accurate results.
 +
 
 +
17. Use of Data and Evidence: Reliable numerical data from simulations validate findings and ensure credibility.
 +
 
 +
 
 +
'''IV. Idealization'''
 +
 
 +
18. Assumption Clarity: The project explicitly states assumptions, such as incompressible, transient, laminar flow conditions.
 +
 
 +
19. Creativity and Innovation: It employs the DAI5 framework innovatively to approach grid dependency studies in CFD.
 +
 
 +
20. Physical Realism: Simulations adhere to physical laws, such as Navier-Stokes equations, ensuring that results are realistic and applicable.
 +
 
 +
21. Alignment with Intent: the study employs Idealized conditions aligned with the intent of achieving accurate and efficient simulations.
 +
 
 +
22. Scalability and Adaptability: The methodologies can be adapted for other complex geometries and simulation conditions.
 +
 
 +
23. Simplicity and Elegance: The project simplifies complex phenomena into actionable simulation steps without losing accuracy.
 +
 
 +
 
 +
'''V. Instruction Set'''
 +
 
 +
24. Clarity of Steps: Methodological steps are clearly detailed, enabling reproducibility in other studies such as pre-processing, processing, and post-processing.
 +
 
 +
25. Comprehensiveness: The simulation process covers all relevant aspects, including multiple grid sizes and evaluation criteria.
 +
 
 +
26. Physical Interpretation: The physical domain of PWR hot leg simulations are feasible within OpenFOAM, a widely-used CFD platform.
 +
 
 +
27. Error Minimization: Error from computational risks, such as grid independency, are mitigated through grid optimization.
 +
 
 +
28. Verification and Validation: The study employs rigorous verification through velocity comparison between grid sizes. Evaluation through velocity profiles ensures robust validation of grid-independent solutions.
 +
 
 +
29. Iterative Approach: Results from coarser grids informed the refinement of finer grids, demonstrating iterative improvement.
 +
 
 +
30. Sustainability Integration: The study implemented a sustainability approach such as following the DAI5 Framework, the scientific method, is reproducable through various method, and ensures the continual nature of the study.
 +
 
 +
31. Communication Effectiveness: The project effectively communicate the purpose of the study which is focusing efforts on critical grid sizes.
 +
 
 +
32. Alignment with DAI5 Framework: The project aligns with CFD best practices and international research standards.
 +
 
 +
33. Documentation Quality: The study is well-documented, with detailed descriptions of methods, results, and discussions.
 +
 
 +
 
 +
 
 +
=== Extended: Artificial Neural Network (ANN) Modeling on PWR Hot Leg Grid Independency Study ===
 +
 
 +
 
 +
Using the data from the previous study [https://air.eng.ui.ac.id/index.php?title=Fadil_Naufal_Wahas#Tugas_Besar:_Grid_Independency_Study_on_the_PWR_Hot_Leg_using_DAI5_Framework Tugas Besar], 4 variations of grid size are gathered, represented by the number of elements or cells: 203,085 elements, 673,390 elements, 1,185,440 elements, and 1,553,450 elements.
 +
 
 +
Due to the immense number of data from these simulations, the artificial neural network (ANN) modeling only uses the slices of the computational domain, specifically the slice through the symmetry line or y = 0 to get the 2-dimensional data of x and z axes.
 +
 
 +
With this 4 variations of grid size, along with the x and z coordinates of the cells of the control volume of the, there are 96,749 rows of data as the input for the ANN modeling with the x-axis velocity component (Ux) and z-axis velocity component (Uy) in said coordinate as the output of the ANN modeling.
 +
 
 +
The the Python codes can be downloaded from [https://air.eng.ui.ac.id/index.php?title=Fadil_Naufal_Wahas#Lid-Driven_Cavity_with_Artificial_Neural_Network_.28ANN.29 the previous ANN Cavity study] and the input-output table can be downloaded [https://docs.google.com/spreadsheets/d/1F8F2FsjSTbahtgEqWLMoAXUlZjz9z5_fe2bDhfqx0nA/edit?usp=sharing here].
 +
 
 +
From the ANN modeling with 5 hidden layers and 256 neurons per hidden layer, as seen in the ANN Architecture below, and 1,000 epochs, it can be seen that the evaluation of the model yields relatively good results.
 +
 
 +
With these statistics: 96,749 rows of data, 3 inputs, 2 outputs, 5 hidden layers, 256 neurons per hidden layer, and 1,000 epoch, the total runtime of the ANN modeling was 5 hours.
 +
 
 +
 
 +
[[File:Fig annarchi.png|400px]]
 +
 
 +
 
 +
The ANN modeling resulted in the model loss of less than 1e-3, specifically 3.5e-4 and 4.3e-4 for the training and testing losses.
 +
 
 +
 
 +
[[File:Fig loss.png|300px]]
  
  
''In Progress.''
+
The ANN model can predict Ux and Uz with '''coefficient of determination (R²) of more than 0.8707 and 0.9718''', respectively.
  
  
 +
[[File:Fig actvspred1.png|300px]] [[File:Fig actvspred2.png|300px]]
  
=== Reduced-Order Model (ROM) using ITHACA-FV: Backward Facing Step (PitzDaily) ===
 
  
 +
It can be seen that the actual data has a relatively good agreement with the ANN-predicted data.
  
''In Progress.''
+
This result can of course be improved by varying the ANN modeling parameters such as the number of hidden layer, the number of neurons per hidden layer, and the number of epoch, and also adding more and more data from the variations of simulation (e.g. y direction cells, time variable, inlet velocity variations, etc.) to cover a broader range of conditions.
  
  
  
 
(EOF)
 
(EOF)

Latest revision as of 22:37, 3 January 2025


Assalamu'alaikum Warahmatullahi Wabarakatuh, Salam Sejahtera untuk kita semua.

Perkenalkan, saya Fadil Naufal Wahas, NPM 2306185416, mahasiswa magister Departemen Teknik Mesin Universitas Indonesia.



Thesis

Tesis : Studi komputasi tentang pengaruh sifat fluida terhadap karakteristik counter-current flow limitation (CCFL) di 1/30 pressurized water reactor (PWR) hot leg

Thesis : Computational study of the effects of fluid properties on counter-current flow limitation (CCFL) characteristics in 1/30 pressurized water reactor (PWR) hot leg

Pembimbing : Prof. Dr. Ir. Harinaldi, M.Eng.

PWR.png

Pada kanal uap (hot leg) teras reaktor pada pembangkit listrik tenaga nuklir pressurized water reactor (PWR) terdapat fenomena counter-current flow limitation (CCFL) yang terjadi pada saat kondisi kecelakaan loss-of-coolant accident (LOCA).

Saat LOCA, karena adanya penurunan tekanan, terjadi penguapan air pendingin yang berada di reaktor sehingga uap tersebut mengalir ke steam generator (SG) melalui hot leg. Sebagian uap yang terkumpul di SG tersebut mengalami kondensasi menjadi air. Air tersebut, dipengaruhi gravitasi, mengalir kembali ke reaktor, berlawanan arah dengan uap. Aliran berlawanan arah ini terjadi saat kecepatan aliran uap berada di bawah ambang batas flooding atau counter-current flow limitation (CCFL).

Fenomena CCFL ini menjadi penting untuk diteliti karena berhubungan dengan keselamatan reaktor nuklir. Oleh karena itu, pengaruh sifat fisik fluida terhadap karakteristik CCFL perlu diinvestigasi.


DAI5 Framework

DAI5 Framework is a guideline developed by Dr. Ahmad Indra Siswantara for problem-solving processes. This video essay is my interpretation of the DAI5 Framework.



Computational Fluid Dynamics (CFD) Part 1

Convergence and Grid Independence

The two aspects that characterize a successful simulation result are convergence and grid independence. A converged solution have very small residuals – measures of the overall conservation of the flow properties.

The only way to eliminate errors due to coarseness of a grid is to perform a grid dependence study, which is a procedure of successive refinement of an initially coarse grid until certain key results do not change. Then the simulation is grid independent. A systematic search for convergent and grid-independent results forms an essential part of all high-quality CFD studies.

Reference: H. K. Versteeg and W. Malalasekera, An Introduction to Computational Fluid Dynamics: The Finite Volume Method. 2nd Edition. England: Pearson, 2007.


Cavity 2D Laminar Flow with CFDSOF

The image below shows a 0.1 m by 0.1 m cavity section filled with air (udara) where the upper wall is moving in the +x-axis direction at 0.1 m/s where the density (ρ) of air is 1 kg/m^3, the dynamic viscosity (µ) of air is 2 * 10^-5 kg/m-s, and the flow is laminar, i.e. Re = 500.


Cav2d case.png


The grid-structured *CFDSOF* software is used in this simulation case.

First, cavity is discritized by dividing it into cells, in this case, a 10x10 cells.


Cav2d discret.png


Then, after specifying the boundary condition of the walls and the iteration of the case, the iteration begins. The results of the velocity vector field and the pressure contour are shown in the images below.


Cav2d u.png

Cav2d p.png


It can be shown that the air is indeed moving inside the cavity and the air that is closest to the upper wall is also moving with the greatest magnitude. From the pressure contour, it can be seen that the upper-most-right corner has the greatest pressure. This is due to the fact that air is colliding at that corner and is diverted to the adjacent bottom. This collision occurs at the 4 corners of the wall, thus creating the swirling effect with the smallest velocity magnitude at the center of the swirl.


OpenFOAM Solvers

Here are solvers that OpenFOAM offers. The table below classifies the solver based on the flow of the fluid and depends on the case-by-case problem.

OpenFOAM Solvers
No. Solver Algorithm Time Flow Compressibility Phase
1 simpleFoam SIMPLE Steady-State Laminar/Turbulent Incompressible Single-phase
2 icoFoam PISO Transient Laminar Incompressible Single-phase
3 pisoFoam PISO Transient Turbulent Incompressible Single-phase
4 pimpleFoam PISO+SIMPLE Transient Turbulent Incompressible Single-phase
5 interFoam PISO+SIMPLE Transient Turbulent Incompressible Multi-phase
6 - - - - - -


SIMPLE = Semi-Implicit Method for Pressure Linked Equations

PISO = Pressure Implicit with Splitting of Operators


Cavity 2D with OpenFOAM

The problem we are trying to solve is lid-driven cavity. Same as previous case, the geometry is a 2 dimensional 0.1 m by 0.1 m (gamma = Lx/Ly = 1) cavity space with the upper wall moving to the positive x-axis direction at certain velocities. The boundary of right, left, and lower wall is stationary. The fluid is air with kinematic viscosity (nu) of 1 * 10-⁵ m²/s.

The INTENTION of this preliminary study is to understand the effect of Reynolds number (Re) on the air flow inside the lid-driven cavity, particularly the flow profile. At certain velocity, is it laminar, transitional, or turbulent? At what Reynolds number does the change occurs?


<math> Re = \frac{&rho U L}{&mu} = \frac{U L}{\&nu} . . . (1) </math>


where: Re = Reynolds number (-) rho = fluid density (kg/m³) U = inlet velocity = upper wall velocity (m/s) L = characteristic length = wall length = 0.1 m mu = dynamic viscosity (kg/m-s) nu = kinematic viscosity = 1 * 10-⁵ (m²/s)

Reynolds number can be calculated using the Eq. (1). We can vary the Reynolds number by varying the wall velocity. Here, the upper wall velocity is varied from 0.0001 m/s to 0.8 m/s with various increment. The wall velocity variation is presented at the table below.


Table 1. Variation of wall velocity
U (m/s) Re (-)
0.0001 1
0.01 100
0.02 200
0.03 300
0.04 400
0.05 500
0.1 1000
0.2 2000
0.3 3000
0.8 8000


We used the open-source CFD software OpenFOAM for this study with simpleFoam solver for both laminar and turbulent flow, with the latter using the k-Omega turbulence model. The flow was assumed to be steady-state. A 50 by 50 hexahedral grid mesh was used in the model, where the z-axis was set to 1 cell to represent the 2 dimensional case.

First, we validated our simulation by comparing the case with U = 0.0001 m/s and U = 0.8 m/s, hence the Re are 1 and 8000, respectively, with the case from a study conducted by Hendriketal [1], also with the same Re. The fluid flow with the isolines (streamlines) from both simulation and reference [1] can be seen in the Fig. 1 and Fig. 2 below. It can be seen that the results generated by our simulations is the same as the results obtained from [1].


Sim 1vs8k.png


Ref 1vs8k.png


The flow with Re = 1 is laminar and almost vertically symmetrical and the flow with Re = 8000 is turbulent with 3 secondary eddies in the 3 corners of the cavity.

Next we varied the parameter of U from 0.01 m/s to 0.3 m/s with simpleFoam laminar model as per Table 1, and look at the flow profile of the cavity. The isolines can be seen at Fig. 3 to Fig. 10.


1 cavity 0.01.png 2 cavity 0.02.png 3 cavity 0.03.png 4 cavity 0.04.png 5 cavity 0.05.png 6 cavity 0.1.png 7 cavity 0.2.png 8 cavity 0.3.png


Convergence can be seen from simulation's variables residuals below.

Re = 1

Residuals Initial.png


Re = 8000

Residuals Initial 0.8.png


References:

[1] H. C. Kuhlmann and F. Romanò, "The Lid-Driven Cavity," Computational Methods in Applied Sciences, vol. 50, 2019. https://doi.org/10.1007/978-3-319-91494-7_8


Lid-Driven Cavity with DAI5 Framework

This is a video essay of the application of DAI5 Framework in understanding lid-driven cavity. The lid-driven cavity simulation is done using OpenFOAM.

Disclaimer: the video is in Bahasa Indonesia.


Lid-Driven Cavity Case File: bit.ly/CavityDAI5



Paper Draft

Grid Independency Study on the Turbulence of Lid Driven Cavity using DAI5 Framework

Google Drive


Mid Test with ChatGPT

Mid Test with ChatGPT
User
ChatGPT
I am going to take an exam on the subject of basic Computational Fluid Dynamics (CFD). I need you to create a basic test consisted of 5 short-answer questions all at once and grade what I do.
Here’s a basic test on Computational Fluid Dynamics (CFD) consisting of 5 short-answer questions:


CFD Basic Test

Question 1: Define the term "viscosity" and explain its significance in fluid flow.

Question 2: What is the difference between laminar and turbulent flow? Provide examples of each.

Question 3: Explain the concept of grid independence in CFD and why it is important for accurate simulation results.

Question 4: Describe the role of the Navier-Stokes equations in CFD. What do they represent?

Question 5: What are boundary conditions in CFD, and why are they crucial for setting up a simulation?


Once you answer these questions, I can grade your responses!

1. Define the term "viscosity" and explain its significance in fluid flow.

Viscosity is a measure of a fluid’s internal friction or resistance to deformation or flow when a force is applied to it. It is a fluid-specific property where fluids with higher viscosity, like syrup, deform less easily compared to fluids with lower viscosity, like water. There are two types of viscosity, the dynamic viscosity (mu) and the kinematic viscosity (nu), with units kg/m.s and m^2/s, respectively. In fluid flow applications, viscosity plays a vital role in determining whether the flow is laminar or turbulent. Viscosity is a critical property that affects fluid dynamics, influencing how fluids flow and behave under various conditions.

2. What is the difference between laminar and turbulent flow? Provide examples of each.

Laminar flow is characterized by smooth, orderly motion of fluid layers, with each layer sliding past the adjacent ones with minimal to no mixing. This type of flow typically occurs at low Reynolds numbers (Re < 2000). An example of laminar flow is the flow of blood inside our capillaries or the flow of air inside a wind tunnel before contact.

Turbulent flow, on the other hand, is characterized by irregular fluid motion with significant mixing and fluctuations in velocity. This type of flow typically occurs at high Reynolds numbers (Re > 4000). An example of turbulent flow is the air in and out of our respiratory system or the airflow around an airplane wing.

3. Explain the concept of grid independence in CFD and why it is important for accurate simulation results.

Grid independence refers to the condition where the results of a simulation do not significantly change with further refinement of the computational grid (mesh). This can be done with a grid dependence study, which is a procedure of successive refinement of an initially coarse grid until certain key results do not change. Achieving grid independence is crucial because it ensures that the numerical solution is not influenced by the discretization of the domain, leading to more reliable and accurate results. A systematic search for grid-independent result forms an essential part of all high-quality CFD studies.

4. Describe the role of the Navier-Stokes equations in CFD. What do they represent?

The Navier-Stokes equations are a set of nonlinear partial differential equations that describe the motion of fluid. They represent the conservation of momentum in fluid flow and are fundamental to the field of computational fluid dynamics. The equations account for viscosity, pressure, and external forces acting on the fluid. In CFD, solving the Navier-Stokes equations enables the prediction of velocity fields, pressure distributions, and other flow characteristics, making them essential for simulating and analyzing fluid behavior in various engineering applications.

5. What are boundary conditions in CFD, and why are they crucial for setting up a simulation?

Boundary conditions in CFD define the behavior of the fluid at the boundaries of the computational domain. They specify values for variables such as velocity, pressure, and other relevant quantities at the edges of the simulation space. They ensure that the simulation reflects the physical reality of the problem being modeled, allowing for accurate predictions and are essential for producing valid and reliable CFD results.

Grading:
  • Definition of Viscosity: (9/10)

Your explanation is clear and well-structured. You correctly define viscosity and its types (dynamic and kinematic) along with their units. You also mention its importance in fluid dynamics and how it affects flow behavior. One minor note: You could expand on how viscosity affects energy dissipation in the flow. Nonetheless, your answer is quite strong.

  • Difference between Laminar and Turbulent Flow: (10/10)

Excellent explanation of both laminar and turbulent flows with clear examples and correct references to Reynolds numbers. The distinction between orderly and chaotic motion is well articulated, and the examples are accurate.

  • Grid Independence Concept: (10/10)

Great explanation! You correctly identify grid independence and explain the grid dependence study and its importance in ensuring simulation accuracy. This is a key concept in CFD, and your description captures it thoroughly.

  • Role of Navier-Stokes Equations: (10/10)

Your answer effectively highlights the significance of the Navier-Stokes equations in CFD. You mention their role in momentum conservation, accounting for viscosity, pressure, and forces, and how they are used to predict key flow characteristics. This is a complete and concise answer.

  • Boundary Conditions in CFD: (9/10)

Good explanation of boundary conditions and their role in simulations. You correctly mention their importance in defining variables at the boundaries and ensuring physical realism in the model. A small suggestion: you could briefly touch upon specific types of boundary conditions (e.g., Dirichlet, Neumann) for more depth, but your answer is still very solid.

Overall Score: 96/100

Excellent work! Your understanding of CFD fundamentals is strong, and you provided clear, well-articulated answers throughout the test. Just minor improvements in elaboration could make it even better.

How does viscosity affects energy dissipation in the fluid flow? Could you elaborate?
Viscosity affects energy dissipation in fluid flow by resisting the motion of fluid layers, converting kinetic energy into thermal energy (heat) through internal friction. Here’s how this process works in detail:

Internal Friction and Shear Stress: Viscosity causes internal friction between adjacent layers of fluid moving at different velocities. This friction leads to shear stress, which requires energy to maintain. As layers slide past each other, some of the flow’s kinetic energy is “used up” in overcoming this frictional resistance.

Conversion of Kinetic Energy to Heat: The energy needed to overcome the viscous forces does not just vanish; it’s transformed into heat. This phenomenon is known as viscous dissipation. In regions with high velocity gradients (such as near solid boundaries in turbulent flows), the energy dissipation rate is higher, causing more kinetic energy to be converted to heat.

Impact on Flow Types:

Laminar Flow: In low-viscosity, laminar flows, this energy dissipation is relatively low, as the layers slide smoothly over each other. However, viscosity is still crucial for determining the flow regime and ensuring the orderly motion of fluid layers. Turbulent Flow: In turbulent flows, viscosity plays a larger role in dissipating energy. The chaotic, fluctuating motion of fluid particles in turbulence generates numerous small eddies, which further increase the velocity gradients and amplify the energy dissipation through viscous effects. Implications in Engineering and CFD: High-viscosity fluids dissipate more energy as heat, which can be critical for cooling and lubrication applications. In CFD, accurately modeling viscosity is essential to capture realistic energy dissipation, especially in simulations involving turbulent flows, as it affects flow stability, boundary layer characteristics, and even heat transfer predictions.

Understanding viscosity's role in energy dissipation is crucial for designing efficient fluid systems, as well as for accurately predicting fluid behavior in simulations.

What are the Dirichlet and Neumann boundary conditions? What other types of boundary conditions are there?
In CFD, boundary conditions define how fluid behaves at the edges of the simulation domain. Here’s a breakdown of Dirichlet and Neumann boundary conditions, along with a few other common types:
  • Dirichlet Boundary Condition (Fixed Value):

This boundary condition specifies a fixed value for a field variable (like velocity, pressure, or temperature) at the boundary. For instance, setting the temperature on a wall to a constant value (e.g., 300 K) or prescribing a fixed velocity at an inlet. Dirichlet conditions are commonly used to impose known values at inflow boundaries or solid surfaces with a constant temperature.

  • Neumann Boundary Condition (Fixed Gradient or Flux):

This condition specifies a fixed rate of change, or gradient, of a variable at the boundary rather than the variable's value itself. For example, setting the heat flux across a wall surface to a constant (which relates to the temperature gradient) or defining a zero-velocity gradient (indicating no shear stress). Neumann conditions are often applied when the exact value is unknown, but the flux or rate of change at the boundary is known, such as insulated walls (zero heat flux) or stress-free outflows.

  • Robin (Mixed) Boundary Condition:

This combines aspects of Dirichlet and Neumann conditions by defining a relationship between the variable and its gradient at the boundary. For instance, in heat transfer, it can represent convective cooling, where the heat flux is proportional to the temperature difference between the fluid and the boundary (e.g., Newton's Law of Cooling). Robin conditions are used in situations where the boundary value depends on both the internal variable and its rate of change, such as semi-permeable membranes or convective heat transfer.

  • Periodic Boundary Condition:

This boundary condition enforces a repeating pattern in space, where the variables on one side of the boundary match those on the opposite side. For example, in simulations of flow over a regularly spaced array of objects, where the pattern of flow repeats, periodic conditions allow efficient modeling by simulating just a small section. This is especially useful in simulations of channels, waves, and symmetric or repeating systems.

  • Symmetry Boundary Condition:

This condition is applied when the domain has a plane of symmetry, where no flow or gradient exists normal to the symmetry plane. The symmetry boundary implies that the normal component of velocity and the normal gradient of scalar variables (like pressure or temperature) are zero. Useful for reducing computational load by only simulating half or a section of a symmetric geometry, like a cylindrical pipe.

  • Outflow (or Far-Field) Boundary Condition:

Designed for flow exiting the domain, where minimal influence from the boundary on the internal flow is desired. Outflow boundaries often enforce zero gradients or “do-nothing” conditions to allow fluid to exit freely. In external flow problems, like around an airplane, far-field conditions simulate an open, infinite environment where variables gradually return to ambient values as they move away from the body.

Each type of boundary condition serves a specific purpose, helping to set up simulations that accurately reflect real physical scenarios. The choice of boundary condition is crucial as it significantly affects simulation stability and results accuracy.


Self-Assessment

I feel like I learned a lot in this CFD Application class. To me, the Navier-Stokes and its numerical solution are substantial in CFD. I can understand more about the concept and theory of CFD and apply them in an analysis. Based on this self-assessment of my performance, I believe I have met the expectations and objectives of the class thus far, which I feel merits a self-assessment score of 92 out of 100.


Post-Mid Test Plan for the Class

It would be nice to know more about the heat transfer aspects of computational fluid dynamics and how to apply it in a case problem.


Computational Fluid Dynamics (CFD) Part 2

Temperature-Difference-Driven Cavity

We try to replicate the study conducted by Betts and Bokhari. Here, we have a rectangular cavity with the dimensions of 0.076 m x 0.52 m x 2.18 m in the x, y, and z axis, respectively, as seen in the figure below. There are no lids in this cavity. Rather, the cavity is driven by temperature difference. The right wall is constantly heated to 39.9 °C, while the left wall is constantly heated to 19.6 °C.


CavHT geo.png


The objective of this study is to understand the fluid flow (in this case, air) due to the temperature difference. The assumptions are the flow is in steady-state. The study is done using OpenFOAM with buoyantSimpleFoam solver with kOmegaSST turbulence model. Rather than specifying the velocity in the boundary condition, the case will have temperature in the boundary condition. The case file can be downloaded from buoyantCavity


CavHT T.png CavHT full.png


It can be seen from the 2 images above that there exist a temperature difference on the right and left walls. This temperature difference lead to the flow of the air inside the cavity. The flow of the air inside the cavity resembles the elongated vortex that can be seen more detailed in the zoomed-in images below.


CavHT vec top.png CavHT vec bottom.png


If we look at the velocity profile in the y axis direction in the centerline of the cavity, we can be certain that there exist a vortex inside the cavity. The velocity profile can be seen in the images below, with a close comparison to the study conducted by Betts and Bokhari.

CavHT vy cfd.png CavHT vy exp.png


Reference: P.L. Betts, I.H. Bokhari, "Experiments on turbulent natural convection in an enclosed tall cavity," International Journal of Heat and Fluid Flow, vol. 21, pp. 675-683, 2000.


Lid-Driven Cavity with Artificial Neural Network (ANN)

Using the data from the previous study Cavity 2D with OpenFOAM, we gather 4 variations of lid velocity of the cavity, 0.01, 0.05, 0.1, 0.3 m/s. With this 4 variations of velocity, along with the x and y coordinates of the cells of the control volume of the 50x50 grid cavity (the mesh cells), we can gather the 10,000 rows of data as the input for the ANN modeling with the pressure (p), x-axis velocity component (Ux), and y-axis velocity component (Uy) in said coordinate as the output of the ANN modeling.

The simulation files, the input-output table, and the Python codes can be downloaded here.

From the ANN modeling with 2 hidden layers and 128 neurons per hidden layer, as seen in the ANN Architecture below, and 500 epochs, it can be seen that the evaluation of the model yields relatively good results.


1 ANN Architecture.png


The ANN modeling resulted in the model loss of less than 5e-4 as seen below.


2 Model Loss.png


The ANN model can predict the p, Ux, and Uy with coefficient of determination (R²) of more than 0.985, 0.975, and 0.99, respectively, as seen below.


Act vs Pred 1.png Act vs Pred 2.png Act vs Pred 3.png


This is further supported by the visualization of the airflow inside the cavity. Here, we compare the velocity vector field of lid-driven cavity with the lid moving at 0.1 m/s, both the simulation (actual data) and the ANN prediction (predicted data)


Vector field 0.1.png 6 cavity 0.1.png


This result can of course be improved by varying the ANN modeling parameters such as the number of hidden layer, the number of neurons per hidden layer, and the number of epoch, and also adding more and more data from the variations of simulation to cover a broader range of conditions.


Discussion with ChatGPT: Continuum Mechanics

Continuum Mechanics
USER
AI
Can you give a practical example (along with a simple calculator for a 1D problem) in engineering where continuum mechanics treats materials as continuous, focusing on the integration of an uninterrupted 'conscious continuum' into the DAI5 framework.
Certainly! Continuum mechanics simplifies the study of materials by assuming they are continuous and devoid of voids, even though materials are composed of discrete particles. This assumption allows engineers to use mathematical tools, such as differential equations and integration, to analyze stresses, strains, and material behavior. Let’s create a practical example in engineering:

Problem: 1D Axial Deformation of a Rod A steel rod of length L=1.0m, cross-sectional area A=0.01m², and Young's modulus E=200GPa is subjected to a tensile force F=10,000N. The goal is to calculate the elongation ΔL of the rod using continuum mechanics and integrate it with the DAI5 framework as an uninterrupted "conscious continuum."

Continuum Mechanics Solution: Using the 1D axial deformation formula:

ΔL=FL/AE

where F = Applied force, L = Original length, A = Cross-sectional area, E = Young's modulus

DAI5 Framework Integration:

Intention: Understand how a tensile force deforms a continuous rod in 1D.

Initial Thinking: Assume a linear elastic behavior where stress and strain follow Hooke's Law. Define the rod as a continuum, ignoring atomic-scale irregularities.

Idealization: Use the governing equation derived from Hooke’s Law, treating material properties as constant and uniformly distributed.

Instruction Set: Write a program to calculate the elongation and visualize its dependence on F, A, E, and L.


Python Calculator:

F = 10000 # Force in Newtons

L = 1.0 # Length in meters

A = 0.01 # Cross-sectional area in square meters

E = 200e9 # Young's modulus in Pascals

delta_L = (F * L) / (A * E)

print(f"Elongation (ΔL): {delta_L:.6f} m")


Reduced-Order Model (ROM)

A Reduced-Order Model (ROM) is a simplified version of a high-fidelity mathematical or computational model, designed to retain the essential features and dynamics of the original system while significantly reducing its computational complexity and resource requirements. This reduction is achieved through reducing the dimension of the matrix equivalent to the physics phenomena at hand by means of the Proper Orthogonal Decomposition (POD) and Singular Value Decomposition (SVD).

There are numerous framework already developed to do ROM, one of which is ITHACA-FV developed to perform reduce order modeling of OpenFOAM CFD simulation. Other than that, there is a Python numerical framework NumPy to conduct ROM.


Tugas Besar: Grid Independency Study on the PWR Hot Leg using DAI5 Framework

This is the final project of the CFD Application Class. The project studied the grid independency of PWR Hot Leg geometry when subjected to the two-phase fluid flow.

The paper draft can be found here: Google Drive


The 33 DAI5 Implementation Evaluation Criteria

The 33 DAI5 Implementation Evaluation Criteria on the Project

"Grid Independency Study on the PWR Hot Leg using DAI5 Framework"


I. Deep Awareness (of) I (DAI)

1. Consciousness of Purpose: In the broader scheme, the study aims to better understand The Creator by understanding the nature of physics and engineering through the study of two-phase liquid-gas flow and grid independency in PWR hot leg simulations, reflecting a deliberate and purposeful approach.

2. Self-awareness: The research demonstrates awareness of the researcher's role as a seeker of knowledge and the project's contribution to the broader field of physics and computational fluid dynamics.

3. Ethical Considerations: Ethical principles are observed by ensuring accuracy and transparency in the methodologies and findings, with the Creator’s presence considered into account.

4. Integration of CCIT (Cara Cerdas Ingat Tuhan): The study explicitly integrates the remembrance of the Creator, connecting scientific inquiry to spiritual awareness by synergizing the Creator and the creations (us).

5. Critical Reflection: The project reflects critically on the significance of grid refinement and its implications for computational efficiency.

6. Continuum of Awareness: Continuous awareness is evident through systematic adherence to the scientific writing method and DAI5 framework stages.


II. Intention

7. Clarity of Intent: The project clearly states its objectives: understanding grid refinement and ensuring reliable CFD simulations.

8. Alignment of Objectives: The goals align with practical CFD applications and the broader mission of advancing reactor safety.

9. Relevance of Intent: The intent addresses a crucial gap in understanding grid dependency for complex PWR hot leg geometries.

10. Sustainability Focus: The study promotes computational efficiency, reducing unnecessary resource use.

11. Focus on Quality: High-quality simulation results are prioritized through detailed analysis and physics-oriented verification.


III. Initial Thinking (about the Problem)

12. Problem Understanding: The complexity of simulating PWR hot leg flow is thoroughly analyzed, with grid size and velocity identified as a key challenge.

13. Stakeholder Awareness: The research considers the needs of reactor designers, CFD practitioners, and safety analysts. This can further benefits the industry as well as the scientific field.

14. Contextual Analysis: The study situates itself within the broader context of computational advancements.

15. Root Cause Analysis: Grid dependency is identified as one of the root cause of inaccuracies and uncertainties in CFD solutions

16. Relevance of Analysis: The analysis directly informs the refinement of grid resolutions represented by the key factor of velocity for accurate results.

17. Use of Data and Evidence: Reliable numerical data from simulations validate findings and ensure credibility.


IV. Idealization

18. Assumption Clarity: The project explicitly states assumptions, such as incompressible, transient, laminar flow conditions.

19. Creativity and Innovation: It employs the DAI5 framework innovatively to approach grid dependency studies in CFD.

20. Physical Realism: Simulations adhere to physical laws, such as Navier-Stokes equations, ensuring that results are realistic and applicable.

21. Alignment with Intent: the study employs Idealized conditions aligned with the intent of achieving accurate and efficient simulations.

22. Scalability and Adaptability: The methodologies can be adapted for other complex geometries and simulation conditions.

23. Simplicity and Elegance: The project simplifies complex phenomena into actionable simulation steps without losing accuracy.


V. Instruction Set

24. Clarity of Steps: Methodological steps are clearly detailed, enabling reproducibility in other studies such as pre-processing, processing, and post-processing.

25. Comprehensiveness: The simulation process covers all relevant aspects, including multiple grid sizes and evaluation criteria.

26. Physical Interpretation: The physical domain of PWR hot leg simulations are feasible within OpenFOAM, a widely-used CFD platform.

27. Error Minimization: Error from computational risks, such as grid independency, are mitigated through grid optimization.

28. Verification and Validation: The study employs rigorous verification through velocity comparison between grid sizes. Evaluation through velocity profiles ensures robust validation of grid-independent solutions.

29. Iterative Approach: Results from coarser grids informed the refinement of finer grids, demonstrating iterative improvement.

30. Sustainability Integration: The study implemented a sustainability approach such as following the DAI5 Framework, the scientific method, is reproducable through various method, and ensures the continual nature of the study.

31. Communication Effectiveness: The project effectively communicate the purpose of the study which is focusing efforts on critical grid sizes.

32. Alignment with DAI5 Framework: The project aligns with CFD best practices and international research standards.

33. Documentation Quality: The study is well-documented, with detailed descriptions of methods, results, and discussions.


Extended: Artificial Neural Network (ANN) Modeling on PWR Hot Leg Grid Independency Study

Using the data from the previous study Tugas Besar, 4 variations of grid size are gathered, represented by the number of elements or cells: 203,085 elements, 673,390 elements, 1,185,440 elements, and 1,553,450 elements.

Due to the immense number of data from these simulations, the artificial neural network (ANN) modeling only uses the slices of the computational domain, specifically the slice through the symmetry line or y = 0 to get the 2-dimensional data of x and z axes.

With this 4 variations of grid size, along with the x and z coordinates of the cells of the control volume of the, there are 96,749 rows of data as the input for the ANN modeling with the x-axis velocity component (Ux) and z-axis velocity component (Uy) in said coordinate as the output of the ANN modeling.

The the Python codes can be downloaded from the previous ANN Cavity study and the input-output table can be downloaded here.

From the ANN modeling with 5 hidden layers and 256 neurons per hidden layer, as seen in the ANN Architecture below, and 1,000 epochs, it can be seen that the evaluation of the model yields relatively good results.

With these statistics: 96,749 rows of data, 3 inputs, 2 outputs, 5 hidden layers, 256 neurons per hidden layer, and 1,000 epoch, the total runtime of the ANN modeling was 5 hours.


Fig annarchi.png


The ANN modeling resulted in the model loss of less than 1e-3, specifically 3.5e-4 and 4.3e-4 for the training and testing losses.


Fig loss.png


The ANN model can predict Ux and Uz with coefficient of determination (R²) of more than 0.8707 and 0.9718, respectively.


Fig actvspred1.png Fig actvspred2.png


It can be seen that the actual data has a relatively good agreement with the ANN-predicted data.

This result can of course be improved by varying the ANN modeling parameters such as the number of hidden layer, the number of neurons per hidden layer, and the number of epoch, and also adding more and more data from the variations of simulation (e.g. y direction cells, time variable, inlet velocity variations, etc.) to cover a broader range of conditions.


(EOF)