diff --git a/examples/phase_field/phase_field_2d.cc b/examples/phase_field/phase_field_2d.cc index b624a5f33..f49c52b79 100644 --- a/examples/phase_field/phase_field_2d.cc +++ b/examples/phase_field/phase_field_2d.cc @@ -1,98 +1,93 @@ /** * @file phase_field_static_2d.cc * * @author Mohit Pundir * * @date creation: Mon Oct 1 2018 * * @brief test of the class PhaseFieldModel on the 2d square * * @section LICENSE * * Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory * (LSMS - Laboratoire de Simulation en Mécanique des Solides) * * Akantu is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * Akantu is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with Akantu. If not, see . * */ /* -------------------------------------------------------------------------- */ #include "non_linear_solver.hh" #include "phase_field_model.hh" #include "solid_mechanics_model.hh" #include "solid_phase_coupler.hh" /* -------------------------------------------------------------------------- */ #include /* -------------------------------------------------------------------------- */ using namespace akantu; const UInt spatial_dimension = 2; /* -------------------------------------------------------------------------- */ int main(int argc, char *argv[]) { initialize("material.dat", argc, argv); Mesh mesh(spatial_dimension); mesh.read("square.msh"); PhaseFieldModel pfm(mesh); pfm.initFull(_analysis_method = _static); - - auto & pfm_solver = pfm.getNonLinearSolver(); - pfm_solver.set("max_iterations", 1); - pfm_solver.set("threshold", 100.0); - pfm_solver.set("convergence_type", _scc_solution); - + // solid mechanics model initialization SolidMechanicsModel smm(mesh); smm.initFull(_analysis_method = _static); smm.applyBC(BC::Dirichlet::FixedValue(0., _y), "bottom"); smm.applyBC(BC::Dirichlet::FixedValue(0., _x), "bottom"); smm.applyBC(BC::Dirichlet::FixedValue(0., _x), "left"); smm.applyBC(BC::Dirichlet::FixedValue(0., _x), "right"); smm.setBaseName( "square"); smm.addDumpFieldVector( "displacement"); smm.addDumpFieldVector( "internal_force"); smm.addDumpField( "stress"); smm.addDumpField( "grad_u"); smm.addDumpField( "damage"); smm.addDumpField( "blocked_dofs"); smm.dump(); auto & smm_solver = smm.getNonLinearSolver(); smm_solver.set("max_iterations", 1000); smm_solver.set("threshold", 1e-8); smm_solver.set("convergence_type", _scc_solution); // coupling of models SolidPhaseCoupler coupler(smm, pfm); UInt nbSteps = 1000; Real increment = 1.e-4; for (UInt s = 1; s < nbSteps; ++s) { smm.applyBC(BC::Dirichlet::IncrementValue(increment, _y), "top"); coupler.solve(); smm.dump(); std::cout << "Step " << s << "/" << nbSteps << std::endl; } finalize(); return EXIT_SUCCESS; } diff --git a/examples/phase_field/phase_field_notch.cc b/examples/phase_field/phase_field_notch.cc index d1ecafb1b..0f36979cd 100644 --- a/examples/phase_field/phase_field_notch.cc +++ b/examples/phase_field/phase_field_notch.cc @@ -1,92 +1,93 @@ /** * @file phase_field_static_2d.cc * * @author Mohit Pundir * * @date creation: Mon Oct 1 2018 * * @brief test of the class PhaseFieldModel on the 2d square * * @section LICENSE * * Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory * (LSMS - Laboratoire de Simulation en Mécanique des Solides) * * Akantu is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * Akantu is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with Akantu. If not, see . * */ /* -------------------------------------------------------------------------- */ #include "non_linear_solver.hh" #include "phase_field_model.hh" #include "solid_mechanics_model.hh" #include "solid_phase_coupler.hh" /* -------------------------------------------------------------------------- */ #include /* -------------------------------------------------------------------------- */ using namespace akantu; const UInt spatial_dimension = 2; /* -------------------------------------------------------------------------- */ int main(int argc, char *argv[]) { initialize("material_notch.dat", argc, argv); // create mesh Mesh mesh(spatial_dimension); mesh.read("square_notch.msh"); // Phase field model initialization PhaseFieldModel pfm(mesh); pfm.initFull(_analysis_method = _static); // solid mechanics model initialization SolidMechanicsModel smm(mesh); smm.initFull(_analysis_method = _static); smm.applyBC(BC::Dirichlet::FixedValue(0., _y), "bottom"); smm.applyBC(BC::Dirichlet::FixedValue(0., _x), "left"); smm.setBaseName( "square_notch"); smm.addDumpFieldVector( "displacement"); smm.addDumpFieldVector( "internal_force"); smm.addDumpField( "stress"); smm.addDumpField( "grad_u"); smm.addDumpField( "damage"); smm.addDumpField( "blocked_dofs"); smm.dump(); auto & smm_solver = smm.getNonLinearSolver(); smm_solver.set("max_iterations", 1000); smm_solver.set("threshold", 1e-8); smm_solver.set("convergence_type", _scc_residual); // coupling of models SolidPhaseCoupler coupler(smm, pfm); UInt nbSteps = 1500; Real increment = 1.e-5; for (UInt s = 1; s < nbSteps; ++s) { smm.applyBC(BC::Dirichlet::IncrementValue(increment, _y), "top"); - coupler.solve(); + smm.solveStep(); + //coupler.solve(); smm.dump(); std::cout << "Step " << s << "/" << nbSteps << std::endl; } finalize(); return EXIT_SUCCESS; }