Changeset 4532


Ignore:
Timestamp:
07/12/10 12:07:13 (15 years ago)
Author:
Eric.Larour
Message:

Introduced update of material properties for Matpar.
Qmu is now working in serial and parallel mode. Need to test results.

Location:
issm/trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/EnumDefinitions/EnumAsString.cpp

    r4521 r4532  
    249249                case RhoWaterEnum : return "RhoWater";
    250250                case GravityEnum : return "Gravity";
     251                case ThermalConductivityEnum : return "ThermalConductivity";
     252                case MixedLayerCapacityEnum : return "MixedLayerCapacity";
     253                case ThermalExchangeVelocityEnum : return "ThermalExchangeVelocity";
    251254                case BetaEnum : return "Beta";
    252255                case CmGradientEnum : return "CmGradient";
  • issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h

    r4521 r4532  
    285285        RhoWaterEnum,
    286286        GravityEnum,
     287        ThermalConductivityEnum,
     288        MixedLayerCapacityEnum,
     289        ThermalExchangeVelocityEnum,
    287290        /*}}}*/
    288291        /*Parameters{{{1*/
  • issm/trunk/src/c/EnumDefinitions/StringAsEnum.cpp

    r4521 r4532  
    247247        else if (strcmp(name,"RhoWater")==0) return RhoWaterEnum;
    248248        else if (strcmp(name,"Gravity")==0) return GravityEnum;
     249        else if (strcmp(name,"ThermalConductivity")==0) return ThermalConductivityEnum;
     250        else if (strcmp(name,"MixedLayerCapacity")==0) return MixedLayerCapacityEnum;
     251        else if (strcmp(name,"ThermalExchangeVelocity")==0) return ThermalExchangeVelocityEnum;
    249252        else if (strcmp(name,"Beta")==0) return BetaEnum;
    250253        else if (strcmp(name,"CmGradient")==0) return CmGradientEnum;
  • issm/trunk/src/c/modules/InputUpdateFromConstantx/InputUpdateFromConstantx.cpp

    r4218 r4532  
    2929                load->InputUpdateFromConstant(constant,name);
    3030        }
     31       
     32        for(i=0;i<materials->Size();i++){
     33                Material* material=(Material*)materials->GetObjectByOffset(i);
     34                material->InputUpdateFromConstant(constant,name);
     35        }
    3136}
    3237void InputUpdateFromConstantx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,int    constant, int name){
     
    4954                Load* load=(Load*)loads->GetObjectByOffset(i);
    5055                load->InputUpdateFromConstant(constant,name);
     56        }
     57       
     58        for(i=0;i<materials->Size();i++){
     59                Material* material=(Material*)materials->GetObjectByOffset(i);
     60                material->InputUpdateFromConstant(constant,name);
    5161        }
    5262}
     
    7181                load->InputUpdateFromConstant(constant,name);
    7282        }
     83       
     84        for(i=0;i<materials->Size();i++){
     85                Material* material=(Material*)materials->GetObjectByOffset(i);
     86                material->InputUpdateFromConstant(constant,name);
     87        }
     88
    7389}
  • issm/trunk/src/c/objects/Elements/Beam.cpp

    r4405 r4532  
    550550        const int numgrids=2;
    551551        double  gaussgrids[numgrids][2]={{0,1},{1,0}};
    552         double  vx_values[numgrids];
    553         double  vy_values[numgrids];
    554         double  vz_values[numgrids];
    555552        double  vel_values[numgrids];
    556553        double  maxvel;
     
    560557
    561558        /*retrive velocity values at nodes */
    562         inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum);
    563         inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum);
    564         if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum);
    565 
    566         /*now, compute maximum of velocity :*/
    567         if(dim==2){
    568                 for(i=0;i<numgrids;i++)vel_values[i]=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2));
    569         }
    570         else{
    571                 for(i=0;i<numgrids;i++)vel_values[i]=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2));
    572         }
     559        inputs->GetParameterValues(&vel_values[0],&gaussgrids[0][0],numgrids,VelEnum);
    573560
    574561        /*now, compute maximum:*/
     
    671658        const int numgrids=2;
    672659        double  gaussgrids[numgrids][2]={{0,1},{1,0}};
    673         double  vx_values[numgrids];
    674         double  vy_values[numgrids];
    675         double  vz_values[numgrids];
    676660        double  vel_values[numgrids];
    677661        double  minvel;
     
    681665
    682666        /*retrive velocity values at nodes */
    683         inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum);
    684         inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum);
    685         if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum);
    686 
    687         /*now, compute minimum of velocity :*/
    688         if(dim==2){
    689                 for(i=0;i<numgrids;i++)vel_values[i]=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2));
    690         }
    691         else{
    692                 for(i=0;i<numgrids;i++)vel_values[i]=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2));
    693         }
     667        inputs->GetParameterValues(&vel_values[0],&gaussgrids[0][0],numgrids,VelEnum);
    694668
    695669        /*now, compute minimum:*/
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r4521 r4532  
    13091309        const int numgrids=6;
    13101310        double  gaussgrids[numgrids][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};
    1311         double  vx_values[numgrids];
    1312         double  vy_values[numgrids];
    1313         double  vz_values[numgrids];
    13141311        double  vel_values[numgrids];
    13151312        double  maxvel;
     
    13191316
    13201317        /*retrive velocity values at nodes */
    1321         inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum);
    1322         inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum);
    1323         if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum);
    1324 
    1325         /*now, compute maximum of velocity :*/
    1326         if(dim==2){
    1327                 for(i=0;i<numgrids;i++)vel_values[i]=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2));
    1328         }
    1329         else{
    1330                 for(i=0;i<numgrids;i++)vel_values[i]=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2));
    1331         }
     1318        inputs->GetParameterValues(&vel_values[0],&gaussgrids[0][0],numgrids,VelEnum);
    13321319
    13331320        /*now, compute maximum:*/
     
    14301417        const int numgrids=6;
    14311418        double  gaussgrids[numgrids][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};
    1432         double  vx_values[numgrids];
    1433         double  vy_values[numgrids];
    1434         double  vz_values[numgrids];
    14351419        double  vel_values[numgrids];
    14361420        double  minvel;
     
    14401424
    14411425        /*retrive velocity values at nodes */
    1442         inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum);
    1443         inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum);
    1444         if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum);
    1445 
    1446         /*now, compute minimum of velocity :*/
    1447         if(dim==2){
    1448                 for(i=0;i<numgrids;i++)vel_values[i]=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2));
    1449         }
    1450         else{
    1451                 for(i=0;i<numgrids;i++)vel_values[i]=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2));
    1452         }
     1426        inputs->GetParameterValues(&vel_values[0],&gaussgrids[0][0],numgrids,VelEnum);
    14531427
    14541428        /*now, compute minimum:*/
  • issm/trunk/src/c/objects/Elements/Sing.cpp

    r4285 r4532  
    489489
    490490        int dim;
    491         double  vx;
    492         double  vy;
    493         double  vz;
    494491        double  maxvel;
    495492
    496         /*retrive velocity values at nodes */
    497         inputs->GetParameterValue(&vx,VxEnum);
    498         inputs->GetParameterValue(&vy,VyEnum);
    499         if(dim==3)inputs->GetParameterValue(&vz,VzEnum);
    500 
    501         /*now, compute maximum of velocity :*/
    502         if(dim==2){
    503                 maxvel=sqrt(pow(vx,2)+pow(vy,2));
    504         }
    505         else{
    506                 maxvel=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2));
    507         }
     493        /*retrieve dim parameter: */
     494        parameters->FindParam(&dim,DimEnum);
     495
     496        /*retrive velocity values at nodes */
     497        inputs->GetParameterValue(&maxvel,VelEnum);
    508498
    509499        /*Assign output pointers:*/
     
    567557
    568558        int dim;
    569         double  vx;
    570         double  vy;
    571         double  vz;
    572559        double  minvel;
    573560
    574         /*retrive velocity values at nodes */
    575         inputs->GetParameterValue(&vx,VxEnum);
    576         inputs->GetParameterValue(&vy,VyEnum);
    577         if(dim==3)inputs->GetParameterValue(&vz,VzEnum);
    578 
    579         /*now, compute minimum of velocity :*/
    580         if(dim==2){
    581                 minvel=sqrt(pow(vx,2)+pow(vy,2));
    582         }
    583         else{
    584                 minvel=sqrt(pow(vx,2)+pow(vy,2)+pow(vz,2));
    585         }
     561        /*retrieve dim parameter: */
     562        parameters->FindParam(&dim,DimEnum);
     563
     564        /*retrive velocity values at nodes */
     565        inputs->GetParameterValue(&minvel,VelEnum);
    586566
    587567        /*Assign output pointers:*/
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r4508 r4532  
    16581658        int dim;
    16591659        const int numgrids=3;
    1660         double  gaussgrids[numgrids][3]={{1,0,0},{0,1,0},{0,0,1}};
    1661         double  vx_values[numgrids];
    1662         double  vy_values[numgrids];
    1663         double  vz_values[numgrids];
     1660        double  gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}};
    16641661        double  vel_values[numgrids];
    16651662        double  maxvel;
     
    16691666
    16701667        /*retrive velocity values at nodes */
    1671         inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum);
    1672         inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum);
    1673         if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum);
    1674 
    1675         /*now, compute maximum of velocity :*/
    1676         if(dim==2){
    1677                 for(i=0;i<numgrids;i++)vel_values[i]=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2));
    1678         }
    1679         else{
    1680                 for(i=0;i<numgrids;i++)vel_values[i]=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2));
    1681         }
     1668        inputs->GetParameterValues(&vel_values[0],&gaussgrids[0][0],numgrids,VelEnum);
    16821669
    16831670        /*now, compute maximum:*/
     
    17791766        int dim;
    17801767        const int numgrids=3;
    1781         double  gaussgrids[numgrids][3]={{1,0,0},{0,1,0},{0,0,1}};
    1782         double  vx_values[numgrids];
    1783         double  vy_values[numgrids];
    1784         double  vz_values[numgrids];
     1768        double  gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}};
    17851769        double  vel_values[numgrids];
    17861770        double  minvel;
     
    17901774
    17911775        /*retrive velocity values at nodes */
    1792         inputs->GetParameterValues(&vx_values[0],&gaussgrids[0][0],numgrids,VxEnum);
    1793         inputs->GetParameterValues(&vy_values[0],&gaussgrids[0][0],numgrids,VyEnum);
    1794         if(dim==3) inputs->GetParameterValues(&vz_values[0],&gaussgrids[0][0],numgrids,VzEnum);
    1795 
    1796         /*now, compute minimum of velocity :*/
    1797         if(dim==2){
    1798                 for(i=0;i<numgrids;i++)vel_values[i]=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2));
    1799         }
    1800         else{
    1801                 for(i=0;i<numgrids;i++)vel_values[i]=sqrt(pow(vx_values[i],2)+pow(vy_values[i],2)+pow(vz_values[i],2));
    1802         }
     1776        inputs->GetParameterValues(&vel_values[0],&gaussgrids[0][0],numgrids,VelEnum);
    18031777
    18041778        /*now, compute minimum:*/
  • issm/trunk/src/c/objects/Materials/Matpar.cpp

    r4248 r4532  
    220220/*}}}1*/
    221221
     222/*Update virtual functions definitions:*/
     223/*FUNCTION Matpar::InputUpdateFromVector(double* vector, int name, int type) {{{1*/
     224void   Matpar::InputUpdateFromVector(double* vector, int name, int type){
     225        /*Nothing updated yet*/
     226}
     227/*}}}*/
     228/*FUNCTION Matpar::InputUpdateFromVector(int* vector, int name, int type) {{{1*/
     229void   Matpar::InputUpdateFromVector(int* vector, int name, int type){
     230        /*Nothing updated yet*/
     231}
     232/*}}}*/
     233/*FUNCTION Matpar::InputUpdateFromVector(bool* vector, int name, int type) {{{1*/
     234void   Matpar::InputUpdateFromVector(bool* vector, int name, int type){
     235        /*Nothing updated yet*/
     236}
     237/*}}}*/
     238/*FUNCTION Matpar::InputUpdateFromConstant(double constant, int name) {{{1*/
     239void   Matpar::InputUpdateFromConstant(double constant, int name){
     240
     241        switch(name){
     242                case RhoIceEnum:
     243                        this->rho_ice=constant;
     244
     245                case  RhoWaterEnum:
     246                        this->rho_water=constant;
     247
     248                case  HeatCapacityEnum:
     249                        this->heatcapacity=constant;
     250
     251                case  ThermalConductivityEnum:
     252                        this->thermalconductivity=constant;
     253
     254                case  LatentHeatEnum:
     255                        this->latentheat=constant;
     256
     257                case  BetaEnum:
     258                        this->beta=constant;
     259
     260                case  MeltingPointEnum:
     261                        this->meltingpoint=constant;
     262
     263                case  MixedLayerCapacityEnum:
     264                        this->mixed_layer_capacity=constant;
     265
     266                case  ThermalExchangeVelocityEnum:
     267                        this->thermalconductivity=constant;
     268
     269                case  GravityEnum:
     270                        this->g=constant;
     271
     272                default:
     273                        break;
     274        }
     275
     276}
     277/*}}}*/
     278/*FUNCTION Matpar::InputUpdateFromConstant(int constant, int name) {{{1*/
     279void   Matpar::InputUpdateFromConstant(int constant, int name){
     280        /*Nothing updated yet*/
     281}
     282/*}}}*/
     283/*FUNCTION Matpar::InputUpdateFromConstant(bool constant, int name) {{{1*/
     284void   Matpar::InputUpdateFromConstant(bool constant, int name){
     285        /*Nothing updated yet*/
     286}
     287/*}}}*/
     288/*FUNCTION Matpar::InputUpdateFromSolution(double* solution) {{{1*/
     289void   Matpar::InputUpdateFromSolution(double* solution){
     290        /*Nothing updated yet*/
     291}
     292/*}}}*/
     293
    222294/*Matpar management: */
    223295/*FUNCTION Matpar::GetBeta {{{1*/
     
    272344}
    273345/*}}}1*/
    274 /*FUNCTION Matpar::InputUpdateFromVector(double* vector, int name, int type) {{{1*/
    275 void   Matpar::InputUpdateFromVector(double* vector, int name, int type){
    276         /*Nothing updated yet*/
    277 }
    278 /*}}}*/
    279 /*FUNCTION Matpar::InputUpdateFromVector(int* vector, int name, int type) {{{1*/
    280 void   Matpar::InputUpdateFromVector(int* vector, int name, int type){
    281         /*Nothing updated yet*/
    282 }
    283 /*}}}*/
    284 /*FUNCTION Matpar::InputUpdateFromVector(bool* vector, int name, int type) {{{1*/
    285 void   Matpar::InputUpdateFromVector(bool* vector, int name, int type){
    286         /*Nothing updated yet*/
    287 }
    288 /*}}}*/
    289 /*FUNCTION Matpar::InputUpdateFromConstant(double constant, int name) {{{1*/
    290 void   Matpar::InputUpdateFromConstant(double constant, int name){
    291         /*Nothing updated yet*/
    292 }
    293 /*}}}*/
    294 /*FUNCTION Matpar::InputUpdateFromConstant(int constant, int name) {{{1*/
    295 void   Matpar::InputUpdateFromConstant(int constant, int name){
    296         /*Nothing updated yet*/
    297 }
    298 /*}}}*/
    299 /*FUNCTION Matpar::InputUpdateFromConstant(bool constant, int name) {{{1*/
    300 void   Matpar::InputUpdateFromConstant(bool constant, int name){
    301         /*Nothing updated yet*/
    302 }
    303 /*}}}*/
    304 /*FUNCTION Matpar::InputUpdateFromSolution(double* solution) {{{1*/
    305 void   Matpar::InputUpdateFromSolution(double* solution){
    306         /*Nothing updated yet*/
    307 }
    308 /*}}}*/
     346
     347
  • issm/trunk/src/m/solutions/SpawnCore.m

    r4525 r4532  
    1111solution_type=femmodel.parameters.SolutionType;
    1212
     13
    1314displaystring(1,'%s%i',['   qmu iteration:'],counter);
    1415
    1516%first update the inputs to the femmodel using the variables provided to us by dakota.
    16 [femmodel.elements femmodel.loads]=InputUpdateFromDakota(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,femmodel.part,variables,variabledescriptors);
     17[femmodel.elements femmodel.loads femmodel.materials]=InputUpdateFromDakota(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,femmodel.part,variables,variabledescriptors);
     18Echo(femmodel.materials)
    1719
    1820%now run the core solution
     
    2224%now process the results to get response function values
    2325responses=DakotaResponses(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,responsedescriptors);
     26
     27format long
     28variables
     29responses
  • issm/trunk/src/mex/DakotaResponses/DakotaResponses.cpp

    r4525 r4532  
    6565        delete parameters;
    6666       
    67         xfree((void**)&responses);
    6867        for(i=0;i<numresponses;i++){
    6968                char* string=responses_descriptors[i]; xfree((void**)&string);
    7069        }
    7170        xfree((void**)&responses_descriptors);
     71       
     72        //xfree((void**)&responses); do not free responses!
    7273
    7374        /*end module: */
  • issm/trunk/src/mex/InputUpdateFromDakota/InputUpdateFromDakota.cpp

    r4525 r4532  
    5959        WriteData(ELEMENTS,elements);
    6060        WriteData(LOADS,loads);
     61        WriteData(MATERIALS,materials);
    6162
    6263        /*Free ressources: */
  • issm/trunk/src/mex/InputUpdateFromDakota/InputUpdateFromDakota.h

    r4491 r4532  
    3131#define ELEMENTS (mxArray**)&plhs[0]
    3232#define LOADS (mxArray**)&plhs[1]
     33#define MATERIALS (mxArray**)&plhs[2]
    3334
    3435/* serial arg counts: */
    3536#undef NLHS
    36 #define NLHS  2
     37#define NLHS  3
    3738#undef NRHS
    3839#define NRHS  9
  • issm/trunk/test/Verification/test25_IceSheetIceFrontM2dDakota/Square.par

    r4525 r4532  
    4242%Dakota options
    4343md.variables.nuv=normal_uncertain.empty();
    44 md.variables.nuv(end+1)=normal_uncertain('RhoIce',1,0.01);
     44md.variables.nuv(end+1)=normal_uncertain('RhoIce',md.rho_ice,0.01);
    4545md.variables.nuv(end+1)=normal_uncertain('DragCoefficient',1,0.01);
    4646
Note: See TracChangeset for help on using the changeset viewer.