synthetik-technologies / blastfoam

A CFD solver for multi-component compressible flow with application to high-explosive detonation, explosive safety and air blast
Other
215 stars 96 forks source link

Add external source in user-defined solver #65

Closed Liu0813 closed 1 year ago

Liu0813 commented 1 year ago

Hi, everyone

I am attempting to develop a MHD solver based on the BlastFoam. In my solver, the Lorentz force and Joule heat are added to the Euler equation as source terms.

The class compressibleBlastSystem provides two functions, i.e. addUSource and addESource. As I understant it, these two functions give the interface to add user-defined source terms. However, I found these the source terms would not be called when the flow is inviscid. I think this issue is caused by the following code in the postUpdate function. https://github.com/synthetik-technologies/blastfoam/blob/cb50fc49f4d8163159eaefa244a7e16071dba2dc/src/compressibleSystem/compressibleBlastSystem/compressibleBlastSystem.C#L166-L230

In the code section, both the judgement needSolve(U_.name()) and needSolve(e_.name()) are always false. And this method to add external source may be not suitable for BlastFoam. Therefore, I want to know how to correctly add an external source in a user-defined BlastFoam solver.