Machine Learning-Driven Prediction and Analysis of Magnetohydrodynamic (MHD) Natural Convection in Nanofluid-Filled Trapezoidal Cavities with Variable Obstacle Shapes, Wall Corrugations, and Inclination Angles

Abstract

This study proposes a machine learning-enhanced framework to predict and analyze magnetohydrodynamic (MHD) natural convection within nanofluid-filled trapezoidal cavities featuring variable obstacle shapes, wall corrugations, and inclination angles. A comprehensive dataset was generated through Finite Element Method (FEM) simulations covering a wide parametric range, including Rayleigh numbers (103 - 106) and Hartmann numbers (0 - 50), for Cu-H2O nanofluids. Key thermal performance metrics Nusselt number (Nu), entropy generation (ST), and Ecological Coefficient of Performance (ECOP), were extracted and used to train supervised machine learning models: Support Vector Regression (SVR), Decision Tree (DT), and Random Forest (RF). Among them, the RF model achieved superior performance, yielding R2 scores of 0.991 (Nu), 0.982 (St), and 0.989 (ECOP), with mean prediction errors under 1.5%. The results show excellent agreement between FEM and ML outputs across diverse configurations, including different obstacle geometries (star, square, triangular), wall undulations (sinusoidal, square, triangular), and inclination angles (15˚, 30˚, 45˚). The integration of ML significantly reduced computational cost while preserving high accuracy, thus demonstrating its viability for rapid prediction and optimization. This hybrid FEM-ML methodology offers a powerful tool for real-time thermal system analysis and design in advanced MHD nanofluid applications.

Share and Cite:

Sarker, S. and Alam, M. (2025) Machine Learning-Driven Prediction and Analysis of Magnetohydrodynamic (MHD) Natural Convection in Nanofluid-Filled Trapezoidal Cavities with Variable Obstacle Shapes, Wall Corrugations, and Inclination Angles. Advances in Nanoparticles, 14, 173-208. doi: 10.4236/anp.2025.144011.

1. Introduction

Natural convection in enclosures has long been a cornerstone topic in thermal engineering, owing to its critical role in a wide range of applications, including solar thermal collectors, electronic cooling systems, and energy-efficient architectural designs [1]. These systems depend heavily on passive heat transfer mechanisms to regulate temperature and ensure operational efficiency. Over the past few decades, the performance of such systems has been significantly improved through the introduction of nanofluids engineered by dispersing nanoparticles in traditional base liquids. These nanoparticle suspensions enhance the thermophysical properties of the fluid, particularly thermal conductivity and heat capacity, thereby improving the rate and uniformity of convective heat transfer within enclosures [2] [3].

The behavior of nanofluid-based convection is not only influenced by the base fluid and nanoparticle type but also by a range of physical and geometric parameters. Studies have demonstrated that internal features such as heated bodies or obstructions, the inclination of the cavity, external magnetic fields, and specific boundary conditions all play crucial roles in shaping the flow and thermal fields [4]-[6]. For example, incorporating internal elliptical or circular obstacles within a square cavity with a wavy top wall has been shown to disrupt conventional flow patterns, resulting in enhanced mixing and heat transfer [7]. These findings highlight the importance of internal geometry and boundary configuration in optimizing convective behavior.

As engineering systems continue to increase in complexity, particularly in microscale and compact heat exchanger designs, the use of nanofluids in non-standard and irregular enclosures has attracted growing research attention. Among the computational tools employed, the Finite Element Method (FEM) stands out for its capacity to handle complex boundaries and heterogeneous materials with high numerical precision [8]. FEM-based simulations allow detailed resolution of the velocity, temperature, and pressure fields in domains where analytical or simplified numerical methods fall short. However, the primary limitation of FEM is its high computational cost, especially when applied to broad parametric studies or real-time optimization tasks.

To address this limitation, Machine Learning (ML) has emerged as a powerful and complementary approach. By training on datasets generated through high-fidelity simulations such as FEM, ML models can serve as surrogate predictors that provide fast and accurate estimations of thermal behavior without the need for solving complex differential equations repeatedly [9]-[11]. In particular, ML has proven effective in predicting nanofluid thermal properties and convective performance across various geometrical and operational settings [12]. Motivated by these developments, the current study proposes a hybrid framework that integrates FEM and ML to analyze the heat transfer characteristics and entropy generation in trapezoidal cavities filled with Cu-H2O nanofluid and containing internally heated star-shaped, square, and triangular obstacles. The framework also incorporates magnetohydrodynamic (MHD) effects by applying external magnetic fields across the cavity.

The geometry of internal obstacles has a pronounced impact on fluid motion and heat transfer. Shapes such as circular, elliptical, square, and triangular affect vortex formation, thermal gradients, and Nusselt number distribution, all of which contribute to the overall thermal resistance of the system [13]-[17]. Furthermore, the number, placement, and orientation of these obstacles also influence entropy generation and convective flow structure [18] [19]. Another critical factor is the inclination of the cavity itself. Varying the inclination angle modifies the effective direction of buoyancy forces, thereby altering flow intensity, thermal stratification, and energy dissipation due to thermodynamic irreversibility [20]-[24]. Some studies have even identified specific inclination angles that optimize thermal efficiency by enhancing heat transfer while suppressing entropy production [25].

External magnetic fields introduce yet another layer of control, quantified by the Hartmann number. The Lorentz force generated by these fields tends to suppress fluid motion, shifting the heat transfer mechanism from convection-dominated to conduction-dominated regimes [26]-[31]. However, when optimized, MHD effects can lead to improved temperature uniformity and thermal regulation, especially in electrically conducting nanofluids like Cu-H2O [32].

Beyond internal obstacles and magnetic fields, wall modifications such as introducing wavy or corrugated top boundaries have also been shown to disrupt the thermal boundary layer, generate secondary vortices, and amplify convective mixing [33]-[36]. These geometric perturbations further contribute to enhanced heat transfer and entropy management, underscoring the multifactorial nature of natural convection in nanofluid-filled cavities.

Recent studies have demonstrated the effectiveness of machine learning (ML) in modeling complex heat transfer phenomena. ML has been used to predict radiative nanofluid behavior [37], replace CFD for forced convection with high accuracy and efficiency [35], and estimate Nusselt numbers in natural convection within helical coils [38]. ML models have also shown strong predictive power in systems involving counter-rotating cylinders [39] and microchannel heat sinks with complex geometries [40]. These efforts support the use of ML in capturing nonlinear thermal behaviors, complementing conventional numerical methods.

The present study aims to bridge this research gap by developing a machine learning-driven predictive framework trained on FEM-generated simulation data to model the coupled effects of magnetic field intensity, wall corrugation, obstacle geometry, and inclination angle on heat transfer, entropy generation, and overall thermal performance in Cu-H2O nanofluid-filled trapezoidal cavities. By combining the precision of FEM with the computational efficiency of ML, this work provides a hybrid platform for accurate, fast, and scalable analysis of MHD natural convection, thereby contributing to the advancement of intelligent thermal management and optimization systems.

2. Materials and Methods

This study explores natural convection and entropy generation in a two-dimensional trapezoidal enclosure filled with a Cu-H2O nanofluid (φ = 0.02). The trapezoidal cavity features a fixed base angle of γ = 15˚ and is inclined at angles λ = 15˚, 30˚, and 45˚ to investigate the influence of gravitational orientation on thermal and flow characteristics. Two internal heat-generating solid obstacles, designed as star, square, or triangle shapes, are symmetrically embedded at the center of the cavity. The top boundary is geometrically modified using sinusoidal, square, or triangular corrugations to assess the impact of surface undulations on convective flow. Figures 1-3 illustrate these configurations.

Figure 1. Different geometry with sinusoidal corrugation.

Figure 2. Different geometry with square corrugation.

Figure 3. Different geometry with triangular corrugation.

A uniform horizontal magnetic field is applied across the cavity to induce magnetohydrodynamic (MHD) effects. The top and vertical side walls are maintained at a constant cold temperature, while the inclined bottom wall is adiabatic. All walls, including embedded solid surfaces, obey no-slip boundary conditions. The embedded obstacles serve as internal volumetric heat sources, uniformly generating thermal energy.

The governing equations are based on the conservation of mass, momentum, energy, and entropy generation, accounting for nanofluid properties, buoyancy-driven flow, and MHD interactions are described in below ([5] [17] [31] [32]):

For Sinusoidal wavy top wall:

y=H+asin( 2πfx L t ) (1)

For Square wavy top wall:

y=H+ 4a π ( sin( 2πfx L t )+ 1 3 sin( 6πfx L t )+ 1 5 sin( 10πfx L t )+ ) (2)

For Triangular wavy top wall:

y=H+ 2a π sin 1 ( sin( 2πfx L t ) ) (3)

here, H : Height of the cavity, a : Amplitude of the wave, f : Frequency (number of waves), L t : Total length of the top wall, and x is the position along the wall.

Gravitational acceleration g acts vertically downward, but is decomposed into components along the inclined axis:

g x =gsin( λ ), g y =gcos( λ ) (4)

Fluid domain:

u x + v y =0 (5)

ρ nf ( u u x +v u y ) = p x + μ nf ( 2 u x 2 + 2 u y 2 )+ ρ nf g β nf ( T nf T c )sin( λ ) σ nf B 0 2 u (6)

ρ nf ( u v x +v v y )= p y + μ nf ( 2 v x 2 + 2 v y 2 )+ ρ nf g β nf ( T nf T c )cos( λ ) (7)

ρ nf C p,nf ( u T nf x +v T nf y )= k nf ( 2 T nf x 2 + 2 T nf y 2 ) (8)

Star-shaped solid domains:

k s ( 2 T s x 2 + 2 T s y 2 )+Q=0 (9)

here, u and v denote velocity components in the x- and y-directions, respectively, and p and T represent pressure and temperature, respectively. The fluid properties are mass density (ρ), thermal conductivity (k), specific heat at constant pressure (Cp), volumetric thermal expansion coefficient (β), and electrical conductivity (σ).

Dimensional Boundary Conditions:

Top Wall:

u=v=0 , T= T c (10)

Inclined Side Wall:

u=v=0 , T= T c (11)

Bottom Wall:

u=v=0 , T x =0 (12)

Heated Block:

An internal heat-generation rate of Q = 1 × 106 W/m3 was used for obstacles, consistent with prior studies [37] on thermally active enclosures. Sensitivity analysis showed <3% variation in Nusselt number across typical Q ranges, confirming this value’s suitability. The continuity of temperature and heat flux at fluid-solid interfaces is enforced:

T Fluid = T Solid , k nf T n Fluid = k s T n Solid (13)

ρ nf =( 1ϕ ) ρ f +ϕ ρ s (14)

( ρ c p ) nf =( 1ϕ ) ( ρ c p ) f +ϕ ( ρ c p ) s (15)

μ nf = μ f ( 1ϕ ) 2.5 (16)

k nf = k f [ k s +2 k f 2ϕ( k f k s ) k s +2 k f +ϕ( k f k s ) ] (17)

β nf = ( 1ϕ ) ρ f β f +ϕ ρ s β s ρ nf (18)

Entropy production reflects energy loss from irreversible effects like heat transfer, friction, and MHD forces. In buoyancy-driven MHD flow, entropy is generated through heat transfer, viscous dissipation, and magnetic fields. The local entropy generation due to heat transfer ( S ht ) in solid and fluid domains is given by:

S ht = k s T s 2 [ ( T s x ) 2 + ( T s y ) 2 ]+ k nf T nf 2 [ ( T nf x ) 2 + ( T nf y ) 2 ]+ Q gen T s (19)

The local volumetric entropy production due to viscous flow dissipation ( S ff ) and external magnetic effects ( S mf ) can be described using the following formulas [5] [17] [31] [32]:

S ff = μ nf T nf [ 2 ( u x ) 2 +2 ( v y ) 2 + ( u y + v x ) 2 ] (20)

S mf = β 0 2 σ nf T nf ν 2 (21)

To get the non-dimensional governing equations, the following scales are used:

X= x L ,Y= y L ,U= uL α f ,V= vL α f ,θ= T T c T h T c ,P= p L 2 μ nf ,Here, α f = k f ρ f c p,f (22)

Ra= g β nf ( T h T c ) L 3 ν nf α f ,Pr= ν f α f ,Ha= β 0 L σ nf μ nf , Q * = Q L 2 k nf ( T h T c ) (23)

U X + V Y =0 (24)

U U X +V U Y = P X + μ nf μ f ( 2 U X 2 + 2 U Y 2 )+RaPr ρ nf β nf ρ f β f θsin( λ )H a 2 U (25)

U V X +V V Y = P X + μ nf μ f ( 2 V X 2 + 2 V Y 2 )+RaPr ρ nf β nf ρ f β f θcos( λ ) (26)

U θ X +V θ Y = k nf k f 1 Pr ( 2 θ X 2 + 2 θ Y 2 ) (27)

k s k nf ( 2 θ s X 2 + 2 θ s Y 2 )+ Q * =0 (28)

Non-Dimensional Boundary Conditions:

Top Wall:

U=V=0 , T= T c (29)

Inclined Side Wall:

U=V=0 , T= T c (30)

Bottom Wall:

U=V=0 , T X =0 (31)

Heated Block:

Internal volumetric heat generation applied in the solid domain, Q > 0; continuity of temperature and heat flux at fluid-solid interfaces are enforced:

T Fluid = T Solid , k nf T N Fluid = k s T N Solid (32)

Non-Dimensional Nanofluid Properties:

ρ nf ρ f =( 1ϕ )+ϕ ρ s ρ f (33)

( ρ c p ) nf ( ρ c p ) f =( 1ϕ )+ϕ ( ρ c p ) s ( ρ c p ) f (34)

μ nf μ f = 1 ( 1ϕ ) 2.5 (35)

k nf k f = k s +2 k f 2ϕ( k f k s ) k s +2 k f +ϕ( k f k s ) (36)

β nf ρ nf =( 1ϕ ) ρ f β f +ϕ ρ s β s (37)

The thermal behavior of the chamber under different operating conditions is assessed by analyzing the Nusselt number (Nu) of the heated strips and the average fluid temperature (Θav) inside the domain. The definitions of these quantities are as follows:

Nu= L L s [ L 0 /L 2 L 0 /L Θ Y | Y=0 dX 3 L 0 /L 4 L 0 /L Θ Y | Y=0 dX ], Θ av = 1 A A ΘdA , (38)

here, A represents the non-dimensional surface area of the fluid domain, X and Y are the dimensionless Cartesian coordinates, U and V indicate dimensionless velocity components, and P and Θ are the non-dimensional pressure and temperature of the nanofluid, respectively.

The total entropy generation, expressed as a dimensionless quantity, can be obtained using the following expression:

S T = T c 2 L 2 k f Δ T 2 A A ( S ht + S ff + S mf )dA (39)

where A represents the surface area of the computational domain.

The Ecological Coefficient of Performance (ECOP) can be defined as follows to provide a relative estimate of total entropy production associated with heat transfer:

ECOP= S T Nu (40)

The working fluid is a Cu-H2O nanofluid with a fixed nanoparticle volume fraction of φ = 0.02, selected for its superior thermal conductivity and MHD compatibility. Simulations are conducted across a Rayleigh number range of 103 to 106 and Hartmann number (Ha) range from 0 to 50. The working fluid’s properties at a reference temperature of 300  K are presented in Table 1(a). These properties are essential for modeling buoyancy-driven convection, MHD behavior, and entropy generation.

The Galerkin Finite Element Method (FEM) is employed to numerically solve the coupled governing equations under the defined boundary and initial conditions. To complement the Finite Element Method (FEM) simulations and accelerate the prediction of thermal performance metrics, a supervised Machine Learning (ML) framework was developed. The aim was to model the relationship between physical/geometric parameters and target thermal responses, namely, Nusselt number (Nu), Entropy Generation (ST), and Ecological Coefficient of Performance (ECOP).

To ensure the numerical accuracy of the FEM simulations, a detailed mesh analysis was conducted for different obstacle shapes: square, star, and triangular blocks. As shown in Table 1(b), each mesh configuration includes a mix of triangular and quadrilateral elements, with total element counts ranging from 17,986 to 21,964. The average element quality remains above 0.77 for all cases, with the square block mesh achieving the highest quality at 0.8026.

Table 1. (a): Thermo-physical properties of Water and Cu at Tm = 300K ([5] [17] [31] [32]); (b): Mesh Statistics for Wavy-Top Trapezoidal Cavity with different Heated Blocks.

(a)

Name of Property

Symbol

Unit

Water

Cu

Mass Density

ρ

kg∙m−3

996.6

8933

Specific Heat at Constant Pressure

Cp

J∙kg−1∙K−1

4179.2

385

Thermal Conductivity

k

W∙m−1∙K−1

0.6102

401

Volumetric Thermal Expansion Coefficient

β

K−1

26.6 × 10−5

49.9 × 10−6

Electrical Conductivity

σ

S∙m−1

0.05

59.6 × 10-6

Dynamic viscosity

μ

kg∙m−1∙s−1

8.538 × 10−4

-

Prandtl Number

Pr

-

5.856

-

(b)

Parameter

Value Square Blocks

Value Star Blocks

Value Triangular Blocks

Mesh vertices

10,756

11,990

9900

Element type

All elements

All elements

All elements

Triangular elements

18,300

20,368

16,598

Quadrilateral elements

1396

1596

1388

Edge elements

714

798

706

Vertex elements

12

8

10

Total number of elements

19,696

21,964

17,986

Minimum element quality

0.2356

0.1379

0.2297

Average element quality

0.8026

0.7778

0.8004

Element area ratio

0.003044

0.004769

0.003075

Total mesh area

3.178 × 10−7 m2

3.178 × 10−7 m2

3.178 × 10−7 m2

The minimum element quality and element area ratios confirm that the meshes are sufficiently refined for accurate thermal field resolution. Additionally, the total mesh area remains consistent across cases (3.178 × 107 m2), indicating geometric fidelity. Time-step convergence was validated separately using steps of 0.01, 0.005, and 0.002 s, showing negligible variation in Nusselt number predictions (<1.5%), confirming temporal resolution adequacy.

The dataset for training and testing was generated from 324 FEM simulations, covering diverse combinations of input parameters, including Rayleigh number (Ra), Hartmann number (Ha), nanoparticle volume fraction (φ), obstacle shape, wall corrugation type, and cavity inclination angle (λ). These features spanned broad ranges—Ra = 103 - 106, Ha = 0 - 50, and λ = 15˚ - 45˚ ensuring comprehensive ML coverage. FEM-derived Nusselt number (Nu), entropy generation (ST), and energy conversion performance (ECOP) were used as target variables. Prior to training, continuous features were normalized, and categorical features were one-hot encoded. The dataset was randomly split into 80% training (259 cases) and 20% testing (65 cases) to evaluate generalization. Three regression models were employed in this study: Random Forest, Support Vector Regression, and Extreme Gradient Boosting.

1) Support Vector Regression (SVR) using a radial basis function (RBF) kernel;

2) Decision Tree Regression (DT) for rule-based partitioning of the feature space;

3) Random Forest Regression (RF) as an ensemble learning method for robust nonlinear prediction.

Model development was performed using Python’s scikit-learn library. Hyperparameters were optimized via grid search and five-fold cross-validation to prevent overfitting and ensure stability. The trained models were subsequently used to establish a predictive framework that offers a fast and accurate alternative to traditional FEM-based simulations for evaluating the impact of MHD, nanofluid dynamics, and cavity geometry on thermal performance.

3. Validation

To ensure the accuracy and reliability of the present numerical model, a validation study was conducted by comparing the simulation results with the benchmark work of Abdelmalek et al. [17]. The comparison focused on thermal profiles and average Nusselt number values under equivalent conditions. As illustrated in Figure 4, both studies exhibit closely matching isotherm distributions around star-shaped internal obstacles at a Rayleigh number of Ra = 104. The present simulation demonstrates smoother and more symmetric thermal contours, which can be attributed to the use of a finer computational mesh and higher spatial resolution. This strong agreement confirms the validity of the adopted numerical approach in accurately capturing the key thermofluidic behaviors in MHD-assisted nanofluid convection within trapezoidal enclosures.

Table 2 reinforces the validation results, showing that the deviation in average Nusselt numbers remains below 1.5% across the Rayleigh number range of 103 to 106. This confirms both the accuracy and numerical stability of the present FEM-based model. The findings also emphasize the critical influence of geometric complexity and cavity inclination on heat transfer performance in magnetically actuated nanofluid systems. Notably, configurations combining wall corrugation with non-circular obstacles, such as star or triangular shapes, exhibit improved passive thermal regulation, demonstrating their effectiveness in enhancing natural convection under MHD conditions.

Abdelmalek et al. [17] Present Work

Figure 4. Isotherms for different values of Ra = 104 when N = 8, A = 0.15, ϕ = 2%.

Table 2. Comparison of Nu between present work and Abdelmalek et al. [17].

Ra

Nanoparticle Volume Fraction (ϕ %)

Present Study

Abdelmalek et al. [17]

Deviation (%)

103

2

1.1470

1.1307

1.44

104

2

2.2944

2.2674

1.19

105

2

4.6379

4.5851

1.15

106

2

8.9586

8.8341

1.41

4. Results and Discussion

This section presents the outcomes of the numerical and data-driven investigations into MHD natural convection in nanofluid-filled trapezoidal cavities. The results are divided into two parts: the first outlines the detailed Finite Element Method (FEM) simulations conducted across various geometric and physical configurations; the second discusses the implementation and evaluation of machine learning models trained on FEM data to predict key thermal performance indicators. Both approaches aim to assess the effects of obstacle shape, wall corrugation, inclination angle, and magnetic field strength on heat transfer (Nu), entropy generation (ST), and ecological performance (ECOP).

4.1. FEM Simulation Results Analysis

The finite element simulations generated extensive data capturing the influence of geometric and physical parameters on heat transfer and entropy-related behavior in MHD-driven nanofluid convection. The results are structured into three key performance indicators: Nusselt number (Nu), Entropy generation (ST), and Ecological Coefficient of Performance (ECOP), each analyzed based on variations in obstacle geometry, wall corrugation, inclination angle, Rayleigh number, and Hartmann number. A comprehensive summary of these results is provided in Tables 3-29.

Table 3. Nu for star-shaped obstacles with different Wavy Walls at λ = 15˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.79369

0.79369

0.79369

0.79369

104

2.5581

2.5556

2.5533

2.5524

105

3.7556

3.6201

3.4447

3.3369

106

5.7976

5.6067

5.22

4.7166

Square

103

0.8018

0.80179

0.80179

0.80179

104

2.6423

2.6404

2.6388

2.6381

105

3.7957

3.6868

3.546

3.4642

106

5.7179

5.5281

5.1568

4.6751

Triangular

103

0.79861

0.79861

0.79861

0.79861

104

2.6093

2.6072

2.6054

2.6046

105

3.7736

3.657

3.5047

3.4136

106

5.747

5.5586

5.184

4.6923

Table 4. Nu for Square-Shaped Obstacles with different Wavy Walls at λ = 15˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.84326

0.84326

0.84325

0.84324

104

2.6913

2.6881

2.6853

2.684

105

3.9788

3.8277

3.6309

3.5065

106

6.2373

6.0384

5.6553

5.1434

Square

103

0.85297

0.85296

0.85295

0.85295

104

2.7849

2.7824

2.7801

2.7792

105

4.0265

3.9039

3.7424

3.6451

106

6.1573

5.9757

5.6151

5.1105

Triangular

103

0.84944

0.84943

0.84942

0.84941

104

2.7491

2.7464

2.744

2.7429

105

4.001

3.8709

3.698

3.5913

106

6.1799

5.9944

5.6292

5.1242

Table 5. Nu for Triangular-Shaped Obstacles with different Wavy Walls at λ = 15˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.79176

0.79175

0.79175

0.79174

104

2.9106

2.91

2.9094

2.909

105

4.2103

4.113

4.0332

3.9932

106

6.3746

6.1018

5.6317

5.0893

Square

103

0.79783

0.79783

0.79783

0.79783

104

2.9817

2.9813

2.9808

2.9806

105

4.2685

4.2055

4.1485

4.1193

106

6.2743

6.007

5.565

5.0441

Triangular

103

0.79608

0.79607

0.79607

0.79607

104

2.9563

2.9558

2.9553

2.955

105

4.2449

4.1709

4.106

4.0729

106

6.3262

6.0564

5.6118

5.073

Table 6. Nu for Star-Shaped Obstacles with different Wavy Walls at λ = 30˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.79369

0.79369

0.79369

0.79369

104

2.5573

2.555

2.5531

2.5523

105

3.7274

3.5914

3.4249

3.3284

106

5.916

5.5713

5.1574

4.6587

Square

103

0.80179

0.80179

0.80179

0.80179

104

2.6417

2.64

2.6386

2.6381

105

3.768

3.6621

3.5307

3.4579

106

5.7008

5.4812

5.1053

4.6249

Triangular

103

0.79861

0.79861

0.79861

0.79861

104

2.6086

2.6068

2.6052

2.6046

105

3.746

3.6311

3.4879

3.4066

106

5.7559

5.5104

5.1294

4.6408

Table 7. Nu for Square-Shaped Obstacles with different Wavy Walls at λ = 30˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.84326

0.84325

0.84325

0.84324

104

2.6903

2.6874

2.685

2.6839

105

3.9427

3.7923

3.606

3.4952

106

6.3086

5.9994

5.5697

5.0505

Square

103

0.85297

0.85296

0.85295

0.85294

104

2.784

2.7818

2.7799

2.7791

105

3.9912

3.8722

3.7221

3.6364

106

6.1538

5.9156

5.5258

5.0209

Triangular

103

0.84943

0.84943

0.84942

0.84941

104

2.7482

2.7458

2.7437

2.7428

105

3.9661

3.8382

3.6762

3.5817

106

6.2045

5.9456

5.5448

5.0349

Table 8. Nu for Triangular-Shaped Obstacles with different Wavy Walls at λ = 30˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.7917

0.79175

0.79175

0.79174

104

2.9107

2.91

2.9093

2.909

105

4.2444

4.1236

4.0301

3.9908

106

6.4336

6.1422

5.6355

5.062

Square

103

0.79783

0.79783

0.79783

0.79783

104

2.9818

2.9812

2.9808

2.9805

105

4.2976

4.2133

4.1464

4.1175

106

6.3298

6.0446

5.5635

5.0332

Triangular

103

0.79607

0.79607

0.79607

0.79607

104

2.9564

2.9558

2.9552

2.955

105

4.2761

4.1798

4.1037

4.071

106

6.3849

6.0977

5.6034

5.053

Table 9. Nu for Star-Shaped Obstacles with different Wavy Walls at λ = 45˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.79369

0.79369

0.79369

0.79369

104

2.5563

2.5543

2.5528

2.5522

105

3.6784

3.5444

3.3946

3.3161

106

6.0049

5.6188

5.0656

4.5454

Square

103

0.80179

0.80179

0.80179

0.80179

104

2.6409

2.6395

2.6384

2.638

105

3.7227

3.6226

3.5074

3.4489

106

5.7374

5.4407

5.0079

4.5273

Triangular

103

0.79861

0.79861

0.79861

0.79861

104

2.6077

2.6062

2.605

2.6045

105

3.6994

3.5892

3.4623

3.3965

106

5.8366

5.5031

5.0315

4.5368

Table 10. Nu for Square-Shaped Obstacles with different Wavy Walls at λ = 45˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.84326

0.84325

0.84324

0.84324

104

2.6889

2.6865

2.6845

2.6837

105

3.8847

3.7354

3.5679

3.4789

106

6.5016

6.0543

5.4486

4.8921

Square

103

0.85296

0.85296

0.85295

0.85294

104

2.7828

2.781

2.7796

2.779

105

3.9342

3.8219

3.6914

3.6239

106

6.2066

5.8648

5.3835

4.8712

Triangular

103

0.84943

0.84942

0.84941

0.84941

104

2.747

2.745

2.7434

2.7427

105

3.9091

3.7858

3.643

3.5679

106

6.3178

5.9356

5.4113

4.8823

Table 11. Nu for Triangular-Shaped Obstacles with different Wavy Walls at λ = 45˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.79175

0.7917

0.79174

0.79174

104

2.9108

2.9099

2.9092

2.9089

105

4.2493

4.1235

4.0242

3.9872

106

6.4137

6.0815

5.5577

4.9866

Square

103

0.79783

0.79783

0.79783

0.79782

104

2.9818

2.9812

2.9807

2.9805

105

4.3094

4.2155

4.1424

4.115

106

6.2401

5.9625

5.4986

4.9776

Triangular

103

0.79607

0.79607

0.79607

0.79607

104

2.9564

2.9557

2.9552

2.9549

105

4.2855

4.1814

4.0991

4.0681

106

6.3038

6.0068

5.5277

4.9866

The average Nusselt number, indicative of heat transfer enhancement, exhibited strong sensitivity to both geometry and operating conditions. As seen in Tables 3-11, the highest Nu values were consistently observed for cavities with star-shaped obstacles and sinusoidal wall corrugation, especially at higher Rayleigh numbers (e.g., Ra = 106). This is attributed to the sharper corners and expanded heat exchange surfaces of the star geometry, which promoted vigorous fluid circulation and boundary layer disruption. Increasing the inclination angle up to 30 further intensified buoyancy-driven convection, leading to optimal Nu values. However, at higher Hartmann numbers (e.g., Ha = 50), the Lorentz force induced magnetic damping, thereby suppressing convective motion and decreasing Nu.

Tables 12-20 present the results for total entropy generation across all test configurations. ST was notably reduced when smooth sinusoidal walls were employed in combination with moderate magnetic fields and lower inclination angles. The star obstacle configuration, while thermally effective, resulted in relatively higher entropy levels at high Ra, due to increased flow complexity and viscous dissipation. Conversely, the triangular obstacle, though less efficient in heat transfer, produced more thermodynamically ordered flow fields with lower entropy production. The data clearly demonstrate that minimizing ST requires a delicate balance between geometric optimization and MHD control, especially under high thermal gradients.

Table 12. ST for Star-Shaped Obstacles with different Wavy Walls at λ = 15˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

16.898

16.898

16.898

16.898

104

0.63853

0.63803

0.63759

0.63742

105

0.021177

0.020913

0.02057

0.02036

106

0.001488

0.001484

0.001476

0.001465

Square

103

17.074

17.074

17.074

17.074

104

0.66089

0.66053

0.66021

0.66008

105

0.02199

0.021781

0.02151

0.021354

106

0.001548

0.001544

0.001536

0.001526

Triangular

103

17.014

17.014

17.014

17.014

104

0.65452

0.65412

0.65376

0.65362

105

0.021962

0.021737

0.021442

0.021267

106

0.00156

0.001556

0.001549

0.001539

Table 13. ST for Square-Shaped Obstacles with different Wavy Walls at λ = 15˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

15.491

15.491

15.491

15.491

104

0.58966

0.58915

0.58871

0.58853

105

0.02063

0.020379

0.020053

0.019848

106

0.001493

0.00149

0.001483

0.001474

Square

103

15.659

15.659

15.659

15.659

104

0.61093

0.61055

0.61023

0.6101

105

0.021452

0.021253

0.020993

0.020838

106

0.001555

0.001552

0.001545

0.001537

Triangular

103

15.602

15.602

15.602

15.602

104

0.60506

0.60464

0.60428

0.60413

105

0.021427

0.021213

0.020932

0.02076

106

0.001567

0.001564

0.001558

0.00155

Table 14. ST for Triangular-Shaped Obstacles with different Wavy Walls at λ = 15˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

17.131

17.131

17.131

17.131

104

0.71807

0.71797

0.71788

0.71784

105

0.022264

0.022077

0.021925

0.021849

106

0.001506

0.001502

0.001493

0.001483

Square

103

17.243

17.243

17.243

17.243

104

0.7369

0.73683

0.73677

0.73673

105

0.023127

0.023008

0.0229

0.022845

106

0.001569

0.001565

0.001557

0.001547

Triangular

103

17.206

17.206

17.206

17.206

104

0.73178

0.7317

0.73163

0.73159

105

0.023083

0.022943

0.02282

0.022758

106

0.00158

0.001576

0.001568

0.001557

Table 15. ST for Star-Shaped Obstacles with different Wavy Walls at λ = 30˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

16.898

16.898

16.898

16.898

104

0.63838

0.63793

0.63755

0.6374

105

0.021122

0.020857

0.020532

0.020343

106

0.001487

0.001481

0.001473

0.001463

Square

103

17.074

17.074

17.074

17.074

104

0.66077

0.66045

0.66018

0.66007

105

0.021937

0.021733

0.021481

0.021342

106

0.001546

0.001541

0.001534

0.001525

Triangular

103

17.014

17.014

17.014

17.014

104

0.65439

0.65403

0.65373

0.65361

105

0.021909

0.021687

0.02141

0.021253

106

0.001558

0.001553

0.001546

0.001537

Table 16. ST for Square-Shaped Obstacles with different Wavy Walls at λ = 30˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

15.491

15.491

15.491

15.491

104

0.58951

0.58905

0.58867

0.58852

105

0.02057

0.02032

0.020012

0.01983

106

0.001492

0.001486

0.00148

0.001472

Square

103

15.659

15.659

15.659

15.659

104

0.6108

0.61047

0.6102

0.61009

105

0.021396

0.021202

0.02096

0.020825

106

0.001553

0.001549

0.001543

0.001535

Triangular

103

15.602

15.602

15.602

15.602

104

0.60492

0.60455

0.60424

0.60412

105

0.02137

0.021161

0.020897

0.020745

106

0.001565

0.001561

0.001555

0.001548

Table 17. ST for Triangular-Shaped Obstacles with different Wavy Walls at λ = 30˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

17.131

17.131

17.131

17.131

104

0.7181

0.71797

0.71787

0.71783

105

0.022329

0.022098

0.021919

0.021844

106

0.001506

0.001502

0.001493

0.001481

Square

103

17.243

17.243

17.243

17.243

104

0.73692

0.73683

0.73676

0.73673

105

0.023182

0.023022

0.022896

0.022842

106

0.00157

0.001565

0.001556

0.001546

Triangular

103

17.206

17.206

17.206

17.206

104

0.7318

0.7317

0.73162

0.73159

105

0.023143

0.02296

0.022815

0.022754

106

0.001581

0.001576

0.001567

0.001556

Table 18. ST for Star-Shaped Obstacles with different Wavy Walls at λ = 45˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

16.898

16.898

16.898

16.898

104

0.63818

0.63779

0.6375

0.63739

105

0.021027

0.020765

0.020472

0.020319

106

0.001485

0.001478

0.001469

0.00146

Square

103

17.074

17.074

17.074

17.074

104

0.66061

0.66034

0.66014

0.66006

105

0.021851

0.021658

0.021437

0.021325

106

0.001544

0.001538

0.001531

0.001523

Triangular

103

17.014

17.014

17.014

17.014

104

0.65422

0.65392

0.65368

0.65359

105

0.02182

0.021606

0.021361

0.021234

106

0.001556

0.00155

0.001542

0.001534

Table 19. ST for Square-Shaped Obstacles with different Wavy Walls at λ = 45˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

15.491

15.491

15.491

15.491

104

0.5893

0.5889

0.58861

0.5885

105

0.020474

0.020227

0.019949

0.019803

106

0.00149

0.001484

0.001476

0.001468

Square

103

15.659

15.659

15.659

15.659

104

0.61063

0.61036

0.61015

0.61008

105

0.021306

0.021122

0.020912

0.020805

106

0.001551

0.001546

0.00154

0.001533

Triangular

103

15.602

15.602

15.602

15.602

104

0.60474

0.60443

0.60419

0.60411

105

0.021278

0.021076

0.020844

0.020723

106

0.001564

0.001558

0.001551

0.001544

Table 20. ST for Triangular-Shaped Obstacles with different Wavy Walls at λ = 45˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

17.131

17.131

17.131

17.131

104

0.71813

0.71796

0.71787

0.71783

105

0.022339

0.022098

0.021907

0.021837

106

0.001505

0.0015

0.00149

0.001479

Square

103

17.243

17.243

17.243

17.243

104

0.73693

0.73683

0.73675

0.73673

105

0.023205

0.023027

0.022888

0.022837

106

0.001567

0.001563

0.001554

0.001544

Triangular

103

17.206

17.206

17.206

17.206

104

0.73182

0.7317

0.73162

0.73159

105

0.023161

0.022963

0.022807

0.022748

106

0.001578

0.001573

0.001564

0.001553

The system’s thermodynamic efficiency was further evaluated using ECOP, as shown in Tables 21-29. This metric inversely correlates with entropy production and provides insight into the trade-off between heat transfer and irreversibility. Among all configurations, cavities with sinusoidal corrugation, star-shaped obstacles, and an inclination of 30˚ delivered the highest ECOP values, particularly at moderate Ha and Ra = 105. The inclusion of magnetic effects (e.g., Ha = 20) improved ECOP by moderating chaotic fluid motion and stabilizing temperature gradients. In contrast, square and triangular corrugations led to localized thermal zones and entropy hotspots, resulting in comparatively lower ECOP scores.

Table 21. ECOP for Star-Shaped Obstacles with different Wavy Walls at λ = 15˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.04697

0.04697

0.04697

0.04697

104

4.0063

4.0054

4.0046

4.0043

105

177.34

173.1

167.46

163.9

106

3896.9

3778

3537.2

3218.6

Square

103

0.046959

0.046959

0.046959

0.046959

104

3.9981

3.9974

3.9969

3.9966

105

172.61

169.27

164.85

162.22

106

3694.1

3581.2

3358.1

3063.4

Triangular

103

0.046938

0.046938

0.046938

0.046938

104

3.9866

3.9859

3.9852

3.9849

105

171.82

168.24

163.45

160.51

106

3684.9

3572.4

3347.2

3048.4

Table 22. ECOP for Square-Shaped Obstacles with different Wavy Walls at λ = 150.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.054436

0.054436

0.054435

0.054435

104

4.5642

4.5627

4.5612

4.5605

105

192.86

187.82

181.07

176.66

106

4177.5

4053.6

3814.3

3488.9

Square

103

0.054471

0.054471

0.05447

0.05447

104

4.5584

4.5572

4.5559

4.5553

105

187.7

183.69

178.27

174.92

106

3959.4

3851.2

3634

3325.3

Triangular

103

0.054443

0.054442

0.054442

0.054442

104

4.5436

4.5423

4.5409

4.5402

105

186.73

182.47

176.67

172.99

106

3943.8

3832.8

3612.8

3305.8

Table 23. ECOP for Triangular-Shaped Obstacles with different Wavy Walls at λ = 15˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.046218

0.046218

0.046217

0.046217

104

4.0534

4.0531

4.0527

4.0525

105

189.11

186.3

183.95

182.77

106

4233.7

4063.9

3771

3433

Square

103

0.04627

0.04627

0.04627

0.04627

104

4.0463

4.0461

4.0458

4.0456

105

184.57

182.79

181.16

180.31

106

3998.5

3839.2

3575.3

3261

Triangular

103

0.046268

0.046268

0.046267

0.046267

104

4.0399

4.0396

4.0393

4.0391

105

183.9

181.79

179.93

178.97

106

4002.9

3843.6

3580.2

3258.8

Table 24. ECOP for Star-Shaped Obstacles with different Wavy Walls at λ = 30˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.04697

0.04697

0.04697

0.04697

104

4.006

4.0052

4.0045

4.0043

105

176.47

172.19

166.81

163.61

106

3979.7

3762.6

3501.7

3183.8

Square

103

0.046959

0.046959

0.046959

0.046959

104

3.9979

3.9973

3.9968

3.9966

105

171.76

168.5

164.36

162.02

106

3688.2

3556.1

3328.2

3033.1

Triangular

103

0.046938

0.046938

0.046938

0.046938

104

3.9864

3.9857

3.9851

3.9849

105

170.98

167.44

162.91

160.29

106

3695.3

3547.9

3317.1

3018.6

Table 25. ECOP for Square-Shaped Obstacles with different Wavy Walls at λ = 30˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.054436

0.054436

0.054435

0.054435

104

4.5637

4.5623

4.5611

4.5604

105

191.67

186.62

180.19

176.26

106

4229

4036.6

3764.6

3431.4

Square

103

0.054471

0.05447

0.05447

0.05447

104

4.5579

4.5568

4.5558

4.5552

105

186.54

182.63

177.58

174.62

106

3962

3818.4

3581.1

3270.5

Triangular

103

0.054443

0.054442

0.054442

0.054441

104

4.5431

4.5419

4.5408

4.5401

105

185.59

181.38

175.92

172.65

106

3964.3

3808.9

3565.2

3252.8

Table 26. ECOP for Triangular-Shaped Obstacles with different Wavy Walls at λ = 30˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.046218

0.046218

0.046217

0.046217

104

4.0534

4.053

4.0527

4.0524

105

190.08

186.61

183.86

182.69

106

4270.8

4090.6

3775.3

3417.3

Square

103

0.04627

0.04627

0.04627

0.04627

104

4.0463

4.046

4.0458

4.0456

105

185.38

183.01

181.1

180.26

106

4032.6

3863

3575.5

3255.4

Triangular

103

0.046268

0.046268

0.046267

0.046267

104

4.0399

4.0396

4.0393

4.0391

105

184.77

182.05

179.86

178.91

106

4039.3

3869.9

3576.7

3248.1

Table 27. ECOP for Star-Shaped Obstacles with different Wavy Walls at λ = 45˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.04697

0.04697

0.04697

0.04697

104

4.0056

4.0049

4.0044

4.0042

105

174.94

170.69

165.81

163.2

106

4044.6

3801.3

3448.4

3113.6

Square

103

0.046959

0.046959

0.046959

0.046959

104

3.9976

3.9971

3.9967

3.9966

105

170.36

167.26

163.61

161.73

106

3716.8

3536.9

3271.5

2973.7

Triangular

103

0.046938

0.046938

0.046938

0.046938

104

3.986

3.9855

3.9851

3.9849

105

169.54

166.12

162.09

159.96

106

3750.9

3549.9

3262.3

2957.2

Table 28. ECOP for Square-Shaped Obstacles with different Wavy Walls at λ = 45˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.054436

0.054435

0.054435

0.054435

104

4.563

4.5618

4.5608

4.5603

105

189.74

184.68

178.85

175.67

106

4362.5

4079.7

3692.5

3332.1

Square

103

0.054471

0.05447

0.05447

0.05447

104

4.5573

4.5564

4.5555

4.5551

105

184.66

180.94

176.52

174.18

106

4001.3

3793.3

3497

3178.7

Triangular

103

0.054442

0.054442

0.054442

0.054441

104

4.5424

4.5414

4.5405

4.54

105

183.71

179.63

174.78

172.17

106

4040.8

3809.8

3489.1

3161.7

Table 29. ECOP for Triangular-Shaped Obstacles with different Wavy Walls at λ = 45˚.

Wavy Wall

Ra

Ha = 0

Ha = 15

Ha = 30

Ha = 50

Sinusoidal

103

0.046218

0.046218

0.046217

0.046217

104

4.0533

4.0529

4.0526

4.0524

105

190.22

186.6

183.69

182.59

106

4260.8

4055.7

3729.7

3372.5

Square

103

0.04627

0.04627

0.04627

0.04627

104

4.0462

4.046

4.0458

4.0456

105

185.71

183.07

180.98

180.19

106

3981.2

3815.9

3538

3223.1

Triangular

103

0.046268

0.046268

0.046267

0.046267

104

4.0398

4.0395

4.0392

4.0391

105

185.03

182.09

179.73

178.83

106

3995.4

3819.4

3534.2

3210.6

In summary, the FEM simulation results highlight the intricate interdependence of obstacle geometry, wall corrugation, inclination angle, and magnetic field strength in shaping the thermofluidic behavior of nanofluid-filled trapezoidal cavities under MHD influence. Star-shaped obstacles consistently outperformed other geometries in enhancing convective heat transfer, while sinusoidal wall corrugation emerged as the most effective in promoting secondary flows and minimizing entropy generation. An inclination angle of 30˚ provided an optimal alignment for buoyancy forces, resulting in favorable thermal performance across most cases. While higher Hartmann numbers suppressed convection, they also contributed to reduced entropy and enhanced ECOP in certain configurations. These results, detailed in Tables 3-29, offer a comprehensive reference for optimizing passive thermal systems and lay the groundwork for the development of machine learning-based predictive models addressed in the next section.

4.2. Machine Learning Model Predictions and Analysis

To overcome the computational cost associated with high-fidelity FEM simulations across a wide parametric space, this study integrates supervised machine learning (ML) techniques to develop surrogate models capable of accurately predicting key thermal performance indicators. By learning from the numerical dataset generated under various geometric and physical conditions, the ML models aim to forecast the average Nusselt number (Nu), entropy generation (ST), and ecological coefficient of performance (ECOP) with minimal error and significantly reduced computation time. This section presents both the qualitative and quantitative evaluation of three distinct ML algorithms: Support Vector Regression (SVR), Decision Tree Regression (DT), and Random Forest Regression (RF). The objective is to assess their predictive accuracy, generalization capacity, and potential to serve as efficient alternatives to traditional numerical solvers in the context of MHD-influenced nanofluid convection in complex cavity geometries.

To complement the detailed FEM analysis and accelerate parametric exploration, machine learning models were trained on simulation data to predict key thermophysical performance metrics: the average Nusselt number (Nu), entropy generation (ST), and ecological coefficient of performance (ECOP). Qualitatively, the predictions produced by Support Vector Regression (SVR), Decision Tree (DT), and Random Forest (RF) models demonstrated strong alignment with the FEM-derived trends across varying Rayleigh and Hartmann numbers, obstacle geometries, and wall corrugation profiles.

The Random Forest model, in particular, exhibited a robust ability to replicate the nonlinear relationships governing the thermal response. For instance, it accurately captured the enhanced heat transfer associated with star-shaped obstacles and sinusoidal wall corrugations, as well as the entropy-reducing effect of moderate magnetic field strength. The machine learning models also consistently reproduced the peak Nu and ECOP values around the 30˚ inclination angle observed in FEM simulations, confirming their ability to internalize spatial and physical patterns. These qualitative consistencies reinforce the validity of ML as a fast-response surrogate for predicting thermal behavior in complex geometrical enclosures.

Quantitative assessment of model performance was conducted using standard regression metrics: Mean Absolute Error (MAE), Mean Squared Error (MSE), and the coefficient of determination (R2). Table 30 summarizes the comparative performance of the three machine learning models across the three target outputs.

Among the models evaluated, Random Forest Regression achieved the highest predictive accuracy, with R2 scores above 0.98 for all output variables. The model also maintained the lowest MAE and MSE, indicating not only precision but also reliability across a diverse dataset spanning geometric and thermal parameters. Decision Tree Regression followed closely, showing competitive results with less complexity. SVR, while still effective, underperformed slightly in capturing high-gradient behaviors, especially in configurations with sharp obstacle edges or strong magnetic damping.

Table 30. Performance metrics of machine learning models.

Model

Metric

Nu

ST

ECOP

SVR

MAE

0.074

0.083

0.068

MSE

0.011

0.014

0.010

R2

0.972

0.964

0.971

Decision Tree

MAE

0.062

0.071

0.061

MSE

0.009

0.012

0.008

R2

0.978

0.971

0.975

Random Forest

MAE

0.041

0.050

0.045

MSE

0.004

0.006

0.005

R2

0.991

0.982

0.989

The random forest model developed in this study was fine-tuned using a grid search approach, with the optimal hyperparameters determined as follows: n_estimators = 200, max_depth = 12, and criterion = squared_error.

Table 31. The feature importance for predicting the Nusselt number is summarized below.

Feature

Importance (%)

Rayleigh Number (Ra)

45

Hartmann Number (Ha)

20

Inclination Angle (λ)

17

Obstacle Shape

10

Wall Corrugation

8

As shown in Table 31, feature importance analysis identified the Rayleigh number (Ra) as the most influential input, contributing 45% to the model’s prediction of Nusselt number, followed by the Hartmann number (Ha) at 20%, inclination angle (λ) at 17%, obstacle shape at 10%, and wall corrugation at 8%. These results clearly demonstrate that thermal and magnetic field effects are the dominant factors influencing convective heat transfer in the studied MHD cavity system.

Figures 5-13 illustrate the scatter plots comparing FEM-simulated and ML-predicted Nusselt Numbers (Nu) for various obstacle shapes and wavy wall configurations at inclination angles of λ = 15˚, 30˚, and 45˚. The predictions were generated using a trained machine learning model on a comprehensive dataset of FEM results. Across all figures, the data points align closely along the ideal prediction line (y = x), indicating a high level of agreement between FEM and ML results. The consistency in prediction accuracy is evident for all three obstacle shapes, star, square, and triangular, and for all wall geometries, sinusoidal, square, and triangular.

Figures 5-7 show results for star-shaped obstacles. These figures reveal minimal scatter and a near-perfect linear relationship, highlighting the model’s robustness under geometrically complex and thermally dynamic conditions.

Figures 8-10 correspond to square-shaped obstacles. The slight deviations from the ideal line remain within acceptable error margins, reinforcing the ML model’s capacity to generalize over regular-shaped geometries.

Figure 5. FEM vs ML Prediction of Nu for Star-Shaped Obstacles with different Wavy Walls at λ = 15˚.

Figure 6. FEM vs ML Prediction of Nu for Star-Shaped Obstacles with different Wavy Walls at λ = 30˚.

Figure 7. FEM vs ML Prediction of Nu for Star-Shaped Obstacles with different Wavy Walls at λ = 45˚.

Figure 8. FEM vs ML Prediction of Nu for Square-Shaped Obstacles with different Wavy Walls at λ = 15˚.

Figure 9. FEM vs ML Prediction of Nu for Square-Shaped Obstacles with different Wavy Walls at λ = 30˚.

Figure 10. FEM vs ML Prediction of Nu for Square-Shaped Obstacles with different Wavy Walls at λ = 45˚.

Figure 11. FEM vs ML Prediction of Nu for Triangular-Shaped Obstacles with different Wavy Walls at λ = 15˚.

Figure 12. FEM vs ML Prediction of Nu for Triangular-Shaped Obstacles with different Wavy Walls at λ = 30˚.

Figure 13. FEM vs ML Prediction of Nu for Triangular-Shaped Obstacles with different Wavy Walls at λ = 45˚.

Figures 11-13 depict results for triangular-shaped obstacles, which pose higher flow complexity. Even under these conditions, the ML model successfully captures the trends, maintaining low predictive error. Overall, the analysis of Figures 5-13 confirms the high predictive fidelity of the ML model across varying geometrical and thermal boundary conditions. This underscores its practical value in accelerating heat transfer predictions in magnetohydrodynamic nanofluid systems without compromising accuracy.

The comparative analysis between FEM and machine learning predictions for the Nusselt number across diverse geometric and thermal configurations demonstrates the strong predictive capability of the ML model. The scatter plots (Figures 5-13) validate the model’s effectiveness in accurately estimating thermal performance for nanofluid-filled trapezoidal cavities influenced by obstacle shape, wall corrugation, and inclination angle under MHD conditions.

The ML model reliably reproduced FEM results across all configurations, with minimal deviations observed regardless of the complexity of obstacle geometries or wall undulations. This consistency underscores the robustness and generalization ability of the trained ML algorithm. Additionally, the model’s rapid inference capabilities make it a valuable surrogate for computationally expensive FEM simulations, enabling efficient design and optimization of thermal systems.

In conclusion, the machine learning approach provides a powerful, efficient, and accurate alternative to traditional numerical simulations for predicting natural convection behavior in complex nanofluidic enclosures, significantly accelerating the analysis while maintaining high fidelity.

5. Conclusions

This study proposed an integrated framework that combines high-fidelity finite element method (FEM) simulations with machine learning (ML) predictions to analyze magnetohydrodynamic (MHD) natural convection in nanofluid-filled trapezoidal cavities. Key variables included obstacle shape (star, square, triangular), top wall corrugation (sinusoidal, square, triangular), and inclination angle (λ = 15˚, 30˚, 45˚), using Cu-H2O nanofluids to improve thermal performance.

FEM results demonstrated that obstacle geometry and wall undulations significantly influence heat transfer and entropy generation. Star and Square obstacles with sinusoidal or triangular wavy walls yielded the highest Nusselt numbers and lowest entropy generation, particularly at λ = 30˚ and 45˚, indicating enhanced thermodynamic efficiency and ecological performance.

The ML models, trained on the FEM dataset, showed excellent predictive accuracy for Nu, St, and ECOP, with deviations typically under 2%. The agreement across various configurations (Figures 5-13) confirms ML’s effectiveness as a reliable and computationally efficient surrogate for FEM.

The trained ML models are reliable within the parameter ranges covered by the FEM dataset; however, they may fail to generalize accurately when applied to scenarios outside these bounds, such as Ra > 106 or Ha > 50. This limitation arises because the models lack embedded physical laws and rely solely on learned patterns from the training data.

6. Key Findings

1) Optimal heat transfer occurred with sinusoidal walls, Star/Square obstacles, and λ = 30˚ - 45˚.

2) MHD effects, though dampening convection, can enhance uniformity and efficiency when geometry is optimized.

3) FEM offered deep physical insights, while ML delivered rapid, accurate predictions ideal for iterative design.

4) The hybrid FEM-ML approach supports scalable, real-time thermal analysis and control.

Future studies should explore the use of hybrid nanofluids, porous domains, and transient heating conditions to simulate more realistic systems. Moreover, incorporating deep learning architectures such as physics-informed neural networks (PINNs) could further improve accuracy and adaptability. These advancements would facilitate digital twin development and intelligent control strategies for energy-efficient systems.

Acknowledgements

The authors gratefully acknowledge the Department of Mathematics, Dhaka University of Engineering and Technology (DUET), Gazipur-1707, Bangladesh, for providing the necessary support and resources to carry out this research work.

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.

References

[1] Hidki, R., El Moutaouakil, L., Charqui, Z., Boukendil, M. and Zrikem, Z. (2021) Natural Convection in a Square Cavity Containing Two Heat-Generating Cylinders with Different Geometries. Materials Today: Proceedings, 45, 7415-7423.[CrossRef]
[2] Cao, Y., Ayed, H., Jarad, F., Togun, H., Alias, H., Issakhov, A., et al. (2021) MHD Natural Convection Nanofluid Flow in a Heat Exchanger: Effects of Brownian Motion and Thermophoresis for Nanoparticles Distribution. Case Studies in Thermal Engineering, 28, Article ID: 101394.[CrossRef]
[3] Zheng, J., Zhang, L., Yu, H., Wang, Y. and Zhao, T. (2021) Study on Natural Convection Heat Transfer in a Closed Cavity with Hot and Cold Tubes. Science Progress, 104, 1-25.[CrossRef] [PubMed]
[4] Ibrahim, M.N.J., Hammoodi, K.A., Abdulsahib, A.D. and Flayyih, M.A. (2022) Study of Natural Convection Inside Inclined Nanofluid Cavity with Hot Inner Bodies (Circular and Ellipse Cylinders). International Journal of Heat and Technology, 40, 699-705. [Google Scholar] [CrossRef]
[5] Tasnim, S., Mitra, A., Saha, H., Islam, M.Q. and Saha, S. (2023) MHD Conjugate Natural Convection and Entropy Generation of a Nanofluid Filled Square Enclosure with Multiple Heat-Generating Elements in the Presence of Joule Heating. Results in Engineering, 17, Article ID: 100993.[CrossRef]
[6] Boulahia, Z., Wakif, A. and Sehaqui, R. (2016) Numerical Study of Mixed Convection of the Nanofluids in Two-Sided Lid-Driven Square Cavity with a Pair of Triangular Heating Cylinders. Journal of Engineering, 2016, Article ID: 8962091.[CrossRef]
[7] Ali, A., Ayaz, M., Ahmad, Z. and Marei, A.M. (2025) Analysis of Entropy Generation in Magnetohydrodynamic Convective Flow of Nanofluids within a Wavy Trapezoidal Enclosure: A Brinkmann-Forchheimer Model Using Finite Element Method. Case Studies in Thermal Engineering, 73, 106719.[CrossRef]
[8] Nadeem, S., Arif, M., Ullah, I. and Alzabut, J. (2025) MHD Natural Convection of Nanofluid Flow Using a Corrugated Permeable Medium within Corrugated Circular Cavity. Journal of Thermal Analysis and Calorimetry, 150, 5697-5724.[CrossRef]
[9] Dogonchi, A.S., Sadeghi, M.S., Ghodrat, M., Chamkha, A.J., Elmasry, Y. and Alsulami, R. (2021) Natural Convection and Entropy Generation of a Nanoliquid in a Crown Wavy Cavity: Effect of Thermo-Physical Parameters and Cavity Shape. Case Studies in Thermal Engineering, 27, Article ID: 101208.[CrossRef]
[10] Alnajem, M.H.S., Alsabery, A.I. and Hashim, I. (2019) Entropy Generation and Natural Convection in a Wavy-Wall Cavity Filled with a Nanofluid and Containing an Inner Solid Cylinder. IOP Conference Series: Materials Science and Engineering, 518, Article ID: 032044.[CrossRef]
[11] Chowdhury, K. and Alim, M.A. (2023) Mixed Convection in a Double Lid-Driven Wavy Shaped Cavity Filled with Nanofluid Subject to Magnetic Field and Internal Heat Source. Journal of Applied Mathematics, 2023, Article ID: 7117186.[CrossRef]
[12] Boulahia, Z., Wakif, A., Chamkha, A.J., Amanulla, C.H. and Sehaqui, R. (2018) Effects of Wavy Wall Amplitudes on Mixed Convection Heat Transfer in a Ventilated Wavy Cavity Filled by Copper-Water Nanofluid Containing a Central Circular Cold Body. Journal of Nanofluids, 8, 1170-1178.[CrossRef]
[13] Khatun, S., Kundu, R., Islam, S., Aktary, R. and Kumar, D. (2025) Sensitivity Analysis on Natural Convective Trapezoidal Cavity Containing Hybrid Nanofluid with Magnetic Effect: Numerical and Statistical Approach. Heliyon, 11, e41508.[CrossRef] [PubMed]
[14] Selimefendigil, F. (2017) Natural Convection in a Trapezoidal Cavity with an Inner Conductive Object of Different Shapes and Filled with Nanofluids of Different Nanoparticle Shapes. Iranian Journal of Science and Technology, Transactions of Mechanical Engineering, 42, 169-184.[CrossRef]
[15] Mohammed, A.A., Thaer, M. and Yahya, D.Q. (2022) Mixed Convection Heat Transfer of Al2O₃-H2O Nanofluid in a Trapezoidal Lid-Driven Cavity at Different Angles of Inclination. Texas Journal of Engineering and Technology, 11, 20-30.
[16] Mejbel, A., Abdulkadhim, A., Hamzah, R., Hamzah, H. and Ali, F. (2020) Natural Convection Heat Transfer for Adiabatic Circular Cylinder Inside Trapezoidal Enclosure Filled with Nanofluid Superposed Porous-Nanofluid Layer. FME Transactions, 48, 82-89.[CrossRef]
[17] Abdelmalek, Z., Tayebi, T., Dogonchi, A.S., Chamkha, A.J., Ganji, D.D. and Tlili, I. (2020) Role of Various Configurations of a Wavy Circular Heater on Convective Heat Transfer within an Enclosure Filled with Nanofluid. International Communications in Heat and Mass Transfer, 113, Article ID: 104525.[CrossRef]
[18] Sheikhzadeh, G.A., Nikfar, M. and Fattahi, A. (2012) Numerical Study of Natural Convection and Entropy Generation of Cu-Water Nanofluid around an Obstacle in a Cavity. Journal of Mechanical Science and Technology, 26, 3347-3356.[CrossRef]
[19] Ali, M.M., Alim, M.A., Akhter, R. and Ahmed, S.S. (2017) MHD Natural Convection Flow of CuO/Water Nanofluid in a Differentially Heated Hexagonal Enclosure with a Tilted Square Block. International Journal of Applied and Computational Mathematics, 3, 1047-1069.[CrossRef]
[20] Akram, M., Benhanifia, K., Brahim, M., Rahmani, L., Ansari, A.Z., Eid, M.R., et al. (2024) Natural Convection and Flow Patterns of Cu-Water Nanofluids in Hexagonal Cavity: A Novel Thermal Case Study. Open Physics, 22, Article ID: 20240041.[CrossRef]
[21] Munshi, M.J.H., Bhuiyan, A.H. and Alim, M.A. (2015) A Numerical Study of Natural Convection in a Square Enclosure with Non-Uniformly Heated Bottom Wall and Square Shape Heated Block. American Journal of Engineering Research (AJER), 4, 124-137.
[22] Chowdhury, K., Alim, A. and Hossen, M. (2020) Natural Convection in a Partially Heated and Cooled Square Enclosure Containing a Diamond Shaped Heated Block. International Journal of Fluid Mechanics & Thermal Sciences, 6, 1-8.[CrossRef]
[23] Saha, B.K., Jihan, J.I., Barai, G., Moon, N.J., Saha, G. and Saha, S.C. (2025) Exploring Natural Convection and Heat Transfer Dynamics of Al2O3-H2O Nanofluid in a Modified Tooth-Shaped Cavity Configuration. International Journal of Thermofluids, 25, Article ID: 101005.[CrossRef]
[24] Sompong, P. and Witayangkurn, S. (2013) Natural Convection in a Trapezoidal Enclosure with Wavy Top Surface. Journal of Applied Mathematics, 2013, Article ID: 840632.[CrossRef]
[25] Suresh Reddy, E. and Panda, S. (2022) Heat Transfer of MHD Natural Convection Casson Nanofluid Flows in a Wavy Trapezoidal Enclosure. The European Physical Journal Special Topics, 231, 2733-2747.[CrossRef]
[26] Alomari, M.A., Al-Farhany, K., Hashem, A.L., Al-Dawody, M.F., Redouane, F. and Olayemi, O.A. (2021) Numerical Study of MHD Natural Convection in Trapezoidal Enclosure Filled with (50%MgO-50%Ag/Water) Hybrid Nanofluid: Heated Sinusoidal from Below. International Journal of Heat and Technology, 39, 1271-1279.[CrossRef]
[27] Rahaman, M.M., Bhowmick, S. and Saha, S.C. (2025) Thermal Performance and Entropy Generation of Unsteady Natural Convection in a Trapezoid-Shaped Cavity. Processes, 13, Article 921.[CrossRef]
[28] Alshayji, A., Alzuabi, M.K. and Aljuwayhel, N.F. (2025) Numerical Investigation of Nanofluid Free Convection in a Rectangular Cavity Using Variable Properties. Journal of Thermal Analysis and Calorimetry, 150, 6519-6538.[CrossRef]
[29] El hadoui, B. and Kaddiri, M. (2025) Optimizing Nanofluid-Enhanced Mixed Convection in Inclined Rectangular Chambers. Journal of Thermal Analysis and Calorimetry, 150, 12717-12733.[CrossRef]
[30] Uddin, M.J., Al Kalbani, K.S., Rahman, M.M., Alam, M.S., Al-Salti, N. and Eltayeb, I.A. (2016) Fundamentals of Nanofluids: Evolution, Applications and New Theory. International Journal of Biomathematics and Systems Biology, 2, 1-32.
[31] Ali, M.M., Akhter, R. and Alim, M.A. (2020) MHD Natural Convection and Entropy Generation in a Grooved Enclosure Filled with Nanofluid Using Two-Component Non-Homogeneous Model. SN Applied Sciences, 2, Article No. 571.[CrossRef]
[32] Deep, S.S., Sultana, S., Haque, T., Rahman, M.T. and Saha, S. (2025) Coupled Fluid-Thermal Analysis of a Square Chamber with a Wavy Top Wall and an Internal Solid Elliptical/Circular Block. Applications in Engineering Science, 24, Article ID: 100268.[CrossRef]
[33] Parmar, K., Parmar, N., Parwani, A.K. and Tripathi, S. (2024) Experimental Studies and Machine Learning Approaches for Thermal Parameters Prediction and Data Analysis in Closed-Loop Pulsating Heat Pipes with Al2O3-Di Water Nanofluid. Journal of Thermal Analysis and Calorimetry, 150, 591-606.[CrossRef]
[34] Hussain, M., Lin, D., Waqas, H. and Al-Mdallal, Q.M. (2025) An Artificial Intelligence and Machine Learning-Driven CFD Simulation for Optimizing Thermal Performance of Blood-Integrated Ternary Nano-Fluid. Engineering Applications of Computational Fluid Mechanics, 19, Article ID: 2459664.[CrossRef]
[35] Godasiaei, S.H. and Kamali, H.A. (2025) Evaluating Machine Learning as an Alternative to CFD for Heat Transfer Modeling. Microgravity Science and Technology, 37, Article No. 6.[CrossRef]
[36] Sharma, P., Ramesh, K., Parameshwaran, R. and Deshmukh, S.S. (2022) Thermal Conductivity Prediction of Titania-Water Nanofluid: A Case Study Using Different Machine Learning Algorithms. Case Studies in Thermal Engineering, 30, Article ID: 101658.[CrossRef]
[37] Hussain, S.M., Nawaz, D., Attique, B., Haroon, M., Jamshed, W., Guedri, K., et al. (2025) Machine Learning Estimation of Heat and Mass Transfer Attributes of Thermal Radiative Williamson Nanofluid Flow via Nonlinear Stretchable Surface. Journal of Radiation Research and Applied Sciences, 18, Article ID: 101581.[CrossRef]
[38] Biswal, G. and Meshram, G.S. (2025) Machine Learning-Based Prediction of Nusselt Number for Vertical Helical Coils in Natural Convection Heat Transfer. International Communications in Heat and Mass Transfer, 164, Article ID: 108983.[CrossRef]
[39] Wang, R., Zeng, Z., Sadeq, A.M., Agrawal, M.K., Muhammad, T. and Rao, B.N. (2025) Predictive Performance Analysis of Machine Learning Models for Forced Convective Heat Transfer of a Flat-Plate in Counter-Rotating Cylinder Systems: A Comprehensive Evaluation. Case Studies in Thermal Engineering, 74, Article ID: 106961.[CrossRef]
[40] Tanzim, R., Das, A., Zaman, S.N., Lia, T.A. and Sarwar, S.T. (2025) A Chromosome Inspired Fin Structure for Microchannel Heat Sinks: CFD Driven XGBR, ANN, and MLR Models for Thermal and Fluid Flow Prediction. International Communications in Heat and Mass Transfer, 169, Article ID: 109763.[CrossRef]

Copyright © 2026 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.