On 4/25/19 6:58 AM, Bruno Blais wrote: > I would like to be able to set-up an initial condition by fixing the value of > the DOF themselves by using their x,y(,z) position with a ParsedFuction. > > Generally, I set the initial condition by using an L2 projection of the > function (for complex function and higher order element I know this is more > appropriate). > However, for some stuff I would like to be able to fix the value of the DOF > directly. > My issue is, through the doxygen, I have not found a way to loop through the > DOF and to extract their position, even more when I have high order element > or > when I have a multiplicity (say velocity-vector + pressure). > > What I would be looking into doing would be something similar to : > > loop over local DOF; > get DOF position > get DOF component (u[0], u[1], u[2], p) > calculate parsed function using the point > set the value of the DOF > end > > Is it something that is possible? This is a weird way of iterating since I > know we always loop over the cells. Maybe there is a way to achieve this by > looping over the cells and then looping over the DOF of the cells? This would > be slightly redundant, but I do not care since I am doing this only once.
You can get the locations of DoFs using DoFTools::map_dofs_to_support_points(). But maybe the easier way is to use VectorTools::interpolate_boundary_values() or project() and just pass it a function object that describes the function you want to set in terms of (x,y,z). This could be your ParsedFunction. interpolate_b_v() will then call your parsed function with a bunch of points that happen to correspond to the DoF locations, but it makes the connection internally and you no longer need to worry about which DoF sits where. 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]. For more options, visit https://groups.google.com/d/optout.
