Writing custom Biphasic code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • ishangupta000794
    Junior Member
    • Apr 2019
    • 27

    Writing custom Biphasic code

    Hello,

    I would like to write my own code for biphasic analysis with different assumptions and a few more changes, especially I want to add mass supply term and remove pressure gradient. Also, I want to have a custom material model. For the material model I can use the material plugin method but how can I join the biphasic code to the simulation or is there any template already that I could use?

    PS: By custom Biphasic code, I mean that I want to code the balance equations by myself

    Best Regards,
    Ishan
    Last edited by ishangupta000794; 09-20-2019, 04:55 AM.
  • maas
    Lead Code Developer
    • Nov 2007
    • 3400

    #2
    Hi Ishan,

    Writing your own biphasic solver will be quite an undertaking, but you should be able to do it with the plugin framework. You will need to do at least the following:
    - create a new solver class, derived from FENewtonSolver that will implement the Quasin method, the Residual, and StiffnessMatrix functions (and a few other).
    - create a new domain class that will implement the volume integrals of the formulation. You also need to implement a domain factory class that will create this domain based on some information that is passed by the user (or read from the input file to be more precise)
    - create a new material class that will hold the material properties.
    - if your formulation has surface integrals, like applied fluid flux, you may need to implement classes derived from FESurfaceLoad.

    With that as a guide, I suggest to first copy the biphasic code into a new plugin and try to get your plugin to do the same as the FEBio code. Then, with your plugin working and reproducing part of the biphasic code in FEBio, you can make your desired changes and implement your custom materials.

    Unfortunately, we don't have any documentation on writing entire new solvers as plugins, but you might want to take a look at the FEBioChem plugin, since it implements a complete nonlinear solver plugin and many of the classes here you will also need to implement.

    Let us know if you have any further questions and good luck

    Cheers,

    Steve
    Department of Bioengineering, University of Utah
    Scientific Computing and Imaging institute, University of Utah

    Comment

    • ishangupta000794
      Junior Member
      • Apr 2019
      • 27

      #3
      Hello Steve,

      Thank you for such a detailed answer. Is there a simpler way to add only the "mass supply/production term" for solid phase?

      Also, the following might be stupid questions but I'm not very sure how to begin with this.

      As you have suggested to copy and run the biphasic code as a plugin, do you mean that I should create a complete plugin folder with solvers and other codes(copied needed for biphasic analysis from the source code) as in the case of FEBioChem plugin and then try running it?

      Can the files like 'FEBioMech/FEElasticMaterial.h' included in biphasic code be read by the plugin itself or do I need to add them to the plugin folder? I understand if that if I need changes in such kind of files, I should have them in the plugin folder but do I need to that otherwise?

      Also, where are the solver files for FEBiphasic code? To be specific, residuals and tolerance. I can see the matrix and other calculations in the code.

      I would really appretite your help in this regard.

      Best Regards,
      Ishan
      Last edited by ishangupta000794; 09-24-2019, 03:37 AM.

      Comment

      • ishangupta000794
        Junior Member
        • Apr 2019
        • 27

        #4
        Hello Steve,

        Could you please reply to my questions soon?

        Thank You,
        Ishan Gupta

        Comment

        • ateshian
          Developer
          • Dec 2007
          • 1824

          #5
          Hi Ishan,

          Is there a simpler way to add only the "mass supply/production term" for solid phase?
          Adding a mass supply/production term for the solid phase would require updating the biphasic module as Steve mentioned. The simpler way is to use the existing multiphasic module, which currently includes a mass supply/production term for the solid phase. The multiphasic module includes biphasic materials as a special case (i.e., no solutes). If you choose to use this module you will not have to write an entire plugin to extend the biphasic module. If you would like some assistance with this, please provide us with some more details about the type of mass supply you need for the solid (e.g., a model, or an equation, or a literature reference).
          do you mean that I should create a complete plugin folder with solvers and other codes(copied needed for biphasic analysis from the source code) as in the case of FEBioChem plugin and then try running it?
          Yes.
          Can the files like 'FEBioMech/FEElasticMaterial.h' included in biphasic code be read by the plugin itself or do I need to add them to the plugin folder?
          They can be read by the plugin itself.
          I understand if that if I need changes in such kind of files, I should have them in the plugin folder
          Yes, and you need to rename them. FEElasticMaterial is a base class inherited by all elastic materials, so you should be careful to change this base class.
          Also, where are the solver files for FEBiphasic code? To be specific, residuals and tolerance.
          All the relevant biphasic files are in the FEBioMix folder. The biphasic solver is FEBiphasicSolver. It is class inherited from the solid solver FEBioMech/FESolidSolver2, so it only includes the pressure tolerance.

          Best,

          Gerard

          Comment

          • ishangupta000794
            Junior Member
            • Apr 2019
            • 27

            #6
            Hello Gerard,

            I have attached the pdf of literature. I want to reproduce this model. Equation number 4 is the mass supply term.
            I would really appretiate if you could assist me with this.

            Best Regards,
            Ishan
            Attached Files

            Comment

            • ateshian
              Developer
              • Dec 2007
              • 1824

              #7
              Hi Ishan,

              The model that you want to implement is a special case of the Rodriguez et al. (1994) growth model, where the deformation gradient is decomposed into an elastic deformation and a growth tensor. This is a popular growth model that we haven't yet implemented in FEBio but we should. I'll spend a little time to work on a plugin that implements the general form of this growth model, and I'll make it sufficiently flexible so that users can select a variety of constitutive models for the growth evolution. I'll let you know when it is done.

              Best,

              Gerard

              Comment

              • ishangupta000794
                Junior Member
                • Apr 2019
                • 27

                #8
                Hello Gerard,

                Could you please tell me the approximate time this will take?

                Best Regards,
                Ishan Gupta

                Comment

                • ateshian
                  Developer
                  • Dec 2007
                  • 1824

                  #9
                  Hi Ishan,

                  The finite element implementation of the Rodriguez growth model is not trivial. The most challenging part is the evaluation of the elasticity tensor when the growth is strain- or stress-dependent. I need to review various literature papers to see how others have implemented it. I am doing this during my spare time so I cannot tell you for certain when it will be done, but I expect it will take a week or two.

                  I have already implemented the growth model where the growth is prescribed (i.e., not a function of loading, but simply determined by user-defined load curves for volume, area and fiber growth). If you would like to take over the task from there, I can share the plugin files with you.

                  Best,

                  Gerard
                  Last edited by ateshian; 10-13-2019, 04:10 PM.

                  Comment

                  • ishangupta000794
                    Junior Member
                    • Apr 2019
                    • 27

                    #10
                    Hello Gerard,

                    Thank you for the reply. Two weeks is not a problem since I'm going for a conference next week.

                    Best Regards,
                    Ishan Gupta

                    Comment

                    • ateshian
                      Developer
                      • Dec 2007
                      • 1824

                      #11
                      Hi Ishan,

                      I looked more closely at the Rodriguez growth model and some of the literature papers describing its finite element implementation but I regret that I am unable to figure out a general finite element implementation of this framework that would work for arbitrary constitutive relations for the growth. This prevents me from creating a plugin that could easily be modified by any user to match a desired growth model. The main problem is the evaluation of the tangent stiffness matrix (the elasticity tensor) when the growth is either strain or stress-dependent, isotropic or anisotropic, using an elastic material that is either isotropic or anisotropic, and where one or more structural tensors defining the material anisotropy may evolve with growth.

                      I realize that this may limit your options. Maybe you can find some paper that provides a sufficiently detailed finite element method for the specific model you need to use.

                      Best,

                      Gerard

                      Comment

                      • ishangupta000794
                        Junior Member
                        • Apr 2019
                        • 27

                        #12
                        Hi Gerard,

                        Could you send me the files that you have prepared?

                        BR
                        Ishan

                        Comment

                        • ateshian
                          Developer
                          • Dec 2007
                          • 1824

                          #13
                          Hi Ishan,

                          Here they are: FERodriguezGrowth.zip

                          Best,

                          Gerard

                          Comment

                          • ishangupta000794
                            Junior Member
                            • Apr 2019
                            • 27

                            #14
                            Hello Gerard,

                            Which material model in FEBio uses Newton Raphsons solver other than the FEBio Chem plugin? I have checked Biphasic and triphasic models but couldn't find it there.

                            The problem is that there is effective stress in the weak form of Biphasic material. I'll have to use tangential stiffness matrix and some kind of iterative procedure to calculate he stresses (Can't find the implementation of tangential stiffness matrix in Biphasic code).
                            I'm looking for a model with newton Raphsons to know where to introduce the solver in the material model. I can see the separate files for solvers but I'm not sure where to introduce it in the main code.

                            Best Regards,
                            Ishan Gupta

                            Comment

                            • ateshian
                              Developer
                              • Dec 2007
                              • 1824

                              #15
                              Hi Ishan,

                              FEBio's code is structured such that all the modules can use the Newton solver and its quasi-Newton variants (BFGS and Broyden). The Newton solver is the default (and currently preferred) solver.

                              The iterative procedure for the Newton solver is handled in the solver class, outside of the description of each domain (elastic, biphasic, etc.). This design means that you should not really alter anything in the Newton solver just because you are introducing your own custom material.

                              A biphasic material (FEBiphasic) is a mixture of a solid and a fluid. The solid material is described by the same class of solid materials used in structural analyses (FEElasticMaterial, which is derived from FESolidMaterial). The flow of fluid within the porous solid is governed by the permeability tensor, which is described in its own class (FEHydraulicPermeability). The tangential stiffness matrix for a biphasic material uses the tangential stiffness evaluated for each of these two classes (FESolidMaterial->Tangent and FEHydraulicPermeability->Tangent_Permeability_Strain).

                              When you implement a new material (derived from either FEElasticMaterial or FEHydraulicPermeability) you need to supply the tangent routine to that material. In other words, the classes I have described so far are abstract classes, they don't implement specific constitutive models. For example, look up FENeoHookean as a prototype for a FEElasticMaterial. Its Tangent function is given in FENeoHookean.cpp. For hydraulic permeability you can look up FEPermHolmesMow.h and FEPermHolmesMow.cpp.

                              Let me know if you require clarifications.

                              Best,

                              Gerard

                              Comment

                              Working...
                              X
                              😀
                              😂
                              🥰
                              😘
                              🤢
                              😎
                              😞
                              😡
                              👍
                              👎