Debian Codegraph @

add_ons/albertasystems/Elast/Common/th_strain_rhs.cc

raw
1 #ifndef _multiphase_rhs_
2 #define _multiphase_rhs_ 1
3 #include <alberta.h>
4 #include <alberta_util.h>
5 #include "newalberta.hh"
6 //#include "do_on_el.hh"
7 //#include "traverse.hh"
8 #include "operator_parts.hh"
9 #include "heat.hh"
10 #include "prototype_fem_elfunc.hh"
11 #include "fem_elfunc.hh"
12 #include "th_strain_rhs.hh"
13 #include "elast_problem.hh"
14
15 /*implements thermally induced strains*/
16 REAL th_strain_rhs::elast_rhs_th(REAL th, REAL a, REAL p, REAL m)
17 {
18 FUNCNAME("elast_rhs_th");
19 REAL alpha = a * 1.55E-5 + p * 1.70E-5 + m * 1.16E-5;
20 //fuers Testproblem muss alpha=1.55E-5e-5, d.h.a=1 sein!
21 /* MSG("alpha = %.3le, alpha*(th-th_a) = %.3le\n",
22 alpha, alpha * (th - prob_data->th_a));
23 */
24 return(alpha * (th - 723.0 )); // Perlit-Start-Temperatur
25 }
26
27 REAL th_strain_rhs::calc(const REAL* const lambda, const int comp_dummy)
28 {
29 int iq=0;//hier vorlaeufig richtig
30 REAL val=0.0;
31 REAL th_at_phik = eval_uh(/*&lagrangenodes[(DIM+1)*k]*/lambda ,
32 (const REAL *) uh_el, temperature->fe_space->bas_fcts);
33 REAL fac1 = elast_rhs_th(th_at_phik,austenite_at_qp[iq], pearlite_at_qp[iq], 0.0/*REAL m*/);
34 val = lambda3_mu2*fac1/* + lambda_mu23*fac2*/;
35 return val;
36 }
37 //private! Sonst macht wer scheisse mit.
38 REAL th_strain_rhs::calc( const int iq, const int comp_dummy)
39 {
40 REAL val=0.0;
41 REAL fac1 = elast_rhs_th(uh_qp[iq],austenite_at_qp[iq], pearlite_at_qp[iq], 0.0/*REAL m*/);
42 // REAL fac2 = elast_rhs_rho(uh_qp[iq],austenite_at_qp[iq], pearlite_at_qp[iq], 0.0/*REAL m*/);
43
44 val = lambda3_mu2*fac1/* + lambda_mu23*fac2*/;
45 return(val);
46 }
47
48
49 int th_strain_rhs::set_at_el(const EL_INFO * const el_info,const LAMBDA_DET* const assem_el_info)
50 {
51 fem_elfunc::set_at_el(el_info, assem_el_info);
52 sol_bas_fcts->get_real_vec(el_info->el, temperature, uh_el);
53 uh_at_qp(quad_fast_uh, uh_el, uh_qp); //so!!
54 return(0);
55 }
56
57
58 //void th_strain_rhs::el_fct(const EL_INFO *el_info)
59 //int th_strain_rhs::calc(const EL_INFO *el_info)
60 REAL th_strain_rhs::func_scp_testfunc( const int i_phi, const int j_comp)
61 {
62 int qp, k;
63 REAL scp= 0.0;
64 //quadratur von rhs(l):
65 for (qp=0; qp < quad->n_points; qp++)
66 {
67 REAL responseofstrain = /*th_strain_rhs::*/calc(qp,j_comp);
68 grd = 0.0;
69 for (k=0; k<=el_info_ptr->mesh->dim; k++)
70 grd += el_info_ptr->el_geom_cache.Lambda[k][j_comp] *
71 test_quad_fast->grd_phi[qp][i_phi][k]; /*test_quad_fast u quad
72 muessen gleichen Grads sein!!*/
73 /* th_strain_rhs::calc(qp) gibt die thermische !Dehnung! mal Diffusions (Antwort-)Matrix zurueck.
74 nicht Verschiebung.
75 grad phi also von der Testfunktion. */
76 scp += quad->w[qp]*el_info_ptr->el_geom_cache.det
77 * responseofstrain* grd/*[j]*/;
78 }
79 return (scp);
80 }
81
82
83 th_strain_rhs::th_strain_rhs(const DOF_REAL_VEC* const temperature
84 ,const PROB_DATA_DIFF* const (prob_datas)[DIM_OF_WORLD*DIM_OF_WORLD],
85 const int quad_degree)
86 : fem_elfunc( /*quad_degree,*/ nil/*timestep*/)
87 , temperature(temperature)
88
89 {
90 FUNCNAME("th_strain_rhs constuctor");
91 int l,k;
92 TEST_EXIT(temperature,"no temperature vec at the moment\n");
93 int dim = temperature->fe_space->mesh->dim, degree=quad_degree;
94 for (l=0; l<dim;l++)
95 {
96 for (k=0; k< dim;k++)
97 {
98 prob_datas_elast[l*dim+k] = prob_datas[l*dim + k];
99 }
100 }
101 if (quad_degree<1)
102 { degree = temperature->fe_space->bas_fcts->degree+2;
103 MSG("quad degree reset to %d\n", degree);
104 }
105 quad = get_quadrature(dim, degree);
106 sol_bas_fcts = temperature->fe_space->bas_fcts;
107 quad_fast_uh = get_quad_fast(
108 sol_bas_fcts, quad, INIT_PHI);
109 uh_el = new REAL [temperature->fe_space->bas_fcts->n_bas_fcts];
110
111 austenite_at_qp = new REAL[quad->n_points];
112 pearlite_at_qp = new REAL[quad->n_points];
113 // memset(pearlite_at_qp,1,sizeof(REAL[quad->n_points])); setzt ein bit eines bytes... falsch
114 for (l=0; l<quad->n_points;l++) austenite_at_qp[l] = 1.0;
115 uh_qp = new REAL[quad->n_points];
116 //ersma so und hier. Kann noch variabel gemacht werden.
117 // REAL scale = prob_data_s11.physconstants[MU_LAMBDA_SCALE];
118 REAL lambda = prob_data_s11.physconstants[LAMBDA];/*scale;*/
119 REAL mu = prob_data_s11.physconstants[MU];/*scale;*/
120 lambda3_mu2 = 3.0*lambda + 2.0*mu;
121 lambda_mu23 = lambda + mu*2.0/3.0;
122 // lambda3_mu2 *= scale;
123 // lambda_mu23 *= scale;
124 MSG("constuction completed\n");
125 }
126
127
128 th_strain_rhs::~th_strain_rhs()
129 {
130
131 // delete [] uh_qp;
132 delete [] austenite_at_qp;
133 delete [] pearlite_at_qp;
134 // delete [] uh_el;
135 // delete [] dof;
136 }
137 #endif