1 | /*!\file Matestar.c
|
---|
2 | * \brief: implementation of the Matestar object
|
---|
3 | */
|
---|
4 |
|
---|
5 | #ifdef HAVE_CONFIG_H
|
---|
6 | #include <config.h>
|
---|
7 | #else
|
---|
8 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
9 | #endif
|
---|
10 |
|
---|
11 | #include "./Matestar.h"
|
---|
12 | #include "./Materials.h"
|
---|
13 | #include "../Inputs/Input.h"
|
---|
14 | #include "../Inputs/Inputs.h"
|
---|
15 | #include "../Inputs/TriaInput.h"
|
---|
16 | #include "../Inputs/PentaInput.h"
|
---|
17 | #include "../Inputs/ControlInput.h"
|
---|
18 | #include "../Elements/Element.h"
|
---|
19 | #include "../Elements/Tria.h"
|
---|
20 | #include "../Elements/Penta.h"
|
---|
21 | #include "../Params/Parameters.h"
|
---|
22 | #include "../Vertex.h"
|
---|
23 | #include "../Hook.h"
|
---|
24 | #include "../Node.h"
|
---|
25 | #include "../IoModel.h"
|
---|
26 | #include "../../shared/shared.h"
|
---|
27 |
|
---|
28 | /*Matestar constructors and destructor*/
|
---|
29 | Matestar::Matestar(){/*{{{*/
|
---|
30 | this->helement=NULL;
|
---|
31 | this->element=NULL;
|
---|
32 | return;
|
---|
33 | }
|
---|
34 | /*}}}*/
|
---|
35 | Matestar::Matestar(int matestar_mid,int index, IoModel* iomodel){/*{{{*/
|
---|
36 |
|
---|
37 | /*Intermediaries:*/
|
---|
38 | int matestar_eid;
|
---|
39 |
|
---|
40 | /*Initialize id*/
|
---|
41 | this->mid=matestar_mid;
|
---|
42 |
|
---|
43 | /*Hooks: */
|
---|
44 | matestar_eid=index+1;
|
---|
45 | this->helement=new Hook(&matestar_eid,1);
|
---|
46 | this->element=NULL;
|
---|
47 |
|
---|
48 | return;
|
---|
49 | }
|
---|
50 | /*}}}*/
|
---|
51 | Matestar::~Matestar(){/*{{{*/
|
---|
52 | delete helement;
|
---|
53 | return;
|
---|
54 | }
|
---|
55 | /*}}}*/
|
---|
56 |
|
---|
57 | /*Object virtual functions definitions:*/
|
---|
58 | Object* Matestar::copy() {/*{{{*/
|
---|
59 |
|
---|
60 | /*Output*/
|
---|
61 | Matestar* matestar=NULL;
|
---|
62 |
|
---|
63 | /*Initialize output*/
|
---|
64 | matestar=new Matestar();
|
---|
65 |
|
---|
66 | /*copy fields: */
|
---|
67 | matestar->mid=this->mid;
|
---|
68 | matestar->helement=(Hook*)this->helement->copy();
|
---|
69 | matestar->element =(Element*)this->helement->delivers();
|
---|
70 |
|
---|
71 | return matestar;
|
---|
72 | }
|
---|
73 | /*}}}*/
|
---|
74 | Material* Matestar::copy2(Element* element_in) {/*{{{*/
|
---|
75 |
|
---|
76 | /*Output*/
|
---|
77 | Matestar* matestar=NULL;
|
---|
78 |
|
---|
79 | /*Initialize output*/
|
---|
80 | matestar=new Matestar();
|
---|
81 |
|
---|
82 | /*copy fields: */
|
---|
83 | matestar->mid=this->mid;
|
---|
84 | matestar->helement=(Hook*)this->helement->copy();
|
---|
85 | matestar->element =element_in;
|
---|
86 |
|
---|
87 | return matestar;
|
---|
88 | }
|
---|
89 | /*}}}*/
|
---|
90 | void Matestar::DeepEcho(void){/*{{{*/
|
---|
91 |
|
---|
92 | _printf_("Matestar:\n");
|
---|
93 | _printf_(" mid: " << mid << "\n");
|
---|
94 | _printf_(" element:\n");
|
---|
95 | helement->Echo();
|
---|
96 | }
|
---|
97 | /*}}}*/
|
---|
98 | void Matestar::Echo(void){/*{{{*/
|
---|
99 |
|
---|
100 | _printf_("Matestar:\n");
|
---|
101 | _printf_(" mid: " << mid << "\n");
|
---|
102 | _printf_(" element:\n");
|
---|
103 | helement->Echo();
|
---|
104 | }
|
---|
105 | /*}}}*/
|
---|
106 | int Matestar::Id(void){ return mid; }/*{{{*/
|
---|
107 | /*}}}*/
|
---|
108 | void Matestar::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
|
---|
109 |
|
---|
110 | if(marshall_direction==MARSHALLING_BACKWARD)helement=new Hook();
|
---|
111 |
|
---|
112 | MARSHALLING_ENUM(MatestarEnum);
|
---|
113 | MARSHALLING(mid);
|
---|
114 | this->helement->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
|
---|
115 | this->element=(Element*)this->helement->delivers();
|
---|
116 |
|
---|
117 | }
|
---|
118 | /*}}}*/
|
---|
119 | int Matestar::ObjectEnum(void){/*{{{*/
|
---|
120 |
|
---|
121 | return MatestarEnum;
|
---|
122 |
|
---|
123 | }
|
---|
124 | /*}}}*/
|
---|
125 |
|
---|
126 | /*Matestar management*/
|
---|
127 | void Matestar::Configure(Elements* elementsin){/*{{{*/
|
---|
128 |
|
---|
129 | /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
|
---|
130 | * datasets, using internal ids and offsets hidden in hooks: */
|
---|
131 | helement->configure((DataSet*)elementsin);
|
---|
132 | this->element = (Element*)helement->delivers();
|
---|
133 | }
|
---|
134 | /*}}}*/
|
---|
135 | IssmDouble Matestar::GetA(){/*{{{*/
|
---|
136 | /*
|
---|
137 | * A = 1/B^n
|
---|
138 | */
|
---|
139 |
|
---|
140 | IssmDouble B,n;
|
---|
141 |
|
---|
142 | element->inputs->GetInputAverage(&B,MaterialsRheologyBEnum);
|
---|
143 | n=this->GetN();
|
---|
144 |
|
---|
145 | return pow(B,-n);
|
---|
146 | }
|
---|
147 | /*}}}*/
|
---|
148 | IssmDouble Matestar::GetAbar(){/*{{{*/
|
---|
149 | /*
|
---|
150 | * A = 1/B^n
|
---|
151 | */
|
---|
152 |
|
---|
153 | IssmDouble B,n;
|
---|
154 |
|
---|
155 | element->inputs->GetInputAverage(&B,MaterialsRheologyBbarEnum);
|
---|
156 | n=this->GetN();
|
---|
157 |
|
---|
158 | return pow(B,-n);
|
---|
159 | }
|
---|
160 | /*}}}*/
|
---|
161 | IssmDouble Matestar::GetB(){/*{{{*/
|
---|
162 |
|
---|
163 | /*Output*/
|
---|
164 | IssmDouble B;
|
---|
165 |
|
---|
166 | element->inputs->GetInputAverage(&B,MaterialsRheologyBEnum);
|
---|
167 | return B;
|
---|
168 | }
|
---|
169 | /*}}}*/
|
---|
170 | IssmDouble Matestar::GetBbar(){/*{{{*/
|
---|
171 |
|
---|
172 | /*Output*/
|
---|
173 | IssmDouble Bbar;
|
---|
174 |
|
---|
175 | element->inputs->GetInputAverage(&Bbar,MaterialsRheologyBbarEnum);
|
---|
176 | return Bbar;
|
---|
177 | }
|
---|
178 | /*}}}*/
|
---|
179 | IssmDouble Matestar::GetD(){/*{{{*/
|
---|
180 | _error_("not implemented yet");
|
---|
181 | }
|
---|
182 | /*}}}*/
|
---|
183 | IssmDouble Matestar::GetDbar(){/*{{{*/
|
---|
184 |
|
---|
185 | _error_("not implemented yet");
|
---|
186 | }
|
---|
187 | /*}}}*/
|
---|
188 | IssmDouble Matestar::GetEc(){/*{{{*/
|
---|
189 |
|
---|
190 | /*Output*/
|
---|
191 | IssmDouble Ec;
|
---|
192 |
|
---|
193 | element->inputs->GetInputAverage(&Ec,MaterialsRheologyEcEnum);
|
---|
194 | return Ec;
|
---|
195 | }
|
---|
196 | /*}}}*/
|
---|
197 | IssmDouble Matestar::GetEcbar(){/*{{{*/
|
---|
198 |
|
---|
199 | /*Output*/
|
---|
200 | IssmDouble Ecbar;
|
---|
201 |
|
---|
202 | element->inputs->GetInputAverage(&Ecbar,MaterialsRheologyEcbarEnum);
|
---|
203 | return Ecbar;
|
---|
204 | }
|
---|
205 | /*}}}*/
|
---|
206 | IssmDouble Matestar::GetEs(){/*{{{*/
|
---|
207 |
|
---|
208 | /*Output*/
|
---|
209 | IssmDouble Es;
|
---|
210 |
|
---|
211 | element->inputs->GetInputAverage(&Es,MaterialsRheologyEsEnum);
|
---|
212 | return Es;
|
---|
213 | }
|
---|
214 | /*}}}*/
|
---|
215 | IssmDouble Matestar::GetEsbar(){/*{{{*/
|
---|
216 |
|
---|
217 | /*Output*/
|
---|
218 | IssmDouble Esbar;
|
---|
219 |
|
---|
220 | element->inputs->GetInputAverage(&Esbar,MaterialsRheologyEsbarEnum);
|
---|
221 | return Esbar;
|
---|
222 | }
|
---|
223 | /*}}}*/
|
---|
224 | IssmDouble Matestar::GetN(){/*{{{*/
|
---|
225 |
|
---|
226 | /*Output*/
|
---|
227 | IssmDouble n=3.0;
|
---|
228 | return n;
|
---|
229 | }
|
---|
230 | /*}}}*/
|
---|
231 | void Matestar::GetViscosity(IssmDouble* pviscosity,IssmDouble eps_eff){/*{{{*/
|
---|
232 | _error_("not implemented yet");
|
---|
233 | }
|
---|
234 | /*}}}*/
|
---|
235 | void Matestar::GetViscosityBar(IssmDouble* pviscosity,IssmDouble eps_eff){/*{{{*/
|
---|
236 | _error_("not implemented yet");
|
---|
237 | }
|
---|
238 | /*}}}*/
|
---|
239 | void Matestar::GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* epsilon){/*{{{*/
|
---|
240 | _error_("not implemented yet");
|
---|
241 | }
|
---|
242 | /*}}}*/
|
---|
243 | void Matestar::GetViscosityDComplement(IssmDouble* pviscosity_complement, IssmDouble* epsilon){/*{{{*/
|
---|
244 | _error_("not implemented yet");
|
---|
245 | }
|
---|
246 | /*}}}*/
|
---|
247 | void Matestar::GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* epsilon){/*{{{*/
|
---|
248 | _error_("not implemented yet");
|
---|
249 | }
|
---|
250 | /*}}}*/
|
---|
251 | IssmDouble Matestar::GetViscosityGeneral(IssmDouble vx,IssmDouble vy,IssmDouble vz,IssmDouble* dvx,IssmDouble* dvy,IssmDouble* dvz,IssmDouble eps_eff,bool isdepthaveraged){/*{{{*/
|
---|
252 |
|
---|
253 | /*output: */
|
---|
254 | IssmDouble viscosity;
|
---|
255 |
|
---|
256 | /*Intermediaries*/
|
---|
257 | IssmDouble epsprime_norm;
|
---|
258 | IssmDouble lambdas;
|
---|
259 | IssmDouble vmag,dvmag[3];
|
---|
260 | IssmDouble B,Ec,Es,E,n;
|
---|
261 |
|
---|
262 | /*Calculate velocity magnitude and its derivative*/
|
---|
263 | vmag = sqrt(vx*vx+vy*vy+vz*vz);
|
---|
264 | if(vmag<1e-12){
|
---|
265 | dvmag[0]=0;
|
---|
266 | dvmag[1]=0;
|
---|
267 | dvmag[2]=0;
|
---|
268 | }
|
---|
269 | else{
|
---|
270 | dvmag[0]=1./(2*sqrt(vmag))*(2*vx*dvx[0]+2*vy*dvy[0]+2*vz*dvz[0]);
|
---|
271 | dvmag[1]=1./(2*sqrt(vmag))*(2*vx*dvx[1]+2*vy*dvy[1]+2*vz*dvz[1]);
|
---|
272 | dvmag[2]=1./(2*sqrt(vmag))*(2*vx*dvx[2]+2*vy*dvy[2]+2*vz*dvz[2]);
|
---|
273 | }
|
---|
274 |
|
---|
275 | EstarStrainrateQuantities(&epsprime_norm,vx,vy,vz,vmag,dvx,dvy,dvz,&dvmag[0]);
|
---|
276 | lambdas=EstarLambdaS(eps_eff,epsprime_norm);
|
---|
277 |
|
---|
278 | /*Get B and enhancement*/
|
---|
279 | n=GetN(); _assert_(n>0.);
|
---|
280 | if (isdepthaveraged==0.){
|
---|
281 | B=GetB(); _assert_(B>0.);
|
---|
282 | Ec=GetEc(); _assert_(Ec>=0.);
|
---|
283 | Es=GetEs(); _assert_(Es>=0.);
|
---|
284 | }
|
---|
285 | else{
|
---|
286 | B=GetBbar(); _assert_(B>0.);
|
---|
287 | Ec=GetEcbar(); _assert_(Ec>=0.);
|
---|
288 | Es=GetEsbar(); _assert_(Es>=0.);
|
---|
289 | }
|
---|
290 |
|
---|
291 | /*Get total enhancement factor E(lambdas)*/
|
---|
292 | E = Ec + (Es-Ec)*lambdas*lambdas; _assert_(E>0.);
|
---|
293 |
|
---|
294 | /*Compute viscosity*/
|
---|
295 | /*if no strain rate, return maximum viscosity*/
|
---|
296 | if(eps_eff==0.){
|
---|
297 | viscosity = 1.e+14/2.;
|
---|
298 | //viscosity = B;
|
---|
299 | //viscosity=2.5*pow(10.,17);
|
---|
300 | }
|
---|
301 | else{
|
---|
302 | viscosity = B/(2.*pow(E,1./n)*pow(eps_eff,2./n));
|
---|
303 | }
|
---|
304 |
|
---|
305 | /*Checks in debugging mode*/
|
---|
306 | if(viscosity<=0) _error_("Negative viscosity");
|
---|
307 |
|
---|
308 | /*Assign output pointer*/
|
---|
309 | return viscosity;
|
---|
310 | }
|
---|
311 | /*}}}*/
|
---|
312 | IssmDouble Matestar::GetViscosity_BGeneral(IssmDouble vx,IssmDouble vy,IssmDouble vz,IssmDouble* dvx,IssmDouble* dvy,IssmDouble* dvz,IssmDouble eps_eff,bool isdepthaveraged){/*{{{*/
|
---|
313 |
|
---|
314 | /*Intermediaries*/
|
---|
315 | IssmDouble dmudB;
|
---|
316 | IssmDouble epsprime_norm;
|
---|
317 | IssmDouble lambdas;
|
---|
318 | IssmDouble vmag,dvmag[3];
|
---|
319 | IssmDouble Ec,Es,E;
|
---|
320 |
|
---|
321 | /*Calculate velocity magnitude and its derivative*/
|
---|
322 | vmag = sqrt(vx*vx+vy*vy+vz*vz);
|
---|
323 | if(vmag<1e-12){
|
---|
324 | dvmag[0]=0;
|
---|
325 | dvmag[1]=0;
|
---|
326 | dvmag[2]=0;
|
---|
327 | }
|
---|
328 | else{
|
---|
329 | dvmag[0]=1./(2*sqrt(vmag))*(2*vx*dvx[0]+2*vy*dvy[0]+2*vz*dvz[0]);
|
---|
330 | dvmag[1]=1./(2*sqrt(vmag))*(2*vx*dvx[1]+2*vy*dvy[1]+2*vz*dvz[1]);
|
---|
331 | dvmag[2]=1./(2*sqrt(vmag))*(2*vx*dvx[2]+2*vy*dvy[2]+2*vz*dvz[2]);
|
---|
332 | }
|
---|
333 |
|
---|
334 | EstarStrainrateQuantities(&epsprime_norm,vx,vy,vz,vmag,dvx,dvy,dvz,&dvmag[0]);
|
---|
335 | lambdas=EstarLambdaS(eps_eff,epsprime_norm);
|
---|
336 |
|
---|
337 | /*Get enhancement*/
|
---|
338 | if (isdepthaveraged==0.){
|
---|
339 | Ec=GetEc(); _assert_(Ec>=0.);
|
---|
340 | Es=GetEs(); _assert_(Es>=0.);
|
---|
341 | }
|
---|
342 | else{
|
---|
343 | Ec=GetEcbar(); _assert_(Ec>=0.);
|
---|
344 | Es=GetEsbar(); _assert_(Es>=0.);
|
---|
345 | }
|
---|
346 |
|
---|
347 | /*Get total enhancement factor E(lambdas)*/
|
---|
348 | E = Ec + (Es-Ec)*lambdas*lambdas; _assert_(E>0.);
|
---|
349 |
|
---|
350 | /*Compute dmudB*/
|
---|
351 | if(eps_eff==0.) dmudB = 0.;
|
---|
352 | else dmudB = 1./(2.*pow(E,1./3.)*pow(eps_eff,2./3.));
|
---|
353 |
|
---|
354 | /*Assign output*/
|
---|
355 | return dmudB;
|
---|
356 |
|
---|
357 | }
|
---|
358 | /*}}}*/
|
---|
359 | void Matestar::GetViscosity_B(IssmDouble* pdmudB,IssmDouble eps_eff){/*{{{*/
|
---|
360 | _error_("not implemented yet");
|
---|
361 | }
|
---|
362 | /*}}}*/
|
---|
363 | void Matestar::GetViscosity_D(IssmDouble* pdmudD,IssmDouble eps_eff){/*{{{*/
|
---|
364 | _error_("not implemented yet");
|
---|
365 | }
|
---|
366 | /*}}}*/
|
---|
367 | void Matestar::GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* epsilon){/*{{{*/
|
---|
368 | _error_("not implemented yet");
|
---|
369 | }
|
---|
370 | /*}}}*/
|
---|
371 | void Matestar::InputUpdateFromConstant(IssmDouble constant, int name){/*{{{*/
|
---|
372 | /*Nothing updated yet*/
|
---|
373 | }
|
---|
374 | /*}}}*/
|
---|
375 | void Matestar::InputUpdateFromConstant(int constant, int name){/*{{{*/
|
---|
376 | /*Nothing updated yet*/
|
---|
377 | }
|
---|
378 | /*}}}*/
|
---|
379 | void Matestar::InputUpdateFromConstant(bool constant, int name){/*{{{*/
|
---|
380 | /*Nothing updated yet*/
|
---|
381 | }
|
---|
382 | /*}}}*/
|
---|
383 | void Matestar::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols,int name, int type){/*{{{*/
|
---|
384 | /*Nothing updated yet*/
|
---|
385 | }
|
---|
386 | /*}}}*/
|
---|
387 | void Matestar::InputUpdateFromVector(IssmDouble* vector, int name, int type){/*{{{*/
|
---|
388 |
|
---|
389 | }
|
---|
390 | /*}}}*/
|
---|
391 | void Matestar::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){/*{{{*/
|
---|
392 |
|
---|
393 | }
|
---|
394 | /*}}}*/
|
---|
395 | bool Matestar::IsDamage(){/*{{{*/
|
---|
396 |
|
---|
397 | _error_("not implemented yet");
|
---|
398 | }
|
---|
399 | /*}}}*/
|
---|
400 | void Matestar::ResetHooks(){/*{{{*/
|
---|
401 |
|
---|
402 | this->element=NULL;
|
---|
403 |
|
---|
404 | /*Get Element type*/
|
---|
405 | this->helement->reset();
|
---|
406 |
|
---|
407 | }
|
---|
408 | /*}}}*/
|
---|
409 | void Matestar::SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin){/*{{{*/
|
---|
410 |
|
---|
411 | }
|
---|
412 | /*}}}*/
|
---|
413 | void Matestar::ViscosityBFS(IssmDouble* pdmudB,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input,IssmDouble eps_eff){/*{{{*/
|
---|
414 |
|
---|
415 | /*Intermediaries*/
|
---|
416 | IssmDouble vx,vy,vz;
|
---|
417 | IssmDouble dvx[3],dvy[3],dvz[3];
|
---|
418 | bool isdepthaveraged=0.;
|
---|
419 |
|
---|
420 | /*Get velocity derivatives in all directions*/
|
---|
421 | _assert_(dim>1);
|
---|
422 | _assert_(vx_input);
|
---|
423 | vx_input->GetInputValue(&vx,gauss);
|
---|
424 | vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
|
---|
425 | _assert_(vy_input);
|
---|
426 | vy_input->GetInputValue(&vy,gauss);
|
---|
427 | vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
|
---|
428 | if(dim==3){
|
---|
429 | _assert_(vz_input);
|
---|
430 | vz_input->GetInputValue(&vz,gauss);
|
---|
431 | vz_input->GetInputDerivativeValue(&dvz[0],xyz_list,gauss);
|
---|
432 | }
|
---|
433 | else{
|
---|
434 | vz = 0.;
|
---|
435 | dvz[0] = 0.; dvz[1] = 0.; dvz[2] = 0.;
|
---|
436 | }
|
---|
437 |
|
---|
438 | /*Compute dmudB*/
|
---|
439 | *pdmudB=GetViscosity_BGeneral(vx,vy,vz,&dvx[0],&dvy[0],&dvz[0],eps_eff,isdepthaveraged);
|
---|
440 | }
|
---|
441 | /*}}}*/
|
---|
442 | void Matestar::ViscosityBHO(IssmDouble* pdmudB,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,IssmDouble eps_eff){/*{{{*/
|
---|
443 |
|
---|
444 | /*Intermediaries*/
|
---|
445 | IssmDouble vx,vy,vz;
|
---|
446 | IssmDouble dvx[3],dvy[3],dvz[3];
|
---|
447 | bool isdepthaveraged=0.;
|
---|
448 |
|
---|
449 | /*Get velocity derivatives in all directions*/
|
---|
450 | _assert_(dim==2 || dim==3);
|
---|
451 | _assert_(vx_input);
|
---|
452 | vx_input->GetInputValue(&vx,gauss);
|
---|
453 | vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
|
---|
454 | if(dim==3){
|
---|
455 | _assert_(vy_input);
|
---|
456 | vy_input->GetInputValue(&vy,gauss);
|
---|
457 | vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
|
---|
458 | }
|
---|
459 | else{
|
---|
460 | dvx[2] = 0.;
|
---|
461 | vy = 0.;
|
---|
462 | dvy[0] = 0.; dvy[1] = 0.; dvy[2] = 0.;
|
---|
463 | }
|
---|
464 | vz = 0.;
|
---|
465 | dvz[0] = 0.; dvz[1] = 0.; dvz[2] = -dvx[0]-dvy[1];
|
---|
466 |
|
---|
467 | /*Compute viscosity*/
|
---|
468 | *pdmudB=GetViscosity_BGeneral(vx,vy,vz,&dvx[0],&dvy[0],&dvz[0],eps_eff,isdepthaveraged);
|
---|
469 | }/*}}}*/
|
---|
470 | void Matestar::ViscosityBSSA(IssmDouble* pdmudB,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,IssmDouble eps_eff){/*{{{*/
|
---|
471 | /*Intermediaries*/
|
---|
472 | IssmDouble vx,vy,vz;
|
---|
473 | IssmDouble dvx[3],dvy[3],dvz[3];
|
---|
474 | bool isdepthaveraged=1.;
|
---|
475 |
|
---|
476 | /*Get velocity derivatives in all directions*/
|
---|
477 | _assert_(dim==1 || dim==2);
|
---|
478 | _assert_(vx_input);
|
---|
479 | vx_input->GetInputValue(&vx,gauss);
|
---|
480 | vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
|
---|
481 | if(dim==2){
|
---|
482 | _assert_(vy_input);
|
---|
483 | vy_input->GetInputValue(&vy,gauss);
|
---|
484 | vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
|
---|
485 | }
|
---|
486 | else{
|
---|
487 | dvx[1] = 0.;
|
---|
488 | dvx[2] = 0.;
|
---|
489 | vy = 0.;
|
---|
490 | dvy[0] = 0.; dvy[1] = 0.; dvy[2] = 0.;
|
---|
491 | }
|
---|
492 | dvx[2] = 0.;
|
---|
493 | dvy[2] = 0.;
|
---|
494 | vz = 0.;
|
---|
495 | dvz[0] = 0.; dvz[1] = 0.; dvz[2] = -dvx[0]-dvy[1];
|
---|
496 |
|
---|
497 | /*Compute viscosity*/
|
---|
498 | *pdmudB=GetViscosity_BGeneral(vx,vy,vz,&dvx[0],&dvy[0],&dvz[0],eps_eff,isdepthaveraged);
|
---|
499 | }/*}}}*/
|
---|
500 | void Matestar::ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
|
---|
501 |
|
---|
502 | /*Intermediaries*/
|
---|
503 | IssmDouble vx,vy,vz;
|
---|
504 | IssmDouble dvx[3],dvy[3],dvz[3];
|
---|
505 | IssmDouble epsilon3d[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
|
---|
506 | IssmDouble epsilon2d[3]; /* epsilon=[exx,eyy,exy];*/
|
---|
507 | IssmDouble eps_eff,eps0=1.e-27;
|
---|
508 | bool isdepthaveraged=0.;
|
---|
509 |
|
---|
510 | /*Get velocity derivatives in all directions*/
|
---|
511 | _assert_(dim>1);
|
---|
512 | _assert_(vx_input);
|
---|
513 | vx_input->GetInputValue(&vx,gauss);
|
---|
514 | vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
|
---|
515 | _assert_(vy_input);
|
---|
516 | vy_input->GetInputValue(&vy,gauss);
|
---|
517 | vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
|
---|
518 | if(dim==3){
|
---|
519 | _assert_(vz_input);
|
---|
520 | vz_input->GetInputValue(&vz,gauss);
|
---|
521 | vz_input->GetInputDerivativeValue(&dvz[0],xyz_list,gauss);
|
---|
522 | }
|
---|
523 | else{
|
---|
524 | vz = 0.;
|
---|
525 | dvz[0] = 0.; dvz[1] = 0.; dvz[2] = 0.;
|
---|
526 | }
|
---|
527 |
|
---|
528 | if(dim==3){
|
---|
529 | /* eps_eff^2 = exx^2 + eyy^2 + exy^2 + exz^2 + eyz^2 + exx*eyy */
|
---|
530 | element->StrainRateFS(&epsilon3d[0],xyz_list,gauss,vx_input,vy_input,vz_input);
|
---|
531 | eps_eff = sqrt(epsilon3d[0]*epsilon3d[0] + epsilon3d[1]*epsilon3d[1] + epsilon3d[3]*epsilon3d[3] + epsilon3d[4]*epsilon3d[4] + epsilon3d[5]*epsilon3d[5] + epsilon3d[0]*epsilon3d[1]+eps0*eps0);
|
---|
532 | }
|
---|
533 | else{
|
---|
534 | /* eps_eff^2 = 1/2 ( exx^2 + eyy^2 + 2*exy^2 )*/
|
---|
535 | element->StrainRateSSA(&epsilon2d[0],xyz_list,gauss,vx_input,vy_input);
|
---|
536 | eps_eff = 1./sqrt(2.)*sqrt(epsilon2d[0]*epsilon2d[0] + epsilon2d[1]*epsilon2d[1] + 2.*epsilon2d[2]*epsilon2d[2]);
|
---|
537 | }
|
---|
538 |
|
---|
539 | /*Compute viscosity*/
|
---|
540 | *pviscosity=GetViscosityGeneral(vx,vy,vz,&dvx[0],&dvy[0],&dvz[0],eps_eff,isdepthaveraged);
|
---|
541 | }
|
---|
542 | /*}}}*/
|
---|
543 | void Matestar::ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
|
---|
544 | this->GetViscosityDerivativeEpsSquare(pmu_prime,epsilon);
|
---|
545 | }/*}}}*/
|
---|
546 | void Matestar::ViscosityHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
|
---|
547 |
|
---|
548 | /*Intermediaries*/
|
---|
549 | IssmDouble vx,vy,vz;
|
---|
550 | IssmDouble dvx[3],dvy[3],dvz[3];
|
---|
551 | IssmDouble epsilon3d[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
|
---|
552 | IssmDouble epsilon2d[5]; /* epsilon=[exx,exy];*/
|
---|
553 | IssmDouble eps_eff;
|
---|
554 | bool isdepthaveraged=0.;
|
---|
555 |
|
---|
556 | if(dim==3){
|
---|
557 | /* eps_eff^2 = exx^2 + eyy^2 + exy^2 + exz^2 + eyz^2 + exx*eyy */
|
---|
558 | element->StrainRateHO(&epsilon3d[0],xyz_list,gauss,vx_input,vy_input);
|
---|
559 | eps_eff = sqrt(epsilon3d[0]*epsilon3d[0] + epsilon3d[1]*epsilon3d[1] + epsilon3d[2]*epsilon3d[2] + epsilon3d[3]*epsilon3d[3] + epsilon3d[4]*epsilon3d[4] + epsilon3d[0]*epsilon3d[1]);
|
---|
560 | }
|
---|
561 | else{
|
---|
562 | /* eps_eff^2 = 1/2 (2*exx^2 + 2*exy^2 ) (since eps_zz = - eps_xx)*/
|
---|
563 | element->StrainRateHO2dvertical(&epsilon2d[0],xyz_list,gauss,vx_input,vy_input);
|
---|
564 | eps_eff = 1./sqrt(2.)*sqrt(2*epsilon2d[0]*epsilon2d[0] + 2*epsilon2d[1]*epsilon2d[1]);
|
---|
565 | }
|
---|
566 |
|
---|
567 | /*Get velocity derivatives in all directions*/
|
---|
568 | _assert_(dim==2 || dim==3);
|
---|
569 | _assert_(vx_input);
|
---|
570 | vx_input->GetInputValue(&vx,gauss);
|
---|
571 | vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
|
---|
572 | if(dim==3){
|
---|
573 | _assert_(vy_input);
|
---|
574 | vy_input->GetInputValue(&vy,gauss);
|
---|
575 | vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
|
---|
576 | }
|
---|
577 | else{
|
---|
578 | dvx[2] = 0.;
|
---|
579 | vy = 0.;
|
---|
580 | dvy[0] = 0.; dvy[1] = 0.; dvy[2] = 0.;
|
---|
581 | }
|
---|
582 | vz = 0.;
|
---|
583 | dvz[0] = 0.; dvz[1] = 0.; dvz[2] = -dvx[0]-dvy[1];
|
---|
584 |
|
---|
585 | /*Compute viscosity*/
|
---|
586 | *pviscosity=GetViscosityGeneral(vx,vy,vz,&dvx[0],&dvy[0],&dvz[0],eps_eff,isdepthaveraged);
|
---|
587 | }/*}}}*/
|
---|
588 | void Matestar::ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
|
---|
589 | _error_("not implemented yet");
|
---|
590 | }/*}}}*/
|
---|
591 | void Matestar::ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surface_input){/*{{{*/
|
---|
592 | _error_("not implemented yet");
|
---|
593 | }/*}}}*/
|
---|
594 | void Matestar::ViscositySSA(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
|
---|
595 |
|
---|
596 | /*Intermediaries*/
|
---|
597 | IssmDouble vx,vy,vz;
|
---|
598 | IssmDouble dvx[3],dvy[3],dvz[3];
|
---|
599 | IssmDouble epsilon2d[3];/* epsilon=[exx,eyy,exy]; */
|
---|
600 | IssmDouble epsilon1d; /* epsilon=[exx]; */
|
---|
601 | IssmDouble eps_eff;
|
---|
602 | bool isdepthaveraged=1.;
|
---|
603 |
|
---|
604 | /*Get velocity derivatives in all directions*/
|
---|
605 | _assert_(dim==1 || dim==2);
|
---|
606 | _assert_(vx_input);
|
---|
607 | vx_input->GetInputValue(&vx,gauss);
|
---|
608 | vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
|
---|
609 | if(dim==2){
|
---|
610 | _assert_(vy_input);
|
---|
611 | vy_input->GetInputValue(&vy,gauss);
|
---|
612 | vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
|
---|
613 | }
|
---|
614 | else{
|
---|
615 | dvx[1] = 0.;
|
---|
616 | dvx[2] = 0.;
|
---|
617 | vy = 0.;
|
---|
618 | dvy[0] = 0.; dvy[1] = 0.; dvy[2] = 0.;
|
---|
619 | }
|
---|
620 | dvx[2] = 0.;
|
---|
621 | dvy[2] = 0.;
|
---|
622 | vz = 0.;
|
---|
623 | dvz[0] = 0.; dvz[1] = 0.; dvz[2] = -dvx[0]-dvy[1];
|
---|
624 |
|
---|
625 | if(dim==2){
|
---|
626 | /* eps_eff^2 = exx^2 + eyy^2 + exy^2 + exx*eyy*/
|
---|
627 | element->StrainRateSSA(&epsilon2d[0],xyz_list,gauss,vx_input,vy_input);
|
---|
628 | eps_eff = sqrt(epsilon2d[0]*epsilon2d[0] + epsilon2d[1]*epsilon2d[1] + epsilon2d[2]*epsilon2d[2] + epsilon2d[0]*epsilon2d[1]);
|
---|
629 | }
|
---|
630 | else{
|
---|
631 | /* eps_eff^2 = exx^2*/
|
---|
632 | element->StrainRateSSA1d(&epsilon1d,xyz_list,gauss,vx_input);
|
---|
633 | eps_eff = fabs(epsilon1d);
|
---|
634 | }
|
---|
635 |
|
---|
636 | /*Compute viscosity*/
|
---|
637 | *pviscosity=GetViscosityGeneral(vx,vy,vz,&dvx[0],&dvy[0],&dvz[0],eps_eff,isdepthaveraged);
|
---|
638 | }/*}}}*/
|
---|
639 | void Matestar::ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
|
---|
640 | _error_("not implemented yet");
|
---|
641 | }/*}}}*/
|
---|