For a domain size of 50x100.I took the values of phase field for 100s which ranges between 0 to 1 over the entire domain. I want to know the y value where my concentration is in between a range of 0.5 to 0.45 for the first 5 time steps, with a constant x coordinate value of 25?
Is it possible in Fenicsx?
You can use dolfinx.fem — DOLFINx 0.9.0.0 documentation to determine all DOFs which are at x[0] == 25
. Once you have those DOFs, loop over time and discard solutions which DOFs are not in the range you want.
Thanks for the previous information. I tried to implement it.
But my result is not consistent. In the sense, my y coordinates are fluctuating top and bottom. With increasing time step.
I tried to get a single value from the range. But can you let me know if my implementation is correct?
def Find_y(timestep, filename="phi_values_log.txt"):
DOFs = fem.locate_dofs_topological(V.sub(0), 1, facets.find(6))
phi_values = v.sub(0).x.array[DOFs]
dof_coords_phi = V_phi.tabulate_dof_coordinates()
with open(filename, "a") as file:
for dof, phi_value in zip(DOFs, phi_values):
if 0.47 <= phi_value <= 0.5:
y_coord = dof_coords_phi[dof, 1]
y_coord_actual = 0.15-y_coord
file.write(f"{timestep} {dof} {phi_value} {y_coord_actual}\n")
We can’t comment any further unless you give us the complete code.
For the sake of increasing the probability someone will reply you, please make it as minimal as possible, and please use a builtin mesh. If you post a long code, or a code which uses a custom mesh, the likelihood of someone taking the time to go through it decreases.