Skip to content

Conversation

@tophmatthews
Copy link
Contributor

@tophmatthews tophmatthews commented Feb 15, 2025

Combines AD/nonAD implementations of ConservativeAdvection. There was a bit of a challenge due velocity being pulled in as a variable in ConservativeAdvection, and velocity pulled in as a material property in ADConservativeAdvection. I still have to do ADMassLumpedTimeDerivative separately and ADInfluxBC separately to enable a true AD upwinding capability.

Ref #15915

@tophmatthews
Copy link
Contributor Author

I need some help on this: I am renaming a param and a coupledvar, and choosing which one to use in the constructor based on isParamValid. isParamValid will pick up a number in the input file applied to a coupledVar, but when I call coupledGenericVectorValue, it does not pick up on this:

*** ERROR ***
Attempted to retrieve default value for coupled variable 'velocity_variable' when none was provided. 

There are three reasons why this may have occurred:
 1. The other version of params.addCoupledVar() should be used in order to provide a default value. 
 2. This should have been a required coupled variable added with params.addRequiredCoupledVar() 
 3. The call to get the coupled value should have been properly guarded with isCoupled()

Help!

@moosebuild
Copy link
Contributor

moosebuild commented Feb 15, 2025

Job Documentation, step Docs: sync website on e875c9b wanted to post the following:

View the site here

This comment will be updated on new commits.

@tophmatthews
Copy link
Contributor Author

I'm guessing it's something missing in Coupleable::getDefaultVectorValue that Coupleable::getDefaultValue doesn't suffer from...

@tophmatthews
Copy link
Contributor Author

no that's not it, it's something in renameParam that doesn't transfer the default correctly!

@tophmatthews
Copy link
Contributor Author

UGH! No, it all comes down to isParamValid being true due to a non-variable value given in the input file, but coupledGenericVectorValue requiring a coupled variable! It doesn't have to be coupled!

@tophmatthews
Copy link
Contributor Author

tophmatthews commented Feb 18, 2025

Here's what I've learned when using params.deprecateCoupledVar("old", "new", "12/31/2025");:

  • if either old or new are provided, then both isParamValid and isParamSetByUser is true for both old and new
  • if neither old nor new are provided, then both isParamValid and isParamSetByUser is false for both old and new
  • if old is provided, coupledGenericVectorValue<is_ad>("old") works, coupledGenericVectorValue<is_ad>("new") gets stuck on Attempted to retrieve default value for coupled variable 'new' when none was provided.
  • if new is provided, coupledGenericVectorValue<is_ad>("new") works, coupledGenericVectorValue<is_ad>("old") gets stuck on Attempted to retrieve default value for coupled variable 'old' when none was provided.

@tophmatthews
Copy link
Contributor Author

For the MaterialPropertyName deprecation in the ad version, I was able to use addDeprecatedParam. For the coupled variable in the non-ad version, I was unable to use deprecateCoupledVar to pass the correct input parameter to use. I added a space to the name to prevent it from doing all the behind the scenes default passing. Not ideal, but should work.

@tophmatthews tophmatthews force-pushed the combine_ad_nonad_conservative_advection_15915 branch from 1bd0e9f to 4cd1bce Compare February 19, 2025 00:43
@tophmatthews tophmatthews force-pushed the combine_ad_nonad_conservative_advection_15915 branch from 4cd1bce to 65fbf23 Compare February 19, 2025 18:09
@tophmatthews
Copy link
Contributor Author

I put in what should make sense...but it just doesn't work...

@tophmatthews tophmatthews force-pushed the combine_ad_nonad_conservative_advection_15915 branch 2 times, most recently from 57ec6d1 to 9fe6047 Compare February 20, 2025 22:15
@moosebuild
Copy link
Contributor

moosebuild commented Feb 21, 2025

Job Coverage, step Generate coverage on e875c9b wanted to post the following:

Framework coverage

49bfce #29889 e875c9
Total Total +/- New
Rate 85.44% 85.44% +0.00% 85.87%
Hits 112378 112399 +21 79
Misses 19152 19152 - 13

Diff coverage report

Full coverage report

Modules coverage

Coverage did not change

Full coverage reports

Reports

Warnings

  • framework new line coverage rate 85.87% is less than the suggested 90.0%

This comment will be updated on new commits.

@tophmatthews tophmatthews marked this pull request as ready for review February 21, 2025 19:33
@tophmatthews
Copy link
Contributor Author

Well I'm a bit bummed because I spent a ton of time combining these, but I'm not totally convinced that upwinding can be applied to AD versions since it overwrites the jacobian definition...probably need your insight @lindsayad

@GiudGiud
Copy link
Contributor

if @lindsayad does not get to it I can take this over post MOOSE-conference

@lindsayad
Copy link
Member

what is the issue? Is there an upwind test that's not working with the AD version?

@tophmatthews
Copy link
Contributor Author

what is the issue? Is there an upwind test that's not working with the AD version?

No, there isn't a particular issue. I need to get the time kernels into AD before I can really test upwinding. It was more of a concern that I was monkeying around with computeJacobian to enable upwinding, and didn't want to mess with the AD and tagging capability built in. A careful review would put my concerns at ease, and then I'll go update the time kernels to AD.

Copy link
Member

@lindsayad lindsayad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm probably going to push some changes to this

@lindsayad lindsayad force-pushed the combine_ad_nonad_conservative_advection_15915 branch from 3bc47f9 to 7190d3e Compare February 25, 2025 20:43
@lindsayad lindsayad changed the title Combine ad nonad conservative advection 15915 [WIP] Combine ad nonad conservative advection 15915 Feb 25, 2025
@lindsayad
Copy link
Member

Need to wait on #29817 to get DenseVector::operator[]

@tophmatthews
Copy link
Contributor Author

Cool thanks @lindsayad ! See I knew I was missing something...

@lindsayad lindsayad self-assigned this Mar 3, 2025
@lindsayad lindsayad force-pushed the combine_ad_nonad_conservative_advection_15915 branch from 7190d3e to 10a1521 Compare March 4, 2025 23:49
@lindsayad lindsayad changed the title [WIP] Combine ad nonad conservative advection 15915 Combine ad nonad conservative advection 15915 Mar 4, 2025
@lindsayad
Copy link
Member

This will further need to wait on libMesh/libmesh#4098 but we are planning to do another libmesh update very soon

@lindsayad lindsayad force-pushed the combine_ad_nonad_conservative_advection_15915 branch from 10a1521 to 257b7f5 Compare March 24, 2025 16:46
@lindsayad
Copy link
Member

Major bummer that the most recent libmesh update merged today did not bring in the begin/end PR 😭

@lindsayad lindsayad force-pushed the combine_ad_nonad_conservative_advection_15915 branch from 257b7f5 to b4de860 Compare April 14, 2025 21:14
@lindsayad
Copy link
Member

@tophmatthews looks like you just need a documentation fixup here

Copy link
Member

@lindsayad lindsayad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GiudGiud could you review my commits please?

@GiudGiud
Copy link
Contributor

GiudGiud commented May 2, 2025

Python failures tied to a package change and unrelated to this PR

@GiudGiud GiudGiud merged commit 50a115b into idaholab:next May 2, 2025
45 of 51 checks passed
@tophmatthews tophmatthews deleted the combine_ad_nonad_conservative_advection_15915 branch May 2, 2025 14:46
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

Successfully merging this pull request may close these issues.

5 participants