Changeset 27895


Ignore:
Timestamp:
09/05/23 09:16:20 (19 months ago)
Author:
Cheng Gong
Message:

CHG: only calculate Cfdragcoeffabsgrad once per iteration, at the first time step

Location:
issm/trunk-jpl/src/c/classes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/c/classes/Cfdragcoeffabsgrad.cpp

    r27728 r27895  
    3030        this->name = NULL;
    3131        this->J = 0.;
     32        this->firsttimepassed = false;
    3233}
    3334/*}}}*/
     
    4041
    4142        this->J = 0.;
     43        this->firsttimepassed = false;
    4244}
    4345/*}}}*/
     
    5052
    5153        this->J = in_J;
     54        this->firsttimepassed = false;
    5255}
    5356/*}}}*/
     
    107110        IssmDouble J_sum=0.;
    108111
    109         for(Object* & object : femmodel->elements->objects){
    110                 Element* element=xDynamicCast<Element*>(object);
    111                 J_part+=this->Cfdragcoeffabsgrad_Calculation(element);
     112        if (!this->firsttimepassed){
     113                for(Object* & object : femmodel->elements->objects){
     114                        Element* element=xDynamicCast<Element*>(object);
     115                        J_part+=this->Cfdragcoeffabsgrad_Calculation(element);
     116                }
     117
     118                ISSM_MPI_Allreduce ( (void*)&J_part,(void*)&J_sum,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
     119                ISSM_MPI_Bcast(&J_sum,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
     120                this->J=J_sum;
     121
     122                this->firsttimepassed = true;
    112123        }
    113 
    114         ISSM_MPI_Allreduce ( (void*)&J_part,(void*)&J_sum,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
    115         ISSM_MPI_Bcast(&J_sum,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
    116         this->J=J_sum;
    117 
    118         return J;
     124        return this->J;
    119125}/*}}}*/
    120126IssmDouble Cfdragcoeffabsgrad::Cfdragcoeffabsgrad_Calculation(Element* element){/*{{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Cfdragcoeffabsgrad.h

    r27728 r27895  
    1818                int         definitionenum;
    1919                char       *name;
     20                bool                    firsttimepassed;
    2021                IssmDouble  J;
    2122
Note: See TracChangeset for help on using the changeset viewer.