Reg. usage of primary_vars in a python script

Hi Pavan,

one example is this one:

...
class BCM_MonitoringTraction(OpenGeoSys.BoundaryCondition):
    def getFlux(self, t, coords, primary_vars):
        x, y, z = coords
        pp_actual = primary_vars[0]
        ux_actual = primary_vars[1]
        uy_actual = primary_vars[2]

        uy_target = ExternalDisplacement(x, t)
        uy_diff = uy_actual - uy_target

        if abs(uy_diff) > 1e-15:
            print("WARNING: uy_diff = ", uy_diff)

        value = 0.0
        jacob = [0.0, 0.0, 0.0]

        return (False, value, jacob)

...

It’s not complete in the sense that the Jacobian is all-zero. The Jacobian is the derivative of the returned flux (value in the example) w.r.t. all primary variables.

The first value True/False in return (False, value, jacob) specifies if a BC should be set at that location. You can use this value to switch between Dirichlet and Neumann BCs: A BoundaryCondition subclass can have both a getFlux() and a getDirichletBCValue() method. There are also examples for Dirichlet BCs in the script I mentioned.

I hope that helps.

Best regards,
Christoph