[1] | 1 | /*! \file Model.cpp
|
---|
| 2 | * \brief Model structure that mirrors the matlab workspace structure. Servers for the serial
|
---|
| 3 | * and parallel runs.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | #ifdef HAVE_CONFIG_H
|
---|
| 7 | #include "config.h"
|
---|
| 8 | #else
|
---|
| 9 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
| 10 | #endif
|
---|
| 11 |
|
---|
| 12 | #include "../shared/shared.h"
|
---|
| 13 | #include "../io/io.h"
|
---|
| 14 | #include "../include/globals.h"
|
---|
| 15 | #include "../include/macros.h"
|
---|
| 16 |
|
---|
| 17 | #include <string.h>
|
---|
| 18 | #include "stdio.h"
|
---|
| 19 |
|
---|
[117] | 20 | #include "./Model.h"
|
---|
[1] | 21 |
|
---|
| 22 |
|
---|
| 23 | /*!--------------------------------------------------
|
---|
| 24 | NewModel
|
---|
| 25 | --------------------------------------------------*/
|
---|
| 26 |
|
---|
| 27 | Model* NewModel(void) {
|
---|
| 28 | /*! create a new Model object */
|
---|
| 29 | Model* model=NULL;
|
---|
| 30 |
|
---|
| 31 | model=(Model*)xmalloc(sizeof(Model));
|
---|
| 32 |
|
---|
| 33 | /*!initialize all pointers to 0: */
|
---|
| 34 | model->repository=NULL;
|
---|
| 35 | model->meshtype=NULL;
|
---|
| 36 | model->analysis_type=NULL;
|
---|
[465] | 37 | model->sub_analysis_type=NULL;
|
---|
[586] | 38 | model->qmu_analysis=0;
|
---|
| 39 | model->solverstring=NULL;
|
---|
| 40 | model->numberofresponses=0;
|
---|
| 41 | model->qmu_npart=0;
|
---|
[1] | 42 | model->numberofelements=0;
|
---|
| 43 | model->numberofnodes=0;
|
---|
| 44 | model->x=NULL;
|
---|
| 45 | model->y=NULL;
|
---|
| 46 | model->z=NULL;
|
---|
| 47 | model->elements=NULL;
|
---|
| 48 | model->elements_type=NULL;
|
---|
| 49 | model->numberofnodes2d=0;
|
---|
| 50 | model->elements2d=NULL;
|
---|
[88] | 51 | model->deadgrids=NULL;
|
---|
[1] | 52 | model->numlayers=0;
|
---|
[88] | 53 | model->uppernodes=NULL;
|
---|
[308] | 54 | model->gridonhutter=NULL;
|
---|
[653] | 55 | model->gridonmacayeal=NULL;
|
---|
| 56 | model->gridonpattyn=NULL;
|
---|
[1] | 57 |
|
---|
| 58 | model->vx_obs=NULL;
|
---|
| 59 | model->vy_obs=NULL;
|
---|
| 60 | model->vx=NULL;
|
---|
| 61 | model->vy=NULL;
|
---|
| 62 | model->vz=NULL;
|
---|
| 63 | model->pressure=NULL;
|
---|
[575] | 64 | model->temperature=NULL;
|
---|
| 65 | model->melting=NULL;
|
---|
[1] | 66 | model->elementonbed=NULL;
|
---|
| 67 | model->elementonsurface=NULL;
|
---|
| 68 | model->gridonbed=NULL;
|
---|
| 69 | model->gridonsurface=NULL;
|
---|
[377] | 70 | model->gridonstokes=NULL;
|
---|
| 71 | model->borderstokes=NULL;
|
---|
[1] | 72 | model->thickness=NULL;
|
---|
| 73 | model->surface=NULL;
|
---|
| 74 | model->bed=NULL;
|
---|
| 75 | model->elementoniceshelf=NULL;
|
---|
[387] | 76 | model->gridonicesheet=NULL;
|
---|
[1] | 77 |
|
---|
| 78 | model->drag_type=0;
|
---|
| 79 | model->drag=NULL;
|
---|
| 80 | model->p=NULL;
|
---|
[586] | 81 | model->q=NULL;
|
---|
[1] | 82 |
|
---|
| 83 |
|
---|
| 84 | model->numberofsegs_diag=0;
|
---|
[516] | 85 | model->numberofsegs_diag_stokes=0;
|
---|
[1] | 86 | model->segmentonneumann_diag=NULL;
|
---|
[387] | 87 | model->segmentonneumann_diag_stokes=NULL;
|
---|
[1] | 88 | model-> neumannvalues_diag=NULL;
|
---|
| 89 | model-> gridondirichlet_diag=NULL;
|
---|
| 90 | model-> dirichletvalues_diag=NULL;
|
---|
| 91 | //prognostic
|
---|
| 92 | model-> segmentonneumann_prog=NULL;
|
---|
| 93 | model-> neumannvalues_prog=NULL;
|
---|
| 94 | model-> gridondirichlet_prog=NULL;
|
---|
| 95 | model-> dirichletvalues_prog=NULL;
|
---|
| 96 | //prognostic2
|
---|
| 97 | model-> segmentonneumann_prog2=NULL;
|
---|
| 98 | model-> neumannvalues_prog2=NULL;
|
---|
| 99 | //thermal
|
---|
| 100 | model-> gridondirichlet_thermal=NULL;
|
---|
| 101 | model-> dirichletvalues_thermal=NULL;
|
---|
| 102 | model-> geothermalflux=NULL;
|
---|
| 103 |
|
---|
| 104 | /*!materials: */
|
---|
| 105 | model->rho_water=0;
|
---|
| 106 | model->rho_ice=0;
|
---|
[586] | 107 | model->g=0;
|
---|
| 108 | model->n=NULL;
|
---|
[1] | 109 | model->B=NULL;
|
---|
| 110 |
|
---|
| 111 | /*!control methods: */
|
---|
| 112 | model->control_type=NULL;
|
---|
| 113 |
|
---|
| 114 | /*!solution parameters: */
|
---|
| 115 | model->fit=NULL;
|
---|
| 116 | model->meanvel=0;
|
---|
| 117 | model->epsvel=0;
|
---|
| 118 | model->artificial_diffusivity=0;
|
---|
| 119 | model->nsteps=0;
|
---|
| 120 | model->tolx=0;
|
---|
| 121 | model->maxiter=NULL;
|
---|
| 122 | model->mincontrolconstraint=0;
|
---|
| 123 | model->maxcontrolconstraint=0;
|
---|
| 124 | model->debug=0;
|
---|
| 125 | model->plot=0;
|
---|
| 126 | model->eps_rel=0;
|
---|
| 127 | model->eps_abs=0;
|
---|
| 128 | model->dt=0;
|
---|
| 129 | model->ndt=0;
|
---|
| 130 | model->penalty_offset=0;
|
---|
| 131 | model->penalty_melting=0;
|
---|
| 132 | model->penalty_lock=0;
|
---|
| 133 | model->sparsity=0;
|
---|
| 134 | model->connectivity=0;
|
---|
| 135 | model->lowmem=0;
|
---|
| 136 | model->optscal=NULL;
|
---|
| 137 | model->yts=0;
|
---|
| 138 | model->viscosity_overshoot=0;
|
---|
[387] | 139 | model->stokesreconditioning=0;
|
---|
[1] | 140 | model->waitonlock=0;
|
---|
| 141 |
|
---|
| 142 | /*!thermal parameters: */
|
---|
| 143 | model->beta=0;
|
---|
| 144 | model->meltingpoint=0;
|
---|
| 145 | model->latentheat=0;
|
---|
| 146 | model->heatcapacity=0;
|
---|
| 147 | model->thermalconductivity=0;
|
---|
| 148 | model->min_thermal_constraints=0;
|
---|
| 149 | model->mixed_layer_capacity=0;
|
---|
| 150 | model->thermal_exchange_velocity=0;
|
---|
| 151 |
|
---|
| 152 |
|
---|
| 153 | model->numrifts=0;
|
---|
| 154 | model->riftsnumpenaltypairs=NULL;
|
---|
| 155 | model->riftspenaltypairs=NULL;
|
---|
| 156 | model->riftsfill=NULL;
|
---|
| 157 | model->riftsfriction=NULL;
|
---|
| 158 |
|
---|
| 159 | /*!penalties: */
|
---|
| 160 | model->numpenalties=0;
|
---|
| 161 | model->penalties=NULL;
|
---|
| 162 | model->penaltypartitioning=NULL;
|
---|
| 163 |
|
---|
| 164 | /*!basal: */
|
---|
| 165 | model->melting=NULL;
|
---|
| 166 | model->accumulation=NULL;
|
---|
| 167 |
|
---|
[300] | 168 | /*elements type: */
|
---|
| 169 | model->ishutter=0;
|
---|
| 170 | model->ismacayealpattyn=0;
|
---|
| 171 | model->isstokes=0;
|
---|
| 172 |
|
---|
[586] | 173 |
|
---|
| 174 | model->epart=NULL;
|
---|
| 175 | model->npart=NULL;
|
---|
| 176 | model->my_grids=NULL;
|
---|
| 177 | model->my_bordergrids=NULL;
|
---|
| 178 |
|
---|
[1] | 179 | return model;
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 |
|
---|
| 183 | /*!--------------------------------------------------
|
---|
| 184 | DeleteModel
|
---|
| 185 | --------------------------------------------------*/
|
---|
| 186 |
|
---|
| 187 | void DeleteModel(Model** pmodel){
|
---|
| 188 |
|
---|
| 189 | /*!Recover structure: */
|
---|
| 190 | Model* model = *pmodel;
|
---|
| 191 |
|
---|
| 192 | int i;
|
---|
| 193 |
|
---|
| 194 | /*!Two cases here:
|
---|
| 195 | * - serial mode: matlab's memory manager will take care of delete model when returning from Imp. Do nothing here, so as not to confuse
|
---|
| 196 | * the memory manager.
|
---|
| 197 | * - in parallel, anything the io layer does (FetchData) did needs to be erased explicitely in the model.
|
---|
| 198 | */
|
---|
| 199 |
|
---|
| 200 | #ifdef _PARALLEL_
|
---|
| 201 | xfree((void**)&model->x);
|
---|
| 202 | xfree((void**)&model->y);
|
---|
| 203 | xfree((void**)&model->z);
|
---|
| 204 | xfree((void**)&model->elements);
|
---|
| 205 | xfree((void**)&model->elements_type);
|
---|
[308] | 206 | xfree((void**)&model->gridonhutter);
|
---|
[653] | 207 | xfree((void**)&model->gridonmacayeal);
|
---|
[1] | 208 | if (strcmp(model->meshtype,"3d")==0){
|
---|
| 209 | xfree((void**)&model->elements2d);
|
---|
| 210 | xfree((void**)&model->deadgrids);
|
---|
[88] | 211 | xfree((void**)&model->uppernodes);
|
---|
[653] | 212 | xfree((void**)&model->gridonpattyn);
|
---|
[1] | 213 | }
|
---|
| 214 | xfree((void**)&model->solverstring);
|
---|
| 215 | xfree((void**)&model->elementonbed);
|
---|
| 216 | xfree((void**)&model->elementonsurface);
|
---|
| 217 | xfree((void**)&model->gridonbed);
|
---|
| 218 | xfree((void**)&model->gridonsurface);
|
---|
[377] | 219 | xfree((void**)&model->gridonstokes);
|
---|
| 220 | xfree((void**)&model->borderstokes);
|
---|
[1] | 221 | xfree((void**)&model->thickness);
|
---|
| 222 | xfree((void**)&model->surface);
|
---|
| 223 | xfree((void**)&model->bed);
|
---|
| 224 | xfree((void**)&model->vx_obs);
|
---|
| 225 | xfree((void**)&model->vy_obs);
|
---|
| 226 | xfree((void**)&model->vx);
|
---|
| 227 | xfree((void**)&model->vy);
|
---|
| 228 | xfree((void**)&model->vz);
|
---|
| 229 | xfree((void**)&model->pressure);
|
---|
[575] | 230 | xfree((void**)&model->temperature);
|
---|
| 231 | xfree((void**)&model->melting);
|
---|
[1] | 232 | xfree((void**)&model->drag);
|
---|
| 233 | xfree((void**)&model->p);
|
---|
| 234 | xfree((void**)&model->q);
|
---|
| 235 | xfree((void**)&model->elementoniceshelf);
|
---|
[387] | 236 | xfree((void**)&model->gridonicesheet);
|
---|
[1] | 237 | xfree((void**)&model->segmentonneumann_diag);
|
---|
[387] | 238 | xfree((void**)&model->segmentonneumann_diag_stokes);
|
---|
[1] | 239 | xfree((void**)&model->neumannvalues_diag);
|
---|
| 240 | xfree((void**)&model->gridondirichlet_diag);
|
---|
| 241 | xfree((void**)&model->dirichletvalues_diag);
|
---|
| 242 | xfree((void**)&model->segmentonneumann_prog);
|
---|
| 243 | xfree((void**)&model->neumannvalues_prog);
|
---|
| 244 | xfree((void**)&model->gridondirichlet_prog);
|
---|
| 245 | xfree((void**)&model->dirichletvalues_prog);
|
---|
| 246 | xfree((void**)&model->segmentonneumann_prog2);
|
---|
| 247 | xfree((void**)&model->neumannvalues_prog2);
|
---|
| 248 | xfree((void**)&model->gridondirichlet_thermal);
|
---|
| 249 | xfree((void**)&model->dirichletvalues_thermal);
|
---|
| 250 | xfree((void**)&model->geothermalflux);
|
---|
| 251 | xfree((void**)&model->melting);
|
---|
| 252 | xfree((void**)&model->accumulation);
|
---|
| 253 | xfree((void**)&model->B);
|
---|
| 254 | xfree((void**)&model->n);
|
---|
| 255 | xfree((void**)&model->fit);
|
---|
| 256 | xfree((void**)&model->optscal);
|
---|
| 257 | xfree((void**)&model->maxiter);
|
---|
| 258 |
|
---|
| 259 |
|
---|
| 260 | /*!Delete structure fields: */
|
---|
| 261 | xfree((void**)&model->repository);
|
---|
| 262 | xfree((void**)&model->meshtype);
|
---|
| 263 | xfree((void**)&model->analysis_type);
|
---|
[465] | 264 | xfree((void**)&model->sub_analysis_type);
|
---|
[1] | 265 |
|
---|
| 266 | if(model->numrifts){
|
---|
| 267 | for(i=0;i<model->numrifts;i++){
|
---|
| 268 | double* riftpenaltypairs=model->riftspenaltypairs[i];
|
---|
| 269 | xfree((void**)&riftpenaltypairs);
|
---|
| 270 | }
|
---|
| 271 | xfree((void**)&model->riftspenaltypairs);
|
---|
| 272 | xfree((void**)&model->riftsnumpenaltypairs);
|
---|
| 273 | xfree((void**)&model->riftsfill);
|
---|
| 274 | xfree((void**)&model->riftsfriction);
|
---|
| 275 | }
|
---|
| 276 |
|
---|
| 277 | xfree((void**)&model->penalties);
|
---|
| 278 | xfree((void**)&model->penaltypartitioning);
|
---|
| 279 |
|
---|
| 280 | xfree((void**)&model->control_type);
|
---|
| 281 |
|
---|
[387] | 282 | xfree((void**)&model->epart);
|
---|
| 283 | xfree((void**)&model->npart);
|
---|
| 284 | xfree((void**)&model->my_grids);
|
---|
| 285 | xfree((void**)&model->my_bordergrids);
|
---|
| 286 |
|
---|
[1] | 287 | /*!Delete entire structure: */
|
---|
| 288 | xfree((void**)pmodel);
|
---|
| 289 | #endif
|
---|
| 290 | }
|
---|
| 291 |
|
---|
| 292 | /*!--------------------------------------------------
|
---|
| 293 | ModelInit
|
---|
| 294 | --------------------------------------------------*/
|
---|
| 295 |
|
---|
| 296 | #undef __FUNCT__
|
---|
| 297 | #define __FUNCT__ "ModelInit"
|
---|
| 298 |
|
---|
| 299 | int ModelInit(Model** pmodel,ConstDataHandle model_handle){
|
---|
| 300 |
|
---|
| 301 | int i,j;
|
---|
| 302 |
|
---|
| 303 | /*output: */
|
---|
| 304 | Model* model=NULL;
|
---|
| 305 |
|
---|
| 306 | /*Allocate model: */
|
---|
| 307 | model=NewModel();
|
---|
| 308 |
|
---|
| 309 | /*In ModelInit, we get all the data that is not difficult to get, and that is small: */
|
---|
[586] | 310 |
|
---|
[1] | 311 | ModelFetchData((void**)&model->analysis_type,NULL,NULL,model_handle,"analysis_type","String",NULL);
|
---|
[465] | 312 | ModelFetchData((void**)&model->sub_analysis_type,NULL,NULL,model_handle,"sub_analysis_type","String",NULL);
|
---|
[586] | 313 | ModelFetchData((void**)&model->qmu_analysis,NULL,NULL,model_handle,"qmu_analysis","Integer",NULL);
|
---|
[1] | 314 |
|
---|
| 315 | ModelFetchData((void**)&model->meshtype,NULL,NULL,model_handle,"type","String",NULL);
|
---|
| 316 | /*!Get numberofelements and numberofnodes: */
|
---|
| 317 | ModelFetchData((void**)&model->numberofnodes,NULL,NULL,model_handle,"numberofgrids","Integer",NULL);
|
---|
| 318 | ModelFetchData((void**)&model->numberofelements,NULL,NULL,model_handle,"numberofelements","Integer",NULL);
|
---|
| 319 | /*!In case we are running 3d, we are going to need the collapsed and non-collapsed 2d meshes, from which the 3d mesh was extruded: */
|
---|
| 320 | if (strcmp(model->meshtype,"3d")==0){
|
---|
| 321 |
|
---|
| 322 | /*!Deal with 2d mesh: */
|
---|
| 323 | ModelFetchData((void**)&model->numberofelements2d,NULL,NULL,model_handle,"numberofelements2d","Integer",NULL);
|
---|
| 324 | ModelFetchData((void**)&model->numberofnodes2d,NULL,NULL,model_handle,"numberofgrids2d","Integer",NULL);
|
---|
| 325 | ModelFetchData((void**)&model->numlayers,NULL,NULL,model_handle,"numlayers","Integer",NULL);
|
---|
| 326 | }
|
---|
[300] | 327 |
|
---|
[586] | 328 |
|
---|
[300] | 329 | /*elements type: */
|
---|
| 330 | ModelFetchData((void**)&model->ishutter,NULL,NULL,model_handle,"ishutter","Integer",NULL);
|
---|
| 331 | ModelFetchData((void**)&model->ismacayealpattyn,NULL,NULL,model_handle,"ismacayealpattyn","Integer",NULL);
|
---|
[394] | 332 | ModelFetchData((void**)&model->isstokes,NULL,NULL,model_handle,"isstokes","Integer",NULL);
|
---|
[300] | 333 |
|
---|
[1] | 334 | /*!Get drag_type, drag and p,q: */
|
---|
| 335 | ModelFetchData((void**)&model->drag_type,NULL,NULL,model_handle,"drag_type","Integer",NULL);
|
---|
| 336 |
|
---|
| 337 | /*!Get materials: */
|
---|
| 338 | ModelFetchData((void**)&model->rho_water,NULL,NULL,model_handle,"rho_water","Scalar",NULL);
|
---|
| 339 | ModelFetchData((void**)&model->rho_ice,NULL,NULL,model_handle,"rho_ice","Scalar",NULL);
|
---|
| 340 | ModelFetchData((void**)&model->g,NULL,NULL,model_handle,"g","Scalar",NULL);
|
---|
| 341 |
|
---|
| 342 | /*Get control parameters: */
|
---|
| 343 | ModelFetchData((void**)&model->control_type,NULL,NULL,model_handle,"control_type","String",NULL);
|
---|
| 344 |
|
---|
| 345 | /*!Get solution parameters: */
|
---|
| 346 | ModelFetchData((void**)&model->yts,NULL,NULL,model_handle,"yts","Scalar",NULL);
|
---|
| 347 | ModelFetchData((void**)&model->meanvel,NULL,NULL,model_handle,"meanvel","Scalar",NULL);
|
---|
| 348 | ModelFetchData((void**)&model->epsvel,NULL,NULL,model_handle,"epsvel","Scalar",NULL);
|
---|
| 349 | ModelFetchData((void**)&model->debug,NULL,NULL,model_handle,"debug","Integer",NULL);
|
---|
| 350 | ModelFetchData((void**)&model->plot,NULL,NULL,model_handle,"plot","Integer",NULL);
|
---|
| 351 | ModelFetchData((void**)&model->artificial_diffusivity,NULL,NULL,model_handle,"artificial_diffusivity","Integer",NULL);
|
---|
| 352 | ModelFetchData((void**)&model->nsteps,NULL,NULL,model_handle,"nsteps","Integer",NULL);
|
---|
| 353 | ModelFetchData((void**)&model->tolx,NULL,NULL,model_handle,"tolx","Scalar",NULL);
|
---|
| 354 | ModelFetchData((void**)&model->mincontrolconstraint,NULL,NULL,model_handle,"mincontrolconstraint","Scalar",NULL);
|
---|
| 355 | ModelFetchData((void**)&model->maxcontrolconstraint,NULL,NULL,model_handle,"maxcontrolconstraint","Scalar",NULL);
|
---|
| 356 | ModelFetchData((void**)&model->eps_rel,NULL,NULL,model_handle,"eps_rel","Scalar",NULL);
|
---|
| 357 | ModelFetchData((void**)&model->eps_abs,NULL,NULL,model_handle,"eps_abs","Scalar",NULL);
|
---|
| 358 | ModelFetchData((void**)&model->dt,NULL,NULL,model_handle,"dt","Scalar",NULL);
|
---|
| 359 | ModelFetchData((void**)&model->ndt,NULL,NULL,model_handle,"ndt","Scalar",NULL);
|
---|
| 360 | ModelFetchData((void**)&model->penalty_offset,NULL,NULL,model_handle,"penalty_offset","Scalar",NULL);
|
---|
| 361 | ModelFetchData((void**)&model->penalty_melting,NULL,NULL,model_handle,"penalty_melting","Scalar",NULL);
|
---|
| 362 | ModelFetchData((void**)&model->penalty_lock,NULL,NULL,model_handle,"penalty_lock","Integer",NULL);
|
---|
| 363 | ModelFetchData((void**)&model->sparsity,NULL,NULL,model_handle,"sparsity","Scalar",NULL);
|
---|
| 364 | ModelFetchData((void**)&model->connectivity,NULL,NULL,model_handle,"connectivity","Integer",NULL);
|
---|
| 365 | ModelFetchData((void**)&model->lowmem,NULL,NULL,model_handle,"lowmem","Integer",NULL);
|
---|
| 366 | ModelFetchData((void**)&model->solverstring,NULL,NULL,model_handle,"solverstring","String",NULL);
|
---|
| 367 | ModelFetchData((void**)&model->viscosity_overshoot,NULL,NULL,model_handle,"viscosity_overshoot","Scalar",NULL);
|
---|
[387] | 368 | ModelFetchData((void**)&model->stokesreconditioning,NULL,NULL,model_handle,"stokesreconditioning","Scalar",NULL);
|
---|
[1] | 369 | ModelFetchData((void**)&model->waitonlock,NULL,NULL,model_handle,"waitonlock","Integer",NULL);
|
---|
| 370 |
|
---|
| 371 | /*!Get thermal parameters: */
|
---|
| 372 | ModelFetchData((void**)&model->beta,NULL,NULL,model_handle,"beta","Scalar",NULL);
|
---|
| 373 | ModelFetchData((void**)&model->meltingpoint,NULL,NULL,model_handle,"meltingpoint","Scalar",NULL);
|
---|
| 374 | ModelFetchData((void**)&model->latentheat,NULL,NULL,model_handle,"latentheat","Scalar",NULL);
|
---|
| 375 | ModelFetchData((void**)&model->heatcapacity,NULL,NULL,model_handle,"heatcapacity","Scalar",NULL);
|
---|
| 376 | ModelFetchData((void**)&model->thermalconductivity,NULL,NULL,model_handle,"thermalconductivity","Scalar",NULL);
|
---|
| 377 | ModelFetchData((void**)&model->min_thermal_constraints,NULL,NULL,model_handle,"min_thermal_constraints","Integer",NULL);
|
---|
| 378 | ModelFetchData((void**)&model->mixed_layer_capacity,NULL,NULL,model_handle,"mixed_layer_capacity","Scalar",NULL);
|
---|
| 379 | ModelFetchData((void**)&model->thermal_exchange_velocity,NULL,NULL,model_handle,"thermal_exchange_velocity","Scalar",NULL);
|
---|
[358] | 380 |
|
---|
[1] | 381 | /*rifts: */
|
---|
| 382 | ModelFetchData((void**)&model->numrifts,NULL,NULL,model_handle,"numrifts","Integer",NULL);
|
---|
| 383 |
|
---|
[586] | 384 | /*qmu: */
|
---|
| 385 | if(model->qmu_analysis){
|
---|
| 386 | ModelFetchData((void**)&model->numberofresponses,NULL,NULL,model_handle,"numberofresponses","Integer",NULL);
|
---|
| 387 | ModelFetchData((void**)&model->qmu_npart,NULL,NULL,model_handle,"npart","Integer",NULL);
|
---|
| 388 | }
|
---|
| 389 |
|
---|
[1] | 390 | /*Assign output pointers: */
|
---|
| 391 | *pmodel=model;
|
---|
| 392 |
|
---|
| 393 | return 1;
|
---|
| 394 | }
|
---|
| 395 |
|
---|
| 396 | /*!--------------------------------------------------
|
---|
| 397 | ModelEcho
|
---|
| 398 | --------------------------------------------------*/
|
---|
| 399 | void ModelEcho(Model* model,int which_part,int rank) {
|
---|
| 400 |
|
---|
| 401 | //which_part determines what gets echoed, otherwise, we'll get too much output.
|
---|
| 402 | //1-> penalties
|
---|
| 403 |
|
---|
| 404 | int i,j;
|
---|
| 405 |
|
---|
| 406 | if(which_part==1 && my_rank==rank && (strcmp(model->meshtype,"3d")==0)){
|
---|
| 407 | printf("Model penalties: \n");
|
---|
| 408 | printf(" number of penalties: %i\n",model->numpenalties);
|
---|
| 409 | printf(" grids: \n");
|
---|
| 410 |
|
---|
| 411 | for(i=0;i<model->numpenalties;i++){
|
---|
| 412 | for(j=0;j<model->numlayers;j++){
|
---|
| 413 | printf("%i ",(int)*(model->penalties+model->numlayers*i+j));
|
---|
| 414 | }
|
---|
| 415 | printf("\n");
|
---|
| 416 | }
|
---|
| 417 | }
|
---|
| 418 |
|
---|
| 419 | if(which_part==2 && my_rank==rank){
|
---|
| 420 | printf("Model rifts: \n");
|
---|
| 421 | printf(" number of rifts: %i\n",model->numrifts);
|
---|
| 422 | for(i=0;i<model->numrifts;i++){
|
---|
| 423 | double* penaltypairs=model->riftspenaltypairs[i];
|
---|
| 424 | printf(" rift #%i\n",i);
|
---|
| 425 | for (j=0;j<model->riftsnumpenaltypairs[i];j++){
|
---|
| 426 | printf(" grids %g %g elements %g %g normal [%g,%g] length %g\n",*(penaltypairs+7*j+0),*(penaltypairs+7*j+1),*(penaltypairs+7*j+2),*(penaltypairs+7*j+3),
|
---|
| 427 | *(penaltypairs+7*j+4),*(penaltypairs+7*j+5),*(penaltypairs+7*j+6));
|
---|
| 428 | }
|
---|
| 429 | printf(" friction %g fill %i\n",model->riftsfriction[i],model->riftsfill[i]);
|
---|
| 430 | }
|
---|
| 431 | }
|
---|
| 432 | cleanup_and_return:
|
---|
| 433 | return;
|
---|
| 434 | }
|
---|