Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions 16_Sedov_Blast_Wave/CASE/DATA/run.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[job_defaults]

n_procs: 1
n_threads: 1

238 changes: 238 additions & 0 deletions 16_Sedov_Blast_Wave/CASE/DATA/setup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
<?xml version="1.0" encoding="utf-8"?><Code_Saturne_GUI case="CASE" solver_version="9.1" study="code_saturne" version="2.0">
<additional_scalars/>
<analysis_control>
<output>
<mesh id="-1" label="Fluid domain" type="cells">
<all_variables status="on"/>
<location>all[]</location>
<writer id="-1"/>
</mesh>
<mesh id="-2" label="Boundary" type="boundary_faces">
<all_variables status="on"/>
<location>all[]</location>
<writer id="-1"/>
</mesh>
<probe_format choice="CSV"/>
<probe_recording_frequency>1</probe_recording_frequency>
<probes_interpolation choice=""/>
<probes_snap choice=""/>
<writer id="-1" label="results">
<directory name="postprocessing"/>
<format name="ensight" options="separate_meshes"/>
<frequency period="time_step">10</frequency>
<output_at_end status="on"/>
<output_at_start status="on"/>
<time_dependency choice="fixed_mesh"/>
</writer>
</output>
<profiles/>
<scalar_balances/>
<time_averages/>
<time_parameters>
<max_courant_num>1</max_courant_num>
<maximum_time>0.5</maximum_time>
<property name="courant_number" label="CourantNb"/>
<property name="fourier_number" label="FourierNb"/>
<property name="local_time_step" label="LocalTime">
<postprocessing_recording status="off"/>
<probes choice="0"/>
</property>
<time_passing>1</time_passing>
<time_step_max_factor>10</time_step_max_factor>
<time_step_min_factor>0.1</time_step_min_factor>
<time_step_ref>5e-05</time_step_ref>
<time_step_var>0.1</time_step_var>
</time_parameters>
</analysis_control>
<boundary_conditions>
<boundary label="x0" name="1" nature="symmetry">X0</boundary>
<boundary label="x1" name="2" nature="outlet">X1</boundary>
<boundary label="y0" name="3" nature="symmetry">Y0</boundary>
<boundary label="y1" name="4" nature="outlet">Y1</boundary>
<boundary label="z0" name="5" nature="symmetry">Z0</boundary>
<boundary label="z1" name="6" nature="symmetry">Z1</boundary>
<symmetry label="x0" field_id="none"/>
<symmetry label="y0" field_id="none"/>
<outlet label="x1" field_id="none">
<compressible_type choice="supersonic_outlet"/>
<scalar name="total_energy" type="thermal" choice="neumann">
<neumann>0</neumann>
</scalar>
</outlet>
<outlet label="y1" field_id="none">
<compressible_type choice="supersonic_outlet"/>
<scalar name="total_energy" type="thermal" choice="neumann">
<neumann>0</neumann>
</scalar>
</outlet>
<symmetry label="z0" field_id="none"/>
<symmetry label="z1" field_id="none"/>
</boundary_conditions>
<calculation_management>
<start_restart>
<frozen_field status="off"/>
</start_restart>
</calculation_management>
<lagrangian model="off"/>
<numerical_parameters>
<velocity_pressure_algo choice="simplec"/>
</numerical_parameters>
<physical_properties>
<fluid_properties>
<material choice="user_material"/>
<method choice="user_properties"/>
<property name="density" choice="predefined_law" label="Density">
<formula status="on" zone_id="1">density = 1;</formula>
<initial_value>1.17862</initial_value>
</property>
<property name="dynamic_diffusion" choice="constant" label="DiffDyn">
<initial_value>0.0</initial_value>
<listing_printing status="off"/>
<postprocessing_recording status="off"/>
</property>
<property name="molecular_viscosity" choice="constant" label="LamVisc">
<initial_value>0</initial_value>
<listing_printing status="off"/>
<postprocessing_recording status="off"/>
</property>
<property name="specific_heat" choice="constant" label="SpecHeat">
<initial_value>1005</initial_value>
<listing_printing status="off"/>
<postprocessing_recording status="off"/>
</property>
<property name="thermal_conductivity" choice="constant" label="ThermalCond">
<initial_value>0</initial_value>
<listing_printing status="off"/>
<postprocessing_recording status="off"/>
</property>
<property name="volume_viscosity" choice="constant" label="VolVisc">
<initial_value>0</initial_value>
<listing_printing status="off"/>
<postprocessing_recording status="off"/>
</property>
<reference_molar_mass>0.028966</reference_molar_mass>
<reference_pressure>101325</reference_pressure>
<reference_temperature>0.00348310693138</reference_temperature>
</fluid_properties>
<gravity>
<gravity_x>0</gravity_x>
<gravity_y>0</gravity_y>
<gravity_z>0</gravity_z>
</gravity>
<notebook/>
<omega>
<omega_x>0</omega_x>
<omega_y>0</omega_y>
<omega_z>0</omega_z>
</omega>
<time_tables/>
</physical_properties>
<solution_domain>
<extrusion/>
<faces_cutting status="off"/>
<joining/>
<mesh_cartesian>
<x_direction ncells="200" min="0.0" max="0.2" prog="1.0" law="constant"/>
<y_direction ncells="200" min="0.0" max="0.2" prog="1.0" law="constant"/>
<z_direction ncells="1" min="0.0" max="0.2" prog="1.0" law="constant"/>
</mesh_cartesian>
<mesh_origin choice="mesh_cartesian"/>
<mesh_smoothing status="off"/>
<meshes_list/>
<periodicity/>
<thin_walls/>
<volumic_conditions>
<zone label="all_cells" id="1" initialization="on" physical_properties="on">all[]</zone>
</volumic_conditions>
</solution_domain>
<thermophysical_models>
<ale_method/>
<atmospheric_flows model="off">
<large_scale_meteo status="off"/>
<read_meteo_data status="off"/>
</atmospheric_flows>
<compressible_model model="constant_gamma">
<variable name="temperature" type="model" label="temperature">
<boundary_diffusion_flux_reconstruction mode="off"/>
<formula status="off" zone_id="1"/>
<rhs_reconstruction>1</rhs_reconstruction>
</variable>
</compressible_model>
<conjugate_heat_transfer>
<external_coupling>
<syrthes_instances/>
</external_coupling>
</conjugate_heat_transfer>
<gas_combustion model="off">
<soot_model model="off"/>
<thermodynamical_pressure status="off"/>
</gas_combustion>
<immersed_boundaries/>
<internal_coupling>
<coupled_scalars/>
<solid_zones/>
</internal_coupling>
<interparticles_radiative_transfer>
<emissivity>1.0</emissivity>
<status>off</status>
</interparticles_radiative_transfer>
<porosities/>
<radiative_transfer model="off">
<absorption_coefficient type="constant">0</absorption_coefficient>
<restart status="on"/>
</radiative_transfer>
<reference_values>
<length/>
</reference_values>
<source_terms/>
<thermal_scalar model="total_energy">
<property name="boundary_temperature" support="boundary" label="Boundary temperature"/>
<property name="thermal_flux" support="boundary" label="Thermal flux"/>
<variable name="total_energy" type="thermal" label="TotEner">
<boundary_diffusion_flux_reconstruction mode="off"/>
<formula status="off" zone_id="1"/>
<max_value>1e+12</max_value>
<min_value>-1e+12</min_value>
<rhs_reconstruction>1</rhs_reconstruction>
<turbulent_flux_model>SGDH</turbulent_flux_model>
</variable>
</thermal_scalar>
<turbomachinery model="off">
<joining/>
</turbomachinery>
<turbulence model="off">
<gravity_terms status="on"/>
<initialization zone_id="1" choice="reference_value"/>
<reference_velocity>1</reference_velocity>
<wall_function>0</wall_function>
</turbulence>
<velocity_pressure>
<initialization>
<formula zone_id="1">velocity[0] = 0.;
velocity[1] = 0.;
velocity[2] = 0.;</formula>
</initialization>
<property name="stress" label="Stress" support="boundary"/>
<property name="stress_normal" label="Stress, normal" support="boundary">
<postprocessing_recording status="off"/>
</property>
<property name="stress_tangential" label="Stress, tangential" support="boundary">
<postprocessing_recording status="off"/>
</property>
<property name="total_pressure" label="total_pressure"/>
<property name="yplus" label="Yplus" support="boundary"/>
<variable name="pressure" label="Pressure">
<boundary_diffusion_flux_reconstruction mode="off"/>
<formula status="on" zone_id="1">pressure = 1;</formula>
<rhs_reconstruction>2</rhs_reconstruction>
</variable>
<variable name="velocity" dimension="3" label="Velocity">
<boundary_diffusion_flux_reconstruction mode="off"/>
<rhs_reconstruction>1</rhs_reconstruction>
</variable>
</velocity_pressure>
</thermophysical_models>
<user_functions>
<calculator/>
</user_functions>
</Code_Saturne_GUI>
130 changes: 130 additions & 0 deletions 16_Sedov_Blast_Wave/CASE/SRC/cs_user_initialization.cpp
Original file line number Diff line number Diff line change
@@ -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 <assert.h>
#include <math.h>

#if defined(HAVE_MPI)
#include <mpi.h>
#endif

/*----------------------------------------------------------------------------
* PLE library headers
*----------------------------------------------------------------------------*/

#include <ple_coupling.h>

/*----------------------------------------------------------------------------
* 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
Loading