feature requestgood first issuewelcome contribution
Description
The current Field APIs, including ScalarField, MatrixField, and Structfield (after #2627) use assertions statements to check input validity, for example,
In software engineering practice, assertion is used to verify whether the program itself is implemented correctly regardless of user inputs, while exceptions/errors are used to check validity of the inputs. Therefore quite a few occurrences of assert statements in field.py and matrix.py are supposed to raise errors.
Contributions are greatly welcomed!