You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a situation quite similar to ex16p.cpp, in that I'm trying to implement a coefficient in the diffusion integrator that depends on an iterative solution.
The only major difference in my case is that I'm solving Stokes, hence u is not scalar-, but vector-valued.
In line 448 of ex16p.cpp, the parameter is updated in each iteration as follows:
void ConductionOperator::SetParameters(const Vector &u)
{`
ParGridFunction u_alpha_gf(&fespace);
u_alpha_gf.SetFromTrueDofs(u);
for (int i = 0; i < u_alpha_gf.Size(); i++)
{
u_alpha_gf(i) = kappa + alpha*u_alpha_gf(i);
}
delete K;
K = new ParBilinearForm(&fespace);
GridFunctionCoefficient u_coeff(&u_alpha_gf);
K->AddDomainIntegrator(new DiffusionIntegrator(u_coeff));
K->Assemble(0); // keep sparsity pattern of M and K the same
K->FormSystemMatrix(ess_tdof_list, Kmat);
delete T;
T = NULL; // re-compute T on the next ImplicitSolve
}
So my question essentially is, if u now stores not a scalar solution, but a 3-dimensional vector-valued one, how would I have to access its entries to set, e.g.
u_alpha_gf = kappa + alpha * ||u||
where ||u|| refers to the Euclidean norm of u?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello everyone!
I have a situation quite similar to ex16p.cpp, in that I'm trying to implement a coefficient in the diffusion integrator that depends on an iterative solution.
The only major difference in my case is that I'm solving Stokes, hence u is not scalar-, but vector-valued.
In line 448 of ex16p.cpp, the parameter is updated in each iteration as follows:
So my question essentially is, if u now stores not a scalar solution, but a 3-dimensional vector-valued one, how would I have to access its entries to set, e.g.
u_alpha_gf = kappa + alpha * ||u||
where ||u|| refers to the Euclidean norm of u?
Any help would be much appreciated!
Beta Was this translation helpful? Give feedback.
All reactions