Mass Conservation in the Latest Underworld3 Version
I’m testing the newest version of Underworld3 and noticed that the Stokes solver seems to enforce only the standard incompressible form of the continuity equation: ∇⋅u=0 In earlier UW3 examples (and older versions), I recall there being ways to modify or extend this equation to include compressibility effects, for example: ∇⋅(ρu)=0 Is this feature no longer available?
Apologies, this would probably be something I did unintentionally when refactoring the solvers. There should be a way to set the RHS term. I'll have a look.
@jcgraciosa - you did the benchmarks originally, can you think about a regression test for this and other less-travelled parts of the equation templating system.
I'll do a regression test of this and will update soon.
The Stokes solver has a PF0 property / expression that should capture the RHS of the continuity equation. This is a different interface to the previous one, so it needs testing, but the code hooks are there ... @jcgraciosa , we could just try the previous benchmarks - we have to do this for the benchmarking paper at some point.
Could you give an example of how you would implement the PFO property?
Hello @gp37! To do the TALA approximation in Underworld3, you can add the following in your model set-up:
stokes.penalty = -(2/3) * viscosity
stokes.constraints = sympy.Matrix([stokes.div_u + dot(v_soln.fn, gradient(rho_bar))/rho_bar])
In the code snippet above:
-
stokes- the stokes solver you created -
viscosity- viscosity value -
stokes.div_u- the expression of the velocity divergence which is a property of the Stokes solver -
v_soln- the velocity mesh variable -
rho_bar- the expression stating how rho varies (e.g. as a function of depth)
If there are other questions, let me know.