On 08/27/2017 11:53 AM, Marek Čapek wrote:
>
>
> I am getting the solution in
>
> PetscWrappers::MPI::Vector solution_phase_n;
>
> I am interested in modifying the vector of the solution - I
> want to cut the undershoots and overshoots in phase-field component
> of the solution. Namely I have values of phase field like -1.005 or 1.005,
> however they should be only in <-1,1>.
> Is it possible to modify only the relevant parts of the
> PetscWrappers::MPI::Vector ?
>
> I want to get afterwards the solution values and gradients using
>
> fe_v_phase.get_function_values
> fe_v_phase.get_function_gradients
>
> to get the "repaired" values and gradients of phase field.
>
> Or should I split the system, ie. firstly solve for the phase
> field, then modify the phase field solution and afterwards
> solve for chemical potential?
The easiest solution is probably to use a
PETScWrappers::MPI::BlockVector with two blocks that corresponds to the
two variables. You would then just apply the operation on one of the
blocks. This may require you to also substructure your matrix into
blocks, but all of your solvers should continue to work. In particular,
just because your matrix is substructured does not imply that you have
to solve one equation at the time (though you can).
The alternative is to figure out which elements of your vector
correspond to the phase-field. Namespace DoFTools has functions that
give you a mask or IndexSet that indicates which variables belong to one
particular vector component. You would then just operate on those vector
elements that are listed in the mask/IndexSet.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email:
bang...@colostate.edu
www:
http://www.math.colostate.edu/~bangerth/