Xiangyu-Hu / SPHinXsys

SPHinXsys provides C++ APIs for engineering simulation and optimization. It aims at complex systems driven by fluid, structure, multi-body dynamics and beyond. The multi-physics library is based on a unique and unified computational framework by which strong coupling has been achieved for all involved physics.
https://www.sphinxsys.org/
Apache License 2.0
259 stars 197 forks source link

Modified algorithm for heat flow calculation #498

Open Harmon9802 opened 4 months ago

Harmon9802 commented 4 months ago

Describe the bug The right hand side of diffusiondt algorithm in all of diffusion types (Inner, Robin, etc. ) only calculate the rate of heat flow per unit volume (W/m3), we need to multiply a particle volume term to get heat flow (W), then we can use it for heat flux calculation.

Trace to the source Steps to trace the source:

  1. Go to 'diffusion_dynamics.hpp'.
  2. Scroll down to 'DiffusionRelaxation<Robin<...>>' for example.
  3. Find two functions inside of the class ”getDiffusionChangeRateRobin“ and "interaction".
  4. Check the algorithm of diffusiondt.

Modified algorithm The modified diffusion_dt_m should be: diffusion_dt_m = diffusiondt * particle_volume

Additional context However, this bug does not effect the final temperature field calculation, it is only useful if we want to calculate overall heat flow instead of volumetric heat flow.

DrChiZhang commented 4 months ago

Please check the thermal_diffusion branch, where more general thermal dynamics equations are solved.

Xiangyu-Hu commented 1 month ago

@DrChiZhang could you make a pull request if you think the changes are done?

DrChiZhang commented 1 month ago

@DrChiZhang could you make a pull request if you think the changes are done?

Sure, I will try to merge master to this branch first.