ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/solveur/src/sl_solvelastoplastique.cpp
Revision: 1158
Committed: Thu Jun 13 22:18:49 2024 UTC (11 months, 1 week ago) by francois
File size: 5099 byte(s)
Log Message:
compatibilité Ubuntu 22.04
Suppression des refeences à Windows
Ajout d'une banière

File Contents

# User Rev Content
1 francois 1158 //####//------------------------------------------------------------
2     //####//------------------------------------------------------------
3     //####// MAGiC
4     //####// Jean Christophe Cuilliere et Vincent FRANCOIS
5     //####// Departement de Genie Mecanique - UQTR
6     //####//------------------------------------------------------------
7     //####// MAGIC est un projet de recherche de l equipe ERICCA
8     //####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres
9     //####// http://www.uqtr.ca/ericca
10     //####// http://www.uqtr.ca/
11     //####//------------------------------------------------------------
12     //####//------------------------------------------------------------
13     //####//
14     //####// sl_solvelastoplastique.cpp
15     //####//
16     //####//------------------------------------------------------------
17     //####//------------------------------------------------------------
18     //####// COPYRIGHT 2000-2024
19     //####// jeu 13 jun 2024 11:58:57 EDT
20     //####//------------------------------------------------------------
21     //####//------------------------------------------------------------
22 souaissa 166 #include "gestionversion.h"
23    
24    
25     #pragma hdrstop
26    
27     #include "sl_solvelastoplastique.h"
28     #include "sl_critere_plastique.h"
29     #include "sl_operateurs_plastique.h"
30    
31     #pragma package(smart_init)
32    
33    
34     SL_SOLVE_ELASTOPLASTIQUE::SL_SOLVE_ELASTOPLASTIQUE(int ele_type,char* file_name,unsigned long mai_id,long nbincr,char*out_file)
35     {
36     Nb_Charge=nbincr;
37     EL_TYPE=ele_type;
38     strcpy(nom_fichier,file_name);
39     strcpy(out_fichier,out_file);
40     mggest=new MG_FILE(nom_fichier);
41     mai=mggest->get_fem_maillageid(mai_id);
42     id_mai=mai_id;
43    
44     }
45    
46     SL_SOLVE_ELASTOPLASTIQUE::~SL_SOLVE_ELASTOPLASTIQUE()
47     {
48     delete mggest;
49     delete mai;
50     }
51    
52     void SL_SOLVE_ELASTOPLASTIQUE::resoudre(ostream& os,double*kg,Matrice& contrainte_elast,Matrice& def_elast)
53     {
54     int nb_tetra=mai->get_nb_fem_tetra();
55     Matrice def_plastique (nb_tetra,6,0.);
56     Matrice cntr_plastque(nb_tetra,6,0.);
57     Matrice cntr_elastique(nb_tetra,6,0.);
58     Matrice def_elastique=def_elast*(1./Nb_Charge);
59     Matrice d_sig_elast(nb_tetra,6,0.);
60     d_sig_elast=contrainte_elast*(1./Nb_Charge);
61     double max= d_sig_elast.Get_AbMax();
62    
63     vecteur lamda(nb_tetra);
64     SL_OPERATEURS_PLASTIQUE op_plastique(mggest);
65     double limte_elast=op_plastique.get_limite_elastque();
66     int N_plas= limte_elast/max;
67     Matrice cont_chargement=d_sig_elast*N_plas;
68     Matrice cntr_tot=d_sig_elast*N_plas;
69     def_elastique=def_elastique*N_plas;
70     Matrice S=op_plastique.get_operateur_s(os,kg);
71     Matrice K_1=op_plastique.modifier_matrice_rigidite(os,kg);
72     int param_plastique=0;
73     for(int i=N_plas;i<N_plas+100;i++)
74     {
75     os<<"INCR_CHARGE : "<<i<<endl;
76     Matrice d_sig(nb_tetra,6,0.);
77     Matrice d_sig_plast(nb_tetra,6,0.);
78     Matrice d_eps_plast(nb_tetra,6,0.);
79     vecteur d_lamda(nb_tetra);
80     op_plastique.get_operateur_m(os,S,cont_chargement,d_sig_elast, lamda,d_lamda,param_plastique);
81    
82     if (param_plastique) d_eps_plast=get_def_plastique(cntr_tot,d_lamda) ;
83     if (param_plastique) d_sig_plast=get_cntr_plastique(S,cntr_tot,d_eps_plast);
84    
85     cont_chargement+= d_sig_elast;
86    
87     if (param_plastique) cntr_plastque+= d_sig_plast;
88     def_elastique+= d_eps_plast;
89     d_sig= d_sig_elast+d_sig_plast ;
90     lamda+=d_lamda;
91     cntr_tot+= d_sig;
92     if (param_plastique)
93     {
94     os<<"DEF_PLASTIQUE"<<endl;
95     os<<d_eps_plast<<endl;
96     os<<"SIG_PLASTIQUE"<<endl;
97     os<<d_sig_plast<<endl;
98     os<<"CONT_CHARGEMENT"<<endl;
99     os<<cont_chargement<<endl;
100     os<<"CONTR_TOT"<<endl;
101     os<<cntr_tot<<endl;
102     }
103     }
104    
105     }
106    
107     Matrice SL_SOLVE_ELASTOPLASTIQUE::get_def_plastique(Matrice& cntr_tot,vecteur&lamda)
108     {
109     int nb_tetra=mai->get_nb_fem_tetra();
110     Matrice def_plastique(0,6,0.);
111     SL_CRITERE_PLASTICITE critere;
112    
113     for(int i=0;i<nb_tetra;i++)
114     {
115     vecteur df_sig=critere.get_derivee_du_critere(cntr_tot.Get_Row(i));
116     vecteur df_eps=lamda[i]*df_sig;
117     def_plastique.Add_Row(df_eps,i);
118     }
119    
120     return def_plastique;
121    
122     }
123    
124    
125    
126     Matrice SL_SOLVE_ELASTOPLASTIQUE :: get_cntr_plastique(Matrice S,Matrice& cntr_tot,Matrice& def_plastque)
127     {
128     int nb_tetra=mai->get_nb_fem_tetra();
129     Matrice cntr_plastique(0,6,0.);
130    
131     for (int a=0;a<nb_tetra;a++)
132     {
133     vecteur res(6);
134    
135     for(int b=0;b<nb_tetra;b++)
136     {
137     Matrice sab=S.Get_SubMatrice(6*a,6*b,6,6);
138     vecteur d_epsp_b=def_plastque.Get_Row(b);
139     res+=sab* d_epsp_b;
140     }
141     cntr_plastique.Add_Row(res,a);
142     }
143    
144     return cntr_plastique;
145     }
146    
147    
148    
149     void SL_SOLVE_ELASTOPLASTIQUE::resoud()
150     {
151     SL_SOLVE_ELASTIQUE solve_elst(EL_TYPE,nom_fichier,id_mai,Nb_Charge);
152     int taille=3*mai->get_nb_fem_noeud();
153     double *fg=new double[taille];
154     double *kg=new double[taille];
155     double *du=new double[taille];
156     Matrice cont(0,6,0.0);
157     Matrice def(0,6,0.0);
158     ofstream os(out_fichier,ios_base::app);
159     solve_elst.resoud(du,kg,fg,cont,def);
160     resoudre(os,kg,cont,def) ;
161    
162     delete [] kg;
163     delete [] fg;
164     delete [] du;
165     }