Lines Matching refs:monitor_ctx

18 static PetscErrorCode MonitorTotalKEDestroy(MonitorTotalKE *monitor_ctx) {  in MonitorTotalKEDestroy()  argument
19 MonitorTotalKE monitor_ctx_ = *monitor_ctx; in MonitorTotalKEDestroy()
57 MonitorTotalKE monitor_ctx; in SetupMontiorTotalKineticEnergy() local
68 PetscCall(PetscNew(&monitor_ctx)); in SetupMontiorTotalKineticEnergy()
69 PetscCall(HoneeCalculateDomainSize(honee, &monitor_ctx->volume)); in SetupMontiorTotalKineticEnergy()
109 …textCreate(honee->dm, NULL, ceed, op_monitor, NULL, NULL, NULL, NULL, &monitor_ctx->op_monitor_ctx… in SetupMontiorTotalKineticEnergy()
111 …ateLocalVecs(op_monitor, DMReturnVecType(honee->dm), PETSC_COMM_SELF, NULL, &monitor_ctx->values)); in SetupMontiorTotalKineticEnergy()
112 PetscCall(VecSetBlockSize(monitor_ctx->values, num_comp_totalke)); in SetupMontiorTotalKineticEnergy()
113 monitor_ctx->num_comps = num_comp_totalke; in SetupMontiorTotalKineticEnergy()
114 PetscCall(PetscMalloc1(num_comp_totalke, &monitor_ctx->sum_values)); in SetupMontiorTotalKineticEnergy()
116 monitor_ctx->tab_level = tab_level + 1; in SetupMontiorTotalKineticEnergy()
118 ctx->data = monitor_ctx; in SetupMontiorTotalKineticEnergy()
133 MonitorTotalKE monitor_ctx = (MonitorTotalKE)ctx->data; in TSMonitor_TotalKineticEnergy() local
150 …PetscCall(ApplyCeedOperatorLocalToLocal(honee->Q_loc, monitor_ctx->values, monitor_ctx->op_monitor… in TSMonitor_TotalKineticEnergy()
152 for (PetscInt i = 0; i < monitor_ctx->num_comps; i++) { in TSMonitor_TotalKineticEnergy()
153 PetscCall(VecStrideSum(monitor_ctx->values, i, &monitor_ctx->sum_values[i])); in TSMonitor_TotalKineticEnergy()
156 …if (rank == 0) PetscCallMPI(MPI_Reduce(MPI_IN_PLACE, monitor_ctx->sum_values, monitor_ctx->num_com… in TSMonitor_TotalKineticEnergy()
157 …else PetscCallMPI(MPI_Reduce(monitor_ctx->sum_values, monitor_ctx->sum_values, monitor_ctx->num_co… in TSMonitor_TotalKineticEnergy()
160 …for (PetscInt i = 0; i < monitor_ctx->num_comps; i++) monitor_ctx->sum_values[i] /= monitor_ctx->v… in TSMonitor_TotalKineticEnergy()
163 if (!monitor_ctx->is_header_written) { in TSMonitor_TotalKineticEnergy()
194 for (PetscInt i = 0; i < monitor_ctx->num_comps; i++) { in TSMonitor_TotalKineticEnergy()
196 if (i < monitor_ctx->num_comps - 1) PetscCall(PetscViewerASCIIPrintf(ctx->viewer, ",")); in TSMonitor_TotalKineticEnergy()
199 monitor_ctx->is_header_written = PETSC_TRUE; in TSMonitor_TotalKineticEnergy()
203 for (PetscInt i = 0; i < monitor_ctx->num_comps; i++) { in TSMonitor_TotalKineticEnergy()
204 PetscCall(PetscViewerASCIIPrintf(ctx->viewer, "%0.17e", monitor_ctx->sum_values[i])); in TSMonitor_TotalKineticEnergy()
205 if (i < monitor_ctx->num_comps - 1) PetscCall(PetscViewerASCIIPrintf(ctx->viewer, ",")); in TSMonitor_TotalKineticEnergy()
209 PetscCall(PetscViewerASCIIAddTab(ctx->viewer, monitor_ctx->tab_level)); in TSMonitor_TotalKineticEnergy()
210 for (PetscInt i = 0; i < monitor_ctx->num_comps; i++) { in TSMonitor_TotalKineticEnergy()
211 …PetscCall(PetscViewerASCIIPrintf(ctx->viewer, "%s: %0.12e ", field_names[i], monitor_ctx->sum_valu… in TSMonitor_TotalKineticEnergy()
215 … for (PetscInt i = 1; i < monitor_ctx->num_comps - 1; i++) sum_rates += monitor_ctx->sum_values[i]; in TSMonitor_TotalKineticEnergy()
219 PetscCall(PetscViewerASCIISubtractTab(ctx->viewer, monitor_ctx->tab_level)); in TSMonitor_TotalKineticEnergy()