dmorse / pscfpp

Polymer Self-Consistent Field Theory (C++/CUDA version)
https://pscf-home.cems.umn.edu
GNU General Public License v3.0
27 stars 20 forks source link

Hold ds constant rather than ns in pspc::Block::setLength #104

Closed benmagruder closed 1 year ago

benmagruder commented 1 year ago

This is the first pull request of three for the purpose of changing the handling of ds and ns in Block::setLength. This pull request makes the appropriate changes in pspc (fd1d and pspg will come later). ds is now the parameter that is held (roughly) constant as block length is changed, rather than maintaining a fixed ns. This code has been tested, and it works as desired. All unit tests pass.

The pull request also fixes a few bugs I've found. The first was in filmIteratorBase, where a vector norm was being improperly calculated. The second involved a sweep that we were using for some unit tests and examples. The sweep is for a lamellar structure at low chi, and we were sweeping into the disordered regime so the final state of the sweep was actually a different phase (DIS) than the original (LAM). This seemed like a bad test case to use for unit tests, so I reversed the sweep direction which allows it to stay as LAM throughout the sweep. It is worth noting that I also had to update the reference fields for these sweep unit tests, and the new reference fields differ slightly in pspc vs pspg. This is because pspc now handles block sweeps by changing ns, while pspg still holds ns constant throughout the sweep, and I wanted our unit tests to accurately reflect what we expect the result should be based on how each code handles ds and ns. The difference is very small in the fields, but not small enough for all unit tests to pass if we used the same reference fields for both.