How to parameterize coefficients of PDEs?

Does anyone know how to parameterize the coefficients of PDEs?
For example, I need to parameterize the vicosity or density of the fluid for Navier-Stokes equation?

How to make changes to the NS node defined below or create the corresponding flow network?

ze = ZeroEquation(nu=nd_fluid_viscosity, dim=3, time=False, max_distance=0.12)
    ns = NavierStokes(nu=ze.equations["nu"], rho=nd_fluid_density, dim=3, time=False)
    navier_stokes_nodes = ns.make_nodes() + ze.make_nodes()

Hi @cxi1

You can parameterize a PDE using a SymPy Symbol. While maybe not obvious, the 1D wave equation example can show how to go about this (here t is the parameterized variable). You can take these ideas and extend them to coefficients of other PDEs.

Note inside the Wave equation we have:

def __init__(self, c=1.0):
        # coordinates
        x = Symbol("x")       
        # time
        t = Symbol("t")

        # make input variables
        input_variables = {"x": x, "t": t}
        # set equations
        self.equations = {}
        self.equations["wave_equation"] = u.diff(t, 2) - (c**2 * u.diff(x)).diff(x)

in the problem t is never predicted by the model but rather injected using the parameterization in the constraints. E.g.

interior = PointwiseInteriorConstraint(
        outvar={"wave_equation": 0},
        parameterization=time_range,  # time_range = {t_symbol: (0, 2 * L)}
1 Like

Thank you so much, Nicholas, that is very helpful to me

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.