Changeset 4954


Ignore:
Timestamp:
08/03/10 20:59:13 (15 years ago)
Author:
Eric.Larour
Message:

Made fully constrained model runs possibles (ie, if f-set is NILL, the solution
still goes through).
This will allow testing of features in the code that do not rely on solutions, but
on specific modules.

Location:
issm/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp

    r3959 r4954  
    2121        /*Merge f set back into n set: */
    2222        u_n=NewVec(nodesets->GetNSize());
    23         VecMerge(u_n,uf,nodesets->GetPV_F(),nodesets->GetFSize());
     23        if(uf) VecMerge(u_n,uf,nodesets->GetPV_F(),nodesets->GetFSize());
    2424
    2525        /*merge single point constraints into n set: */
  • issm/trunk/src/c/modules/Reduceloadfromgtofx/Reduceloadfromgtofx.cpp

    r3959 r4954  
    6464                if (nodesets->GetSSize()){
    6565
    66                         VecPartition(&pf, pn, nodesets->GetPV_F(),nodesets->GetFSize());
     66                        if(nodesets->GetFSize()){
     67                                VecPartition(&pf, pn, nodesets->GetPV_F(),nodesets->GetFSize());
    6768
    68                         /*pf = pf - Kfs * y_s;*/
    69                         MatGetLocalSize(Kfs,&Kfsm,&Kfsn);
    70                         Kfsy_s=NewVecFromLocalSize(Kfsm);
    71                         if (flag_ys0){
     69                                /*pf = pf - Kfs * y_s;*/
     70                                MatGetLocalSize(Kfs,&Kfsm,&Kfsn);
     71                                Kfsy_s=NewVecFromLocalSize(Kfsm);
     72                                if (flag_ys0){
    7273
    73                                 /*Create y_s0, full of 0: */
    74                                 VecDuplicate(y_s,&y_s0);
    75                                 VecSet(y_s0,0.0);
    76                                 VecAssemblyBegin(y_s0);
    77                                 VecAssemblyEnd(y_s0);
     74                                        /*Create y_s0, full of 0: */
     75                                        VecDuplicate(y_s,&y_s0);
     76                                        VecSet(y_s0,0.0);
     77                                        VecAssemblyBegin(y_s0);
     78                                        VecAssemblyEnd(y_s0);
    7879
    79                                 MatMultPatch(Kfs,y_s0,Kfsy_s);
     80                                        MatMultPatch(Kfs,y_s0,Kfsy_s);
     81                                }
     82                                else{
     83                                        MatMultPatch(Kfs,y_s,Kfsy_s);
     84                                }
     85
     86                                a=-1;
     87                                VecAXPY(pf,a,Kfsy_s); 
    8088                        }
    8189                        else{
    82                                 MatMultPatch(Kfs,y_s,Kfsy_s);
     90                                pf=NULL;
    8391                        }
    84 
    85                         a=-1;
    86                         VecAXPY(pf,a,Kfsy_s); 
    8792                }
    8893                else{
  • issm/trunk/src/c/modules/Reducematrixfromgtofx/Reducematrixfromgtofx.cpp

    r3332 r4954  
    1919        //Reduce matrix from n-size to f-size
    2020        if(nodesets->GetSSize()){
    21                
    22                 MatPartition(&Kff, Knn, nodesets->GetPV_F(),nodesets->GetFSize(),nodesets->GetPV_F(),nodesets->GetFSize());
    23                 MatPartition(&Kfs, Knn, nodesets->GetPV_F(),nodesets->GetFSize(),nodesets->GetPV_S(),nodesets->GetSSize());
    2421
     22                if(nodesets->GetFSize()){
     23                        MatPartition(&Kff, Knn, nodesets->GetPV_F(),nodesets->GetFSize(),nodesets->GetPV_F(),nodesets->GetFSize());
     24                        MatPartition(&Kfs, Knn, nodesets->GetPV_F(),nodesets->GetFSize(),nodesets->GetPV_S(),nodesets->GetSSize());
     25                }
    2526        }
    2627        else{
  • issm/trunk/src/c/modules/Solverx/Solverx.cpp

    r3913 r4954  
    2929        PetscTruth flag;
    3030        int solver_type;
     31
     32        /*First, check that f-set is not NULL, ie model is fully constrained: */
     33        if(!Kff){
     34                *puf=NULL;
     35                return;
     36        }
    3137
    3238        /*If initial guess for solution exists, use it to create uf, otherwise,
  • issm/trunk/src/c/solutions/convergence.cpp

    r3913 r4954  
    3131        double yts;
    3232
    33         /*Check arguments*/
    34         ISSMASSERT(Kff && pf && uf && old_uf);
     33        /*If uf is NULL in input, f-set is nil, model is fully constrained, therefore converged from
     34         * the get go: */
     35        if(!uf){
     36                *pconverged=1;
     37                return;
     38        }
    3539
    3640        /*get convergence options*/
  • issm/trunk/src/m/classes/public/ismodelselfconsistent.m

    r4891 r4954  
    188188%DIAGNOSTIC{{{1
    189189if md.analysis_type==DiagnosticSolutionEnum,
    190 
    191         %CHECK THAT WE ARE NOT FULLY CONSTRAINED
    192         if isempty(find(~md.spcvelocity(:,1:2))),
    193                 error(['model not consistent: model ' md.name ' is totally constrained horizontally, no need to solve!']);
    194         end
    195         if (md.dim==3),
    196                 if isempty(find(~md.spcvelocity(:,3))),
    197                         error(['model not consistent: model ' md.name ' is totally constrained vertically, no need to solve!']);
    198                 end
    199         end
    200190
    201191        %HUTTER ON ICESHELF WARNING
  • issm/trunk/src/m/solutions/convergence.m

    r4778 r4954  
    11function converged=convergence(K_ff,p_f,u_f,u_f_old,parameters)
     2
     3%before we start, check that u_f actually holds values, otherwise, we are done converging
     4if isempty(u_f), converged=true;  return; end
    25
    36%Get convergence options
  • issm/trunk/src/m/solvers/solver_diagnostic_nonlinear.m

    r4839 r4954  
    3434                displaystring(femmodel.parameters.Verbose,'%s','   Generating penalty matrices:');
    3535                [K_gg , p_g, kmax]=PenaltySystemMatrices(K_gg_nopenalty,p_g_nopenalty,femmodel.elements,femmodel.nodes,femmodel.vertices,loads,femmodel.materials,femmodel.parameters);
     36               
    3637
    3738                displaystring(femmodel.parameters.Verbose,'%s','   reducing matrix from g to f set');
    3839                [K_ff, K_fs] = Reducematrixfromgtof( K_gg, femmodel.Gmn, femmodel.nodesets);
    39 
     40               
    4041                displaystring(femmodel.parameters.Verbose,'%s','   reduce load from g size to f size');
    4142                p_f = Reduceloadfromgtof( p_g, femmodel.Gmn, K_fs, femmodel.ys, femmodel.nodesets);
    42                
     43
    4344                displaystring(femmodel.parameters.Verbose,'%s','   solving');
    4445                uf=Solver(K_ff,p_f,old_uf,femmodel.parameters);
     
    5455               
    5556                displaystring(femmodel.parameters.Verbose,'%s%i','      number of unstable constraints: ',num_unstable_constraints);
    56                
     57
    5758                %Figure out if convergence have been reached
    5859                converged=convergence(K_ff,p_f,uf,old_uf,femmodel.parameters);
  • issm/trunk/test/Verification/test01_IceShelfIceFrontM2d/Square.par

    r3757 r4954  
    22
    33%dynamics
    4 md.verbose=0;
     4md.verbose=1;
    55md.dt=1; %1 year
    66md.ndt=md.dt*10;
     
    3636md.time=50;
    3737md.waitonlock=30;
     38
     39%spc all velocities
     40md.spcvelocity(:,1:3)=1;
     41md.spcvelocity(:,4)=0;
     42md.spcvelocity(:,5)=100;
     43md.spcvelocity(:,6)=0;
Note: See TracChangeset for help on using the changeset viewer.