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