idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.62k stars 1.01k forks source link

Adds aux kernel to extract components of material type std::vector #5331

Closed SudiptaBiswas closed 8 years ago

SudiptaBiswas commented 8 years ago

This adds aux kernel to extract components of material type std::vector. Closes issue #5308.

moosebuild commented 8 years ago

Results of testing 02cc36ab3cd2c2d6b4cdce7f97268cc527bb1a6e using moose_PR_pre_check recipe:

Failed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18864

moosebuild commented 8 years ago

Results of testing 4d04265e0811c55252030a6132a6e0633f0b1b73 using moose_PR_pre_check recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18877

moosebuild commented 8 years ago

Results of testing 4d04265e0811c55252030a6132a6e0633f0b1b73 using moose_PR_test_dbg recipe:

Failed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18879

moosebuild commented 8 years ago

Results of testing 4d04265e0811c55252030a6132a6e0633f0b1b73 using moose_PR_app_tests recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18880

moosebuild commented 8 years ago

Results of testing 4d04265e0811c55252030a6132a6e0633f0b1b73 using moose_PR_test recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18878

moosebuild commented 8 years ago

Results of testing 2392bf93a8a6b73fe4365685c537817fbbdc4bcf using moose_PR_pre_check recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18885

moosebuild commented 8 years ago

Results of testing 2392bf93a8a6b73fe4365685c537817fbbdc4bcf using moose_PR_test recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18886

dschwen commented 8 years ago

Something went wrong with the rebase again. You have a commit by Mike Tonks in there

moosebuild commented 8 years ago

Results of testing 2392bf93a8a6b73fe4365685c537817fbbdc4bcf using moose_PR_test_dbg recipe:

Failed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18887

moosebuild commented 8 years ago

Results of testing 2392bf93a8a6b73fe4365685c537817fbbdc4bcf using moose_PR_app_tests recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18888

moosebuild commented 8 years ago

Results of testing a47978763d5638ec067f2913b20e8403c741114b using moose_PR_pre_check recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18889

moosebuild commented 8 years ago

Results of testing a47978763d5638ec067f2913b20e8403c741114b using moose_PR_app_tests recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18892

moosebuild commented 8 years ago

Results of testing a47978763d5638ec067f2913b20e8403c741114b using moose_PR_test recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18890

moosebuild commented 8 years ago

Results of testing a47978763d5638ec067f2913b20e8403c741114b using moose_PR_test_dbg recipe:

Failed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18891

dschwen commented 8 years ago

I suggest you try running the tests in debug mode locally using

./run_tests --dbg

It looks like the mooseAssert cannot be in the constructor. Remember what we discussed when material properties are initialized? At construction time of the AuxKernel the material properties will not be set to meaningful values, so you cannot call .size() on them. Just move the mooseAssert into the computeValue function (for dbg we do not care about performance too much). Even better would be to have a check that is always enabled in timestepSetup() like we did in the rigid body motion work.

permcody commented 8 years ago

You should probalby do your checks in initialSetup().

On Wed, Jul 1, 2015 at 1:16 PM, Daniel Schwen notifications@github.com wrote:

I suggest you try running the tests in debug mode locally using

./run_tests --dbg

It looks like the mooseAssert cannot be in the constructor. Remember what we discussed when material properties are initialized? At construction time of the AuxKernel the material properties will not be set to meaningful values, so you cannot call .size() on them. Just move the mooseAssert into the computeValue function (for dbg we do not care about performance too much). Even better would be to have a check that is always enabled in timestepSetup() like we did in the rigid body motion work.

— Reply to this email directly or view it on GitHub https://github.com/idaholab/moose/pull/5331#issuecomment-117798938.

friedmud commented 8 years ago

Checks on the size of material properties cannot be done in initialSetup() either.

The only place to do them is in computeValue()

SudiptaBiswas commented 8 years ago

We are avoiding putting the error check in computeValue(), since the compute value gets overwritten in derived classes and we wanted this error check in the base class. For now we are putting this is timestepSetup().

dschwen commented 8 years ago

What's wrong with doing the check timestepSetup() for now? (apart from being a little bit hacky)

permcody commented 8 years ago

The fact that it's hacky...

On Wed, Jul 1, 2015 at 2:35 PM Daniel Schwen notifications@github.com wrote:

What's wrong with doing the check timestepSetup() for now? (apart from being a little bit hacky)

— Reply to this email directly or view it on GitHub https://github.com/idaholab/moose/pull/5331#issuecomment-117817842.

friedmud commented 8 years ago

You CANT do it in timestepSetup(). Guys... slow down and think about this thing for a minute. We're trying to test the size of a material property.... that is ONLY going to be valid when your "on element". timestepSetup(), initialSetup(), the constructor, etc.... get called outside of element loops where material properties are simply invalid.

dschwen commented 8 years ago

Well, the material properties don't simply vanish between the element loops. We have a fixed bit of memory (to which we hand out references, so it better be fixed!) and in our case want the exact same vector size at every quad point. As far as I understand we should totally be able to initialize this material property object and set all the vectors for each qp to the desired size once and for all. In computeQpProperty we'd then just fill in the vectors without ever worrying about them being sized correctly. What am I missing in this picture?

permcody commented 8 years ago

Daniel's right, we resize these properties conservatively early (I believe in the ComputeMaterialPropsThread). I just need time to look at how to make sure that's called before initialSetup() if that even makes sense. Full disclosure, I haven't really looked at Sudipta's PR yet nor given this much thought. Stateful properties may also through another wrench into the works.

On Wed, Jul 1, 2015 at 4:15 PM Daniel Schwen notifications@github.com wrote:

Well, the material properties don't simply vanish between the element loops. We have a fixed bit of memory (to which we hand out references, so it better be fixed!) and in our case want the exact same vector size at every quad point. As far as I understand we should totally be able to initialize this material property object and set all the vectors for each qp to the desired size once and for all. In computeQpProperty we'd then just fill in the vectors without ever worrying about them being sized correctly. What am I missing in this picture?

— Reply to this email directly or view it on GitHub https://github.com/idaholab/moose/pull/5331#issuecomment-117839590.

friedmud commented 8 years ago

You're depending on a side effect that isn't true in all cases... and might not be true in the future if we change things about the way material property storage is handled.

For instance, with stateful material properties you cannot depend on the size of that material property being correct outside of an element loop AT ALL. In fact, it should be zero sized if everything is done correctly.

Without stateful properties you're depending on the last element hit by the last element loop NEEDING that material property at all. You're basically referencing invalid memory (we never guarantee the contents of qp indexed arrays outside of element loops) and hoping it works out ok. Any number of things could happen between the end of an element loop and the next call of timestepSetup() or initialSetup().

SudiptaBiswas commented 8 years ago

I am putting the error check in ComputeValue of individual derived classes then. Here, the error check gets repeated in all the files but probably this way the AuxKernel could be used for all materials in general, not only for our specific case.

moosebuild commented 8 years ago

Results of testing 4df6632ae0d6fc1f14622973624cb84a12b842f6 using moose_PR_pre_check recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18893

moosebuild commented 8 years ago

Results of testing 4df6632ae0d6fc1f14622973624cb84a12b842f6 using moose_PR_app_tests recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18896

moosebuild commented 8 years ago

Results of testing 4df6632ae0d6fc1f14622973624cb84a12b842f6 using moose_PR_test recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18894

moosebuild commented 8 years ago

Results of testing 4df6632ae0d6fc1f14622973624cb84a12b842f6 using moose_PR_test_dbg recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18895

moosebuild commented 8 years ago

Results of testing 8db0584356f69235256939b46ee8ffd7dab5d405 using moose_PR_pre_check recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18914

moosebuild commented 8 years ago

Results of testing 8db0584356f69235256939b46ee8ffd7dab5d405 using moose_PR_app_tests recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18917

moosebuild commented 8 years ago

Results of testing 8db0584356f69235256939b46ee8ffd7dab5d405 using moose_PR_test recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18915

moosebuild commented 8 years ago

Results of testing 8db0584356f69235256939b46ee8ffd7dab5d405 using moose_PR_test_dbg recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18916

dschwen commented 8 years ago

Apart form my comments this looks nice.

moosebuild commented 8 years ago

Results of testing 7cdf14eca30664248e0768042dad77b7483bde69 using moose_PR_pre_check recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18926

moosebuild commented 8 years ago

Results of testing 689088e04519485e448fac3dbde37049bfb95a61 using moose_PR_pre_check recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18930

moosebuild commented 8 years ago

Results of testing 5e4d5b19dc2826b974783b9d0225ab00054c2743 using moose_PR_pre_check recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18934

moosebuild commented 8 years ago

Results of testing 689088e04519485e448fac3dbde37049bfb95a61 using moose_PR_test recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18931

moosebuild commented 8 years ago

Results of testing 5e4d5b19dc2826b974783b9d0225ab00054c2743 using moose_PR_app_tests recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18937

moosebuild commented 8 years ago

Results of testing 7cdf14eca30664248e0768042dad77b7483bde69 using moose_PR_test recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18927

moosebuild commented 8 years ago

Results of testing 7cdf14eca30664248e0768042dad77b7483bde69 using moose_PR_app_tests recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18929

moosebuild commented 8 years ago

Results of testing 5e4d5b19dc2826b974783b9d0225ab00054c2743 using moose_PR_test recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18935

moosebuild commented 8 years ago

Results of testing 689088e04519485e448fac3dbde37049bfb95a61 using moose_PR_app_tests recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18933

moosebuild commented 8 years ago

Results of testing 5b6f2a86074271ad85e0b81a7fc9bc998dc681fd using moose_PR_pre_check recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18938

moosebuild commented 8 years ago

Results of testing 5b6f2a86074271ad85e0b81a7fc9bc998dc681fd using moose_PR_app_tests recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18941

moosebuild commented 8 years ago

Results of testing 5b6f2a86074271ad85e0b81a7fc9bc998dc681fd using moose_PR_test recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18939

moosebuild commented 8 years ago

Results of testing 7cdf14eca30664248e0768042dad77b7483bde69 using moose_PR_test_dbg recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18928

moosebuild commented 8 years ago

Results of testing 5e4d5b19dc2826b974783b9d0225ab00054c2743 using moose_PR_test_dbg recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18936

moosebuild commented 8 years ago

Results of testing 689088e04519485e448fac3dbde37049bfb95a61 using moose_PR_test_dbg recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18932

moosebuild commented 8 years ago

Results of testing 5b6f2a86074271ad85e0b81a7fc9bc998dc681fd using moose_PR_test_dbg recipe:

Passed on: linux-gnu

View the results here: https://www.moosebuild.org/view_job/18940