Bounding gridfunction from below

While modeling a shear-thickening fluid with navier-stokes I update the viscosity at each timestep according to

\nu = 0.01|2^{0.5} \nabla^s \mathbf{u}|^{0.5}

where |\cdot | is the Frobenius norm. This seems to be working fine using gridfunctions and the Innerproduct() method for now, but I would like enforce a minimum value of \nu, say 10^{-4} to reduce the risk of encountering zero-viscosities. What’s the best way of implementing something akin to this:

\nu = max\{ 10^{-4}, 0.01|2^{0.5} \nabla^s \mathbf{u}|^{0.5} \}


you can do this with IfPos

IfPos(val-1e-4, val, 1e-4)

best Christopher

Seems to be working as I wanted, thanks again!