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

RheoModel revamp #111

Merged
merged 8 commits into from
Jul 21, 2021
Merged

RheoModel revamp #111

merged 8 commits into from
Jul 21, 2021

Conversation

akabla
Copy link
Member

@akabla akabla commented Apr 12, 2021

No description provided.

@akabla akabla mentioned this pull request Apr 13, 2021
Copy link
Member

@moustachio-belvedere moustachio-belvedere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thanks Alexandre! Added some questions below.

test/benchmarks.jl Show resolved Hide resolved
src/models/zener.jl Show resolved Hide resolved
# Storage modulus
Gp = quote
if a!=1.0
#if a!=1.0 # This is to be removed as the condition contradicts the constraints

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which constraint? This will cause unexpected non-zero results for users not familiar with floating point error (cos(pi/2)!=0). Small error but noticeable in log-log plots.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one:

# Constraints
        constraint = quote
                 (a<1) & (a>0)
                end,

For the floating-point error, maybe it would make sense to use the specialised functions that solve this problem?

julia> cos(pi/2)
6.123233995736766e-17

julia> cospi(1/2)
0.0

Copy link
Member

@moustachio-belvedere moustachio-belvedere Apr 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That constraint is only enforced in a handful of places though (e.g. checking initial conditions before the fit process starts). Importantly, it's not enforced when making a direct call to the modulus (I don't think, unless you/Ale changed it), or during optimisation process. (Indeed, we wouldn't need the special mittleff wrapper if the constraint was enforced throughout optimisation.)

Same applies to the other changes you made in a number of the the other models. (I didn't comment on them all, but I noticed there were several other changes you made getting rid of edge case handling.

I do not have skin in the game here because I'm unlikely to use RHEOS in future, but what I can say for certain is that those edge cases were in their specifically because we hit them at various times using RHEOS in practice, and they caused unwanted behaviour - so we need to think carefully about each removal. Worth discussing with Ale also.

edit: sure if you can fix it using cospi then that's fine, but it doesn't address the other edge case handling you removed from other moduli, and I'm not sure if there any speed/readability consequences from using cospi instead of cos.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good point. It is not very important here, but this touches on a broader set of problems about how we check the constraints when we call the moduli. I'd prefer to keep it clean and fast for the low level access like _G and _Ga, but we should definitely make sure that the parameters sent to functions such as relaxmod are checked properly, for instance for the relative values of the exponents, etc. There are at the moment many ways it could go wrong, and not all of them can be hacked as we do here - we need to throw exceptions I think. There are indeed other issues with the fact that NLopt does not enforce the constraints beyond checking parameters at the start. Maybe this deserves its own issue...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some work in that direction already, which is documented in the open issue #86

Exceptions make sense in some contexts, but definitely not all of them (the above code with cos(pi/2) being a good example). A 'smooth' transition from springpot to spring/dashpot specialisation causes fundamental difficulties in computational implementation, but the conversation around to what extent we want to support it and how is still an important one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, not all contexts can be addressed like that indeed.

docs/src/assets/plothelper.jl Show resolved Hide resolved
src/definitions.jl Show resolved Hide resolved
_Gppa::TVec

_constraint::FWConstraint
_Gramp::Bool

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't understand the ramp nomenclature, might be worth having a longer discussion about it. Also, do we need a Jramp? Assuming it's a flag for handling singularities I'm not sure that creep moduli have any - happy to be corrected.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right about Jramp, it is not required for the creep functions indeed.
The flags is just a placeholder for future use at the moment. Nothing implemented. So yes, the long discussion is still pending!

@akabla
Copy link
Member Author

akabla commented Apr 17, 2021

@moustachio-belvedere
thanks for the comments Louis!

@akabla akabla marked this pull request as ready for review July 21, 2021 12:32
@akabla akabla merged commit b8d3085 into master Jul 21, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants