| /petsc/src/ts/tutorials/autodiff/ |
| H A D | adr_ex1.cxx | 43 const PetscScalar *u, *udot; in IFunctionPassive() local 48 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunctionPassive() 50 f[0] = udot[0] + ctx->k * u[0] * u[1]; in IFunctionPassive() 51 f[1] = udot[1] + ctx->k * u[0] * u[1]; in IFunctionPassive() 52 f[2] = udot[2] - ctx->k * u[0] * u[1]; in IFunctionPassive() 54 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunctionPassive() 65 const PetscScalar *u, *udot; in IFunctionActive1() local 73 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunctionActive1() 81 f_a[0] = udot[0] + ctx->k * u_a[0] * u_a[1]; in IFunctionActive1() 82 f_a[1] = udot[1] + ctx->k * u_a[0] * u_a[1]; in IFunctionActive1() [all …]
|
| H A D | adr_ex5adj_mf.cxx | 38 …FunctionLocalPassive(DMDALocalInfo *info, PetscReal t, Field **u, Field **udot, Field **f, void *p… 248 PetscErrorCode IFunctionLocalPassive(DMDALocalInfo *info, PetscReal t, Field **u, Field **udot, Fie… in IFunctionLocalPassive() argument 276 … f[j][i].u = udot[j][i].u - appctx->D1 * (uxx + uyy) + uc * vc * vc - appctx->gamma * (1.0 - uc); in IFunctionLocalPassive() 277 …f[j][i].v = udot[j][i].v - appctx->D2 * (vxx + vyy) - uc * vc * vc + (appctx->gamma + appctx->kapp… in IFunctionLocalPassive() 289 Field **u, **f, **udot; in IFunctionActive() local 328 PetscCall(DMDAVecGetArrayRead(da, Udot, &udot)); in IFunctionActive() 372 … f_a[j][i].u = udot[j][i].u - appctx->D1 * (uxx + uyy) + uc * vc * vc - appctx->gamma * (1.0 - uc); in IFunctionActive() 373 …f_a[j][i].v = udot[j][i].v - appctx->D2 * (vxx + vyy) - uc * vc * vc + (appctx->gamma + appctx->ka… in IFunctionActive() 400 PetscCall(DMDAVecRestoreArrayRead(da, Udot, &udot)); in IFunctionActive()
|
| /petsc/src/ts/tests/ |
| H A D | ex15.c | 45 const PetscScalar *u, *udot; in IFunction_Conservative() local 50 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction_Conservative() 53 f[0] = udot[0] + u[0]; in IFunction_Conservative() 54 f[1] = udot[1] - u[0]; in IFunction_Conservative() 57 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction_Conservative() 64 const PetscScalar *u, *udot; in IFunction_Nonconservative() local 69 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction_Nonconservative() 72 f[0] = PetscExpScalar(u[0]) * udot[0] + PetscExpScalar(u[0]); in IFunction_Nonconservative() 73 f[1] = PetscExpScalar(u[1]) * udot[1] - PetscExpScalar(u[0]); in IFunction_Nonconservative() 76 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction_Nonconservative()
|
| /petsc/src/ts/tutorials/hybrid/ |
| H A D | ex1.c | 64 const PetscScalar *u, *udot; in IFunction() local 69 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction() 73 f[0] = udot[0] - u[0] + 100 * u[1]; in IFunction() 74 f[1] = udot[1] - 10 * u[0] - u[1]; in IFunction() 76 f[0] = udot[0] - u[0] - 10 * u[1]; in IFunction() 77 f[1] = udot[1] + 100 * u[0] - u[1]; in IFunction() 81 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction() 94 const PetscScalar *u, *udot; in IJacobian() local 98 PetscCall(VecGetArrayRead(Udot, &udot)); in IJacobian() 114 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IJacobian()
|
| H A D | ex1fwd.c | 147 const PetscScalar *u, *udot; in IFunction() local 152 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction() 156 f[0] = udot[0] - u[0] + 100 * u[1]; in IFunction() 157 f[1] = udot[1] - 10 * u[0] - u[1]; in IFunction() 159 f[0] = udot[0] - u[0] - 10 * u[1]; in IFunction() 160 f[1] = udot[1] + 100 * u[0] - u[1]; in IFunction() 164 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction() 177 const PetscScalar *u, *udot; in IJacobian() local 181 PetscCall(VecGetArrayRead(Udot, &udot)); in IJacobian() 197 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IJacobian()
|
| H A D | ex1fd.c | 124 const PetscScalar *u, *udot; in IFunction() local 129 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction() 133 f[0] = udot[0] - u[0] + 100 * u[1]; in IFunction() 134 f[1] = udot[1] - 10 * u[0] - u[1]; in IFunction() 136 f[0] = udot[0] - u[0] - 10 * u[1]; in IFunction() 137 f[1] = udot[1] + 100 * u[0] - u[1]; in IFunction() 141 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction() 154 const PetscScalar *u, *udot; in IJacobian() local 158 PetscCall(VecGetArrayRead(Udot, &udot)); in IJacobian() 174 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IJacobian()
|
| H A D | ex1adj.c | 124 const PetscScalar *u, *udot; in IFunction() local 129 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction() 133 f[0] = udot[0] - u[0] + 100 * u[1]; in IFunction() 134 f[1] = udot[1] - 10 * u[0] - u[1]; in IFunction() 136 f[0] = udot[0] - u[0] - 10 * u[1]; in IFunction() 137 f[1] = udot[1] + 100 * u[0] - u[1]; in IFunction() 141 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction() 154 const PetscScalar *u, *udot; in IJacobian() local 158 PetscCall(VecGetArrayRead(Udot, &udot)); in IJacobian() 174 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IJacobian()
|
| /petsc/src/ts/tutorials/advection-diffusion-reaction/ |
| H A D | ex2.c | 45 const PetscScalar *u, *udot; in IFunction() local 49 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction() 51 f[0] = udot[0] - k1(ctx, t) * u[2] + ctx->k2 * u[0]; in IFunction() 52 f[1] = udot[1] - k1(ctx, t) * u[2] + ctx->k3 * u[1] * u[3] - ctx->sigma2; in IFunction() 53 f[2] = udot[2] - ctx->k3 * u[1] * u[3] + k1(ctx, t) * u[2]; in IFunction() 54 f[3] = udot[3] - ctx->k2 * u[0] + ctx->k3 * u[1] * u[3]; in IFunction() 56 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction() 65 const PetscScalar *u, *udot; in IJacobian() local 69 PetscCall(VecGetArrayRead(Udot, &udot)); in IJacobian() 88 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IJacobian()
|
| H A D | ex1.c | 98 const PetscScalar *u, *udot; in IFunction() local 103 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction() 105 f[0] = udot[0] + ctx->k * u[0] * u[1]; in IFunction() 106 f[1] = udot[1] + ctx->k * u[0] * u[1]; in IFunction() 107 f[2] = udot[2] - ctx->k * u[0] * u[1]; in IFunction() 109 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction() 121 const PetscScalar *u, *udot; in IJacobian() local 125 PetscCall(VecGetArrayRead(Udot, &udot)); in IJacobian() 137 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IJacobian()
|
| H A D | ex4.c | 142 Field *u, *f, *udot; in IFunction() local 166 PetscCall(DMDAVecGetArrayRead(da, Udot, &udot)); in IFunction() 175 f[0].rho = udot[0].rho; /* u[0].rho - 0.0; */ in IFunction() 176 f[0].c = udot[0].c; /* u[0].c - 1.0; */ in IFunction() 181 f[Mx - 1].rho = udot[Mx - 1].rho; /* u[Mx-1].rho - 1.0; */ in IFunction() 182 f[Mx - 1].c = udot[Mx - 1].c; /* u[Mx-1].c - 0.0; */ in IFunction() 203 …f[i].rho = udot[i].rho - appctx->epsilon * rhoxx + kcxrhox - appctx->mu * PetscAbsScalar(rho) * (1… in IFunction() 204 …f[i].c = udot[i].c - appctx->delta * cxx + appctx->lambda * c + appctx->alpha * rho * c / (appct… in IFunction() 211 PetscCall(DMDAVecRestoreArrayRead(da, Udot, &udot)); in IFunction()
|
| H A D | reaction_diffusion.c | 242 Field **u, **f, **udot; in IFunction() local 268 PetscCall(DMDAVecGetArrayRead(da, Udot, &udot)); in IFunction() 286 … f[j][i].u = udot[j][i].u - (appctx->D1 * (uxx + uyy) - uc * vc * vc + appctx->gamma * (1.0 - uc)); in IFunction() 287 …f[j][i].v = udot[j][i].v - (appctx->D2 * (vxx + vyy) + uc * vc * vc - (appctx->gamma + appctx->kap… in IFunction() 297 PetscCall(DMDAVecRestoreArrayRead(da, Udot, &udot)); in IFunction()
|
| /petsc/src/ts/tutorials/power_grid/ |
| H A D | ex1.c | 35 const PetscScalar *u, *udot; in IFunction() local 45 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction() 47 …f[0] = 2.0 * ctx->H * udot[0] / ctx->omega_s + ctx->E * ctx->V * PetscSinScalar(u[1]) / ctx->X - R; in IFunction() 48 f[1] = udot[1] - u[0] + ctx->omega_s; in IFunction() 51 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction() 63 const PetscScalar *u, *udot; in IJacobian() local 67 PetscCall(VecGetArrayRead(Udot, &udot)); in IJacobian() 74 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IJacobian()
|
| H A D | ex2.c | 44 const PetscScalar *u, *udot; in IFunction() local 49 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction() 54 f[0] = udot[0] - ctx->omega_s * (u[1] - 1.0); in IFunction() 55 f[1] = 2.0 * ctx->H * udot[1] + Pmax * PetscSinScalar(u[0]) + ctx->D * (u[1] - 1.0) - ctx->Pm; in IFunction() 58 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction() 70 const PetscScalar *u, *udot; in IJacobian() local 74 PetscCall(VecGetArrayRead(Udot, &udot)); in IJacobian() 86 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IJacobian()
|
| H A D | ex3.h | 106 const PetscScalar *u, *udot; in IFunction() local 111 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction() 114 f[0] = udot[0] - ctx->omega_b * (u[1] - ctx->omega_s); in IFunction() 115 …f[1] = 2.0 * ctx->H / ctx->omega_s * udot[1] + Pmax * PetscSinScalar(u[0]) + ctx->D * (u[1] - ctx-… in IFunction() 118 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction() 130 const PetscScalar *u, *udot; in IJacobian() local 134 PetscCall(VecGetArrayRead(Udot, &udot)); in IJacobian() 143 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IJacobian()
|
| H A D | ex5.c | 184 const PetscScalar *u, *udot; in IFunction() local 191 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction() 195 f[0] = user->Tw * udot[0] - wd[stepnum] + u[0]; in IFunction() 198 f[1] = 2.0 * (user->Ht + user->Hm) * udot[1] - Pw / wm + user->Te; in IFunction() 202 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction()
|
| /petsc/src/ts/tutorials/ |
| H A D | ex34.c | 70 Field *u, *udot, *f; in FormIFunction() local 83 PetscCall(DMDAVecGetArrayRead(dm, Udot, &udot)); in FormIFunction() 89 f[i].u = hx * udot[i].u; in FormIFunction() 90 f[i].v = hx * udot[i].v - PetscSqr(user->c) * (u[i + 1].u - u[i].u) / hx; in FormIFunction() 91 f[i].th = hx * udot[i].th; in FormIFunction() 94 f[i].u = hx * udot[i].u; in FormIFunction() 95 f[i].v = hx * udot[i].v - PetscSqr(user->c) * (u[i - 1].u - u[i].u) / hx; in FormIFunction() 96 f[i].th = hx * udot[i].th; in FormIFunction() 99 f[i].u = hx * udot[i].u; 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() [all …]
|
| H A D | ex41.c | 106 const PetscScalar *u, *udot; in IFunction() local 111 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction() 114 f[0] = udot[0] - u[1]; in IFunction() 115 f[1] = udot[1] + 9.8; in IFunction() 118 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction() 130 const PetscScalar *u, *udot; in IJacobian() local 134 PetscCall(VecGetArrayRead(Udot, &udot)); in IJacobian() 147 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IJacobian()
|
| H A D | ex40.c | 109 const PetscScalar *u, *udot; in IFunction() local 114 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction() 117 f[0] = udot[0] - u[1]; in IFunction() 118 f[1] = udot[1] + 9.8; in IFunction() 121 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction() 133 const PetscScalar *u, *udot; in IJacobian() local 137 PetscCall(VecGetArrayRead(Udot, &udot)); in IJacobian() 146 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IJacobian()
|
| H A D | ex17.c | 162 PetscScalar *u, *udot, *f; in FormIFunction() local 184 PetscCall(DMDAVecGetArrayRead(da, Udot, &udot)); in FormIFunction() 194 else f[i] = udot[i] + (2. * u[i] - u[i - 1] - u[i + 1]) * sx; in FormIFunction() 198 else f[i] = udot[i] + (2. * u[i] - u[i - 1] - u[i + 1]) * sx; in FormIFunction() 204 PetscCall(DMDAVecRestoreArrayRead(da, Udot, &udot)); in FormIFunction()
|
| H A D | ex20adj.c | 125 const PetscScalar *u, *udot; in IFunction() local 130 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunction() 133 f[0] = udot[0]; in IFunction() 135 f[0] = udot[0] - u[1]; in IFunction() 137 f[1] = udot[1] - user->mu * ((1.0 - u[0] * u[0]) * u[1] - u[0]); in IFunction() 139 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunction()
|
| H A D | ex32.c | 101 const PetscScalar *u, *udot; in IFunction() local 119 PetscCall(DMDAVecGetArrayRead(da, Udot, &udot)); in IFunction() 129 f[i] = (u[i + 1] - 2 * u[i] + u[i - 1]) / h2 + app->sw[i - xs] * (-app->A * u[i]) - udot[i]; in IFunction() 133 PetscCall(DMDAVecRestoreArrayRead(da, Udot, &udot)); in IFunction()
|
| H A D | ex26.c | 263 PetscScalar u, udot, uxx, uyy, vx, vy, avx, avy, vxp, vxm, vyp, vym; in FormIFunctionLocal() local 358 udot = user->parabolic ? xdot[j][i].u : 0.; in FormIFunctionLocal() 361 f[j][i].u = udot + uxx + uyy - .5 * (x[j + 1][i].omega - x[j - 1][i].omega) * hx; in FormIFunctionLocal() 365 udot = user->parabolic ? xdot[j][i].v : 0.; in FormIFunctionLocal() 368 f[j][i].v = udot + uxx + uyy + .5 * (x[j][i + 1].omega - x[j][i - 1].omega) * hy; in FormIFunctionLocal()
|
| /petsc/src/binding/petsc4py/demo/legacy/ode/ |
| H A D | fastslowsplit.py | 57 def evalIFunctionFast(self, ts, t, u, udot, f): argument 58 f[0] = udot[0] + (-2.0 + u[1] * u[1] - np.cos(5.0 * t)) / (2.0 * u[1]) 61 def evalIJacobianFast(self, ts, t, u, udot, a, A, B): argument
|
| H A D | vanderpol.py | 81 def evalIFunction(self, ts, t, u, udot, f): argument 84 f[0] = udot[0] 86 f[0] = udot[0] - u[1] 87 f[1] = udot[1] - mu * ((1.0 - u[0] * u[0]) * u[1] - u[0]) 90 def evalIJacobian(self, ts, t, u, udot, shift, A, B): argument 108 def evalIJacobianP(self, ts, t, u, udot, shift, C): argument
|
| /petsc/src/ts/tutorials/multirate/ |
| H A D | ex3fastslowsplit.c | 53 const PetscScalar *u, *udot; in IFunctionfast() local 58 PetscCall(VecGetArrayRead(Udot, &udot)); in IFunctionfast() 60 f[0] = udot[0] + (-2.0 + u[1] * u[1] - PetscCosScalar(5.0 * t)) / (2.0 * u[1]); in IFunctionfast() 61 PetscCall(VecRestoreArrayRead(Udot, &udot)); in IFunctionfast()
|