On 12/22/21 2:15 AM, Toddy Liu wrote:
Dear Deal.II community,

I'm getting trouble in changing the values of my solution variable Phi. Firstly, I create a R20 circle whose center is located at the center of the square domain by using VectorTools::interpolate(dof_handler, user_defined_function, solution_Phi). After creating this circle and several program loops, the radius of this circle grows up to about 40,  as shown below, solution_Phi inside the circle is 1(denoted by red color) while outside the circle is -1(denoted by blue color). Here comes my problem, are there any practical ways to assign those solution_Phi who is located at the top half of the square domain(y>=60) to -1 while others(y<60) keep unchanged?

If I understand what you want to do correctly, then it isn't actually about the circle, but you want to do something like VectorTools::interpolate but only for degrees of freedom that satisfy a certain condition?

There isn't anything of this sort readily available in deal.II, but (as so often) something like this can be found in ASPECT. Take a look at the ideas here:

https://github.com/geodynamics/aspect/blob/master/cookbooks/prescribed_velocity/prescribed_velocity.cc#L238-L264
This code creates constraints for individual DoFs, but you could as well just write the corresponding values into your solution vector.

Best
 W.


--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 [email protected]
                           www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/dbbdfe8f-d5d6-b630-51b9-49bb0c39039f%40colostate.edu.

Reply via email to