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 33 of file SubChannel1PhaseProblem.C.

34{
35 const PetscScalar * xx;
36 PetscScalar * ff;
37 PetscInt size;
38
40 Ctx * cc = static_cast<Ctx *>(ctx);
41 LibmeshPetscCallQ(VecGetSize(x, &size));
42
43 libMesh::DenseVector<Real> solution_seed(size, 0.0);
44 LibmeshPetscCallQ(VecGetArrayRead(x, &xx));
45 for (PetscInt i = 0; i < size; i++)
46 solution_seed(i) = xx[i];
47
48 LibmeshPetscCallQ(VecRestoreArrayRead(x, &xx));
49
50 libMesh::DenseVector<Real> Wij_residual_vector =
51 cc->schp->residualFunction(cc->iblock, solution_seed);
52
53 LibmeshPetscCallQ(VecGetArray(f, &ff));
54 for (int i = 0; i < size; i++)
55 ff[i] = Wij_residual_vector(i);
56
57 LibmeshPetscCallQ(VecRestoreArray(f, &ff));
58 PetscFunctionReturn(LIBMESH_PETSC_SUCCESS);
59}
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