SPHinXsys
SPHinXsys copied to clipboard
Particle generation breaks restart feature
https://github.com/Xiangyu-Hu/SPHinXsys/blob/e5d224d7af1d0685165e45224ecc50d65186f5cc/SPHINXsys/src/shared/bodies/base_body.h#L137-L144
Restart is inherently broken with new particle generation approach. For any particle generator, initializeOtherVariables
happens after the function implemented by the user, the initialization of extra variable based on a function such as
https://github.com/Xiangyu-Hu/SPHinXsys/blob/e5d224d7af1d0685165e45224ecc50d65186f5cc/SPHINXsys/src/shared/particles/solid_particles.cpp#L30-L32
is (1) crashing if the variable was registered by the user inadvertently (avoidable and ok, requires removing some lines), and (2) overriding any user/file loaded values (more problematic from design POV). See the sources of problems in base_particles.hpp
https://github.com/Xiangyu-Hu/SPHinXsys/blob/e5d224d7af1d0685165e45224ecc50d65186f5cc/SPHINXsys/src/shared/particles/base_particles.hpp#L45-L56
and
https://github.com/Xiangyu-Hu/SPHinXsys/blob/e5d224d7af1d0685165e45224ecc50d65186f5cc/SPHINXsys/src/shared/particles/base_particles.hpp#L59-L71
Yes. This issue is very relevant to that a variable is only allowed once. The other Variable are only those in particle classes. Any new variable will be defined in method will be initialized in the specific method class. My original design is separate geometric model variable, physical model variables and dynamics relevant variables. The first two are defined in particles, the third in method classes. However, the clear separation between the three is not very obvious.