Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steady State Heat without Time Dependence is Broken #19

Open
avik-pal opened this issue Oct 18, 2023 · 5 comments
Open

Steady State Heat without Time Dependence is Broken #19

avik-pal opened this issue Oct 18, 2023 · 5 comments

Comments

@avik-pal
Copy link
Member

avik-pal commented Oct 18, 2023

https://docs.sciml.ai/MethodOfLines/dev/tutorials/heatss/ seems to be broken with the latest versions of the packages.

ERROR: ArgumentError: Equations (12), states (12), and initial conditions (121) are of different lengths. To allow a different number of equations than states use kwarg check_length=false.
Stacktrace:
  [1] check_eqs_u0(eqs::Vector{Equation}, dvs::Vector{Any}, u0::Vector{Float64}; check_length::Bool, kwargs::@Kwargs{})
    @ ModelingToolkit /mnt/julia/packages/ModelingToolkit/oIgbi/src/systems/abstractsystem.jl:1745
  [2] process_NonlinearProblem(constructor::Type, sys::NonlinearSystem, u0map::Vector{…}, parammap::SciMLBase.NullParameters; version::Nothing, jac::Bool, checkbounds::Bool, sparse::Bool, simplify::Bool, linenumbers::Bool, parallel::Symbolics.SerialForm, eval_expression::Bool, use_union::Bool, tofloat::Bool, kwargs::@Kwargs{})
    @ ModelingToolkit /mnt/julia/packages/ModelingToolkit/oIgbi/src/systems/nonlinear/nonlinearsystem.jl:338
  [3] process_NonlinearProblem
    @ ModelingToolkit /mnt/julia/packages/ModelingToolkit/oIgbi/src/systems/nonlinear/nonlinearsystem.jl:322 [inlined]
  [4] (NonlinearProblem{})(sys::NonlinearSystem, u0map::Vector{…}, parammap::SciMLBase.NullParameters; check_length::Bool, kwargs::@Kwargs{})
    @ ModelingToolkit /mnt/julia/packages/ModelingToolkit/oIgbi/src/systems/nonlinear/nonlinearsystem.jl:367
  [5] NonlinearProblem (repeats 2 times)
    @ ModelingToolkit /mnt/julia/packages/ModelingToolkit/oIgbi/src/systems/nonlinear/nonlinearsystem.jl:364 [inlined]
  [6] #NonlinearProblem#740
    @ ModelingToolkit /mnt/julia/packages/ModelingToolkit/oIgbi/src/systems/nonlinear/nonlinearsystem.jl:361 [inlined]
  [7] NonlinearProblem(sys::NonlinearSystem, args::Vector{Float64})
    @ ModelingToolkit /mnt/julia/packages/ModelingToolkit/oIgbi/src/systems/nonlinear/nonlinearsystem.jl:360
  [8] discretize(pdesys::PDESystem, discretization::MOLFiniteDifference{…}; analytic::Nothing, kwargs::@Kwargs{})
    @ PDEBase /mnt/julia/packages/PDEBase/aRCcl/src/discretization_state.jl:63
  [9] discretize
    @ Main /mnt/julia/packages/PDEBase/aRCcl/src/discretization_state.jl:55 [inlined]
 [10] construct_heatss_nlproblem::Float64)
    @ Main /mnt/research/benchmarks/SciMLBenchmarks.jl/benchmarks/NonlinearProblem/steady_state_heateq.jmd:48
 [11] top-level scope
    @ /mnt/research/benchmarks/SciMLBenchmarks.jl/benchmarks/NonlinearProblem/steady_state_heateq.jmd:1
Some type information was truncated. Use `show(err)` to see complete types.

The last working versions we could figure out were:

  [5b8099bc] DomainSets v0.6.7
  [23fbe1c1] Latexify v0.16.1
⌃ [94925ecb] MethodOfLines v0.10.0
⌃ [961ee093] ModelingToolkit v8.64.0
⌃ [a7812802] PDEBase v0.1.4
⌅ [0bca4576] SciMLBase v1.98.1
  [9672c7b4] SteadyStateDiffEq v1.16.1

cc @ChrisRackauckas

@YingboMa
Copy link
Member

From the error message, it's probably trying to construct the u0 from the unsimplified system by mistake.

julia> s = symbolic_discretize(pdesys, discretization)[1];
JuliaSimCompiler: generate_system

julia> ss = structural_simplify(s);

julia> NonlinearProblem(structural_simplify(s), rand(length(states(ss))))
NonlinearProblem with uType Vector{Float64}. In-place: true
u0: 12-element Vector{Float64}:
 0.5658693983716057
 0.730452210930952
 0.7999093647009754
 0.34068068695778175
 0.6066626175654133
 0.49832174589693123
 0.985735570069928
 0.10313229637404808
 0.5761788103850009
 0.019531876564822248
 0.4600618070405691
 0.5048377501152175

julia> length(states(s))
121

@xtalax
Copy link
Member

xtalax commented Oct 19, 2023

Afraid that this isn't the case:

        simpsys = structural_simplify(sys)
        if tspan === nothing
            add_metadata!(get_metadata(sys), sys)
            return prob = NonlinearProblem(simpsys, ones(length(simpsys.states));
                                           discretization.kwargs..., kwargs...)

@avik-pal
Copy link
Member Author

Digging a bit further 8.71.2 for Modeling Toolkit works

@ChrisRackauckas
Copy link
Member

I thought you said you were on latest?

@avik-pal
Copy link
Member Author

avik-pal commented Oct 19, 2023

I meant 8.71.2 works, but the latest 8.72 doesn't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants