-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor constructor #143
base: main
Are you sure you want to change the base?
Refactor constructor #143
Conversation
Refactor tracers
Yes, this is not ideal but since this still works:
I don't think it is too much of an issue. |
I worry that |
Closes #141
Overview for reviewers
In the end this is not really a refactor. In addition to the
construct
method, which we already had, this PR adds aninstantiate
method.As before, the user starts by constructing the type, which fixes:
If a user wants to change any of these quantities they have to create a new type. The reason we can't have the N of plankton change dynamically is because there have to be as many tracer functions as there are plankton and their input arguments also depends on how many plankton there are in the model.
Once a type is created, the user can instantiate an object with the default values just by calling the type, as we've done before:
Note that the constructor takes in size dependent parameters and computers emergent parameters from those. The emergent parameters are then used as fields in the N2P2ZD struct.
The above wasn't satisfactory on its own because the user might want to instantiate the model using different size-dependant parameter values. They can now do this using the new function:
Same as the constructor, this takes in the size dependent parameters, does the required computation and instantiates the struct with the computed emergent parameters.
The annoying thing is that if the user wants to use different tracer functions (and arguments) than the default, they have to pass the updated arguments to both functions but I don't see an obvious way around this:
I'd appreciate any feedback on this - the general structure as well the naming conventions. It's worth saying that there is some further refactoring to do in how we handle things like sinking tracers but I'll tackle that in a separate PR.