-
Notifications
You must be signed in to change notification settings - Fork 4
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
Out-of-scope k
variable usage when updating source terms.
#225
Comments
Having delved into the code some more, I believe that what's meant to be happening in these loops is that:
However, we should clarify this and make these associations explicit if we are! We may additionally need to regenerate the test data if we are meant to be using |
This is a good spot and it is indeed an error in the code (which I know you already know!). This part of the code hasn't been used for some time and I need to go back into the theory to test this. In particular, this part of the code will only be encountered when dispersive materials are modelled. As mentioned, I haven't used this feature for >15 years. Can we create an issue for me to generate a test that will use the dispersive materials feature, and also to double check what this k-value should be, as I am 99% confident that Will has the correct solution? |
I agree with this @willGraham01 |
As discussed, @willGraham01 , please make change as described above, I will review later. |
* Cherry-pick Sam's linting * Add flag to Source class to indicate empty array * Add flag to Source class to indicate empty array * Indentation * Initialise values rather than assign * Refactored source updates - flagged mystery indexing * Pre-commit consistency with #223 * Update clang-format to #222 settings * Fix out-of-order initilisation warning * Revert pre-commit to suppress GitHub failures until #223 is ready * Remove unused variables in updating Ksource terms * Start refactoring the refactored functions. Flag more inconsistencies * Missing std:: * Merge E_s steady-state updates into one function (revert files to previous commit if undesired) * Fix bugs in unification (IE Will can't type) * Pull out E_s source updates, and wrap to avoid empty-source updates * Pull out H-source updates, don't add empty array checks yet * Fully refactor H-field, now to find the bug... * Add that newline to make pre-commit happy * Missed a -1 in ONE place... does this fix the bug? * Remove useless comment * Apply Peter's suggestion on #226 * Add Peter's resolution to #225 * Apply Sam's suggestions for SourceIndex struct * Small doc changes that didn't get caught
* Cherry-pick Sam's linting * Add flag to Source class to indicate empty array * Add flag to Source class to indicate empty array * Indentation * Initialise values rather than assign * Refactored source updates - flagged mystery indexing * Pre-commit consistency with #223 * Update clang-format to #222 settings * Fix out-of-order initilisation warning * Revert pre-commit to suppress GitHub failures until #223 is ready * Remove unused variables in updating Ksource terms * Start refactoring the refactored functions. Flag more inconsistencies * Missing std:: * Merge E_s steady-state updates into one function (revert files to previous commit if undesired) * Fix bugs in unification (IE Will can't type) * Pull out E_s source updates, and wrap to avoid empty-source updates * Pull out H-source updates, don't add empty array checks yet * Fully refactor H-field, now to find the bug... * Add that newline to make pre-commit happy * Missed a -1 in ONE place... does this fix the bug? * Remove useless comment * Apply Peter's suggestion on #226 * Add Peter's resolution to #225 * Apply Sam's suggestions for SourceIndex struct * Small doc changes that didn't get caught
* Cherry-pick Sam's linting * Add flag to Source class to indicate empty array * Add flag to Source class to indicate empty array * Indentation * Initialise values rather than assign * Refactored source updates - flagged mystery indexing * Pre-commit consistency with #223 * Update clang-format to #222 settings * Fix out-of-order initilisation warning * Revert pre-commit to suppress GitHub failures until #223 is ready * Remove unused variables in updating Ksource terms * Start refactoring the refactored functions. Flag more inconsistencies * Missing std:: * Merge E_s steady-state updates into one function (revert files to previous commit if undesired) * Fix bugs in unification (IE Will can't type) * Pull out E_s source updates, and wrap to avoid empty-source updates * Pull out H-source updates, don't add empty array checks yet * Fully refactor H-field, now to find the bug... * Add that newline to make pre-commit happy * Missed a -1 in ONE place... does this fix the bug? * Remove useless comment * Apply Peter's suggestion on #226 * Add Peter's resolution to #225 * Apply Sam's suggestions for SourceIndex struct * Small doc changes that didn't get caught
* Cherry-pick Sam's linting * Add flag to Source class to indicate empty array * Add flag to Source class to indicate empty array * Indentation * Initialise values rather than assign * Refactored source updates - flagged mystery indexing * Pre-commit consistency with #223 * Update clang-format to #222 settings * Fix out-of-order initilisation warning * Revert pre-commit to suppress GitHub failures until #223 is ready * Remove unused variables in updating Ksource terms * Start refactoring the refactored functions. Flag more inconsistencies * Missing std:: * Merge E_s steady-state updates into one function (revert files to previous commit if undesired) * Fix bugs in unification (IE Will can't type) * Pull out E_s source updates, and wrap to avoid empty-source updates * Pull out H-source updates, don't add empty array checks yet * Fully refactor H-field, now to find the bug... * Add that newline to make pre-commit happy * Missed a -1 in ONE place... does this fix the bug? * Remove useless comment * Apply Peter's suggestion on #226 * Add Peter's resolution to #225 * Apply Sam's suggestions for SourceIndex struct * Small doc changes that didn't get caught
The variable
k
is used in theKsource
update loop, with a specific instance here, despite not being a loop variable.This is only possible since the indexing-variables are declared right at the top of
execute()
. In the previous two loops (Isource
,Jsource
),k
is a loop variable so this is fine. However in theKsource
update loop onlyi
andj
are loop variables. It is only becausek
is globally scoped that the code compiles: but then we also notice that in this loop the valuek
is not changing, but is fixed tok = inputs.K1.index
, and is still being used to fetch constants from the input matrices!The text was updated successfully, but these errors were encountered: