필터 지우기
필터 지우기

Enforcing values in ODE solver

조회 수: 2 (최근 30일)
Pulkit
Pulkit 2024년 2월 27일
댓글: Pulkit 2024년 2월 29일
I am trying to solve a stiff ode with ode15s. There is a variable for which there exists a physical constraint due to which it cannot exceed a certain maximum (the allowed maximum also changes with other variables).
I could use events to stop the ode integration and reset the variable but there is a regime where the event persists for some time so, I don't know if exiting the solver each time after just one iteration is efficient.
I also tried using global variables, so that I can always manually control it but then it becomes unphysical when solver rejects a step and goes back.
Is there a way to apply the constraint within the solver? Is there some other solver that could help or would it be better to write one by myself?
Thanks!
  댓글 수: 1
Torsten
Torsten 2024년 2월 28일
편집: Torsten 2024년 2월 28일
I could use events to stop the ode integration and reset the variable but there is a regime where the event persists for some time so, I don't know if exiting the solver each time after just one iteration is efficient.
This is only possible if you define the event as a discontinuous function, and this is not allowed. An allowed event function has a zero crossing without remaining in the state.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2024년 2월 27일
Use events, and remember that events are only detected when a value crosses the trigger, and are not detected when the system starts in that state.
  댓글 수: 1
Pulkit
Pulkit 2024년 2월 29일
Oh in that case, I don't think i can make use of built in solvers. The variable reaching a maximum is not a one-time event but a whole regime that would persist for some time. Thanks for the reply.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

제품


릴리스

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by