Closed Shuaihao-Zhang closed 1 month ago
It can be obtained by dynamic cast if you have base material pointer. https://github.com/Xiangyu-Hu/SPHinXsys/blob/350ef8fc04637c0b51bbb2ad9b839224c09afb35/src/shared/particle_dynamics/base_particle_dynamics.hpp#L40-L52
I see. Thanks!
Hi, I got another question.
We use BaseParticles
here. If I want to use the Classes defined in fluid_dynamics
, I need the member variable pressure p_
and many other variables. p_
is registered in FluidParticles
. I cannot use p_(DynamicCast<FluidParticles>(this, particles_)->p_)
to get the variable p_
, because I don't use FluidParticles
and p_
is not registered yet.
So, should I register pressure p_
by my self in the continuum_dynamics
? This way seems not very good, because I need to register many variables same to those registered in the FluidParticles
and SolidParticles
.
Hi, I got another question.
We use
BaseParticles
here. If I want to use the Classes defined influid_dynamics
, I need the member variable pressurep_
and many other variables.p_
is registered inFluidParticles
. I cannot usep_(DynamicCast<FluidParticles>(this, particles_)->p_)
to get the variablep_
, because I don't useFluidParticles
andp_
is not registered yet.So, should I register pressure
p_
by my self in thecontinuum_dynamics
? This way seems not very good, because I need to register many variables same to those registered in theFluidParticles
andSolidParticles
. One option maybe: Try to use some register variables only in dynamics, viz. these variables are registered when specific dynamics are used.
Thanks, Chi. I guess this can solve the current issue. But we need to re-organize the previous code framework. I think we should delete the FluidParticles
and SolidParticles
, and register all the variables in the fluid_dynamics
and solid_dynamics
. I'm not sure if this will lead to any other issues.
Thanks, Chi. I guess this can solve the current issue. But we need to re-organize the previous code framework. I think we should delete the
FluidParticles
andSolidParticles
, and register all the variables in thefluid_dynamics
andsolid_dynamics
. I'm not sure if this will lead to any other issues.
For this kind of fundamental change, we need careful discussion with Xiangyu and other contributors. You can initialize a Issue to talk this, meanwhile implement your algorithm with independent registered variables in dynamics.
For this kind of fundamental change, we need careful discussion with Xiangyu and other contributors. You can initialize a Issue to talk this, meanwhile implement your algorithm with independent registered variables in dynamics.
Thanks, I will discuss with Prof. Hu next week.
After the discussion, it seems that we need make fluid and solid class virtually inherited from base material.
After the discussion, it seems that we need make fluid and solid class virtually inherited from base material.
Sure. I will try this way.
Now the continuum media is implelemented.
As we discussed before, we just need
continuum_dynamics
for mechanical relaxation andgeneral_continuum
for material properties. For the particle and body, we just used theBaseParticles
andRealBody
.I encountered with a problem here.
Normally, there will be a member variable to record the material in the class
*Particles
, such as in the fluid: https://github.com/Xiangyu-Hu/SPHinXsys/blob/350ef8fc04637c0b51bbb2ad9b839224c09afb35/src/shared/particles/fluid_particles.h#L54 Then, we can get the material type in the relaxation process based on the particle type, like what we do in the fluid: https://github.com/Xiangyu-Hu/SPHinXsys/blob/350ef8fc04637c0b51bbb2ad9b839224c09afb35/src/shared/particle_dynamics/fluid_dynamics/fluid_dynamics_inner.cpp#L59 We usefluid_(particles_->fluid_)
to get the material type based on the particle type. So that we can use the functions defined in the materials through the variablefluid_
.The problem is that if we use
BaseParticles
, we can only get 'BaseMaterial' through the particle type, and we cannot get the materialGeneralContinuum
. Then I don't know how can we use the member functions and variables defined in the materialGeneralContinuum
.