https://mooseframework.inl.gov
Classes | Functions
SubChannel1PhaseProblem.C File Reference

Go to the source code of this file.

Classes

struct  Ctx
 

Functions

PetscErrorCode formFunction (SNES, Vec x, Vec f, void *ctx)
 

Function Documentation

◆ formFunction()

PetscErrorCode formFunction ( SNES  ,
Vec  x,
Vec  f,
void ctx 
)

Definition at line 27 of file SubChannel1PhaseProblem.C.

28 {
29  const PetscScalar * xx;
30  PetscScalar * ff;
31  PetscInt size;
32 
34  Ctx * cc = static_cast<Ctx *>(ctx);
35  LibmeshPetscCallQ(VecGetSize(x, &size));
36 
37  libMesh::DenseVector<Real> solution_seed(size, 0.0);
38  LibmeshPetscCallQ(VecGetArrayRead(x, &xx));
39  for (PetscInt i = 0; i < size; i++)
40  solution_seed(i) = xx[i];
41 
42  LibmeshPetscCallQ(VecRestoreArrayRead(x, &xx));
43 
44  libMesh::DenseVector<Real> Wij_residual_vector =
45  cc->schp->residualFunction(cc->iblock, solution_seed);
46 
47  LibmeshPetscCallQ(VecGetArray(f, &ff));
48  for (int i = 0; i < size; i++)
49  ff[i] = Wij_residual_vector(i);
50 
51  LibmeshPetscCallQ(VecRestoreArray(f, &ff));
52  PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
53 }
PetscFunctionBegin
SubChannel1PhaseProblem * schp
const std::vector< double > x
Real f(Real x)
Test function for Brents method.
LibmeshPetscCallQ(DMShellGetContext(dm, &ctx))
libMesh::DenseVector< Real > residualFunction(int iblock, libMesh::DenseVector< Real > solution)
Computes Residual Vector based on the lateral momentum conservation equation for block iblock & updat...
void * ctx
PetscFunctionReturn(LIBMESH_PETSC_SUCCESS)