Data mapping problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • FEBUser20
    Junior Member
    • Nov 2020
    • 23

    Data mapping problem

    Hello,

    for my current study, I am using a custom material model. This material has a parameter that has six values assigned to it.

    Example of how the parameter is used in the input file:
    <customparameter>1, 1, 1, 0.5, 0.7, 0.8</customparameter>.

    In the source code, this parameter is declared as follows:
    "double m_customparameter[6];"

    I tried to map the parameter....
    <MeshData>
    <ElementData name="map_customparameter" elem_set="elem_set">
    <elem lid="1">1,1,1,0.5,0.5,0.5</elem>
    <elem lid="2">1,1,1,0.5,0.6,0.8</elem>
    ...
    </ElementData>
    </MeshData>

    ... but unfortunately this results in the following error message:

    Tag "elem": invalid value

    I would like to make the element-wise mapping work for this parameter as well. How do I have to change the source code so that the mapping works also in this case?
    I guess that you have to make a change in the FEBioMeshDataSection3.cpp (see picture in the attachment)...???. I hope that someone can help me.

    Best regards,

    Richard
    Attached Files
  • ateshian
    Developer
    • Dec 2007
    • 1853

    #2
    Hi Richard,

    Instead of declaring it as a double, use FEParamDouble, then extract the content of the FEParamDouble pointer as shown in FENeoHookean. Remember to #include <FECore/FEModelParam.h> in the header file where you declare m_customparameter.

    Best,

    Gerard

    Comment

    • FEBUser20
      Junior Member
      • Nov 2020
      • 23

      #3
      Hello Gerard,

      thank you for your quick reply.
      I have changed the source code according to your advice. However, the problem still exists. In addition, the mapping also does not work with standard materials in FEBio such as "PermRefOrtho". I tried to map the parameter "perm1" (see input file in the attachment).
      I would be very grateful if you could help me further.

      Best,

      Richard
      Attached Files

      Comment

      • ateshian
        Developer
        • Dec 2007
        • 1853

        #4
        Hi Richard,

        It turns out that FEParamDouble arrays cannot be mapped (which is the reason that your implementation and PermRefOrtho fail). In your case you want to map a quantity with six values, so *in principle* you should use FEParamMat3ds which maps symmetric 3x3 matrices (thus, 6 values). However, the FEBio code currently does not recognize mapped mat3ds quantities (the User's Manual indicates that it recognizes scalar, vec2 and vec3 quantities). Looking at the code I see that mapping FEParamMat3d parameters (9 values) is already implemented (but not yet documented), and you would need to include datatype="mat3" in the MeshData section, e.g.,
        Code:
        <ElementData name="map_customparameter" datatype="mat3" elem_set="elem_set">
        Of course, you would also need to provide three extraneous values for your custom parameters. Alternatively, you can use two FEParamVec3 entries to represent the six values you want to map. Or you can wait for the update to the FEBio code that includes mapping of FEParamMat3ds parameters. I've committed this update to the code and in principle it should become available tomorrow in the development version of FEBioStudio. However, I'll rely on you to test that capability, so please let me know if you encounter errors. You will need to use datatype="mat3s" for that.

        I have also updated and committed changes to FEPermRefOrtho to use FEParamVec3 parameters instead of 3D arrays of FEParamDouble parameters. You can view those changes to see how you can extract the FEParamMat3d or FEParamMat3ds parameters needed for your custom material. (Those changes appear in the GitHub repository.)

        Best,

        Gerard

        Comment

        • FEBUser20
          Junior Member
          • Nov 2020
          • 23

          #5
          Hello Gerard,

          thank you for the great support.
          I have tested your update of the development version of FEBio. The mapping of "vec3" quantities for the model "PermRefOrtho" now works without any problems.
          Nevertheless, the mapping of "mat3ds" quantities still causes problems.
          I found out that in "FEBioMeshDataSection3" the function
          Code:
          void FEBioMeshDataSection3::ParseElementData(XMLTag& tag, FEDomainMap& map)
          is called. Here, the case
          Code:
          case FE_MAT3DS : map.setValue(n, mat3ds(v[0], v[1], v[2], v[3], v[4], v[5]); break;
          is missing (as far as I can tell).
          After this addition, the input file is read without problems. However, the calculation stops after a short time due to a "nan" error. The reason for this is that when extracting the 6 parameter values in the material model, the variable consists only of zeros.Unfortunately, I could not find out what causes the problem.

          Example of how I extract the data:
          Code:
              
          double FEPermFiberDistribution::FiberDensity(FEMaterialPoint& mp, const vec3d& n0)
          {
          mat3ds customparameter = m_customparameter(mp);
          double cxx = customparameter.xx();
          double cyy = customparameter.yy();
          ...
          }
          Do you know what could cause the problem?

          Best,

          Richard



          Comment

          • ateshian
            Developer
            • Dec 2007
            • 1853

            #6
            Hi Richard,

            It turns out there were a few other changes I needed to make to get this to work. I committed more changes on GitHub, so please update to this latest development version and try it again.

            One more thing: You now need to also specify the format of the ElementData as "ITEM", e.g.,
            Code:
            <ElementData name="map_perm" datatype="mat3s" format="ITEM" elem_set="elem_set">
            Please try it out and let me know if it finally works for you. (I was able to get it to work on a sample model I created.)

            Best,

            Gerard

            Comment

            • ateshian
              Developer
              • Dec 2007
              • 1853

              #7
              I made one more minor change to make the default format for "mat3s" be format="ITEM". So you don't need to include the format in <ElementData>.

              Comment

              • FEBUser20
                Junior Member
                • Nov 2020
                • 23

                #8
                Hello Gerard,

                I tried it out and it works well for me. Thank you very much for the support.

                Best,

                Richard

                Comment

                Working...
                X