Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
c53ef54
Plans
hverhelst Mar 25, 2021
c0ecafe
added simple material matrix structure
hverhelst Mar 29, 2021
ae77a76
removed new
hverhelst Mar 29, 2021
bdeec36
material class
filiatra Apr 1, 2021
b656900
material class
filiatra Apr 1, 2021
fa0ffd1
added composite material class.
hverhelst Apr 5, 2021
3e96749
made multipatch support for angles (bit sloppy)
hverhelst Apr 7, 2021
ff45d1b
fix composite matrix
hverhelst Apr 12, 2021
2bba282
small
hverhelst Apr 14, 2021
307e6ff
fix initialization of options
filiatra Apr 15, 2021
8484e4a
gsCompositeMatrix Raw
hverhelst Apr 23, 2021
99ed976
added gsMaterialEval
hverhelst May 14, 2021
71c7539
Merge remote-tracking branch 'origin/master' into Composites
hverhelst Dec 3, 2021
64e8f03
small
hverhelst Dec 3, 2021
2b696ab
Merge branch 'master' into Composites
hverhelst Jul 12, 2022
f5c5843
add different material matrix classes
hverhelst Oct 14, 2022
524ba51
Merge branch 'master' into Composites
hverhelst Apr 3, 2023
fcee2bb
small
hverhelst Apr 8, 2023
9ac602d
Merge remote-tracking branch 'origin/Composites' into Composites
hverhelst Apr 8, 2023
52fd1b9
small
hverhelst Apr 8, 2023
125cc8b
Merge remote-tracking branch 'origin/master' into Composites
hverhelst Jul 12, 2023
d5e1e03
small
hverhelst Jan 8, 2024
9a510ad
Merge remote-tracking branch 'origin/master' into Composites
hverhelst Jul 11, 2024
62e93f2
First commit for material classes.
hverhelst Jul 13, 2024
db8479f
add positive part of strain (as an example)
hverhelst Jul 16, 2024
719fca6
Fix calculation deformation gradient
lventavinuela Jul 31, 2024
694dbe7
Expression assembler check
lventavinuela Jul 31, 2024
a706fe5
Merge
lventavinuela Jul 31, 2024
b532e98
Check assembler
lventavinuela Jul 31, 2024
7032eb8
Deviatoric tensor
lventavinuela Jul 31, 2024
8ac7ea3
Draft degraded material
lventavinuela Jul 31, 2024
2b95a69
Implement degradation function
lventavinuela Aug 19, 2024
544e400
Add voigt stress in gsMaterialEval
lventavinuela Aug 21, 2024
f1c37ac
Fix Voigt notation
lventavinuela Sep 3, 2024
5b5d1b2
Add elasticity script with gsMaterialEval
lventavinuela Sep 4, 2024
6b3ae3d
rename file
lventavinuela Sep 4, 2024
1326bae
new file
lventavinuela Sep 5, 2024
dcb7001
Update linear elastic material with damage
lventavinuela Sep 10, 2024
43acaeb
nothing
hverhelst Sep 10, 2024
31a3c42
undo
hverhelst Sep 10, 2024
2c8d612
xml single patch for elasticity check
lventavinuela Sep 10, 2024
9f6a913
Add elastic energy, correct Heaviside function, correct deviatoric te…
lventavinuela Sep 10, 2024
ba9edd7
Draft fracture elasticity (to be checked)
lventavinuela Sep 10, 2024
f4c6959
Fix NR elasticity
lventavinuela Sep 27, 2024
77f6e30
Clean script
lventavinuela Sep 30, 2024
526b52b
Fracture formulation to be corrected
lventavinuela Oct 17, 2024
3a573a2
introduce displacement stepping (from xml input)
lventavinuela Oct 21, 2024
d1600af
corrections of gsinfo
lventavinuela Oct 22, 2024
dfbf1f8
Add penalty term to the formulation
lventavinuela Oct 30, 2024
3c87773
Minor changes
lventavinuela Nov 4, 2024
b27d45a
PF fracture with multipatch (to be checked)
lventavinuela Nov 6, 2024
01aa250
small changes
lventavinuela Nov 6, 2024
966b14c
Composite example (to be checked)
lventavinuela Nov 20, 2024
7b428c7
Correct errors (missing class gsCompositeMaterial.h)
lventavinuela Nov 20, 2024
d0f23af
Updated composite material class
lventavinuela Nov 20, 2024
6faac56
correct neumann BC
lventavinuela Nov 21, 2024
25b46d5
add comments
lventavinuela Nov 21, 2024
fc07bbe
Add homogenized stiffness matrix function
lventavinuela Nov 25, 2024
3a78acc
updates composite + fracture
lventavinuela Dec 3, 2024
4cd74d6
Add new class for homogenized material matrix and clean simple script…
lventavinuela Dec 7, 2024
0759fd0
include numerical integration through the thickness (to be checked --…
lventavinuela Dec 9, 2024
6aea06c
Merge branch 'master' into MaterialClasses
hverhelst Jan 22, 2025
eac8cc3
delete files
hverhelst Jan 22, 2025
579356d
delete more files
hverhelst Jan 22, 2025
748664b
intermediate update: only bug left is parallelization
hverhelst Jan 29, 2025
b85701c
small
hverhelst Feb 7, 2025
4bc4412
move files
hverhelst Feb 14, 2025
faed6b9
Merge remote-tracking branch 'origin/master' into MaterialClassesClean
hverhelst Feb 14, 2025
777b55c
major revision materials:
hverhelst Mar 7, 2025
95fa319
fix deformation gradient
hverhelst Mar 7, 2025
4d82315
small fixes
hverhelst Mar 17, 2025
3f49e36
git compiler warnings
hverhelst Mar 26, 2025
fb71b75
remove composite
hverhelst Mar 26, 2025
64b9bda
add doc strings
hverhelst Mar 26, 2025
4b53d50
Merge remote-tracking branch 'origin/master' into MaterialClassesClean
hverhelst Mar 26, 2025
4b58bb2
Fix compilation of examples
hverhelst Mar 26, 2025
57830a3
fix compilation
hverhelst Mar 26, 2025
8a660db
remove degraded
hverhelst Mar 26, 2025
fb5952e
Delete src/gsFunctionSum.h
hverhelst Mar 26, 2025
1888996
Update gsMaterial_.cpp
hverhelst Mar 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ endif()
include(gsConfig)

## Collect files
aux_header_directory (${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_NAME}_H )
aux_cpp_directory (${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_NAME}_CPP)
aux_tmpl_header_directory(${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_NAME}_HPP)
aux_header_directory (${CMAKE_CURRENT_SOURCE_DIR}/src ${PROJECT_NAME}_H )
aux_cpp_directory (${CMAKE_CURRENT_SOURCE_DIR}/src ${PROJECT_NAME}_CPP)
aux_tmpl_header_directory(${CMAKE_CURRENT_SOURCE_DIR}/src ${PROJECT_NAME}_HPP)

if( (NOT GISMO_BUILD_LIB) )
aux_instance_directory (${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_NAME}_INS)
Expand All @@ -45,6 +45,10 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
set(gismo_MODULES ${gismo_MODULES} $<TARGET_OBJECTS:${PROJECT_NAME}>
CACHE INTERNAL "G+Smo modules" )

#Symlink include dir (in case your headers are in /src)
execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/${PROJECT_NAME})


install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}"
DESTINATION include/gismo
FILES_MATCHING PATTERN "*.h" )
Expand Down
125 changes: 125 additions & 0 deletions examples/beam_nonLinElast_3D.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/// This is an example of using the nonlinear elasticity solver on a 3D multi-patch geometry
/// The problems is part of the EU project "Terrific".
///
/// Authors: O. Weeger (2012-1015, TU Kaiserslautern),
/// A.Shamanskiy (2016 - ...., TU Kaiserslautern)
#include <gismo.h>
#include <gsElasticity/gsElasticityAssembler.h>
#include <gsElasticity/gsIterative.h>
#include <gsElasticity/gsWriteParaviewMultiPhysics.h>
#include <gsElasticity/gsMaterialBase.h>
#include <gsElasticity/gsLinearMaterial.h>

using namespace gismo;

int main(int argc, char* argv[]){

gsInfo << "Testing the nonlinear elasticity solver in 3D.\n";

//=====================================//
// Input //
//=====================================//

real_t youngsModulus = 74e9;
real_t poissonsRatio = 0.33;
index_t materialLaw = material_law::saint_venant_kirchhoff;
index_t numUniRef = 0;
index_t numDegElev = 0;
index_t numPlotPoints = 10000;

// minimalistic user interface for terminal
gsCmdLine cmd("Testing the linear elasticity solver in 3D.");
cmd.addInt("l","law","Material law: 0 - St.V.-K., 1 - neoHookeLn, 2 - neoHookeQuad",materialLaw);
cmd.addInt("r","refine","Number of uniform refinement application",numUniRef);
cmd.addInt("d","degelev","Number of degree elevation application",numDegElev);
cmd.addInt("p","points","Number of points to plot to Paraview",numPlotPoints);
try { cmd.getValues(argc,argv); } catch (int rv) { return rv; }

//=============================================//
// Scanning geometry and creating bases //
//=============================================//

// scanning geometry
gsMultiPatch<> patch, geometry;
patch.addPatch(gsNurbsCreator<>::BSplineCube());
patch.patch(0).coefs().col(0)*=10;
geometry = patch.uniformSplit(0);
geometry.computeTopology();
// creating basis
gsMultiBasis<> basis(geometry);
for (index_t i = 0; i < numDegElev; ++i)
basis.degreeElevate();
for (index_t i = 0; i < numUniRef; ++i)
basis.uniformRefine();

//=============================================//
// Setting loads and boundary conditions //
//=============================================//

// source function, rhs
gsConstantFunction<> f(0.,0.,0.,3);
// surface load, neumann BC
gsConstantFunction<> g(0, 0, -1e8,3);

// boundary conditions
gsBoundaryConditions<> bcInfo;
// Dirichlet BC are imposed separately for every component (coordinate)
for (index_t d = 0; d < 3; d++)
{
bcInfo.addCondition(0,boundary::west,condition_type::dirichlet,0,d);
}
// Neumann BC are imposed as one function
bcInfo.addCondition(1,boundary::east,condition_type::neumann,&g);

//=============================================//
// Solving //
//=============================================//

gsLinearMaterial<real_t> materialMat(youngsModulus,poissonsRatio,3);

// creating assembler
gsElasticityAssembler<real_t> assembler(geometry,basis,bcInfo,f,&materialMat);
// gsElasticityAssembler<real_t> assembler(geometry,basis,bcInfo,f);
assembler.options().setReal("YoungsModulus",youngsModulus);
assembler.options().setReal("PoissonsRatio",poissonsRatio);
assembler.options().setInt("MaterialLaw",materialLaw);
gsInfo << "Initialized system with " << assembler.numDofs() << " dofs.\n";

// setting Newton's method
gsIterative<real_t> newton(assembler);
newton.options().setInt("MaxIters",50);
newton.options().setReal("AbsTol",1e-12);
newton.options().setInt("Verbosity",solver_verbosity::all);
newton.options().setInt("Solver",linear_solver::LDLT);

gsInfo << "Solving...\n";
gsStopwatch clock;
clock.restart();
newton.solve();
gsInfo << "Solved the system in " << clock.stop() <<"s.\n";

//=============================================//
// Output //
//=============================================//

// solution to the nonlinear problem as an isogeometric displacement field
gsMultiPatch<> solutionNonlinear;
assembler.constructSolution(newton.solution(),newton.allFixedDofs(),solutionNonlinear);
// constructing stresses
gsPiecewiseFunction<> stresses;
assembler.constructCauchyStresses(solutionNonlinear,stresses,stress_components::von_mises);

if (numPlotPoints > 0)
{
gsField<> nonlinearSolutionField(geometry,solutionNonlinear);
gsField<> stressField(assembler.patches(),stresses,true);
// creating a container to plot all fields to one Paraview file
std::map<std::string,const gsField<> *> fields;
fields["Deformation"] = &nonlinearSolutionField;
fields["von Mises"] = &stressField;
gsWriteParaviewMultiPhysics(fields,"terrific_nle",numPlotPoints);
gsInfo << "Open \"terrific_nle.pvd\" in Paraview for visualization.\n";
}

return 0;
}
10 changes: 9 additions & 1 deletion examples/cooks_nonLinElast_2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include <gsElasticity/gsElasticityAssembler.h>
#include <gsElasticity/gsIterative.h>
#include <gsElasticity/gsWriteParaviewMultiPhysics.h>
#include <gsElasticity/gsMaterialBase.h>
#include <gsElasticity/gsLinearMaterial.h>
#include <gsElasticity/gsNeoHookeLogMaterial.h>

using namespace gismo;

Expand Down Expand Up @@ -67,11 +70,16 @@ int main(int argc, char* argv[]){
// Solving //
//=============================================//

gsNeoHookeLogMaterial<real_t> materialMat(youngsModulus,poissonsRatio,2);
// gsLinearMaterial<real_t> materialMat(youngsModulus,poissonsRatio);

// creating assembler
gsElasticityAssembler<real_t> assembler(geometry,basisDisplacement,bcInfo,g);
gsElasticityAssembler<real_t> assembler(geometry,basisDisplacement,bcInfo,g,&materialMat);
// gsElasticityAssembler<real_t> assembler(geometry,basisDisplacement,bcInfo,g);
assembler.options().setReal("YoungsModulus",youngsModulus);
assembler.options().setReal("PoissonsRatio",poissonsRatio);
assembler.options().setInt("MaterialLaw",material_law::neo_hooke_ln);
// assembler.options().setInt("MaterialLaw",material_law::saint_venant_kirchhoff);
gsInfo << "Initialized system with " << assembler.numDofs() << " dofs.\n";

// setting Newton's method
Expand Down
102 changes: 102 additions & 0 deletions examples/gsMaterial_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/** @file gsMaterialMatrix_test.cpp

@brief Simple example for material matrix evaluations

This file is part of the G+Smo library.

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.

Author(s): H.M. Verhelst
*/

#include <gismo.h>
#include <gsElasticity/gsMaterialEval.h>
#include <gsElasticity/gsLinearMaterial.h>
#include <gsUtils/gsStopwatch.h>

using namespace gismo;

int main (int argc, char** argv)
{
gsCmdLine cmd(".");

try { cmd.getValues(argc,argv); } catch (int rv) { return rv; }

// Make geometry
gsMultiPatch<> mp, mp_def;
mp.addPatch( gsNurbsCreator<>::BSplineCube(1) ); // degree
mp.addAutoBoundaries();
mp.uniformRefine(); // refines both
mp_def = mp;
mp_def.patch(0).coefs().col(0) *= 2; // deformation *2 in the x direction (col(0))

real_t E_modulus = 210e9;
real_t PoissonRatio = 0.3;
gsFunctionExpr<> E(std::to_string(E_modulus),3);
gsFunctionExpr<> nu(std::to_string(PoissonRatio),3);

gsMatrix<> pts(3,6);
pts.col(0)<<0.125,0.375,0.5;
pts.col(1)<<0.375,0.125,0.5;
pts.col(2)<<0.125,0.25,0.5;
pts.col(3)<<0.25,0.125,0.5;
pts.col(4)<<0.25,0.25,0.5;
pts.col(5)<<0.5,0.5,0.5;

gsMatrix<> Fres, Eres, Sres, Cres;

gsLinearMaterial<real_t> SvK(E_modulus, PoissonRatio, 3);
gsStopwatch time;
// ============================================================
time.restart();
// Using precomputation of material matrices
// Precompute the material matrix
gsMaterialData<real_t> data;
SvK.precompute(&mp,&mp_def,0,pts,data);
SvK.eval_deformation_gradient_into(data,Fres);
SvK.eval_strain_into(data,Eres);
SvK.eval_stress_into(data,Sres);
SvK.eval_matrix_into(data,Cres);
gsInfo<<"Computation took "<<time.stop()<<" s\n";

gsInfo<<"Deformation gradient\n";
gsInfo<<Fres<<"\n";

gsInfo<<"Strain\n";
gsInfo<<Eres<<"\n";

gsInfo<<"Stress\n";
gsInfo<<Sres<<"\n";

gsInfo<<"Material matrix\n";
gsInfo<<Cres<<"\n";

// ============================================================
// Using gsMaterialEval
time.restart();
gsMaterialEval<real_t, gsMaterialOutput::F, true> SvK_F(&SvK, mp, mp_def);
gsMaterialEval<real_t, gsMaterialOutput::E, true> SvK_E(&SvK, mp, mp_def);
gsMaterialEval<real_t, gsMaterialOutput::S, true> SvK_S(&SvK, mp, mp_def);
gsMaterialEval<real_t, gsMaterialOutput::C, true> SvK_C(&SvK, mp, mp_def);
SvK_F.piece(0).eval_into(pts,Fres);
SvK_E.piece(0).eval_into(pts,Eres);
SvK_S.piece(0).eval_into(pts,Sres);
SvK_C.piece(0).eval_into(pts,Cres);
gsInfo<<"Computation took "<<time.stop()<<" s\n";

// gsInfo<<"Deformation gradient\n";
// gsInfo<<Fres<<"\n";

gsInfo<<"Strain\n";
gsInfo<<Eres<<"\n";

gsInfo<<"Stress\n";
gsInfo<<Sres<<"\n";

gsInfo<<"Material matrix\n";
gsInfo<<Cres<<"\n";

return 0;
}
7 changes: 6 additions & 1 deletion examples/plateWithHole_linElast_2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <gismo.h>
#include <gsElasticity/gsElasticityAssembler.h>
#include <gsElasticity/gsWriteParaviewMultiPhysics.h>
#include <gsElasticity/gsMaterialBase.h>
#include <gsElasticity/gsLinearMaterial.h>

using namespace gismo;

Expand Down Expand Up @@ -75,8 +77,11 @@ int main(int argc, char* argv[]){
// Assembling & solving //
//=============================================//

gsLinearMaterial<real_t> materialMat(youngsModulus,poissonsRatio,2);

// creating assembler
gsElasticityAssembler<real_t> assembler(geometry,basis,bcInfo,g);
// gsElasticityAssembler<real_t> assembler(geometry,basis,bcInfo,g);//,materialMat);
gsElasticityAssembler<real_t> assembler(geometry,basis,bcInfo,g,&materialMat);
assembler.options().setReal("YoungsModulus",youngsModulus);
assembler.options().setReal("PoissonsRatio",poissonsRatio);
gsInfo<<"Assembling...\n";
Expand Down
9 changes: 7 additions & 2 deletions examples/terrific_linElast_3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <gismo.h>
#include <gsElasticity/gsElasticityAssembler.h>
#include <gsElasticity/gsWriteParaviewMultiPhysics.h>
#include <gsElasticity/gsGeoUtils.h>
#include <gsElasticity/gsMaterialBase.h>
#include <gsElasticity/gsLinearMaterial.h>

using namespace gismo;

Expand Down Expand Up @@ -72,8 +73,12 @@ int main(int argc, char* argv[])
// Assembling & solving //
//=============================================//

gsLinearMaterial<real_t> materialMat(youngsModulus,poissonsRatio,3);

// creating assembler
gsElasticityAssembler<real_t> assembler(geometry,basis,bcInfo,f);
// gsElasticityAssembler<real_t> assembler(geometry,basis,bcInfo,g);//,materialMat);
gsElasticityAssembler<real_t> assembler(geometry,basis,bcInfo,f,&materialMat);

assembler.options().setReal("YoungsModulus",youngsModulus);
assembler.options().setReal("PoissonsRatio",poissonsRatio);
assembler.options().setInt("DirichletValues",dirichlet::l2Projection);
Expand Down
3 changes: 3 additions & 0 deletions examples/terrific_nonLinElast_3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <gismo.h>
#include <gsElasticity/gsElasticityAssembler.h>
#include <gsElasticity/gsIterative.h>
#include <gsElasticity/gsLinearMaterial.h>
#include <gsElasticity/gsWriteParaviewMultiPhysics.h>

using namespace gismo;
Expand Down Expand Up @@ -74,6 +75,8 @@ int main(int argc, char* argv[]){
// Solving //
//=============================================//

gsLinearMaterial<real_t> materialMat(youngsModulus,poissonsRatio,3);

// creating assembler
gsElasticityAssembler<real_t> assembler(geometry,basis,bcInfo,f);
assembler.options().setReal("YoungsModulus",youngsModulus);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion gsALE.hpp → src/gsALE.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ gsALE<T>::gsALE(gsMultiPatch<T> & geometry, const gsMultiPatch<T> & displacement
for (gsMultiPatch<>::const_biterator it = geometry.bBegin(); it != geometry.bEnd(); ++it)
for (index_t d = 0; d < geometry.parDim(); ++d)
bcInfo.addCondition(it->patch,it->side(),condition_type::dirichlet,0,d);
gsConstantFunction<T> rhs(gsVector<>::Zero(geometry.parDim()),geometry.parDim());
gsConstantFunction<T> rhs(gsVector<T>::Zero(geometry.parDim()),geometry.parDim());

// define assembler according to the method
if (methodALE == ale_method::TINE || methodALE == ale_method::TINE_StVK || methodALE == ale_method::ILE || methodALE == ale_method::LE)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion gsBaseAssembler.h → src/gsBaseAssembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class gsBaseAssembler : public gsAssembler<T>

virtual void setRHS(const gsMatrix<T> & rhs) {m_system.rhs() = rhs;}

virtual void setMatrix(const gsSparseMatrix<T> & matrix) {m_system.matrix() = matrix;}
virtual void setMatrix(const gsSparseMatrix<T> & mat) {m_system.matrix() = mat;}

protected:
using gsAssembler<T>::m_pde_ptr;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading