From 7ea993e18d9572781a205453288a448de0c36149 Mon Sep 17 00:00:00 2001 From: Eric Larour Date: Sun, 1 Dec 2024 21:35:19 -0800 Subject: [PATCH] CHG: fixed issue with geometry kernel being recomputed several times when runing dakota. Fixed this by setting geometrydone in the sealevel initial geometry computations. --- src/c/classes/Dakota/IssmParallelDirectApplicInterface.cpp | 7 +++++++ src/c/cores/sealevelchange_core.cpp | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/c/classes/Dakota/IssmParallelDirectApplicInterface.cpp b/src/c/classes/Dakota/IssmParallelDirectApplicInterface.cpp index a5b90305..b9f77530 100644 --- a/src/c/classes/Dakota/IssmParallelDirectApplicInterface.cpp +++ b/src/c/classes/Dakota/IssmParallelDirectApplicInterface.cpp @@ -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){ @@ -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); } } diff --git a/src/c/cores/sealevelchange_core.cpp b/src/c/cores/sealevelchange_core.cpp index ad1ca595..a5988736 100644 --- a/src/c/cores/sealevelchange_core.cpp +++ b/src/c/cores/sealevelchange_core.cpp @@ -663,6 +663,8 @@ 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(femmodel->results->Size()+1,XxeEnum,xxe,nel,1,1,1)); @@ -670,6 +672,9 @@ void sealevelchange_initialgeometry(FemModel* femmodel) { /*{{{*/ femmodel->results->AddResult(new GenericExternalResult(femmodel->results->Size()+1,ZzeEnum,zze,nel,1,1,1)); femmodel->results->AddResult(new GenericExternalResult(femmodel->results->Size()+1,AreaeEnum,areae,nel,1,1,1)); #endif + + geometrydone=true; + femmodel->parameters->SetParam(geometrydone,SealevelchangeGeometryDoneEnum); xDelete(xxe); xDelete(yye);