diff --git a/src/shared/particle_dynamics/fluid_dynamics/fluid_dynamics_inner.cpp b/src/shared/particle_dynamics/fluid_dynamics/fluid_dynamics_inner.cpp index db6c606b90..39361f263e 100644 --- a/src/shared/particle_dynamics/fluid_dynamics/fluid_dynamics_inner.cpp +++ b/src/shared/particle_dynamics/fluid_dynamics/fluid_dynamics_inner.cpp @@ -77,11 +77,11 @@ Real AcousticTimeStepSize::outputResult(Real reduced_value) } //=================================================================================================// AdvectionTimeStepSizeForImplicitViscosity:: - AdvectionTimeStepSizeForImplicitViscosity(SPHBody &sph_body, Real U_max, Real advectionCFL) - : LocalDynamicsReduce(sph_body, U_max * U_max), + AdvectionTimeStepSizeForImplicitViscosity(SPHBody &sph_body, Real U_ref, Real advectionCFL) + : LocalDynamicsReduce(sph_body, Real(0)), FluidDataSimple(sph_body), vel_(particles_->vel_), smoothing_length_min_(sph_body.sph_adaptation_->MinimumSmoothingLength()), - advectionCFL_(advectionCFL) {} + speed_ref_(U_ref), advectionCFL_(advectionCFL) {} //=================================================================================================// Real AdvectionTimeStepSizeForImplicitViscosity::reduce(size_t index_i, Real dt) { @@ -91,15 +91,15 @@ Real AdvectionTimeStepSizeForImplicitViscosity::reduce(size_t index_i, Real dt) Real AdvectionTimeStepSizeForImplicitViscosity::outputResult(Real reduced_value) { Real speed_max = sqrt(reduced_value); - return advectionCFL_ * smoothing_length_min_ / (speed_max + TinyReal); + return advectionCFL_ * smoothing_length_min_ / (SMAX(speed_max, speed_ref_) + TinyReal); } //=================================================================================================// -AdvectionTimeStepSize::AdvectionTimeStepSize(SPHBody &sph_body, Real U_max, Real advectionCFL) - : AdvectionTimeStepSizeForImplicitViscosity(sph_body, U_max, advectionCFL), +AdvectionTimeStepSize::AdvectionTimeStepSize(SPHBody &sph_body, Real U_ref, Real advectionCFL) + : AdvectionTimeStepSizeForImplicitViscosity(sph_body, U_ref, advectionCFL), fluid_(DynamicCast(this, particles_->getBaseMaterial())) { Real viscous_speed = fluid_.ReferenceViscosity() / fluid_.ReferenceDensity() / smoothing_length_min_; - reference_ = SMAX(viscous_speed * viscous_speed, reference_); + speed_ref_ = SMAX(viscous_speed, speed_ref_); } //=================================================================================================// Real AdvectionTimeStepSize::reduce(size_t index_i, Real dt) diff --git a/src/shared/particle_dynamics/fluid_dynamics/fluid_dynamics_inner.h b/src/shared/particle_dynamics/fluid_dynamics/fluid_dynamics_inner.h index 523af73190..aa7f480b26 100644 --- a/src/shared/particle_dynamics/fluid_dynamics/fluid_dynamics_inner.h +++ b/src/shared/particle_dynamics/fluid_dynamics/fluid_dynamics_inner.h @@ -234,7 +234,7 @@ class AdvectionTimeStepSizeForImplicitViscosity { public: explicit AdvectionTimeStepSizeForImplicitViscosity( - SPHBody &sph_body, Real U_max, Real advectionCFL = 0.25); + SPHBody &sph_body, Real U_ref, Real advectionCFL = 0.25); virtual ~AdvectionTimeStepSizeForImplicitViscosity(){}; Real reduce(size_t index_i, Real dt = 0.0); virtual Real outputResult(Real reduced_value) override; @@ -242,7 +242,7 @@ class AdvectionTimeStepSizeForImplicitViscosity protected: StdLargeVec &vel_; Real smoothing_length_min_; - Real advectionCFL_; + Real speed_ref_, advectionCFL_; }; /** @@ -252,7 +252,7 @@ class AdvectionTimeStepSizeForImplicitViscosity class AdvectionTimeStepSize : public AdvectionTimeStepSizeForImplicitViscosity { public: - explicit AdvectionTimeStepSize(SPHBody &sph_body, Real U_max, Real advectionCFL = 0.25); + explicit AdvectionTimeStepSize(SPHBody &sph_body, Real U_ref, Real advectionCFL = 0.25); virtual ~AdvectionTimeStepSize(){}; Real reduce(size_t index_i, Real dt = 0.0); diff --git a/tests/2d_examples/test_2d_dambreak/Dambreak.cpp b/tests/2d_examples/test_2d_dambreak/Dambreak.cpp index f76989a8ee..0216990747 100644 --- a/tests/2d_examples/test_2d_dambreak/Dambreak.cpp +++ b/tests/2d_examples/test_2d_dambreak/Dambreak.cpp @@ -21,8 +21,8 @@ Real BW = particle_spacing_ref * 4; /**< Thickness of tank wall. */ //---------------------------------------------------------------------- Real rho0_f = 1.0; /**< Reference density of fluid. */ Real gravity_g = 1.0; /**< Gravity. */ -Real U_max = 2.0 * sqrt(gravity_g * LH); /**< Characteristic velocity. */ -Real c_f = 10.0 * U_max; /**< Reference sound speed. */ +Real U_ref = 2.0 * sqrt(gravity_g * LH); /**< Characteristic velocity. */ +Real c_f = 10.0 * U_ref; /**< Reference sound speed. */ //---------------------------------------------------------------------- // Geometric shapes used in this case. //---------------------------------------------------------------------- @@ -91,7 +91,7 @@ int main(int ac, char *av[]) SimpleDynamics wall_boundary_normal_direction(wall_boundary); SharedPtr gravity_ptr = makeShared(Vecd(0.0, -gravity_g)); SimpleDynamics fluid_step_initialization(water_block, gravity_ptr); - ReduceDynamics fluid_advection_time_step(water_block, U_max); + ReduceDynamics fluid_advection_time_step(water_block, U_ref); ReduceDynamics fluid_acoustic_time_step(water_block); //---------------------------------------------------------------------- // Define the methods for I/O operations, observations diff --git a/tests/2d_examples/test_2d_dambreak_multi_resolution/dambreak_multi_resolution.cpp b/tests/2d_examples/test_2d_dambreak_multi_resolution/dambreak_multi_resolution.cpp index 518c841d99..14f944f2d0 100644 --- a/tests/2d_examples/test_2d_dambreak_multi_resolution/dambreak_multi_resolution.cpp +++ b/tests/2d_examples/test_2d_dambreak_multi_resolution/dambreak_multi_resolution.cpp @@ -31,8 +31,8 @@ StdVec observation_location = {Vecd(DL, 0.2)}; */ Real rho0_f = 1.0; /**< Reference density of fluid. */ Real gravity_g = 1.0; /**< Gravity force of fluid. */ -Real U_max = 2.0 * sqrt(gravity_g * LH); /**< Characteristic velocity. */ -Real c_f = 10.0 * U_max; /**< Reference sound speed. */ +Real U_ref = 2.0 * sqrt(gravity_g * LH); /**< Characteristic velocity. */ +Real c_f = 10.0 * U_ref; /**< Reference sound speed. */ //---------------------------------------------------------------------- // Geometric shapes used in this case. //---------------------------------------------------------------------- @@ -123,7 +123,7 @@ int main(int ac, char *av[]) SimpleDynamics wall_boundary_normal_direction(wall_boundary); SharedPtr gravity_ptr = makeShared(Vecd(0.0, -gravity_g)); SimpleDynamics fluid_step_initialization(water_block, gravity_ptr); - ReduceDynamics fluid_advection_time_step(water_block, U_max); + ReduceDynamics fluid_advection_time_step(water_block, U_ref); ReduceDynamics fluid_acoustic_time_step(water_block); //---------------------------------------------------------------------- diff --git a/tests/2d_examples/test_2d_dambreak_python/dambreak_python.cpp b/tests/2d_examples/test_2d_dambreak_python/dambreak_python.cpp index 4419a0d6ca..99ca1f275a 100644 --- a/tests/2d_examples/test_2d_dambreak_python/dambreak_python.cpp +++ b/tests/2d_examples/test_2d_dambreak_python/dambreak_python.cpp @@ -26,8 +26,8 @@ class Parameter //---------------------------------------------------------------------- Real rho0_f = 1.0; /**< Reference density of fluid. */ Real gravity_g = 1.0; /**< Gravity. */ - Real U_max = 2.0 * sqrt(gravity_g * LH); /**< Characteristic velocity. */ - Real c_f = 10.0 * U_max; /**< Reference sound speed. */ + Real U_ref = 2.0 * sqrt(gravity_g * LH); /**< Characteristic velocity. */ + Real c_f = 10.0 * U_ref; /**< Reference sound speed. */ //---------------------------------------------------------------------- // Geometric shapes used in this case. //---------------------------------------------------------------------- @@ -150,7 +150,7 @@ class Environment : public PreSettingCase wall_boundary_normal_direction(wall_boundary), gravity_ptr(makeShared(Vecd(0.0, -gravity_g))), fluid_step_initialization(water_block, gravity_ptr), - fluid_advection_time_step(water_block, U_max), + fluid_advection_time_step(water_block, U_ref), fluid_acoustic_time_step(water_block), body_states_recording(io_environment, sph_system.real_bodies_), restart_io(io_environment, sph_system.real_bodies_), diff --git a/tests/2d_examples/test_2d_hydrostatic_fsi/hydrostatic_fsi.cpp b/tests/2d_examples/test_2d_hydrostatic_fsi/hydrostatic_fsi.cpp index 782fc27f74..d66a2d277c 100644 --- a/tests/2d_examples/test_2d_hydrostatic_fsi/hydrostatic_fsi.cpp +++ b/tests/2d_examples/test_2d_hydrostatic_fsi/hydrostatic_fsi.cpp @@ -51,11 +51,11 @@ StdVec observation_location = {Vecd(0.5 * Dam_L, -0.5 * Gate_width)}; //---------------------------------------------------------------------- Real rho0_f = 1000.0; /**< Reference density of fluid. */ Real gravity_g = 9.81; /**< Value of gravity. */ -Real U_max = 2.0 * sqrt(Dam_H * gravity_g); +Real U_ref = 2.0 * sqrt(Dam_H * gravity_g); ; /**< Characteristic velocity. */ -Real c_f = 10.0 * U_max; /**< Reference sound speed. */ +Real c_f = 10.0 * U_ref; /**< Reference sound speed. */ Real Re = 0.1; /**< Reynolds number. */ -Real mu_f = rho0_f * U_max * DL / Re; /**< Dynamics viscosity. */ +Real mu_f = rho0_f * U_ref * DL / Re; /**< Dynamics viscosity. */ //---------------------------------------------------------------------- // Material properties of the elastic gate. //---------------------------------------------------------------------- @@ -235,7 +235,7 @@ int main() /** Evaluation of fluid density by summation approach. */ InteractionWithUpdate update_fluid_density(water_block_complex); /** Compute time step size without considering sound wave speed. */ - ReduceDynamics get_fluid_advection_time_step_size(water_block, U_max); + ReduceDynamics get_fluid_advection_time_step_size(water_block, U_ref); /** Compute time step size with considering sound wave speed. */ ReduceDynamics get_fluid_time_step_size(water_block); /** Pressure relaxation using verlet time stepping. */ diff --git a/tests/2d_examples/test_2d_square_droplet/src/droplet.cpp b/tests/2d_examples/test_2d_square_droplet/src/droplet.cpp index 97a5bd1a53..a9bd392757 100644 --- a/tests/2d_examples/test_2d_square_droplet/src/droplet.cpp +++ b/tests/2d_examples/test_2d_square_droplet/src/droplet.cpp @@ -21,8 +21,8 @@ Real BW = particle_spacing_ref * 2; /**< Extending width for BCs. */ //---------------------------------------------------------------------- Real rho0_f = 1.0; /**< Reference density of water. */ Real rho0_a = 0.001; /**< Reference density of air. */ -Real U_max = 1.0; /**< Characteristic velocity. */ -Real c_f = 10.0 * U_max; /**< Reference sound speed. */ +Real U_ref = 1.0; /**< Characteristic velocity. */ +Real c_f = 10.0 * U_ref; /**< Reference sound speed. */ Real mu_f = 0.2; /**< Water viscosity. */ Real mu_a = 0.002; /**< Air viscosity. */ //---------------------------------------------------------------------- @@ -149,8 +149,8 @@ int main() InteractionDynamics air_transport_correction(air_wall_contact, air_water_complex, 0.05); /** Time step size without considering sound wave speed. */ - ReduceDynamics get_water_advection_time_step_size(water_block, U_max); - ReduceDynamics get_air_advection_time_step_size(air_block, U_max); + ReduceDynamics get_water_advection_time_step_size(water_block, U_ref); + ReduceDynamics get_air_advection_time_step_size(air_block, U_ref); /** Time step size with considering sound wave speed. */ ReduceDynamics get_water_time_step_size(water_block); ReduceDynamics get_air_time_step_size(air_block); diff --git a/tests/2d_examples/test_2d_standing_wave/standing_wave.cpp b/tests/2d_examples/test_2d_standing_wave/standing_wave.cpp index 961f228e9e..a21c24331a 100644 --- a/tests/2d_examples/test_2d_standing_wave/standing_wave.cpp +++ b/tests/2d_examples/test_2d_standing_wave/standing_wave.cpp @@ -21,8 +21,8 @@ BoundingBox system_domain_bounds(Vec2d(-BW, -BW), Vec2d(DL + BW, DH + BW)); //---------------------------------------------------------------------- Real rho0_f = 1000.0; /**< Reference density of fluid. */ Real gravity_g = 9.81; /**< Gravity force of fluid. */ -Real U_max = 2.0 * sqrt(gravity_g * LH); /**< Characteristic velocity. */ -Real c_f = 10.0 * U_max; /**< Reference sound speed. */ +Real U_ref = 2.0 * sqrt(gravity_g * LH); /**< Characteristic velocity. */ +Real c_f = 10.0 * U_ref; /**< Reference sound speed. */ //---------------------------------------------------------------------- // Geometric shapes used in this case. //---------------------------------------------------------------------- @@ -198,7 +198,7 @@ int main(int ac, char *av[]) SimpleDynamics wall_boundary_normal_direction(wall_boundary); SharedPtr gravity_ptr = makeShared(Vecd(0.0, -gravity_g)); SimpleDynamics fluid_step_initialization(water_block, gravity_ptr); - ReduceDynamics fluid_advection_time_step(water_block, U_max); + ReduceDynamics fluid_advection_time_step(water_block, U_ref); ReduceDynamics fluid_acoustic_time_step(water_block); /** We can output a method-specific particle data for debug */ water_block.addBodyStateForRecording("Pressure"); diff --git a/tests/2d_examples/test_2d_static_confinement/static_confinement.cpp b/tests/2d_examples/test_2d_static_confinement/static_confinement.cpp index 8acc7c73d6..4ff77a2802 100644 --- a/tests/2d_examples/test_2d_static_confinement/static_confinement.cpp +++ b/tests/2d_examples/test_2d_static_confinement/static_confinement.cpp @@ -22,8 +22,8 @@ StdVec observation_location = {Vecd(DL, 0.2)}; //---------------------------------------------------------------------- Real rho0_f = 1.0; /**< Reference density of fluid. */ Real gravity_g = 1.0; /**< Gravity force of fluid. */ -Real U_max = 2.0 * sqrt(gravity_g * LH); /**< Characteristic velocity. */ -Real c_f = 10.0 * U_max; /**< Reference sound speed. */ +Real U_ref = 2.0 * sqrt(gravity_g * LH); /**< Characteristic velocity. */ +Real c_f = 10.0 * U_ref; /**< Reference sound speed. */ //---------------------------------------------------------------------- // Geometric shapes used in this case. //---------------------------------------------------------------------- @@ -134,7 +134,7 @@ int main(int ac, char *av[]) /** Evaluation of density by summation approach. */ InteractionWithUpdate update_density_by_summation(water_block_inner); /** Time step size without considering sound wave speed. */ - ReduceDynamics get_fluid_advection_time_step_size(water_block, U_max); + ReduceDynamics get_fluid_advection_time_step_size(water_block, U_ref); /** Time step size with considering sound wave speed. */ ReduceDynamics get_fluid_time_step_size(water_block); /** Pressure relaxation algorithm by using position verlet time stepping. */ diff --git a/tests/2d_examples/test_2d_two_phase_dambreak/two_phase_dambreak.cpp b/tests/2d_examples/test_2d_two_phase_dambreak/two_phase_dambreak.cpp index 90902329cc..027f5b77a4 100644 --- a/tests/2d_examples/test_2d_two_phase_dambreak/two_phase_dambreak.cpp +++ b/tests/2d_examples/test_2d_two_phase_dambreak/two_phase_dambreak.cpp @@ -63,8 +63,8 @@ int main() InteractionDynamics air_transport_correction(air_wall_contact, air_water_complex); /** Time step size without considering sound wave speed. */ - ReduceDynamics get_water_advection_time_step_size(water_block, U_max); - ReduceDynamics get_air_advection_time_step_size(air_block, U_max); + ReduceDynamics get_water_advection_time_step_size(water_block, U_ref); + ReduceDynamics get_air_advection_time_step_size(air_block, U_ref); /** Time step size with considering sound wave speed. */ ReduceDynamics get_water_time_step_size(water_block); ReduceDynamics get_air_time_step_size(air_block); diff --git a/tests/2d_examples/test_2d_two_phase_dambreak/two_phase_dambreak.h b/tests/2d_examples/test_2d_two_phase_dambreak/two_phase_dambreak.h index 92f43766c2..b8e74e3f54 100644 --- a/tests/2d_examples/test_2d_two_phase_dambreak/two_phase_dambreak.h +++ b/tests/2d_examples/test_2d_two_phase_dambreak/two_phase_dambreak.h @@ -24,8 +24,8 @@ StdVec observation_location = {Vecd(DL, 0.2)}; Real rho0_f = 1.0; /**< Reference density of water. */ Real rho0_a = 0.001; /**< Reference density of air. */ Real gravity_g = 1.0; /**< Gravity force of fluid. */ -Real U_max = 2.0 * sqrt(gravity_g * LH); /**< Characteristic velocity. */ -Real c_f = 10.0 * U_max; /**< Reference sound speed. */ +Real U_ref = 2.0 * sqrt(gravity_g * LH); /**< Characteristic velocity. */ +Real c_f = 10.0 * U_ref; /**< Reference sound speed. */ //---------------------------------------------------------------------- // Geometric elements used in shape modeling. //---------------------------------------------------------------------- diff --git a/tests/2d_examples/test_2d_wetting_effects/src/wetting.cpp b/tests/2d_examples/test_2d_wetting_effects/src/wetting.cpp index f243dca35f..4327321db1 100644 --- a/tests/2d_examples/test_2d_wetting_effects/src/wetting.cpp +++ b/tests/2d_examples/test_2d_wetting_effects/src/wetting.cpp @@ -57,8 +57,8 @@ int main() InteractionDynamics air_transport_correction(air_wall_contact, air_water_complex, 0.05); /** Time step size without considering sound wave speed. */ - ReduceDynamics get_water_advection_time_step_size(water_block, U_max); - ReduceDynamics get_air_advection_time_step_size(air_block, U_max); + ReduceDynamics get_water_advection_time_step_size(water_block, U_ref); + ReduceDynamics get_air_advection_time_step_size(air_block, U_ref); /** Time step size with considering sound wave speed. */ ReduceDynamics get_water_time_step_size(water_block); ReduceDynamics get_air_time_step_size(air_block); diff --git a/tests/2d_examples/test_2d_wetting_effects/src/wetting.h b/tests/2d_examples/test_2d_wetting_effects/src/wetting.h index d867067f96..3d865613b0 100644 --- a/tests/2d_examples/test_2d_wetting_effects/src/wetting.h +++ b/tests/2d_examples/test_2d_wetting_effects/src/wetting.h @@ -19,8 +19,8 @@ BoundingBox system_domain_bounds(Vec2d(-BW, -BW), Vec2d(DL + BW, DH + BW)); //---------------------------------------------------------------------- Real rho0_f = 1.0; /**< Reference density of water. */ Real rho0_a = 1.0e-3; /**< Reference density of air. */ -Real U_max = 1.0; /**< Characteristic velocity. */ -Real c_f = 10.0 * U_max; /**< Reference sound speed. */ +Real U_ref = 1.0; /**< Characteristic velocity. */ +Real c_f = 10.0 * U_ref; /**< Reference sound speed. */ Real mu_f = 5.0e-2; /**< Water viscosity. */ Real mu_a = 5.0e-4; /**< Air viscosity. */ Real contact_angle = (150.0 / 180.0) * 3.1415926; /**< Contact angle with Wall. */ diff --git a/tests/user_examples/test_2d_oscillating_beam_UL/oscillating_beam_UL.cpp b/tests/user_examples/test_2d_oscillating_beam_UL/oscillating_beam_UL.cpp index e8c5f26b96..31bccffeac 100644 --- a/tests/user_examples/test_2d_oscillating_beam_UL/oscillating_beam_UL.cpp +++ b/tests/user_examples/test_2d_oscillating_beam_UL/oscillating_beam_UL.cpp @@ -39,7 +39,7 @@ Real Q = 2.0 * (cos(kl) * sinh(kl) - sin(kl) * cosh(kl)); Real vf = 0.05; Real R = PL / (0.5 * Pi); //for dual time-step -Real U_max = vf * c0 * (M * (cos(kl) - cosh(kl)) - N * (sin(kl) - sinh(kl))) / Q; +Real U_ref = vf * c0 * (M * (cos(kl) - cosh(kl)) - N * (sin(kl) - sinh(kl))) / Q; //---------------------------------------------------------------------- // Geometric shapes used in the system. //---------------------------------------------------------------------- @@ -145,7 +145,7 @@ int main(int ac, char* av[]) InteractionWithUpdate correcttion_matrix(beam_body_inner); Dynamics1Level beam_shear_stress_relaxation(beam_body_inner); //for dula timestep - ReduceDynamics fluid_advection_time_step(beam_body, U_max, 0.2); + ReduceDynamics fluid_advection_time_step(beam_body, U_ref, 0.2); ReduceDynamics fluid_acoustic_time_step(beam_body, 0.4); // clamping a solid body part. BodyRegionByParticle beam_base(beam_body, makeShared(createBeamConstrainShape())); diff --git a/tests/user_examples/test_3d_oscillating_plate_UL/oscillating_plate_UL.cpp b/tests/user_examples/test_3d_oscillating_plate_UL/oscillating_plate_UL.cpp index ca484f76cc..96bf120ffd 100644 --- a/tests/user_examples/test_3d_oscillating_plate_UL/oscillating_plate_UL.cpp +++ b/tests/user_examples/test_3d_oscillating_plate_UL/oscillating_plate_UL.cpp @@ -33,7 +33,7 @@ Real gravity_g = 0.0; Real governing_vibration_integer_x = 2.0; Real governing_vibration_integer_y = 2.0; -Real U_max = 1.0; //Maximum velocity +Real U_ref = 1.0; //Maximum velocity /** Define application dependent particle generator for thin structure. */ class PlateParticleGenerator : public ParticleGenerator { @@ -135,7 +135,7 @@ int main() */ SimpleDynamics initial_velocity(plate_body); /** Time step size calculation. */ - ReduceDynamics fluid_advection_time_step(plate_body, U_max, 0.2); + ReduceDynamics fluid_advection_time_step(plate_body, U_ref, 0.2); ReduceDynamics fluid_acoustic_time_step(plate_body, 0.4); /** stress relaxation. */ Dynamics1Level plate_pressure_relaxation(plate_body_inner);