Skip to content

Commit

Permalink
CHG: fixed issue with geometry kernel being recomputed several times
Browse files Browse the repository at this point in the history
when runing dakota. Fixed this by setting geometrydone in the sealevel
initial geometry computations.
  • Loading branch information
larour committed Dec 2, 2024
1 parent 4830a10 commit 7ea993e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/c/classes/Dakota/IssmParallelDirectApplicInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace SIM {

int world_rank;
ISSM_MPI_Comm_rank(ISSM_MPI_COMM_WORLD,&world_rank);
void (*solutionprecore)(FemModel*) = NULL;
int solution_type;

/*Build an femmodel if you are a slave, using the corresponding communicator:*/
if(world_rank!=0){
Expand All @@ -27,6 +29,11 @@ namespace SIM {

/*Need to know we are firing up from ISSM main, not a coupler driver like issm_slcp or issm_ocean:*/
femmodel_init->parameters->AddObject(new IntParam(IsSlcCouplingEnum,0));

/*Launch cores that build data only once, for all future solutions during the uncertainty quantification: */
femmodel_init->parameters->FindParam(&solution_type,SolutionTypeEnum);
WrapperPreCorePointerFromSolutionEnum(&solutionprecore,femmodel_init->parameters,solution_type);
if(solutionprecore)solutionprecore(femmodel_init);
}

}
Expand Down
5 changes: 5 additions & 0 deletions src/c/cores/sealevelchange_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,13 +663,18 @@ void sealevelchange_initialgeometry(FemModel* femmodel) { /*{{{*/
femmodel->parameters->AddObject(new DoubleVecParam(YyeEnum,yye,nel));
femmodel->parameters->AddObject(new DoubleVecParam(ZzeEnum,zze,nel));
femmodel->parameters->AddObject(new DoubleVecParam(AreaeEnum,areae,nel));

femmodel->parameters->AddObject(new DoubleVecParam(AreaeEnum,areae,nel));

#ifdef _ISSM_DEBUG_
femmodel->results->AddResult(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,XxeEnum,xxe,nel,1,1,1));
femmodel->results->AddResult(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,YyeEnum,yye,nel,1,1,1));
femmodel->results->AddResult(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,ZzeEnum,zze,nel,1,1,1));
femmodel->results->AddResult(new GenericExternalResult<IssmDouble*>(femmodel->results->Size()+1,AreaeEnum,areae,nel,1,1,1));
#endif

geometrydone=true;
femmodel->parameters->SetParam(geometrydone,SealevelchangeGeometryDoneEnum);

xDelete<IssmDouble>(xxe);
xDelete<IssmDouble>(yye);
Expand Down

0 comments on commit 7ea993e

Please sign in to comment.