Material property requested by kernel is not defined on block 0?

550 views
Skip to first unread message

walkand...@gmail.com

unread,
Sep 27, 2017, 5:36:51 AM9/27/17
to moose-users
Dear all,
    Thanks for your help. Now I can couple the tensor mechanics with the diffusion equation together.
    But now I have a new problem. Since in the diffusion equation, I need the derivative of Sigma over c, so I need this forth-order-tensor matrix Cijkl.

    I did this in my header file:
*************************************************
#include "Kernel.h"

class ExampleC;
class RankFourTensor;

template <>
InputParameters validParams<ExampleC>();

class ExampleC:public Kernel
{
public:
    ExampleC(const InputParameters &parameters);

protected:
    virtual Real computeQpResidual() override ;
    virtual Real computeQpJacobian() override ;
    const VariableGradient &_grad_couple_stress;

    const Real &_D;
    const MaterialProperty<RankFourTensor> &_Cijkl;
};
*************************************************

then for the source file, I use the getMaterialProperty to get the Cijkl, it looks like:
*************************************************
#include "ExampleC.h"
#include "RankFourTensor.h"

template <>
InputParameters validParams<ExampleC>()
{
    InputParameters params=validParams<Kernel>();

    params.addRequiredParam<Real>("D","diffusion");
    params.addRequiredCoupledVar("couple_stress","hydrostatic stress");

    params.addRequiredParam<MaterialPropertyName>("Cijkl","Cijkl name");

    return params;
}

ExampleC::ExampleC(const InputParameters &parameters)
        :Kernel(parameters),
         _D(getParam<Real>("D")),
         _grad_couple_stress(coupledGradient("couple_stress")),
         _Cijkl(getMaterialProperty<RankFourTensor>("Cijkl"))
{}
*************************************************

then in my input file, I did this:
*************************************************
[Kernels]
  [./TensorMechanics]
    displacements = 'disp_x disp_y'
  [../]

  [./dcdt]
    type = TimeDerivative
    variable = c
  [../]
  [./c_diff]
    type = ExampleC
    variable = c
    couple_stress = hystress
    D = 0.1
    Cijkl = CIJKL
    block = 0
  [../]
[]

[Materials]
  [./CIJKL]
    type = ComputeIsotropicElasticityTensor
    youngs_modulus = 14.8619240917
    poissons_ratio = 0.3
    block = 0
  [../]
  [./eigen_fun]
    type = DerivativeParsedMaterial
    function = (c-0.5)/3.0
    args = c
    f_name = c_fun
  [../]
  [./eigen_strain]
    type = ComputeVariableEigenstrain
    args = c
    prefactor = c_fun
    eigen_base = '1 1 1 0 0 0'
    eigenstrain_name = eigen_strain
    #outputs = exodus
  [../]
  [./strain]
    type = ComputeSmallStrain
    displacements = 'disp_x disp_y'
    eigenstrain_names = eigen_strain
  [../]
  [./stress]
    type = ComputeLinearElasticStress
  [../]
[]
*************************************************

But this give me an error:

Material property 'CIJKL', requested by 'c_diff' is not defined on block 0


I try to give 'block=0' in both the material part and kernel part, the error is still there. My domain is a rectangle domain, only one block.


So now, I can just use the youngs_modulus and poissons_ratio to compute the Cijkl manually.



So for short, my questions are:


1. How to get the forth-order-tensor material(and other tensor like stress and strain) in my own kernel correctly? I need this to do the coupling things.


2. How to get the second-order-tensor(i.e. stress and strain) and its derivative over given args(for example, c or U)

what I mean is:

(1)-get strain

(2)-get dstrain/u or dstress/dc (where the stress_ij=C_ijkl[strain_kl-(c-c_ref)delta_kl])


I see the AllenCahnPFFracture has some code did this, but not sure how to use it correctly in my own kernel: http://mooseframework.org/docs/doxygen/modules/AllenCahnPFFracture_8h_source.html

http://mooseframework.org/docs/doxygen/modules/PFFractureBulkRateBase_8C_source.html


I know Moose has the 'Derivativematerialinterface' in :

http://mooseframework.org/wiki/MooseSystems/Materials/Derivativematerialinterface/


so it shouldn't be so difficult right?

Any helpful suggestions?


Best regards


Cody Permann

unread,
Sep 27, 2017, 3:41:24 PM9/27/17
to moose-users
I don't immediately see the problem here. We have numerous tests that do this very thing and they work fine. Do you happen to have a public application that we can take a look at?

--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/moose-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/moose-users/e28ae734-e284-4bb1-8eb3-20d9562a3bd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Schwen

unread,
Sep 27, 2017, 6:31:20 PM9/27/17
to moose-users
The problem is that block names and material property names are not the same thing! The CIJKL material declares the `elasticity_tensor` material property. This is what you need to pass in (Cijkl = elasticity_tensor)

walkand...@gmail.com

unread,
Sep 28, 2017, 3:49:14 AM9/28/17
to moose-users


在 2017年9月27日星期三 UTC+2下午9:41:24,Cody Permann写道:
I don't immediately see the problem here. We have numerous tests that do this very thing and they work fine. Do you happen to have a public application that we can take a look at?

Hi Cody, thank you sincerely for the reply. I tried Daniel's solution and it works. The problem is I given a wrong material property name.

Thank you!

walkand...@gmail.com

unread,
Sep 28, 2017, 3:53:40 AM9/28/17
to moose-users


在 2017年9月28日星期四 UTC+2上午12:31:20,Daniel Schwen写道:
The problem is that block names and material property names are not the same thing! The CIJKL material declares the `elasticity_tensor` material property. This is what you need to pass in (Cijkl = elasticity_tensor)


Thank you so much Daniel, I followed your suggestion and it works.
So these 'elasticity_tensor', 'stress' and 'strain' are the only valid keywords when I need to use the getMaterialProperty in my own kernel?

Daniel Schwen

unread,
Sep 28, 2017, 10:06:22 AM9/28/17
to moose...@googlegroups.com
So these 'elasticity_tensor', 'stress' and 'strain' are the only valid keywords when I need to use the getMaterialProperty in my own kernel?
 
No! Most definitely not! They are not `keywords` in the sense that there is a limited and predefined set. They are identifiers that are set by the material class that provides the property. Just search for declareProperty in MOOSE framework and modules and you will find hundreds of material property names. Many are set up to be user defined. Look at GenericConstantMaterial for example. It defines a set of properties with constant values and the property names are given by the user in the input file.

walkand...@gmail.com

unread,
Sep 29, 2017, 3:53:16 AM9/29/17
to moose-users
Thank you Daniel, I will read that part carefully.

Best regards

在 2017年9月28日星期四 UTC+2下午4:06:22,Daniel Schwen写道:
Reply all
Reply to author
Forward
0 new messages