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

Inconsistency in the meaning of "phase_index" in source/material_model/utilities.cc #6140

Open
lhy11009 opened this issue Nov 7, 2024 · 0 comments

Comments

@lhy11009
Copy link
Contributor

lhy11009 commented Nov 7, 2024

@gassmoeller. Hi Rene, I noticed that the variable "phase_index" is used in a couple of places in the source/material_model/utilities.cc file. First, it appears in the PhaseFunction.compute_value function as in.phase_index, where it’s used as an input. Then, it shows up in the phase_average_value function, where "phase_index" is used to loop over all the phases.

From the way these variables interact with phase_function_values, it seems like they might have slightly different meanings—one potentially indicating the index of the phase transition and the other referring to the index of the phase.
In the first case, here is a piece of the code link

      for (unsigned int j=0; j < phase_function.n_phase_transitions(); ++j)
        {
          phase_inputs.phase_index = j;
          phase_function_values[j] = phase_function.compute_value(phase_inputs);
        }

And in the second case link

                averaged_parameter += phase_function_values[phase_index-composition_index] * (std::log(parameter_values[phase_index+1]) - averaged_parameter);

Does this interpretation align with your understanding as well? If so, perhaps we could rename in.phase_index to in.phase_transition_index for clarity.

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

1 participant