SciML / SciML/ComponentArrays.jl

Alias variables

Open
#43 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
375
Forks
42
Avg merge
7h 25m
Merged PRs (30d)
17

Description

When there are physical conversions between components, we often have things like

x.comp1.out = fun(x.comp2.in)

However, when solving differential equations, we must have the same number of states as the number of equations, so we cannot actually introduce the new x.comp2.in variable without adding the trivial algebraic equation

du[i] = x.comp1.out - fun(x.comp2.in)

I wonder if we can add some kind of mechanism such that x.comp2.in directly returns fun(x.comp1.out).

Possible syntax:

x = ComponentArray(
    comp1 = ComponentArray(out=1),
    comp2 = ComponentArray(in=AliasVar(UpperLevel().comp1.out, fun)),
)

where UpperLevel signifies that comp2 array must keep a reference of the upper level ComponentArray x.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points, so start by examining the existing ComponentArray construction and indexing behavior. Evaluate whether the proposed AliasVar and UpperLevel mechanism fits that design. Done means a defined interface and behavior for alias variables, including how references and conversions are handled.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.