Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91047600
phase_field_2d.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Nov 7, 07:33
Size
3 KB
Mime Type
text/x-c
Expires
Sat, Nov 9, 07:33 (2 d)
Engine
blob
Format
Raw Data
Handle
22185683
Attached To
rAKA akantu
phase_field_2d.cc
View Options
/**
* @file phase_field_static_2d.cc
*
* @author Mohit Pundir <mohit.pundir@epfl.ch>
*
* @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 <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "non_linear_solver.hh"
#include "phase_field_model.hh"
#include "solid_mechanics_model.hh"
#include "solid_phase_coupler.hh"
/* -------------------------------------------------------------------------- */
#include <iostream>
/* -------------------------------------------------------------------------- */
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<SolidMechanicsModel, PhaseFieldModel> 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;
}
Event Timeline
Log In to Comment