Ignore:
Timestamp:
05/19/11 18:15:37 (14 years ago)
Author:
Eric.Larour
Message:

trunk: implemented forcing for accumulation in 2D. Verification and validation needed on Nicole's side.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/ModelProcessorx/Transient/UpdateElementsTransient.cpp

    r8331 r8363  
    1616
    1717        /*Intermediary*/
    18         int      i;
     18        int      i,j;
    1919        int      counter;
    2020        Element *element = NULL;
     21        char     fetchstring[100];
     22        double   time;
     23
     24       
     25        /*download whatever data will persist through forcing processing: */
     26        IoModelFetchData(&iomodel->elements,NULL,NULL,iomodel_handle,"elements");
    2127
    2228        /*Ok, let's go through forcings: */
     29        /*first, accumulation: */
     30        if(iomodel->forcing_accumulation_num_time_steps==0)_error_("accumulation forcing not available!");
     31
     32        iomodel->forcing_numtimesteps=iomodel->forcing_accumulation_num_time_steps;
     33        IoModelFetchData(&iomodel->timesteps,NULL,NULL,iomodel_handle,"forcing_accumulation_time_steps");
     34
     35        for(i=0;i<iomodel->forcing_accumulation_num_time_steps;i++){
     36                time=iomodel->timesteps[i];
     37                sprintf(&fetchstring[0],"forcing_accumulation_%i",i+1);
     38                IoModelFetchData(&iomodel->forcing,NULL,NULL,iomodel_handle,fetchstring);
    2339
    2440
     41
     42                /*we now have the forcing for the corresponding time step, for all the nodes. Use this
     43                 *to write over the existing accumulation input: */
     44
     45                counter=0;
     46                for (j=0;j<iomodel->numberofelements;j++){
     47                        if(iomodel->my_elements[j]){
     48                                element=(Element*)elements->GetObjectByOffset(counter);
     49                                element->UpdateForcing(j,iomodel,i,time,AccumulationRateEnum); //we need j to index into elements.
     50                                counter++;
     51
     52                        }
     53                }
     54
     55
     56
     57                /*Free ressources:*/
     58                xfree((void**)&iomodel->forcing);
     59        }
     60               
     61
     62        /*Free ressources:*/
     63        xfree((void**)&iomodel->forcing);
     64        xfree((void**)&iomodel->timesteps);
     65        xfree((void**)&iomodel->elements);
     66
    2567}
Note: See TracChangeset for help on using the changeset viewer.