https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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  snes,
Vec  x,
Vec  f,
void *  ctx 
)

Definition at line 34 of file SubChannel1PhaseProblem.C.

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