diff --git a/16_Sedov_Blast_Wave/CASE/DATA/run.cfg b/16_Sedov_Blast_Wave/CASE/DATA/run.cfg new file mode 100644 index 0000000..89ecabe --- /dev/null +++ b/16_Sedov_Blast_Wave/CASE/DATA/run.cfg @@ -0,0 +1,5 @@ +[job_defaults] + +n_procs: 1 +n_threads: 1 + diff --git a/16_Sedov_Blast_Wave/CASE/DATA/setup.xml b/16_Sedov_Blast_Wave/CASE/DATA/setup.xml new file mode 100644 index 0000000..ed39457 --- /dev/null +++ b/16_Sedov_Blast_Wave/CASE/DATA/setup.xml @@ -0,0 +1,238 @@ + + + + + + + all[] + + + + + all[] + + + + 1 + + + + + + 10 + + + + + + + + + + 1 + 0.5 + + + + + + + 1 + 10 + 0.1 + 5e-05 + 0.1 + + + + X0 + X1 + Y0 + Y1 + Z0 + Z1 + + + + + + 0 + + + + + + 0 + + + + + + + + + + + + + + + + + + + + density = 1; + 1.17862 + + + 0.0 + + + + + 0 + + + + + 1005 + + + + + 0 + + + + + 0 + + + + 0.028966 + 101325 + 0.00348310693138 + + + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + + + + + + + all[] + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + 1.0 + off + + + + 0 + + + + + + + + + + + + + 1e+12 + -1e+12 + 1 + SGDH + + + + + + + + + 1 + 0 + + + + velocity[0] = 0.; +velocity[1] = 0.; +velocity[2] = 0.; + + + + + + + + + + + + + pressure = 1; + 2 + + + + 1 + + + + + + + \ No newline at end of file diff --git a/16_Sedov_Blast_Wave/CASE/SRC/cs_user_initialization.cpp b/16_Sedov_Blast_Wave/CASE/SRC/cs_user_initialization.cpp new file mode 100644 index 0000000..dff4d6f --- /dev/null +++ b/16_Sedov_Blast_Wave/CASE/SRC/cs_user_initialization.cpp @@ -0,0 +1,130 @@ +/*============================================================================ + * User initialization for the Sedov blast wave problem. + * + * A high-pressure region (r < r0) surrounded by a low-pressure ambient + * creates a cylindrical shock wave propagating radially outward. + *============================================================================*/ + +/* code_saturne version 9.1 */ + +/* + This file is part of code_saturne, a general-purpose CFD tool. + + Copyright (C) 1998-2025 EDF S.A. + + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 51 Franklin + Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +/*----------------------------------------------------------------------------*/ + +#include "cs_defs.h" + +/*---------------------------------------------------------------------------- + * Standard C library headers + *----------------------------------------------------------------------------*/ + +#include +#include + +#if defined(HAVE_MPI) +#include +#endif + +/*---------------------------------------------------------------------------- + * PLE library headers + *----------------------------------------------------------------------------*/ + +#include + +/*---------------------------------------------------------------------------- + * Local headers + *----------------------------------------------------------------------------*/ + +#include "cs_headers.h" + +/*----------------------------------------------------------------------------*/ + +BEGIN_C_DECLS + +/*----------------------------------------------------------------------------*/ +/*! + * \file cs_user_initialization.cpp + * + * \brief Initialization prior to solving time steps. + */ +/*----------------------------------------------------------------------------*/ + +/*============================================================================ + * User function definitions + *============================================================================*/ + +/*----------------------------------------------------------------------------*/ +/*! + * \brief Define initial conditions for variables. + * + * This function is not yet called by code_saturne, use + * `cs_user_initialization` for the time being + * This function is called before the beginning of the computation + * allowing an overload of the GUI defined initialization (called just + * after cs_gui_initial_conditions). + * + * \param[in, out] domain pointer to a cs_domain_t structure + */ +/*----------------------------------------------------------------------------*/ + +void +cs_user_initialization(cs_domain_t *domain) +{ + const cs_lnum_t n_cells = cs_glob_mesh->n_cells; + const cs_real_3_t *cell_cen = + (const cs_real_3_t *)cs_glob_mesh_quantities->cell_cen; + + /* Access field pointers */ + cs_real_t *rho = CS_F_(rho)->val; + cs_real_t *p = CS_F_(p)->val; + cs_real_3_t *vel = (cs_real_3_t *)CS_F_(vel)->val; + + /* Sedov blast wave parameters: + * rho0 - uniform ambient density + * pinfty - ambient pressure (very low) + * phot - high pressure inside the blast region + * r0 - initial blast radius */ + const cs_real_t rho0 = 1.0; + const cs_real_t pinfty = 0.01; + const cs_real_t phot = 100.0; + const cs_real_t r0 = 0.005; + + /* Loop over all cells: set uniform density and zero velocity, + * then apply a pressure discontinuity at radius r0 */ + for (cs_lnum_t c = 0; c < n_cells; c++) { + double x = cell_cen[c][0]; + double y = cell_cen[c][1]; + double r = sqrt(x*x + y*y); + + rho[c] = rho0; + vel[c][0] = 0.0; + vel[c][1] = 0.0; + vel[c][2] = 0.0; + + if (r < r0) + p[c] = phot; /* hot region: energy source */ + else + p[c] = pinfty; /* ambient: near-vacuum pressure */ + } +} + +/*----------------------------------------------------------------------------*/ + +END_C_DECLS diff --git a/16_Sedov_Blast_Wave/README.md b/16_Sedov_Blast_Wave/README.md new file mode 100644 index 0000000..5a31c7c --- /dev/null +++ b/16_Sedov_Blast_Wave/README.md @@ -0,0 +1,38 @@ +Sedov Blast Wave +================ + +2D Sedov blast wave problem solved with the compressible module of +code_saturne (constant gamma, Euler equations). + +A point-like energy release at the origin creates a cylindrical shock +wave that propagates radially. The shock radius follows the self-similar +Sedov-Taylor solution: R(t) proportional to t^(2/5) in 2D (t^(1/2) for +the cylindrical symmetry used here with a quarter-domain). + +Setup +----- + +- Compressible model: constant gamma (gamma = 1.4) +- Turbulence: off (inviscid) +- Mesh: 200 x 200 x 1 Cartesian (generated at runtime), domain [0, 0.2]^2 +- Boundary conditions: + - x0, y0: symmetry (quarter-domain exploiting axial symmetry) + - x1, y1: supersonic outlet + - z0, z1: symmetry (2D) +- Time stepping: adaptive (CFL = 1), dt_ref = 5e-5 s, t_final = 0.5 s + +Initial conditions (set in `cs_user_initialization.cpp`): + +| Region | Density | Pressure | Velocity | +|-----------|---------|----------|----------| +| r < 0.005 | 1.0 | 100.0 | 0.0 | +| r >= 0.005| 1.0 | 0.01 | 0.0 | + +Reference +--------- + +L. I. Sedov, "Similarity and Dimensional Methods in Mechanics", +Academic Press, 1959. + +G. I. Taylor, "The formation of a blast wave by a very intense explosion", +Proc. R. Soc. Lond. A, 201(1065):159-186, 1950. diff --git a/16_Sedov_Blast_Wave/smgr.xml b/16_Sedov_Blast_Wave/smgr.xml new file mode 100644 index 0000000..9deb963 --- /dev/null +++ b/16_Sedov_Blast_Wave/smgr.xml @@ -0,0 +1,7 @@ + + + + + + +