-
Notifications
You must be signed in to change notification settings - Fork 34
[GSPH] Disc physics in GSPH #1957
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
Draft
y-lapeyre
wants to merge
10
commits into
Shamrock-code:main
Choose a base branch
from
y-lapeyre:gsph/disc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f2121be
everything except sink update
y-lapeyre a079ee1
sink update ok for single sink
y-lapeyre b8165c0
add sink-sink cfl condition
y-lapeyre 07b76d7
Merge branch 'main' into gsph/disc
y-lapeyre f516846
author update
y-lapeyre 928ffbf
minor fixes
y-lapeyre 32f873f
add sinks to json header
y-lapeyre 5ac9143
abort the merge
y-lapeyre 3e94095
Merge branch 'main' into gsph/disc
y-lapeyre c44b51e
Merge branch 'main' into gsph/disc
y-lapeyre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/shammodels/gsph/include/shammodels/gsph/modules/ExternalForces.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| // -------------------------------------------------------// | ||
| // | ||
| // SHAMROCK code for hydrodynamics | ||
| // Copyright (c) 2021-2026 Timothée David--Cléris <[email protected]> | ||
| // SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1 | ||
| // Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information | ||
| // | ||
| // -------------------------------------------------------// | ||
|
|
||
| #pragma once | ||
|
|
||
| /** | ||
| * @file ExternalForces.hpp | ||
| * @author Timothée David--Cléris ([email protected]) | ||
| * @author Yona Lapeyre ([email protected]) | ||
| * @brief | ||
| * | ||
| */ | ||
|
|
||
| #include "shambackends/typeAliasVec.hpp" | ||
| #include "shambackends/vec.hpp" | ||
| #include "shammodels/gsph/SolverConfig.hpp" | ||
| #include "shammodels/gsph/modules/SolverStorage.hpp" | ||
| #include "shamrock/scheduler/ShamrockCtx.hpp" | ||
|
|
||
| namespace shammodels::gsph::modules { | ||
|
|
||
| template<class Tvec, template<class> class SPHKernel> | ||
| class ExternalForces { | ||
| public: | ||
| using Tscal = shambase::VecComponent<Tvec>; | ||
| static constexpr u32 dim = shambase::VectorProperties<Tvec>::dimension; | ||
| using Kernel = SPHKernel<Tscal>; | ||
|
|
||
| using Config = SolverConfig<Tvec, SPHKernel>; | ||
| using Storage = SolverStorage<Tvec, u32>; | ||
|
|
||
| ShamrockCtx &context; | ||
| Config &solver_config; | ||
| Storage &storage; | ||
|
|
||
| ExternalForces(ShamrockCtx &context, Config &solver_config, Storage &storage) | ||
| : context(context), solver_config(solver_config), storage(storage) {} | ||
|
|
||
| /** | ||
| * @brief is ran once per timestep, it computes the forces that are independant of velocity | ||
| * | ||
| */ | ||
| void compute_ext_forces_indep_v(); | ||
|
|
||
| /** | ||
| * @brief add external forces to the particle acceleration, note that forces dependant on | ||
| * velocity shlould be added here | ||
| * | ||
| */ | ||
| void add_ext_forces(); | ||
|
|
||
| void point_mass_accrete_particles(); | ||
|
|
||
| private: | ||
| using SolverConfigExtForce = typename Config::ExtForceConfig; | ||
| using EF_PointMass = typename SolverConfigExtForce::PointMass; | ||
|
|
||
| inline PatchScheduler &scheduler() { return shambase::get_check_ref(context.sched); } | ||
| }; | ||
|
|
||
| } // namespace shammodels::gsph::modules |
89 changes: 89 additions & 0 deletions
89
src/shammodels/gsph/include/shammodels/gsph/modules/GSPHSetup.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| // -------------------------------------------------------// | ||
| // | ||
| // SHAMROCK code for hydrodynamics | ||
| // Copyright (c) 2021-2026 Timothée David--Cléris <[email protected]> | ||
| // SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1 | ||
| // Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information | ||
| // | ||
| // -------------------------------------------------------// | ||
|
|
||
| #pragma once | ||
|
|
||
| /** | ||
| * @file GSPHSetup.hpp | ||
| * @author Yona Lapeyre ([email protected]) | ||
| * @brief | ||
| * | ||
| */ | ||
|
|
||
| #include "shambackends/typeAliasVec.hpp" | ||
| #include "shambackends/vec.hpp" | ||
| #include "shammodels/gsph/SolverConfig.hpp" | ||
| #include "shammodels/gsph/modules/SolverStorage.hpp" | ||
| #include "shammodels/gsph/modules/setup/IGSPHSetupNode.hpp" | ||
| #include "shamrock/scheduler/ShamrockCtx.hpp" | ||
| #include <memory> | ||
|
|
||
| namespace shammodels::gsph::modules { | ||
|
|
||
| template<class Tvec, template<class> class SPHKernel> | ||
| class GSPHSetup { | ||
| public: | ||
| using Tscal = shambase::VecComponent<Tvec>; | ||
| static constexpr u32 dim = shambase::VectorProperties<Tvec>::dimension; | ||
| using Kernel = SPHKernel<Tscal>; | ||
|
|
||
| using Config = SolverConfig<Tvec, SPHKernel>; | ||
| using Storage = SolverStorage<Tvec, u32>; | ||
|
|
||
| ShamrockCtx &context; | ||
| Config &solver_config; | ||
| Storage &storage; | ||
|
|
||
| GSPHSetup(ShamrockCtx &context, Config &solver_config, Storage &storage) | ||
| : context(context), solver_config(solver_config), storage(storage) {} | ||
|
|
||
| void apply_setup(SetupNodePtr setup, std::optional<u32> insert_step = std::nullopt); | ||
|
|
||
| std::shared_ptr<IGSPHSetupNode> make_generator_disc_mc( | ||
| Tscal part_mass, | ||
| Tscal disc_mass, | ||
| Tscal r_in, | ||
| Tscal r_out, | ||
| std::function<Tscal(Tscal)> sigma_profile, | ||
| std::function<Tscal(Tscal)> H_profile, | ||
| std::function<Tvec(Tvec)> vel_profile, | ||
| std::function<Tscal(Tvec)> cs_profile, | ||
| std::mt19937_64 eng, | ||
| Tscal init_h_factor); | ||
|
|
||
| std::shared_ptr<IGSPHSetupNode> make_generator_from_context(ShamrockCtx &context_other); | ||
|
|
||
| std::shared_ptr<IGSPHSetupNode> make_combiner_add( | ||
| SetupNodePtr parent1, SetupNodePtr parent2); | ||
|
|
||
| std::shared_ptr<IGSPHSetupNode> make_modifier_warp_disc( | ||
| SetupNodePtr parent, Tscal Rwarp, Tscal Hwarp, Tscal inclination, Tscal posangle); | ||
|
|
||
| std::shared_ptr<IGSPHSetupNode> make_modifier_custom_warp( | ||
| SetupNodePtr parent, | ||
| std::function<Tscal(Tscal)> inc_profile, | ||
| std::function<Tscal(Tscal)> psi_profile, | ||
| std::function<Tvec(Tscal)> k_profile); | ||
|
|
||
| std::shared_ptr<IGSPHSetupNode> make_modifier_add_offset( | ||
| SetupNodePtr parent, Tvec offset_postion, Tvec offset_velocity); | ||
|
|
||
| std::shared_ptr<IGSPHSetupNode> make_modifier_filter( | ||
| SetupNodePtr parent, std::function<bool(Tvec)> filter); | ||
|
|
||
| std::shared_ptr<IGSPHSetupNode> make_modifier_split_part( | ||
| SetupNodePtr parent, u64 n_split, u64 seed, Tscal h_scaling); | ||
|
y-lapeyre marked this conversation as resolved.
|
||
|
|
||
| private: | ||
| inline PatchScheduler &scheduler() { return shambase::get_check_ref(context.sched); } | ||
|
|
||
| u64 injected_parts = 0; | ||
| }; | ||
|
|
||
| } // namespace shammodels::gsph::modules | ||
57 changes: 57 additions & 0 deletions
57
src/shammodels/gsph/include/shammodels/gsph/modules/SinkParticlesUpdate.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| // -------------------------------------------------------// | ||
| // | ||
| // SHAMROCK code for hydrodynamics | ||
| // Copyright (c) 2021-2026 Timothée David--Cléris <[email protected]> | ||
| // SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1 | ||
| // Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information | ||
| // | ||
| // -------------------------------------------------------// | ||
|
|
||
| #pragma once | ||
|
|
||
| /** | ||
| * @file SinkParticlesUpdate.hpp | ||
| * @author Timothée David--Cléris ([email protected]) | ||
| * @brief | ||
| * | ||
| */ | ||
|
|
||
| #include "shambackends/typeAliasVec.hpp" | ||
| #include "shambackends/vec.hpp" | ||
| #include "shammodels/gsph/SolverConfig.hpp" | ||
| #include "shammodels/gsph/modules/SolverStorage.hpp" | ||
| #include "shammodels/sph/SinkPartStruct.hpp" | ||
| #include "shamrock/scheduler/ShamrockCtx.hpp" | ||
|
|
||
| namespace shammodels::gsph::modules { | ||
|
|
||
| template<class Tvec, template<class> class SPHKernel> | ||
| class SinkParticlesUpdate { | ||
| public: | ||
| using Tscal = shambase::VecComponent<Tvec>; | ||
| static constexpr u32 dim = shambase::VectorProperties<Tvec>::dimension; | ||
| using Kernel = SPHKernel<Tscal>; | ||
|
|
||
| using Config = SolverConfig<Tvec, SPHKernel>; | ||
| using Storage = SolverStorage<Tvec, u32>; | ||
|
|
||
| ShamrockCtx &context; | ||
| Config &solver_config; | ||
| Storage &storage; | ||
|
|
||
| using Sink = sph::SinkParticle<Tvec>; | ||
|
|
||
| SinkParticlesUpdate(ShamrockCtx &context, Config &solver_config, Storage &storage) | ||
| : context(context), solver_config(solver_config), storage(storage) {} | ||
|
|
||
| void accrete_particles(Tscal dt); | ||
| void predictor_step(Tscal dt); | ||
| void compute_sph_forces(); | ||
| void compute_ext_forces(); | ||
| void corrector_step(Tscal dt); | ||
|
|
||
| private: | ||
| inline PatchScheduler &scheduler() { return shambase::get_check_ref(context.sched); } | ||
| }; | ||
|
|
||
| } // namespace shammodels::gsph::modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.