Skip to content

Custom derived quantities #1130

@RemDelaporteMathurin

Description

@RemDelaporteMathurin

It would be nice for users to be able to define custom derived quantities like this:

def my_func(**kwargs):
    D = kwargs["D"]
    c_h1 = kwargs["H_1"]
    c_h2 = kwargs["H_2"]
    n = kwargs["n"]

    return -D * ufl.dot(ufl.grad(c_h1 + c_h2), n)


def retention(**kwargs):
    D = kwargs["D"]["H_1"]
    D_0 = kwargs["D_0"]
    c_h1 = kwargs["H_1"]
    c_h2 = kwargs["H_2"]
    n = kwargs["n"]

    return c_h1 + c_h2


my_custom_quantity = F.CustomQuantity(expr=retention, subdomain=vol1, title="Retention", filename="retention.txt")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions