-
Notifications
You must be signed in to change notification settings - Fork 18
Adhesion #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nimasina-innovation
wants to merge
23
commits into
development
Choose a base branch
from
adhesion
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Adhesion #140
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
19da18a
The updated adhesion with the development branch
949045a
Merge branch 'development' into adhesion
fcab9a6
Merging development into adhesion
0bbc22b
Merging development into adhesion modifying the style error
4021170
Merging development into adhesion modifying all errors
d6718e7
Modifying clang and documentation and adding regression tests
237c76d
Modifying in clang format and documentation and adding regression tes…
e545217
Modifying in clang format and documentation and adding regression tes…
ad2abc8
Merge branch 'development' into adhesion
b09fa44
Documentation and adding regression tests and clang format
2af1525
Merge branch 'adhesion' of github.com:solidsgroup/alamo into adhesion
be5570f
Documentation of the adhesion and adding the regression tests and cla…
58ace0e
Documentation of Adhesion model and adding regression tests and clang…
9c944f4
Documentation of Adhesion model and adding regression tests in clang …
7975a92
Merge branch 'development' into adhesion
bd171a6
Adhesion model with the added test
841ef64
Adhesion model with added test
053f43f
Final tweaks
bsrunnels ef83cbf
removing extra code and bringing into compliance
bsrunnels 0a436fe
integrating with nh
bsrunnels 5c7b42a
fixed tests (issue was failing to apply symmetry in for loops for mat…
bsrunnels f1f4920
working test case
bsrunnels 3e00642
working example
bsrunnels File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| alamo.program = mechanics | ||
| alamo.program.mechanics.model = finite.adhesion | ||
|
|
||
| plot_file = output | ||
|
|
||
| # this is not a time integration, so do | ||
| # exactly one timestep and then quit | ||
| timestep = 0.01 | ||
| stop_time = 2.0 | ||
|
|
||
| # amr parameters | ||
| amr.plot_int = 1 | ||
| amr.max_level = 6 | ||
| amr.n_cell = 32 32 32 | ||
| amr.blocking_factor = 8 | ||
| amr.regrid_int = 1 | ||
| amr.grid_eff = 1.0 | ||
| amr.cell.all = 1 | ||
| amr.thermo.plot_int = 1 | ||
|
|
||
| # geometry | ||
| geometry.prob_lo = -8 -8 -8 | ||
| geometry.prob_hi = 8 8 8 | ||
| geometry.is_periodic = 0 0 0 | ||
|
|
||
| #ic.type = ellipse | ||
| #ic.ellipse.a = 1.0 0.75 0.5 # ellipse radii | ||
| #ic.ellipse.x0 = 0 0 0 # location of ellipse center | ||
| #ic.ellipse.eps = 0.1 # diffuse boundary | ||
|
|
||
| ic.type = expression | ||
| ic.expression.constant.eps = 0.3 | ||
| ic.expression.constant.R = 4.0 | ||
| ic.expression.region0 = " (max( erf((x^2 + y^2 - R)/eps),0.0))^2" | ||
| ic.expression.region1 = " (max(-erf((x^2 + y^2 - R)/eps),0.0))^2" | ||
| ic.expression.region2 = "1.0 - (max( erf((x^2 + y^2 - R)/eps),0.0))^2 - (max(-erf((x^2 + y^2 - R)/eps),0.0))^2" | ||
| #ic.expression.region2 = "0.0" | ||
|
|
||
| # elastic moduli | ||
| nmodels = 2 | ||
| model1.mu = 2.0 | ||
| model1.kappa = 3.0 | ||
| model2.mu = 10.0 | ||
| model2.kappa = 30.0 | ||
| model3.mu = 2.0 | ||
| model3.kappa = 3.0 | ||
| model1.d = 0.0 | ||
| model2.d = 0.0 | ||
| model3.d = 0.0 | ||
| model1.zeta = 0.0 | ||
| model2.zeta = 0.0 | ||
| model3.zeta = 1.0 | ||
| model1.L = 0.0 | ||
| model2.L = 0.0 | ||
| model3.L = 0.2 | ||
| #model3.mu = 210 | ||
| #model3.kappa = 0.3 | ||
|
|
||
| solver.verbose = 3 | ||
| solver.nriters = 10 | ||
| #solver.max_iter = 20 | ||
| solver.fixed_iter = 100 | ||
| #elasticop.small = 0.1 | ||
|
|
||
| print_model = 1 | ||
|
|
||
| bc.type = tensiontest | ||
| bc.tensiontest.type = uniaxial_stress | ||
| bc.tensiontest.disp=(0,1,2:0,8,0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,242 @@ | ||
| // This models a finite-strain, solid with adhesion behavior governed by | ||
| // a combination of elastic energy and an adhesion decay term. | ||
| // | ||
| // The energy and derivatives are: | ||
| // | ||
| // .. math:: | ||
| // :nowrap: | ||
| // | ||
| // \begin{gather} | ||
| // W = d \left[ \frac{\mu}{2J^{2/3}}(F^T F : I - 3) + \frac{\kappa}{2}(J - 1)^2 \right] + \frac{\zeta}{J^n} \\ | ||
| // DW = \text{(first Piola-Kirchhoff stress)} \\ | ||
| // DDW = \text{(tangent stiffness tensor)} | ||
| // \end{gather} | ||
| // | ||
| // where: | ||
| // - :math:`d` The coefficient of degradable part, | ||
| // - :math:`\mu` is the shear modulus, | ||
| // - :math:`\kappa` is the bulk modulus, | ||
| // - :math:`\zeta` is the adhesion decay coefficient or the coefficient of non-degradable part, | ||
| // - :math:`n` is the decay exponent, | ||
| // - :math:`F` is the deformation gradient, | ||
| // - :math:`J = \det(F)` is the volume ratio, | ||
| // - :math:`F^T F : I = \text{trace}(F^T F)` is used to capture isochoric deformation. | ||
| // | ||
| // Notes: | ||
| // | ||
| // Adhesion energy model W(F): | ||
| // Consists of two parts: | ||
| // 1. Degradable (elastic shear + volumetric terms) | ||
| // 2. Non-degradable (adhesion term decaying with volume expansion) | ||
| // This model is rate-independent, reversible, and purely elastic. | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add documentation at the top of this file to outline the method. See |
||
| #ifndef MODEL_SOLID_FINITE_ADHESION_H_ | ||
| #define MODEL_SOLID_FINITE_ADHESION_H_ | ||
|
|
||
| #include "IO/ParmParse.H" | ||
| #include "Model/Solid/Finite/NeoHookean.H" | ||
| #include "Model/Solid/Solid.H" | ||
| #include "Set/Set.H" | ||
| #include <array> // For std::array to represent fourth-order tensors | ||
| #include <cmath> // For std::pow and std::abs | ||
| #include <eigen3/Eigen/Dense> // For Eigen::Matrix3d | ||
|
|
||
| namespace Model | ||
| { | ||
| namespace Solid | ||
| { | ||
| namespace Finite | ||
| { | ||
|
|
||
| class Adhesion : public NeoHookean | ||
| { | ||
| public: | ||
| static constexpr KinematicVariable kinvar = KinematicVariable::F; | ||
|
|
||
| Adhesion() {} | ||
| Adhesion(Solid<Set::Sym::Major> base) : NeoHookean(base) {} | ||
| virtual ~Adhesion() {} | ||
|
|
||
| // Material parameters (declared in order) | ||
| Set::Scalar d = NAN; ///< Adhesion strength (degradable part coefficient) | ||
| Set::Scalar zeta = NAN; ///< Adhesion decay parameter (non-degradable part) | ||
| Set::Scalar n = NAN; ///< Decay exponent | ||
| Set::Scalar L = NAN; ///< Mobility | ||
|
|
||
| // Return a zero-parameter adhesion model. | ||
| static Adhesion | ||
| Zero() | ||
| { | ||
| Adhesion adhesion; | ||
| adhesion.d = 0.0; ///< Adhesion strength (degradable part coefficient) | ||
| adhesion.zeta = 0.0; ///< Adhesion decay parameter (non-degradable part) | ||
| adhesion.n = 0.0; ///< Decay exponent | ||
| adhesion.L = 0.0; | ||
| adhesion.mu = 0.0; | ||
| adhesion.kappa = 0.0; | ||
| return adhesion; | ||
| } | ||
|
|
||
| // Return a random-parameter adhesion model. | ||
| static Adhesion | ||
| Random() | ||
| { | ||
| Adhesion adhesion; | ||
| adhesion.d = Util::Random() ; // Util::Random(); ///< Adhesion strength (degradable part coefficient) | ||
| adhesion.zeta = Util::Random(); ///< Adhesion decay parameter (non-degradable part) | ||
| adhesion.n = Util::Random(); ///< Decay exponent | ||
| adhesion.mu = Util::Random(); | ||
| adhesion.kappa = Util::Random();// Util::Random(); | ||
| adhesion.L = Util::Random(); | ||
| return adhesion; | ||
| } | ||
|
|
||
| // Parse function: Reads material parameters from the input file. | ||
| // Here, we assume the input file provides: mu, kappa, d, zeta, and n. | ||
| static void | ||
| Parse(Adhesion &value, IO::ParmParse &pp) | ||
| { | ||
| pp.queryclass<NeoHookean>(value); | ||
| // Initial value for damage | ||
| pp_query_default("d", value.d, 0.0); | ||
| // Adhesion decay parameter (non-degradable part) | ||
| pp_query_default("zeta", value.zeta, 0.0); | ||
| // Decay exponent | ||
| pp_query_default("n", value.n, 1.0); | ||
| // Mobility | ||
| pp_query_default("L", value.L, 0.0); | ||
| } | ||
|
|
||
| // Strain energy function: | ||
| // W = d * [ 0.5*mu*(trace(F^T F)-3)/J^(2/3) + 0.5*kappa*(J-1)^2 ] + zeta/J^n | ||
| Set::Scalar | ||
| W(const Set::Matrix &F) const override | ||
| { | ||
| Set::Scalar w_nh = (1.0 - d) * NeoHookean::W(F); | ||
| Set::Scalar J = F.determinant(); | ||
| Set::Scalar w_compress = zeta * std::pow(J, -n); | ||
| return w_nh + w_compress; | ||
| } | ||
|
|
||
| // First Piola-Kirchhoff stress (derivative of W) | ||
| Set::Matrix | ||
| DW(const Set::Matrix &F) const override | ||
| { | ||
| Set::Matrix dw_nh = (1.0 - d) * NeoHookean::DW(F); | ||
| Set::Scalar J = F.determinant(); | ||
| Set::Matrix FinvT = F.inverse().transpose(); | ||
| Set::Matrix dw_compress = zeta * (-n * std::pow(J, -n) * FinvT); | ||
| return dw_nh + dw_compress; | ||
| } | ||
|
|
||
| // Tangent stiffness tensor (second derivative of W) | ||
| Set::Matrix4<AMREX_SPACEDIM, Set::Sym::Major> | ||
| DDW(const Set::Matrix &F) const override | ||
| { | ||
| Set::Matrix4<AMREX_SPACEDIM, Set::Sym::Major> ddw_nh = | ||
| (1.0 - d) * NeoHookean::DDW(F); | ||
|
|
||
| Set::Scalar J = F.determinant(); | ||
| Set::Matrix FinvT = F.inverse().transpose(); | ||
|
|
||
| Set::Matrix4<AMREX_SPACEDIM, Set::Sym::Major> ddw_compress; | ||
|
|
||
| for (int i = 0; i < AMREX_SPACEDIM; i++) | ||
| { | ||
| for (int j = 0; j < AMREX_SPACEDIM; j++) | ||
| { | ||
| for (int k = 0; k < AMREX_SPACEDIM; k++) | ||
| { | ||
| for (int l = 0; l < AMREX_SPACEDIM; l++) | ||
| { | ||
| // Adhesion-related term (zeta) | ||
|
|
||
| // dFinvT(i,j) / dF(k,l) | ||
| // = dFinv(j,i) / dF(k,l) | ||
| // = -dFinvT(k,j) * dFinvT(iL) | ||
|
|
||
| Set::Scalar t3 = n * n * std::pow(J, -n) * FinvT(i, j) * FinvT(k, l) | ||
| + n * std::pow(J, -n) * FinvT(k, j) * FinvT(i, l); | ||
| ddw_compress(i, j, k, l) = zeta * t3; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return ddw_nh + ddw_compress; | ||
| } | ||
|
|
||
| // Print material parameters | ||
| virtual void | ||
| Print(std::ostream &out) const override | ||
| { | ||
| out << "d = " << d << ", mu = " << mu << ", kappa = " << kappa | ||
| << ", zeta = " << zeta << ", n = " << n; | ||
| } | ||
|
|
||
| virtual void Advance(Set::Scalar dt, Set::Matrix strain, | ||
| Set::Matrix P, Set::Scalar /*time*/) override | ||
| { | ||
| // Util::Message(INFO,dt); | ||
| // Util::Message(INFO,L); | ||
| // Util::Message(INFO,(P.transpose()*P).trace()); | ||
| Set::Scalar dd = std::max(0.0,(P.transpose()*P).trace() * (0.8 - d)); | ||
| // Util::Message(INFO,dd); | ||
| d += dd * L * dt; | ||
| } | ||
|
|
||
|
|
||
|
|
||
| #define OP_CLASS Adhesion | ||
| #define OP_VARS X(d) X(mu) X(kappa) X(zeta) X(n) X(L) | ||
| #include "Model/Solid/InClassOperators.H" | ||
| }; | ||
|
|
||
| #include "Model/Solid/ExtClassOperators.H" | ||
|
|
||
| } // namespace Finite | ||
| } // namespace Solid | ||
| } // namespace Model | ||
|
|
||
| template<> | ||
| ALAMO_SINGLE_DEFINITION | ||
| int Set::Field<Model::Solid::Finite::Adhesion>::NComp() const | ||
| { | ||
| return 4; | ||
| } | ||
| template<> | ||
| ALAMO_SINGLE_DEFINITION | ||
| std::string Set::Field<Model::Solid::Finite::Adhesion>::Name(int i) const | ||
| { | ||
| if (i == 0) return name + "_mu"; | ||
| if (i == 1) return name + "_kapp"; | ||
| if (i == 2) return name + "_d"; | ||
| if (i == 3) return name + "_L"; | ||
| return name; | ||
| } | ||
| template<> | ||
| ALAMO_SINGLE_DEFINITION | ||
| void Set::Field<Model::Solid::Finite::Adhesion>::Copy(int a_lev, amrex::MultiFab& a_dst, int a_dstcomp, int a_nghost) const | ||
| { | ||
| for (amrex::MFIter mfi(a_dst, amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi) | ||
| { | ||
| const amrex::Box& bx = mfi.growntilebox(amrex::IntVect(a_nghost)); | ||
| if (bx.ok()) | ||
| { | ||
| amrex::Array4<const Model::Solid::Finite::Adhesion> const& src = ((*this)[a_lev])->array(mfi); | ||
| amrex::Array4<Set::Scalar> const& dst = a_dst.array(mfi); | ||
| for (int n = 0; n < AMREX_SPACEDIM * AMREX_SPACEDIM; n++) | ||
| { | ||
| amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) { | ||
| dst(i, j, k, a_dstcomp + 0) = src(i, j, k).mu; | ||
| dst(i, j, k, a_dstcomp + 1) = src(i, j, k).kappa; | ||
| dst(i, j, k, a_dstcomp + 2) = src(i, j, k).d; | ||
| dst(i, j, k, a_dstcomp + 3) = src(i, j, k).L; | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
| #endif // MODEL_SOLID_FINITE_ADHESION_H_ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatting in this file is noncompliant with the style outlined in
.clang-format.