I’m trying to extend the Navier-Stokes PDEs to multiphase flows using Volume Of Fluid (VOF) approach, as it is done here. This requires to compute an auxiliary variable ‘alpha’ that represents the volume fraction of fluid (e.g. water), and that is bounded between 0 and 1.
I’m looking for a way to specify a sigmoid activation function for this output only, leaving the other output activations unchanged. However, I can’t see a simple way to implement that with Modulus. Is there a way to do that?
My recommended approach would be to define a temporary version of this variable (alpha_hat). You neural network model will predict this variable plus others (e.g. u,v,p,alpha_hat). Now we define a custom node that goes from alpha_hat → alpha. E.g.
Then just add this to your node list and keep all your PDEs / loss functions the same. Operating through temporary variables / fields to make more customized outputs should be very flexible.