Creating a New Diffusion Kernel #25708
Replies: 5 comments 4 replies
-
|
Hello This is a vector now, when it used to be a scalar before these, _grad_some_variable[_qp] and _grad_u[_qp] are vectors so the product is a dot product. Now, one is a real and you end up returning a vector. This makes sense for a convection term in a PDE If you are trying to substitute one into a conductivity, chances are you're modeling diffusion not convection and a diffusion kernel is a better example to follow Guillaume |
Beta Was this translation helpful? Give feedback.
-
|
OK so just to be clear, in this kernel I have changed the following line to include coupledValue instead of coupledGradient, so is this still producing a vector? _grad_some_variable(coupledValue("some_gradient")) In the .h file I have... VariableValue & _grad_some_variable; I did not change the variable name even though it says _grad_some_variable is physically k_thermal that gets coupld. |
Beta Was this translation helpful? Give feedback.
-
|
Yes that is what I was thought, so still confused. Eventually I want to implement this weak form _grad_u[_qp] * _grad_test[_i][_qp] * _sigma_e[_qp] so that's why I had coupledValue for _grad_some_variable and declared this as VariableValue in the .h file. Eventually _grad_some_variable will be the coupled electrical conductivity _sigma_e. |
Beta Was this translation helpful? Give feedback.
-
|
Yes that worked in my earlier code. Does the order of operation matter? That may be my mistake? My new code gets the compile error. Yes _sigma_e is real. |
Beta Was this translation helpful? Give feedback.
-
|
This worked. Yes I did add now the _grad_test since I ultimately want the diffusion operator. Maybe that was the issue? Real Real |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have diffusion operator kernel written a few years based on the ExampleConvection coupled kernel example in Example 3. In that kernel I added a coupled parameter for temperature, creating a diffusion operator kernel where thermal conductivity is coupled into as its value is a function of temperature.
I have tried the same thing from scratch in my latest MOOSE app from, and made the following changes. Since the example convection kernel is coupling some_gradient
and I want to couple a real value for thermal conductivity, I changed coupledGradient to coupledValue, which is what my old kernel used. Then I changed in the .h file the VariableGradient declaration to VariableValue, and I get a compile error.
private:
const VariableGradient & _grad_some_variable;
My original function compiles and passes tests this one does not. What am I missing? Any suggestions?
These are the errors I get.
Compiling C++ (in opt mode) /Users/johnsevic/projects/moose/examples/ex03_coupling/build/unity_src/kernels_Unity.C...
In file included from /Users/johnsevic/projects/moose/examples/ex03_coupling/build/unity_src/kernels_Unity.C:2:
/Users/johnsevic/projects/moose/examples/ex03_coupling/src/kernels/ExampleConvection.C:35:10: error: no viable conversion from returned value of type 'typename boostcopy::enable_if_c<ScalarTraits::value, TypeVector<typename CompareTypes<double, double>::supertype>>::type' (aka 'libMesh::TypeVector') to function return type 'libMesh::Real' (aka 'double')
return _test[_i][_qp] * (_grad_some_variable[_qp] * _grad_u[_qp]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/johnsevic/projects/moose/examples/ex03_coupling/src/kernels/ExampleConvection.C:41:10: error: no viable conversion from returned value of type 'typename boostcopy::enable_if_c<ScalarTraits::value, TypeVector<typename CompareTypes<double, double>::supertype>>::type' (aka 'libMesh::TypeVector') to function return type 'libMesh::Real' (aka 'double')
return _test[_i][_qp] * (_grad_some_variable[_qp] * _grad_phi[_j][_qp]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
make: *** [/Users/johnsevic/projects/moose/framework/build.mk:151: /Users/johnsevic/projects/moose/examples/ex03_coupling/build/unity_src/kernels_Unity.aarch64-apple-darwin20.0.0.opt.lo] Error 1
Beta Was this translation helpful? Give feedback.
All reactions