Skip to content

VOF buoyancy assembler fix#1896

Merged
blaisb merged 19 commits intomasterfrom
VOF-buoyancy-fix
Feb 8, 2026
Merged

VOF buoyancy assembler fix#1896
blaisb merged 19 commits intomasterfrom
VOF-buoyancy-fix

Conversation

@Julamipolymtl
Copy link
Collaborator

@Julamipolymtl Julamipolymtl commented Jan 30, 2026

Description

This PR fixes the boussinesq buoyancy term that was miscalculated in VOF. Contrary to the Navier Stockes equations from the PSPGSUPGNavierStokesAssemblerCore, when using VOF, the density term appears explicitely in both left and right had sides of the assembly from GLSNavierStokesVOFAssemblerCore. As such, the BuoyancyAssembler from the base Navier Stockes code did not compute the proper buoyancy term.

This was made apparent when I used both heat transfert and VOF for a fun lava-lamp model and found that the thermal coefficient value had to be multiplied by approximately the density value for the boussinesq term to take effect.

Solution

Added new buoyancy assembler specific for VOF navier_stockes_vof_assemblers and changed the setup assembler in both fluid_dynamic_matrix_based and fluid_dynamic_block to compute buoyancy properly. It was found that the product of linearly interpolated density and thermal expansion (which is the same as a bilinear interpolation) lead to a non-physical error maximized at phase fraction = 0.5. The product is now evaluated for phase 0 and 1 and linearly interpolated.

Testing

New vof buoyancy test added and updated output of failing test that used HT, VOF and the boussinesq buoyancy approximation.

Documentation

No new simulation parameters.

Miscellaneous (will be removed when merged)

Checklist (will be removed when merged)

See this page for more information about the pull request process.

Code related list:

  • All in-code documentation related to this PR is up to date (Doxygen format)
  • Copyright headers are present and up to date
  • Lethe documentation is up to date
  • Fix has unit test(s) (preferred) or application test(s), and restart files are in the generator folder
  • The branch is rebased onto master
  • Changelog (CHANGELOG.md) is up to date
  • Code is indented with indent-all and .prm files (examples and tests) with prm-indent

Pull request related list:

  • Labels are applied
  • There are at least 2 reviewers (or 1 if small feature) excluding the responsible for the merge
  • If this PR closes an issue or is related to a project, it is linked in the "Projects" or "Development" section
  • If the fix is temporary, an issue is opened
  • The PR description is cleaned and ready for merge

Copy link
Contributor

@blaisb blaisb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice @Julamipolymtl.
Do you think you could add a trivial application test (e.g. you could take a regular buoyancy cavity test, do it with VOF with the cavity filled with a fluid of a non unit density for example, there does not need to be two fluids).

Could you also add a changelog :)!

@blaisb
Copy link
Contributor

blaisb commented Feb 1, 2026

I am not sure why the marangoni tests are failing, did they have buoyancy in them? I presume so.

Copy link
Collaborator

@hepap hepap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation looks good!

I also think a new test would be nice to have.

Also, check if the header are up-to-date for the year :)

Copy link
Collaborator

@OresteMarquis OresteMarquis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the change of the variable name, it is good to go for me :)

for (unsigned int q = 0; q < n_q_points; ++q)
{
// Forcing term (gravity)
const Tensor<1, dim> &force = scratch_data.force[q];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the force on the fluid always the gravity in general in Lethe? This is not a super name if its the only source of momentum but it may be changed in another PR. In any case, I would change the variable force in this assembler by gravity since the buoyancy is driven by gravity.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my knowledge, this forcing term does not have to necessarily be gravity, it could for example be an external magnetic field's effect on a magnetic fluid. I know I personally am a fan of using a parameter outside its intended use :')

From my understanding, the boussinesq buoyancy force would just modify the effect of any external acceleration field, it just so happens that that acceleration field is most often gravity, but it would apply equally to a magnetic field's acceleration.

@Julamipolymtl
Copy link
Collaborator Author

I am not sure why the marangoni tests are failing, did they have buoyancy in them? I presume so.

Indeed all failing marangoni tests had HT, VOF and buoyancy force enabled. I'm no marangoni expert, but I'm guessing these were temperature dependant buoyancy driven tests which now need to be scaled due to the change in the driving buoyancy term. Since I've never modelled this physisc I'd still like to look into the failing tests before changing the failing outputs.

@blaisb
Copy link
Contributor

blaisb commented Feb 3, 2026

@Julamipolymtl I would avoid changing the output of the test. Most likely you could rescale the thermal expansion coefficient by 1/density to ensure that the values remain the same as before.

@Julamipolymtl Julamipolymtl force-pushed the VOF-buoyancy-fix branch 2 times, most recently from ccafffb to c5ee5b3 Compare February 3, 2026 15:39
@Julamipolymtl Julamipolymtl changed the title Vof buoyancy fix VOF buoyancy assembler fix Feb 5, 2026
Copy link
Contributor

@blaisb blaisb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question regarding a test and 1-2 typo to fix otherwise this is good to go from my side.
Feel free to ask me on slack if there is anything.

@blaisb
Copy link
Contributor

blaisb commented Feb 6, 2026

@Julamipolymtl ping me and the others when you have implemented the change on the interpolation of the buoyancy property.

@Julamipolymtl Julamipolymtl requested a review from blaisb February 6, 2026 19:13
@Julamipolymtl
Copy link
Collaborator Author

Julamipolymtl commented Feb 6, 2026

@blaisb @hepap @OresteMarquis the density_thermal_expansion property product is now interpolated linearly instead of bilinearly. It produced enough of a change for all 3 modified tests to fail again. I've remodified them. This should be it for this PR.

Copy link
Contributor

@blaisb blaisb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will just need a rebase for the changelog. I'll take care of it.

@blaisb blaisb merged commit 6fb4a08 into master Feb 8, 2026
10 checks passed
@blaisb blaisb deleted the VOF-buoyancy-fix branch February 8, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants