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

Functions missing derivative functions, that are already present #1909

Closed
modelica-trac-importer opened this issue Jan 15, 2017 · 6 comments · Fixed by #2919
Closed

Functions missing derivative functions, that are already present #1909

modelica-trac-importer opened this issue Jan 15, 2017 · 6 comments · Fixed by #2919
Assignees
Labels
enhancement New feature or enhancement L: Media Issue addresses Modelica.Media P: low Low priority issue
Milestone

Comments

@modelica-trac-importer
Copy link

modelica-trac-importer commented Jan 15, 2017

Reported by veje.johannes on 16 Feb 2016 10:04 UTC
In Media.IdealGases.Common.Functions there are three functions where the corresponding derivative function is available but not implemented.

These three functions are; h_T, h_Tlow, and s0_Tlow with the corresponding functions: h_T_der, h_Tlow_der, and s0_Tlow_der.

function h_T 
  ...
  annotation (Inline=false,smoothOrder=2);
end h_T;

For a fourth function, cp_Tlow, the derivative function is implemented.

function cp_Tlow 
  ...
  annotation (Inline=false, derivative(zeroDerivative=data) = cp_Tlow_der);
end cp_Tlow;

Migrated-From: https://trac.modelica.org/Modelica/ticket/1909

@modelica-trac-importer modelica-trac-importer added enhancement New feature or enhancement L: Media Issue addresses Modelica.Media P: low Low priority issue labels Jan 15, 2017
@modelica-trac-importer
Copy link
Author

Modified by beutlich on 16 Feb 2016 14:16 UTC

@modelica-trac-importer modelica-trac-importer changed the title Functions missing derivative functions, that are already pressent Functions missing derivative functions, that are already present Jan 15, 2017
@modelica-trac-importer
Copy link
Author

Comment by hubertus on 16 Feb 2016 14:35 UTC
There are two options for getting derivatives of functions:

  1. the developer writes a derivative function and uses the derivative-annotation or
  2. the tool computes the derivative automatically through AD (automatic differentiation) based on the smoothOrder annotation given by the developer.

I have chosen the latter, and I think most tools are fine with that. Note that one has to do either one or the other. But: this code was written when Dymola was the only tool that supported the Media library. So I'd like to use this ticket to get input from all tool developers:

  • do you support computation of derivatives based on the SmoothOrder annotation?
  • which of the two options do you prefer?

Note that the derivative functions are historical, Dymola supported that before supporting SmoothOrder.

@modelica-trac-importer modelica-trac-importer changed the title Functions missing derivative functions, that are already present Functions missing derivative functions, that are already pressent Jan 15, 2017
@modelica-trac-importer
Copy link
Author

Comment by beutlich on 16 Feb 2016 14:46 UTC
For the record: SimulationX supports both options.

@modelica-trac-importer
Copy link
Author

Comment by hansolsson on 17 Feb 2016 16:37 UTC
Dymola also supports both - and I see several reasons to prefer smoothOrder:

  • Reducing the risk of errors by having less code
  • Declarative - by stating that the function is 2 times continuously differentiable instead of giving a derivative

The cases where a function has a smooth derivative, but it cannot be computed using automatic differentiation of the algorithm as it is written is pretty rare (but I am sure some have found those cases).

@modelica-trac-importer
Copy link
Author

Comment by jmattsson on 18 Feb 2016 08:25 UTC
JModelica.org supports both.

@beutlich
Copy link
Member

beutlich commented May 7, 2019

As again pointed here by @thorade the derivative or smoothOrder annotation, respectively, is missing for s0_Tlow.

@beutlich beutlich added this to the MSL4.0.0 milestone May 7, 2019
@beutlich beutlich changed the title Functions missing derivative functions, that are already pressent Functions missing derivative functions, that are already present May 7, 2019
beutlich added a commit to beutlich/ModelicaStandardLibrary that referenced this issue May 7, 2019
@beutlich beutlich self-assigned this May 7, 2019
beutlich added a commit to beutlich/ModelicaStandardLibrary that referenced this issue May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement L: Media Issue addresses Modelica.Media P: low Low priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants