-
Notifications
You must be signed in to change notification settings - Fork 232
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
fluid shell interaction model. #184
base: master
Are you sure you want to change the base?
Changes from 27 commits
f8fade7
5950b9b
ec0e3a9
80a1659
3443ced
d5e664c
681eb49
125be31
65bc702
8e36627
f2a5922
b6ceedd
471c930
b707560
39d41a4
89a9bc6
fb290cb
c6d04f8
624fbd1
9a08163
ff9f30f
6c2d127
2011946
235b67f
d793dff
5c7cfed
c678a18
69d626e
8799ebb
f385aa1
311d7e6
ec0b095
30e2d15
0532bbd
6544d38
9fefef0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -427,6 +427,55 @@ namespace SPH | |
} | ||
} | ||
//=================================================================================================// | ||
template <typename VariableType> | ||
DampingPairwiseFromShell<VariableType>:: | ||
DampingPairwiseFromShell(BaseContactRelation &contact_relation, const std::string &variable_name, Real eta) | ||
: LocalDynamics(contact_relation.sph_body_), | ||
DataDelegateContact<BaseParticles, ShellParticles>(contact_relation), | ||
eta_(eta), Vol_(particles_->Vol_), mass_(particles_->mass_), | ||
variable_(*particles_->getVariableByName<VariableType>(variable_name)) | ||
{ | ||
for (size_t k = 0; k != contact_particles_.size(); ++k) | ||
{ | ||
shell_variable_.push_back(contact_particles_[k]->template getVariableByName<VariableType>(variable_name)); | ||
DrChiZhang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
//=================================================================================================// | ||
template <typename VariableType> | ||
void DampingPairwiseFromShell<VariableType>::interaction(size_t index_i, Real dt) | ||
{ | ||
Real Vol_i = Vol_[index_i]; | ||
Real mass_i = mass_[index_i]; | ||
VariableType &variable_i = variable_[index_i]; | ||
|
||
std::array<Real, MaximumNeighborhoodSize> parameter_b; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These arrays can cause memory errors for multiresolution, where the neighborhood size is larger than the MaximumNeighborhoodSize variable. I think we mentioned this once but I don't remember what our conclusion was with prof. Hu. It's not very efficient either, perhaps @FabienPean-Virtonomy has a better solution? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it happened I had some problems there in the past, it was more related to some system resolution compared to particle spacing. There will be issues for multiresolution definitely. Two simpler options I see:
Otherwise other solutions could involve a different container outside STL (but require adding dependency), thread local vector (need to be confident about concurrency) |
||
|
||
/** Contact interaction. */ | ||
for (size_t k = 0; k < contact_configuration_.size(); ++k) | ||
{ | ||
StdLargeVec<VariableType> &variable_k = *(shell_variable_[k]); | ||
Neighborhood &contact_neighborhood = (*contact_configuration_[k])[index_i]; | ||
// forward sweep | ||
for (size_t n = 0; n != contact_neighborhood.current_size_; ++n) | ||
{ | ||
size_t index_j = contact_neighborhood.j_[n]; | ||
|
||
parameter_b[n] = contact_particles_[k]->DegeneratedSpacing(index_j) * eta_ * contact_neighborhood.dW_ijV_j_[n] * Vol_i * dt / contact_neighborhood.r_ij_[n]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is "DegeneratedSpacing"? Could we have a more understandable name? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shell formulation is called Degenerated Approach, therefore, DegeneratedSpacing used here denoting the spacing being degenerated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does degenerated mean in this context? Can you explain it please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I thought is " shell particle is degenerated (having low standard or behavior) ) from volume particle in the thickness spacing. Then, with shell particle is interacting with volume particle, the degenerated spacing is considered. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean that you consider the shell particle as a squashed solid particle in the thickness dimension? If yes, I would just call it ThicknessAdjustedSpacing for example, much clearer I think. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Name it "Thinkness" is one of my old choices, while this name is meaningless for volume particles as they do not have thickness. Maybe "ReducedThickness", "ReducedCrossSection", "DegeneratedThickness" or "DegeneratedCrossSection" is more readable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "ReducedThickness", "ReducedCrossSection" sound good to me There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok my problem was more with spacing than degenerate, I went to look in the code and it is basically the reduced or degenerated dimension (return 1 for volume, thickness for shells, and area for beams). Also why is the naming convention changing ? It was using camelCase before, now part of the new code is in PascalCase. Please change uniformize back to camelCase It is implemented by virtual function, which I am not so comfortable with, but I don't have a straightforward drop-in replacement to offer at the moment. |
||
|
||
// only update particle i | ||
variable_[index_i] += parameter_b[n] * (variable_i - variable_k[index_j]) / (mass_i - 2.0 * parameter_b[n]); | ||
} | ||
// backward sweep | ||
for (size_t n = contact_neighborhood.current_size_; n != 0; --n) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do feel that we need not repeat so much codes here. |
||
{ | ||
size_t index_j = contact_neighborhood.j_[n - 1]; | ||
|
||
// only update particle i | ||
variable_[index_i] += parameter_b[n - 1] * (variable_i - variable_k[index_j]) / (mass_i - 2.0 * parameter_b[n - 1]); | ||
} | ||
} | ||
} | ||
//=================================================================================================// | ||
template <class DampingAlgorithmType> | ||
template <typename... ConstructorArgs> | ||
DampingWithRandomChoice<DampingAlgorithmType>:: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ namespace SPH | |
Vecd nablaW_ijV_j = contact_neighborhood.dW_ijV_j_[n] * contact_neighborhood.e_ij_[n]; | ||
|
||
// acceleration for transport velocity | ||
acceleration_trans -= 2.0 * nablaW_ijV_j; | ||
acceleration_trans -= 2.0 * nablaW_ijV_j * this->contact_particles_[k]->DegeneratedSpacing(index_j); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will decrease efficiency of the original code a lot, as it needs another value from particle j. |
||
} | ||
} | ||
|
||
|
@@ -59,7 +59,7 @@ namespace SPH | |
Vecd nablaW_ijV_j = contact_neighborhood.dW_ijV_j_[n] * contact_neighborhood.e_ij_[n]; | ||
|
||
// acceleration for transport velocity | ||
acceleration_trans -= 2.0 * nablaW_ijV_j; | ||
acceleration_trans -= 2.0 * nablaW_ijV_j * this->contact_particles_[k]->DegeneratedSpacing(index_j); | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,8 @@ namespace SPH | |
Neighborhood &contact_neighborhood = (*this->contact_configuration_[k])[index_i]; | ||
for (size_t n = 0; n != contact_neighborhood.current_size_; ++n) | ||
{ | ||
sigma += contact_neighborhood.W_ij_[n] * contact_inv_rho0_k * contact_mass_k[contact_neighborhood.j_[n]]; | ||
Real mass = this->contact_particles_[k]->ParticleMass(contact_neighborhood.j_[n]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same issue on decreasing efficiency. We should have a discussion on this. |
||
sigma += contact_neighborhood.W_ij_[n] * contact_inv_rho0_k * mass; | ||
} | ||
} | ||
return sigma; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "fluid_shell_interaction.h" | ||
|
||
//=================================================================================================// | ||
namespace SPH | ||
{ | ||
//=================================================================================================// | ||
namespace fluid_dynamics | ||
{ | ||
//=================================================================================================// | ||
} | ||
//=================================================================================================// | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/* -------------------------------------------------------------------------* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be long to fluid dynamics. |
||
* SPHinXsys * | ||
* -------------------------------------------------------------------------* | ||
* SPHinXsys (pronunciation: s'finksis) is an acronym from Smoothed Particle* | ||
* Hydrodynamics for industrial compleX systems. It provides C++ APIs for * | ||
* physical accurate simulation and aims to model coupled industrial dynamic* | ||
* systems including fluid, solid, multi-body dynamics and beyond with SPH * | ||
* (smoothed particle hydrodynamics), a meshless computational method using * | ||
* particle discretization. * | ||
* * | ||
* SPHinXsys is partially funded by German Research Foundation * | ||
* (Deutsche Forschungsgemeinschaft) DFG HU1527/6-1, HU1527/10-1, * | ||
* HU1527/12-1 and HU1527/12-4 * | ||
* * | ||
* Portions copyright (c) 2017-2022 Technical University of Munich and * | ||
* the authors' affiliations. * | ||
* * | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may * | ||
* not use this file except in compliance with the License. You may obtain a* | ||
* copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * | ||
* * | ||
* ------------------------------------------------------------------------*/ | ||
/** | ||
* @file fluid_shell_interaction.h | ||
* @brief Here, we define the algorithm classes for the interaction between fluid and | ||
* thin structure, plate and shell. | ||
* @author Chi ZHang and Xiangyu Hu | ||
*/ | ||
|
||
|
||
#ifndef FLUID_SHELL_INTERACTION_H | ||
#define FLUID_SHELL_INTERACTION_H | ||
|
||
#include "fluid_dynamics_complex.h" | ||
#include "fluid_dynamics_complex.hpp" | ||
|
||
namespace SPH | ||
{ | ||
namespace fluid_dynamics | ||
{ | ||
typedef DataDelegateContact<FluidParticles, ShellParticles> FluidShellContactData; | ||
typedef DataDelegateContact<FluidParticles, ShellParticles, DataDelegateEmptyBase> FluidShellData; | ||
|
||
/** | ||
* @class InteractionWithShell | ||
* @brief Abstract base class for general fluid-shell interaction model. | ||
* @note Here, | ||
*/ | ||
template<class BaseIntegrationType> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am thinkin the current formulation is too complicated. We need a discuss on this. |
||
class InteractionWithShell : public BaseIntegrationType, public FluidShellData | ||
{ | ||
public: | ||
template <class BaseBodyRelationType, typename... Args> | ||
InteractionWithShell(BaseContactRelation &contact_relation, BaseBodyRelationType &base_body_relation, Args &&...args); | ||
|
||
template <typename... Args> | ||
InteractionWithShell(ComplexRelation &fluid_shell_relation, Args &&...args) | ||
: InteractionWithShell(fluid_shell_relation.getContactRelation(), fluid_shell_relation.getInnerRelation(), std::forward<Args>(args)...) | ||
{} | ||
|
||
virtual ~InteractionWithShell(){}; | ||
|
||
protected: | ||
Real spacing_ref_; | ||
StdVec<StdLargeVec<Real> *> shell_thickness_; | ||
StdVec<StdLargeVec<Vecd> *> shell_n_, shell_vel_ave_, shell_acc_ave_; | ||
}; | ||
|
||
/** | ||
* @class BaseFluidShellIntegration1stHalf | ||
* @brief template class for fluid-shell pressure relaxation scheme | ||
*/ | ||
template <class Integration1stHalfType> | ||
class BaseFluidShellIntegration1stHalf : public InteractionWithShell<Integration1stHalfType> | ||
{ | ||
public: | ||
template <typename... Args> | ||
explicit BaseFluidShellIntegration1stHalf(Args &&...args) | ||
: InteractionWithShell<Integration1stHalfType>(std::forward<Args>(args)...){}; | ||
virtual ~BaseFluidShellIntegration1stHalf(){}; | ||
void interaction(size_t index_i, Real dt = 0.0); | ||
|
||
protected: | ||
virtual Vecd computeNonConservativeAcceleration(size_t index_i) override; | ||
}; | ||
|
||
using FluidShellIntegration1stHalf = BaseFluidShellIntegration1stHalf<Integration1stHalf>; | ||
using FluidShellIntegration1stHalfRiemann = BaseFluidShellIntegration1stHalf<Integration1stHalfRiemann>; | ||
|
||
using FluidShellandWallIntegration1stHalf = BaseIntegration1stHalfWithWall<FluidShellIntegration1stHalf>; | ||
using FluidShellandWallIntegration1stHalfRiemann = BaseIntegration1stHalfWithWall<FluidShellIntegration1stHalfRiemann>; | ||
using ExtendFluidShellandWallIntegration1stHalfRiemann = BaseExtendIntegration1stHalfWithWall<FluidShellIntegration1stHalfRiemann>; | ||
|
||
/** | ||
* @class BaseFluidShellIntegration2ndHalf | ||
* @brief template class pressure relaxation scheme with wall boundary | ||
*/ | ||
template <class Integration2ndHalfType> | ||
class BaseFluidShellIntegration2ndHalf : public InteractionWithShell<Integration2ndHalfType> | ||
{ | ||
public: | ||
template <typename... Args> | ||
explicit BaseFluidShellIntegration2ndHalf(Args &&...args) | ||
: InteractionWithShell<Integration2ndHalfType>(std::forward<Args>(args)...) | ||
{}; | ||
virtual ~BaseFluidShellIntegration2ndHalf(){}; | ||
void interaction(size_t index_i, Real dt = 0.0); | ||
}; | ||
using FluidShellIntegration2ndHalf = BaseFluidShellIntegration2ndHalf<Integration2ndHalf>; | ||
using FluidShellIntegration2ndHalfRiemann = BaseFluidShellIntegration2ndHalf<Integration2ndHalfRiemann>; | ||
|
||
using FluidShellandWallIntegration2ndHalf = BaseIntegration2ndHalfWithWall<FluidShellIntegration2ndHalf>; | ||
using FluidShellandWallIntegration2ndHalfRiemann = BaseIntegration2ndHalfWithWall<FluidShellIntegration2ndHalfRiemann>; | ||
|
||
/** | ||
* @class ViscousWithWall | ||
* @brief template class viscous acceleration with wall boundary | ||
*/ | ||
template <class ViscousAccelerationInnerType> | ||
class BaseViscousAccelerationWithShell : public InteractionWithShell<ViscousAccelerationInnerType> | ||
{ | ||
public: | ||
template <typename... Args> | ||
BaseViscousAccelerationWithShell(Args &&...args) | ||
: InteractionWithShell<ViscousAccelerationInnerType>(std::forward<Args>(args)...) | ||
{}; | ||
virtual ~BaseViscousAccelerationWithShell(){}; | ||
void interaction(size_t index_i, Real dt = 0.0); | ||
}; | ||
|
||
using ViscousAccelerationWithShell = BaseViscousAccelerationWithShell<ViscousAccelerationInner>; | ||
using ViscousAccelerationWithShellandWall = BaseViscousAccelerationWithWall<ViscousAccelerationWithShell>; | ||
|
||
} | ||
} | ||
#endif //FLUID_SHELL_INTERACTION_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which test cases uses this class?