Showing posts with label Simulation. Show all posts
Showing posts with label Simulation. Show all posts

Thursday, April 17, 2014

CFD: Generating Non-Uniform 2D Rectangular Grid Meshes in Fortran

In Computational Fluid Dynamics (CFD), resolving boundary layers and high-gradient shear regions requires non-uniform grid clustering near solid walls while keeping cell counts manageable in free-stream regions. Here is a Fortran routine to generate a geometrically stretched, symmetric 2D rectangular grid.

Domain: Rectangular 2D domain \([a, b] imes [c, d]\) • Method: Geometric progression expansion clustering toward boundaries

Mathematical Formulation

Given domain limits \(x \in [a, b]\) with \(n_x\) divisions and expansion ratio \(r_x\), the initial wall-adjacent step size \(\eta_x\) is computed from the geometric sum across the symmetric half-domain:

eta_x = (b - a) * (1 - exp_x) / (2 * (1 - exp_x**(n_x / 2)))
eta_y = (d - c) * (1 - exp_y) / (2 * (1 - exp_y**(n_y / 2)))

Fortran Source Code

! ====================================================================
! 2D Non-Uniform Symmetric Rectangular Grid Generator
! ====================================================================
      exp_x = 1.05   ! x-axis expansion factor
      exp_y = 1.10   ! y-axis expansion factor

      a = 0.0
      b = 1.0
      c = 0.0
      d = 1.0

! Uniform step sizes for reference
      del_x = (b - a) / n_x
      del_y = (d - c) / n_y

! Compute first wall-adjacent step sizes (eta_x, eta_y)
      eta_x = (b - a) * (1.0 - exp_x) / (2.0 * (1.0 - exp_x**(n_x / 2)))
      eta_y = (d - c) * (1.0 - exp_y) / (2.0 * (1.0 - exp_y**(n_y / 2)))

      x(1) = a
      y(1) = c

! --- X-Direction Mesh Generation ---
! Half 1: Wall to Center (Expanding)
      DO i = 2, n_x / 2 + 1
          x(i) = x(i - 1) + eta_x * exp_x**(i - 2)
      END DO

! Half 2: Center to Opposite Wall (Contracting)
      DO i = n_x / 2 + 2, n_x + 1
          x(i) = x(i - 1) + eta_x * exp_x**(n_x + 1 - i)
      END DO

! --- Y-Direction Mesh Generation ---
! Half 1: Wall to Center (Expanding)
      DO j = 2, n_y / 2 + 1
          y(j) = y(j - 1) + eta_y * exp_y**(j - 2)
      END DO

! Half 2: Center to Opposite Wall (Contracting)
      DO j = n_y / 2 + 2, n_y + 1
          y(j) = y(j - 1) + eta_y * exp_y**(n_y + 1 - j)
      END DO
! ====================================================================

Thursday, August 29, 2013

Troubleshooting FSI System Coupling Errors in ANSYS Fluent and CFX (Excessive Distortion)

During two-way Fluid-Structure Interaction (FSI) simulations using ANSYS System Coupling between Transient Structural and Fluent or CFX, a sudden simulation abort often occurs at the very first coupling iteration with excessive mesh distortion errors.

Simulation Environments: ANSYS Workbench • System Coupling • Transient Structural • Fluent / CFX

Error Symptoms

Fluent System Coupling Exception:

System Coupling Exception: Origin: Transient Structural (Solution)
Error Code: 2
Error Description: One or more elements have become highly distorted.
Excessive distortion of elements is usually a symptom indicating the need for corrective action elsewhere.
Try ramping the load up instead of step applying the load (KBC,1).

CFX System Coupling Error:

ERROR #001100279 has occurred in subroutine ErrAction.
Message: CFX encountered the error: Read. Fatal error occurred when requesting Total Mesh Displacement for FSI.

Root Causes and Solutions

  1. Operating / Reference Pressure Mismatch:

    Both Fluent and CFX compute pressures relative to a designated operating/reference pressure. If your structural model expects gauge pressure but receives absolute pressure (or vice versa), the structural boundary experiences an instantaneous massive pressure spike at time step zero, causing severe structural element distortion. Ensure your fluid reference pressure aligns with your structural reference state.

  2. Velocity Inlet Vector Misalignment:

    Ensure velocity inlet boundary conditions match the physical geometry coordinate axes. For example, if a cylindrical fluid channel lies along the X-axis and the inlet velocity is erroneously assigned to Y or Z, fluid impacts the boundary wall immediately, creating an unphysical pressure surge and massive displacement.

  3. Load Ramping:

    In Transient Structural, avoid step-applying initial loads (KBC,1). Instead, ramp fluid forces gradually over the first few coupling sub-iterations to prevent transient shockwaves from inverting flexible mesh elements.

Thursday, August 22, 2013

Fixing ANSYS Fluent FSI Error: Unassigned Interface Zone Detected

When preparing an ANSYS Fluent mesh for two-way Fluid-Structure Interaction (FSI) coupled with ANSYS Mechanical, clicking Check Mesh may trigger the following warning and cause the mesh validation to fail:

Context: ANSYS Fluent mesh validation • Dynamic Mesh • Boundary Conditions
WARNING: Unassigned interface zone detected for interface 6.
WARNING: Mesh check failed.
To get more detailed information about the mesh check failure,
increase the mesh check verbosity via the TUI command /mesh/check-verbosity.

Root Cause & Solution

This error occurs when the boundary condition type for the FSI surface is set to Interface rather than Wall.

  • In Fluent, the boundary type Interface is exclusively reserved for grid interface pairs (such as sliding meshes or non-conformal meshes joined via Mesh Interfaces).
  • For an FSI coupling surface where fluid interacts with a solid structure, the boundary condition type must be set to Wall.
  • Under the Dynamic Mesh panel, designate this Wall as a dynamic boundary zone and assign it to System Coupling.

Once changed from Interface to Wall, re-running Check Mesh passes cleanly with zero warnings.

Monday, August 19, 2013

Troubleshooting ADINA FSI Simulation: INPUT ERROR: No Node Found in BCD

When running a Fluid-Structure Interaction (FSI) simulation in the ADINA FEM software suite, generating the solver DATA file may abort with the following error:

Environment: ADINA Structures • ADINA CFD • FSI Boundary Condition Definition
*** INPUT ERROR: No node found in BCD 1

Cause and Resolution

This error occurs when the FSI Boundary Condition (BCD) is assigned to the incorrect model body or geometric surface:

  • In ADINA FSI modeling, the fluid-structure boundary condition must be explicitly defined on the shared interface surface corresponding to the proper model domain (e.g. defining structural boundary nodes on the solid body and fluid boundary nodes on the fluid body).
  • If the FSI boundary surface is mapped to a geometry surface that lacks associated mesh nodes in that model component, ADINA cannot bind any degrees of freedom and throws the No node found in BCD error.

Verify that your interface boundary assignments match the mesh geometry of the active model component before regenerating the DATA file.

How Google Antigravity Solved the Mysterious NVIDIA Sleep Reboot on My Dell Inspiron 7567 (Ubuntu Linux)

If you run modern Ubuntu or Linux on a Dell Inspiron 15 Gaming (7567) or a similar 7th-gen Intel laptop paired with an NVIDIA GeForce GTX ...