Home
last modified time | relevance | path

Searched refs:PetscSqr (Results 1 – 25 of 142) sorted by relevance

123456

/petsc/src/ts/tutorials/
H A Dex34.c55 …f[i].v = -hx * (PetscSqr(user->gammaTilde) * u[i].u + (PetscSqr(user->gamma) / user->xi) * (u[i].… in FormRHSFunction()
90 f[i].v = hx * udot[i].v - PetscSqr(user->c) * (u[i + 1].u - u[i].u) / hx; in FormIFunction()
95 f[i].v = hx * udot[i].v - PetscSqr(user->c) * (u[i - 1].u - u[i].u) / hx; in FormIFunction()
100 …f[i].v = hx * udot[i].v - PetscSqr(user->c) * (u[i - 1].u - 2. * u[i].u + u[i + 1].u… in FormIFunction()
135 const PetscScalar dxx0 = PetscSqr(user->c) / hx, dxxR = -PetscSqr(user->c) / hx; in FormIJacobian()
146 const PetscScalar dxxL = -PetscSqr(user->c) / hx, dxx0 = PetscSqr(user->c) / hx; in FormIJacobian()
157 …const PetscScalar dxxL = -PetscSqr(user->c) / hx, dxx0 = 2. * PetscSqr(user->c) / hx, dxxR = -Pets… in FormIJacobian()
198 u[i].u = 1.5 * PetscExpScalar(-PetscSqr(x[i] - 10) / PetscSqr(sigma)); in FormInitialSolution()
256 dt = 0.4 * PetscSqr(hx) / PetscSqr(user.c); /* Diffusive stability limit */ in main()
H A Dex24.c111 …for (i = 0; i < ctx->n - 1; i++) f += PetscSqr(1. - x[i]) + 100. * PetscSqr(x[i + 1] - PetscSqr(x[… in MonitorObjective()
167 a = x[i + 1] - PetscSqr(x[i]); in FormIFunction()
216 a = x[i + 1] - PetscSqr(x[i]); in FormIJacobian()
H A Dex53.c117 for (d = 0; d < dim; ++d) u[d] = PetscSqr(x[d]) - (d > 0 ? 2.0 * x[d - 1] * x[d] : 0.0); in quadratic_u()
352 …for (d = 0; d < dim - 1; ++d) f0[d] += PetscSqr(2. * PETSC_PI) * PetscSinReal(2. * PETSC_PI * x[d]… in f0_trig_linear_u()
353 …f0[dim - 1] += PetscSqr(2. * PETSC_PI) * PetscSinReal(2. * PETSC_PI * x[dim - 1]) * (2. * G + lamb… in f0_trig_linear_u()
367 f0[0] -= sum / M - 4 * PetscSqr(PETSC_PI) * kappa * sum * t; in f0_trig_linear_p()
458 PetscReal tstar = PetscRealPart(c * time) / PetscSqr(2.0 * L); /* - */ in terzaghi_2d_u()
462 … (m % 2 == 1) F2 += (8.0 / PetscSqr(m * PETSC_PI)) * PetscCosReal(0.5 * m * PETSC_PI * zstar) * (1… in terzaghi_2d_u()
495 PetscReal tstar = PetscRealPart(c * time) / PetscSqr(2.0 * L); /* - */ in terzaghi_2d_eps()
499 …* L)) * PetscSinReal(0.5 * m * PETSC_PI * zstar) * (1.0 - PetscExpReal(-PetscSqr(m * PETSC_PI) * t… in terzaghi_2d_eps()
531 PetscReal tstar = PetscRealPart(c * time) / PetscSqr(2.0 * L); /* - */ in terzaghi_2d_p()
537 …* PETSC_PI)) * PetscSinReal(0.5 * m * PETSC_PI * zstar) * PetscExpReal(-PetscSqr(m * PETSC_PI) * t… in terzaghi_2d_p()
[all …]
H A Dex45.c120 *u = dim * PetscSqr(PETSC_PI) * time; in mms_trig_lin()
127 *u = dim * PetscSqr(PETSC_PI); in mms_trig_lin_t()
135 for (d = 0; d < dim; ++d) f0[0] += PetscSqr(PETSC_PI) * (PetscCosReal(PETSC_PI * x[d]) - 1.0); in f0_trig_lin()
157 *u = PetscSqr(PETSC_PI) * PetscCosReal(time); in mms_trig_trig()
164 *u = -PetscSqr(PETSC_PI) * PetscSinReal(time); in mms_trig_trig_t()
171 f0[0] -= PetscSqr(PETSC_PI) * PetscSinReal(t); in f0_trig_trig_exp()
172 for (d = 0; d < dim; ++d) f0[0] += PetscSqr(PETSC_PI) * PetscCosReal(PETSC_PI * x[d]); in f0_trig_trig_exp()
362 for (PetscInt d = 0; d < dim; d++) norm += PetscSqr(PetscRealPart(g[dim * i + d])); in Remesh()
/petsc/src/snes/tutorials/
H A Dex5.c202 …f[0] = 2 * PetscSqr(PETSC_PI) * PetscSinReal(PETSC_PI * x) * PetscSinReal(PETSC_PI * y) - user->pa… in MMSForcing2()
221PetscSqr(PETSC_PI) * (-2 * m * n * ((-1 + x) * x + (-1 + y) * y) * PetscCosReal(m * PETSC_PI * x *… in MMSForcing3()
231 …u[0] = (PetscPowReal(x, 4) - PetscSqr(Lx) * PetscSqr(x)) * (PetscPowReal(y, 4) - PetscSqr(Ly) * Pe… in MMSSolution4()
241PetscSqr(x) * (PetscSqr(x) - PetscSqr(Lx)) * (PetscSqr(Ly) - 6 * PetscSqr(y)) + 2 * PetscSqr(y) * … in MMSForcing4()
H A Dex55.c153 …f[0] = 2 * PetscSqr(PETSC_PI) * PetscSinReal(PETSC_PI * x) * PetscSinReal(PETSC_PI * y) - user->pa… in MMSForcing2()
168PetscSqr(PETSC_PI) * (-2 * m * n * ((-1 + x) * x + (-1 + y) * y) * PetscCosReal(m * PETSC_PI * x *… in MMSForcing3()
176 …u[0] = (PetscPowReal(x, 4) - PetscSqr(Lx) * PetscSqr(x)) * (PetscPowReal(y, 4) - PetscSqr(Ly) * Pe… in MMSSolution4()
184PetscSqr(x) * (PetscSqr(x) - PetscSqr(Lx)) * (PetscSqr(Ly) - 6 * PetscSqr(y)) + 2 * PetscSqr(y) * … in MMSForcing4()
H A Dex8.c18 const PetscScalar ux2 = PetscSqr(u_x[0]); in objective_2d()
19 const PetscScalar uy2 = PetscSqr(u_x[1]); in objective_2d()
27 const PetscScalar ux2 = PetscSqr(u_x[0]); in gradient_1_2d()
28 const PetscScalar uy2 = PetscSqr(u_x[1]); in gradient_1_2d()
38 const PetscScalar ux2 = PetscSqr(u_x[0]); in hessian_11_2d()
39 const PetscScalar uy2 = PetscSqr(u_x[1]); in hessian_11_2d()
H A Dex34.c58 const PetscReal r = PetscSqrtReal(PetscSqr(x[0]) + PetscSqr(x[1])); in obstacle_ball()
59 const PetscReal psi_0 = PetscSqrtReal(1. - PetscSqr(r_0)); in obstacle_ball()
64 if (r < r_0) u[0] = PetscSqrtReal(1.0 - PetscSqr(r)); in obstacle_ball()
75 const PetscReal r = PetscSqrtReal(PetscSqr(x[0]) + PetscSqr(x[1])); in exactSol_ball()
H A Dex12.c117 const PetscReal radius2 = PetscSqr(0.15); in ball_u_2d()
118 const PetscReal r2 = PetscSqr(x[0] - 0.5) + PetscSqr(x[1] - 0.5); in ball_u_2d()
142 const PetscReal alpha = 500., radius2 = PetscSqr(0.15); in f0_ball_u()
145 for (d = 0, r2 = 0.0; d < dim; ++d) r2 += PetscSqr(x[d] - 0.5); in f0_ball_u()
147 …f0[0] = (-2.0 * dim * alpha - 8.0 * PetscSqr(alpha) * r2 * PetscTanhReal(xi)) * PetscSqr(1.0 / Pet… in f0_ball_u()
160 f0[0] = -20.0 * PetscExpReal(-(PetscSqr(x[0] - 0.5) + PetscSqr(x[1] - 0.5))); in f0_checkerboard_0_u()
202 f0[0] = -4.0 * PetscSqr(PETSC_PI) * PetscSinReal(2.0 * PETSC_PI * x[0]); in f0_xtrig_u()
223 f0[0] = -8.0 * PetscSqr(PETSC_PI) * PetscSinReal(2.0 * PETSC_PI * x[0]); in f0_xytrig_u()
371 const PetscReal radius2 = PetscSqr(0.15); in ball_u_3d()
372 const PetscReal r2 = PetscSqr(x[0] - 0.5) + PetscSqr(x[1] - 0.5) + PetscSqr(x[2] - 0.5); in ball_u_3d()
/petsc/src/dm/dt/interface/
H A Ddtprob.c27 p[0] = PetscSqrtReal(2. / PETSC_PI) * PetscExpReal(-0.5 * PetscSqr(x[0])); in PetscPDFMaxwellBoltzmann1D()
71 p[0] = x[0] * PetscExpReal(-0.5 * PetscSqr(x[0])); in PetscPDFMaxwellBoltzmann2D()
93 p[0] = 1. - PetscExpReal(-0.5 * PetscSqr(x[0])); in PetscCDFMaxwellBoltzmann2D()
115 p[0] = PetscSqrtReal(2. / PETSC_PI) * PetscSqr(x[0]) * PetscExpReal(-0.5 * PetscSqr(x[0])); in PetscPDFMaxwellBoltzmann3D()
137 …al(x[0] / PETSC_SQRT2) - PetscSqrtReal(2. / PETSC_PI) * x[0] * PetscExpReal(-0.5 * PetscSqr(x[0])); in PetscCDFMaxwellBoltzmann3D()
160 …p[0] = PetscSqrtReal(1. / (2. * PETSC_PI)) * PetscExpReal(-0.5 * PetscSqr(x[0] / … in PetscPDFGaussian1D()
236 p[0] = (1. / PETSC_PI) * PetscExpReal(-0.5 * (PetscSqr(x[0]) + PetscSqr(x[1]))); in PetscPDFGaussian2D()
283 …C_PI * PetscSqrtReal(PETSC_PI)) * PetscExpReal(-0.5 * (PetscSqr(x[0]) + PetscSqr(x[1]) + PetscSqr(… in PetscPDFGaussian3D()
942 for (PetscInt d = 0; d < dim; ++d) mag += PetscSqr(PetscRealPart(a[p * dim + d])); in PetscProbComputeKSStatisticMagnitude()
/petsc/src/ts/utils/dmplexlandau/
H A Dland_tensors.h76 r2 = PetscSqr(r); in LandauTensor2D()
78 rp2 = PetscSqr(rp); in LandauTensor2D()
79 zmzp2 = PetscSqr(zmzp); in LandauTensor2D()
88 pi4pow = 4 * PETSC_PI * LANDAU_INVSQRT(PetscSqr(l) * l); in LandauTensor2D()
96 i1func = 4. / (PetscSqr(s) * sqrt_1s + PETSC_MACHINE_EPSILON) * mask * (ks - (1. + s) * es); in LandauTensor2D()
98 Ud[0][0] = -pi4pow * (rp2 * i1func + PetscSqr(zmzp) * i2func); in LandauTensor2D()
/petsc/src/dm/dt/tests/
H A Dex7.c54 diffMat += PetscSqr(PetscAbsReal(Lstarwcheck[i] - Lstarw[i])); in CheckPullback()
55 normMat += PetscSqr(Lstarwcheck[i]) + PetscSqr(Lstarw[i]); in CheckPullback()
195 diff = PetscSqrtReal(PetscSqr(wvcheck - wv)); in main()
221 diff = PetscSqrtReal(PetscSqr(wvcheck - wv)); in main()
342 diff += PetscSqr(uWwcheck[l] - uWw[l]); in main()
343 norm += PetscSqr(uWwcheck[l]) + PetscSqr(uWw[l]); in main()
413 diffMat += PetscSqr(PetscAbsReal(matcheck[l] - intv0mat[l])); in main()
414 normMat += PetscSqr(matcheck[l]) + PetscSqr(intv0mat[l]); in main()
427 diffMat += PetscSqr(PetscAbsReal(wIntv0check[l] - wIntv0[l])); in main()
428 normMat += PetscSqr(wIntv0check[l]) + PetscSqr(wIntv0[l]); in main()
[all …]
/petsc/src/dm/impls/plex/
H A Dplexadapt.c62 const PetscReal coarseRatio = refRatio == (PetscReal)PETSC_DEFAULT ? PetscSqr(0.5) : 1 / refRatio; in DMPlexLabelToMetricConstraint()
72 PetscCall(VecCreateSeq(PETSC_COMM_SELF, Nv * PetscSqr(dim), metricVec)); in DMPlexLabelToMetricConstraint()
75 PetscCall(PetscMalloc1(PetscSqr(Neq), &eqns)); in DMPlexLabelToMetricConstraint()
94 eqns[0 * Neq + r] = PetscSqr(e[0]); in DMPlexLabelToMetricConstraint()
96 eqns[2 * Neq + r] = PetscSqr(e[1]); in DMPlexLabelToMetricConstraint()
99 eqns[0 * Neq + r] = PetscSqr(e[0]); in DMPlexLabelToMetricConstraint()
102 eqns[3 * Neq + r] = PetscSqr(e[1]); in DMPlexLabelToMetricConstraint()
104 eqns[5 * Neq + r] = PetscSqr(e[2]); in DMPlexLabelToMetricConstraint()
150 for (s = 0; s < PetscSqr(dim); ++s) metric[v * PetscSqr(dim) + s] /= totVol; in DMPlexLabelToMetricConstraint()
/petsc/src/dm/impls/swarm/tutorials/
H A Dex1.c65 energy_0 += wq[p] * (PetscSqr(coords[p * 2 + 0]) + PetscSqr(coords[p * 2 + 1])); in main()
82 …for (PetscInt p = 0; p < Np; ++p) energy_1 += wq[p] * (PetscSqr(coords[p * 2 + 0]) + PetscSqr(coor… in main()
/petsc/src/dm/impls/swarm/tests/
H A Dex4.c147 g[(p * 2 + 1) * dim + d] = -PetscSqr(omega) * u[(p * 2 + 0) * dim + d]; in RHSFunction()
161 PetscScalar vals[4] = {0., 1., -PetscSqr(((AppCtx *)ctx)->omega), 0.}; in RHSJacobian()
209 for (p = 0; p < Np; ++p) vres[p] = -PetscSqr(omega) * x[p]; in RHSFunctionV()
254 const PetscReal E = 0.5 * (v2 + PetscSqr(omega) * x2); in RHSObjectiveF()
280 g[(p * 2 + 0) * dim + d] = PetscSqr(omega) * u[(p * 2 + 0) * dim + d]; in RHSFunctionG()
426 const PetscReal en = 0.5 * (v * v + PetscSqr(omega) * x * x); in ComputeError()
427 const PetscReal exen = 0.5 * PetscSqr(omega * x0); in ComputeError()
464 const PetscReal E = 0.5 * (v2 + PetscSqr(omega) * x2); in EnergyMonitor()
465 …const PetscReal mE = 0.5 * (v2 + PetscSqr(omega) * x2 - PetscSqr(omega) * dt * PetscSqrtReal(x2 * … in EnergyMonitor()
/petsc/src/ksp/ksp/interface/
H A Deige.c281 rscale = px0 / (PetscSqr(px0) + PetscSqr(py0)); in KSPPlotEigenContours_Private()
282 iscale = -py0 / (PetscSqr(px0) + PetscSqr(py0)); in KSPPlotEigenContours_Private()
289 tmod = PetscSqr(tx) + PetscSqr(ty); /* modulus of the complex polynomial */ in KSPPlotEigenContours_Private()
/petsc/src/ksp/ksp/tests/
H A Dex13.c126 PetscCall(MatSetValue(P, row, row, PetscSqr(0.84201), INSERT_VALUES)); in main()
133 PetscCall(MatSetValue(P, row, row, PetscSqr(0.81228), INSERT_VALUES)); in main()
139 PetscCall(MatSetValue(P, row, row, PetscSqr(0.30957), INSERT_VALUES)); in main()
144 PetscCall(MatSetValue(P, row, row, PetscSqr(3.2303), INSERT_VALUES)); in main()
/petsc/src/ts/impls/implicit/irk/
H A Dirk.c74 …PetscCall(PetscMalloc3(PetscSqr(nstages), &tab->A, PetscSqr(nstages), &tab->A_inv, PetscSqr(nstage… in TSIRKTableauCreate()
76 PetscCall(PetscArraycpy(tab->A, A, PetscSqr(nstages))); in TSIRKTableauCreate()
81 if (A_inv) PetscCall(PetscArraycpy(tab->A_inv, A_inv, PetscSqr(nstages))); in TSIRKTableauCreate()
83 if (I_s) PetscCall(PetscArraycpy(tab->I_s, I_s, PetscSqr(nstages))); in TSIRKTableauCreate()
99 PetscCall(PetscMalloc3(PetscSqr(nstages), &gauss_A_real, nstages, &gauss_b, nstages, &gauss_c)); in TSIRKCreate_Gauss()
100 …PetscCall(PetscMalloc4(PetscSqr(nstages), &gauss_A, PetscSqr(nstages), &gauss_A_inv, nstages, &gau… in TSIRKCreate_Gauss()
101 PetscCall(PetscMalloc3(nstages, &b, PetscSqr(nstages), &G0, PetscSqr(nstages), &G1)); in TSIRKCreate_Gauss()
645 PetscCall(PetscFormatRealArray(buf, sizeof(buf), "% 8.6f", PetscSqr(irk->nstages), tab->A)); in TSView_IRK()
/petsc/src/snes/impls/gs/
H A Dgssecant.c91 dxt += PetscRealPart(PetscSqr(d - x)); in SNESComputeNGSDefaultSecant()
92 xt += PetscRealPart(PetscSqr(x)); in SNESComputeNGSDefaultSecant()
93 ft += PetscRealPart(PetscSqr(f)); in SNESComputeNGSDefaultSecant()
/petsc/src/snes/impls/ntrdc/
H A Dntrdc.c419 auk = PetscSqr(gfnorm) / gTBg; in SNESSolve_NEWTONTRDC()
431 c0 = PetscSqr(c0); in SNESSolve_NEWTONTRDC()
435 c2 = PetscSqr(c2) - PetscSqr(delta); in SNESSolve_NEWTONTRDC()
436 … tau_pos = (c1 + PetscSqrtReal(PetscSqr(c1) - 4. * c0 * c2)) / (2. * c0); /* quadratic formula */ in SNESSolve_NEWTONTRDC()
437 tau_neg = (c1 - PetscSqrtReal(PetscSqr(c1) - 4. * c0 * c2)) / (2. * c0); in SNESSolve_NEWTONTRDC()
452 f0 = 0.5 * PetscSqr(fnorm); /* minimizing function f(X) */ in SNESSolve_NEWTONTRDC()
485 g = 0.5 * PetscSqr(gnorm); /* minimizing function g(W) */ in SNESSolve_NEWTONTRDC()
/petsc/src/snes/linesearch/impls/bt/
H A Dlinesearchbt.c114 f = 0.5 * PetscSqr(fnorm); in SNESLineSearchApply_BT()
150 g = 0.5 * PetscSqr(gnorm); in SNESLineSearchApply_BT()
192 lambdatemp = -initslope * PetscSqr(lambda) / (2.0 * (g - f - lambda * initslope)); in SNESLineSearchApply_BT()
215 g = 0.5 * PetscSqr(gnorm); in SNESLineSearchApply_BT()
265 lambdatemp = -initslope * PetscSqr(lambda) / (2.0 * (g - f - lambda * initslope)); in SNESLineSearchApply_BT()
294 g = 0.5 * PetscSqr(gnorm); in SNESLineSearchApply_BT()
/petsc/src/vec/is/utils/
H A Dkdtree.c320 for (PetscInt j = 0; j < dim; j++) dist += PetscSqr(x[j] - y[j]); in PetscSquareDistance()
352 …for (PetscInt d = 0; d < dim; d++) dist += PetscSqr(point[d] - tree->coords[leaf.coords_handle + d… in PetscKDTreeQueryLeaf_CopyCoords()
385 rd += -PetscSqr(old_offset) + PetscSqr(new_offset); in PetscKDTreeQuery_Recurse()
393 rd += -PetscSqr(old_offset) + PetscSqr(new_offset); in PetscKDTreeQuery_Recurse()
446 …* tree->dim], tree->root_handle, (char)tree->is_root_leaf, offsets, rd, PetscSqr(tolerance), &indi… in PetscKDTreeQueryPointsNearestNeighbor()
/petsc/src/snes/tests/
H A Dex68.c108 …for (r = 0; r < constraintSize; ++r) error += PetscRealPart(PetscSqr(uArray[r] - bArray[r + N - co… in CheckProblem2()
112 …for (r = constraintSize; r < N - constraintSize; ++r) error += PetscRealPart(PetscSqr(uArray[r] - … in CheckProblem2()
116 …for (r = N - constraintSize; r < N; ++r) error += PetscRealPart(PetscSqr(uArray[r] - (bArray[r - (… in CheckProblem2()
/petsc/src/dm/interface/
H A Ddmgeommodel.c19 for (PetscInt d = 0; d < dE; ++d) norm += PetscSqr(PetscRealPart(mcoords[d])); in DMSnapToGeomModelBall()
39 for (PetscInt d = 0; d < dE - 1; ++d) norm += PetscSqr(PetscRealPart(mcoords[d])); in DMSnapToGeomModelCylinder()
/petsc/src/ksp/pc/impls/kaczmarz/
H A Dkaczmarz.c39 anrm += PetscRealPart(PetscSqr(vals[j])); in PCApply_Kaczmarz()
55 anrm += PetscRealPart(PetscSqr(vals[j])); in PCApply_Kaczmarz()

123456