Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about boundary TYPE_E #262

Open
JohnZhan2023 opened this issue Jan 19, 2025 · 1 comment
Open

Questions about boundary TYPE_E #262

JohnZhan2023 opened this issue Jan 19, 2025 · 1 comment

Comments

@JohnZhan2023
Copy link

JohnZhan2023 commented Jan 19, 2025

Image
I would like to simulate the response of an object in an air fluid. For this, I have set the left side as the inlet, the right side as the outlet, and periodic boundary conditions for the top, bottom, front, and back. The left side has a velocity directed towards the right, while the right side is configured to allow free outflow.

However, I have observed that during the simulation, a backward shock wave appears at the left wall, as though the outflow condition is not functioning as expected. I would greatly appreciate any insights or suggestions as to why this might be occurring.

Here are the detailed settings I have used:

parallel_for(lbm.get_N(), [&](ulong n) {
    uint x=0u, y=0u, z=0u;
    lbm.coordinates(n, x, y, z);

    // Default initial values: rho=1, u=0, flags=0 (inside fluid)
    // Below, modifications will be made as needed
    // (1) Inlet (x=0): Set velocity boundary
    if(x == 0u) {
        lbm.flags[n] = TYPE_E;      // Fluid boundary, use Equilibrium boundary
        lbm.u.x[n]   = U_in;        // Set velocity in the x direction
        lbm.u.y[n]   = 0.0f;
        lbm.u.z[n]   = 0.0f;
    }

    // (2) Outlet (x=Nx-1): Can specify a near free outflow
    //     Method A: Approximate velocity as (U_in, 0, 0), or smaller
    //     Method B: Set density rho != 1
    //     The following demonstrates a simple "velocity" specification
    if(x == Nx_1) {
        lbm.flags[n] = TYPE_E;      // Equilibrium boundary
        // lbm.u.x[n]   = U_in;        // Can also be set to a smaller value, such as 0.8f*U_in
        // lbm.u.y[n]   = 0.0f;
        // lbm.u.z[n]   = 0.0f;
        lbm.rho[n]   = 1.0f;  // Or slightly less than 1.0f to simulate a slight pressure gradient
    }

    // (3) Top, bottom, front, and back boundaries: Rigid walls
    // if(y == 0u || y == Ny_1 || z == 0u || z == Nz_1) {
    //     lbm.flags[n] = TYPE_S;      // No-slip boundary
    //     // set the transparent boundary
    // }
});
@JohnZhan2023
Copy link
Author

JohnZhan2023 commented Jan 19, 2025

Also, I want to ask about what the redlines mean?

Image

And what will cause the red lines?

My code is as follows:

// --------------------------- 1. Define Physical Quantities, Grid, and Flow Parameters ---------------------------
// Example: Set Reynolds number Re, characteristic length D (obstacle diameter), and inlet velocity U_in
const float Re       = 4000.0f;   // Example: Reynolds number around 4000
const float D        = 100.0f;    // Cylinder diameter (LBM length unit)
const float U_in     = 0.05f;     // Inlet velocity (LBM velocity unit, typical range ~0.001 - 0.1)
// From Re = (U_in * D) / nu => nu = (U_in * D) / Re
const float nu       = (U_in * D) / Re;

// Define the dimensions of the wind tunnel: assume that the length direction x is much larger, and y, z are the height and width
// This is just an example; you can adjust the size as needed
const float Lx = 10.0f * D;  // Length in the x direction
const float Ly = 2.0f  * D;  // Height in the y direction
const float Lz = 2.0f  * D;  // Width in the z direction

// Convert floating-point dimensions to integer grid sizes
// For example, aiming for ~5-6 million grid cells in total volume Nx*Ny*Nz
// Simple example: 1 cell corresponds to 1 LBM length unit in each direction
const uint Nx = (uint)ceil(Lx);
const uint Ny = (uint)ceil(Ly);
const uint Nz = (uint)ceil(Lz);
float3 axis = axis_ * (Nx, Ny, Nz); //0, 4, 5, 6

// --------------------------- 2. Create LBM Simulation Object ---------------------------
// Here, only a single GPU is used, and no additional body forces are applied (fx=fy=fz=0.0f)
LBM lbm(Nx, Ny, Nz, nu, 0.0f, 0.0f, 0.0f);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant