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
229 changes: 229 additions & 0 deletions 50_vof/Vof_Dam_Break/CASE/DATA/setup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
<?xml version="1.0" encoding="utf-8"?><Code_Saturne_GUI case="CASE" solver_version="9.1" study="code_saturne" version="2.0">
<additional_scalars>
<users/>
</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 id="1" name="1" status="on">
<probe_x>0.06983</probe_x>
<probe_y>0.14371</probe_y>
<probe_z>0.0073</probe_z>
</probe>
<probe id="2" name="2" status="on">
<probe_x>0.27296</probe_x>
<probe_y>0.027</probe_y>
<probe_z>0.0073</probe_z>
</probe>
<probe id="3" name="3" status="on">
<probe_x>0.307</probe_x>
<probe_y>0.06714</probe_y>
<probe_z>0.0073</probe_z>
</probe>
<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_value">0.01</frequency>
<output_at_end status="on"/>
<time_dependency choice="fixed_mesh"/>
</writer>
</output>
<profiles/>
<time_averages/>
<time_parameters>
<iterations>3000</iterations>
<property name="courant_number" label="CourantNb"/>
<property name="fourier_number" label="FourierNb"/>
<time_passing>0</time_passing>
<time_step_ref>0.00025</time_step_ref>
</time_parameters>
</analysis_control>
<boundary_conditions>
<boundary label="back" name="1" nature="symmetry">back</boundary>
<boundary label="front" name="2" nature="symmetry">front</boundary>
<boundary label="leftWall" name="3" nature="wall">leftWall</boundary>
<boundary label="lowerWall" name="4" nature="wall">lowerWall</boundary>
<boundary label="rightWall" name="5" nature="wall">rightWall</boundary>
<boundary label="atmosphere" name="6" nature="imposed_p_outlet">atmosphere</boundary>
<imposed_p_outlet label="atmosphere" field_id="none">
<dirichlet name="pressure">0</dirichlet>
</imposed_p_outlet>
<symmetry label="back" field_id="none"/>
<symmetry label="front" field_id="none"/>
<wall label="lowerWall" field_id="none">
<velocity_pressure choice="off">
<dirichlet name="velocity" component="0">0</dirichlet>
<dirichlet name="velocity" component="1">0</dirichlet>
<dirichlet name="velocity" component="2">0</dirichlet>
</velocity_pressure>
</wall>
<wall label="rightWall" field_id="none">
<velocity_pressure choice="off">
<dirichlet name="velocity" component="0">0</dirichlet>
<dirichlet name="velocity" component="1">0</dirichlet>
<dirichlet name="velocity" component="2">0</dirichlet>
</velocity_pressure>
</wall>
<wall label="leftWall" field_id="none">
<velocity_pressure choice="off">
<dirichlet name="velocity" component="0">0</dirichlet>
<dirichlet name="velocity" component="1">0</dirichlet>
<dirichlet name="velocity" component="2">0</dirichlet>
</velocity_pressure>
</wall>
</boundary_conditions>
<calculation_management>
<block_io/>
<partitioning/>
<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">
<initial_value>1.17862</initial_value>
<value_0>1000</value_0>
<value_1>1</value_1>
</property>
<property name="dynamic_diffusion" choice="constant" label="DiffDyn">
<initial_value>0.01</initial_value>
<listing_printing status="off"/>
<postprocessing_recording status="off"/>
</property>
<property name="molecular_viscosity" choice="predefined_law" label="LamVisc">
<initial_value>1.83e-05</initial_value>
<value_0>0.001</value_0>
<value_1>1.48e-05</value_1>
</property>
<property name="surface_tension" choice="constant" label="SurfTen">
<initial_value>0.07</initial_value>
<listing_printing status="off"/>
<postprocessing_recording status="off"/>
</property>
<reference_pressure>101325</reference_pressure>
<reference_temperature>293.15</reference_temperature>
</fluid_properties>
<gravity>
<gravity_x>0</gravity_x>
<gravity_y>-9.81</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_smoothing status="off"/>
<meshes_list>
<mesh name="damBreak_with_groups.med"/>
</meshes_list>
<periodicity/>
<thin_walls/>
<volumic_conditions>
<zone label="all_cells" id="1" initialization="on" physical_properties="on">all[]</zone>
<zone label="water_column" id="2" initialization="on">x &gt;= 0 and x &lt;= 0.1461 and y &gt;= 0 and y &lt;= 0.292</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="off"/>
<conjugate_heat_transfer>
<external_coupling>
<syrthes_instances/>
</external_coupling>
</conjugate_heat_transfer>
<gas_combustion model="off">
<thermodynamical_pressure status="off"/>
</gas_combustion>
<hgn_model model="no_mass_transfer">
<initialization>
<formula zone_id="2">void_fraction = 0.;</formula>
<formula zone_id="1">void_fraction = 1.;</formula>
</initialization>
<variable name="void_fraction" type="model" label="void_fraction">
<rhs_reconstruction>1</rhs_reconstruction>
</variable>
</hgn_model>
<immersed_boundaries/>
<internal_coupling>
<coupled_scalars/>
<solid_zones/>
</internal_coupling>
<porosities/>
<radiative_transfer model="off"/>
<reference_values>
<length/>
</reference_values>
<source_terms/>
<thermal_scalar model="off"/>
<turbomachinery model="off">
<joining/>
</turbomachinery>
<turbulence model="off">
<gravity_terms status="on"/>
<initialization zone_id="1" choice="reference_value"/>
<initialization zone_id="2" 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>
<formula zone_id="2">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">
<rhs_reconstruction>2</rhs_reconstruction>
</variable>
<variable name="velocity" dimension="3" label="Velocity">
<rhs_reconstruction>1</rhs_reconstruction>
</variable>
</velocity_pressure>
</thermophysical_models>
<user_functions>
<calculator/>
</user_functions>
</Code_Saturne_GUI>
111 changes: 111 additions & 0 deletions 50_vof/Vof_Dam_Break/CASE/SRC/cs_user_boundary_conditions.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#include "cs_headers.h"

/*
* Approximation of OpenFOAM pressureInletOutletVelocity
* on the boundary zone "atmosphere".
*
* GUI configuration:
* atmosphere -> Imposed P outlet
* pressure -> 0 Pa relative
*/

void
cs_user_boundary_conditions(cs_domain_t *domain,
int bc_type[])
{
CS_UNUSED(bc_type);

const cs_mesh_t *mesh = domain->mesh;

const cs_lnum_t n_b_faces = mesh->n_b_faces;
const cs_lnum_t *b_face_cells = mesh->b_face_cells;

/*
* In Code_Saturne, b_face_normal is stored as a flat array:
*
* normal[3*face_id + 0]
* normal[3*face_id + 1]
* normal[3*face_id + 2]
*/
const cs_real_t *b_face_normal
= domain->mesh_quantities->b_face_normal;

/*
* cs_boundary_zone_by_name returns a cs_zone_t.
*/
const cs_zone_t *zone
= cs_boundary_zone_by_name("atmosphere");

cs_field_t *velocity = CS_F_(vel);

cs_field_bc_coeffs_t *vel_bc = velocity->bc_coeffs;

/*
* Previous-time cell velocity.
* Stored as a flat vector array.
*/
const cs_real_t *cell_velocity = velocity->val_pre;

for (cs_lnum_t i = 0; i < zone->n_elts; i++) {

const cs_lnum_t face_id = zone->elt_ids[i];
const cs_lnum_t cell_id = b_face_cells[face_id];

const cs_real_t ux = cell_velocity[3*cell_id + 0];
const cs_real_t uy = cell_velocity[3*cell_id + 1];
const cs_real_t uz = cell_velocity[3*cell_id + 2];

const cs_real_t nx = b_face_normal[3*face_id + 0];
const cs_real_t ny = b_face_normal[3*face_id + 1];
const cs_real_t nz = b_face_normal[3*face_id + 2];

/*
* The face-normal vector includes the face area.
* Only the sign is used here.
*
* positive -> outflow
* negative -> inflow
*/
const cs_real_t normal_flux_predictor
= ux*nx + uy*ny + uz*nz;

if (normal_flux_predictor >= 0.0) {

/*
* Outflow:
* homogeneous Neumann condition on velocity.
*/
vel_bc->icodcl[face_id] = 3;

for (int component_id = 0; component_id < 3; component_id++) {

const cs_lnum_t bc_id
= component_id*n_b_faces + face_id;

vel_bc->rcodcl3[bc_id] = 0.0;
}
}
else {

/*
* Inflow:
*
* icodcl = 11:
* Neumann on the normal component and
* Dirichlet on tangential components.
*
* Zero vector means zero imposed tangential velocity.
*/
vel_bc->icodcl[face_id] = 11;

for (int component_id = 0; component_id < 3; component_id++) {

const cs_lnum_t bc_id
= component_id*n_b_faces + face_id;

vel_bc->rcodcl1[bc_id] = 0.0;
vel_bc->rcodcl3[bc_id] = 0.0;
}
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 50_vof/Vof_Dam_Break/FIGURES/t=0.25s_cs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 50_vof/Vof_Dam_Break/FIGURES/t=0.5s_cs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions 50_vof/Vof_Dam_Break/MESH/damBreak_with_groups.med
Git LFS file not shown
Loading