Hi everyone!
I have the following problem.
I have obtained a solution with ANSYS Fluent and I want to analyze it with FEniCSx. The mesh is in Nastran format and I have converted it to XDFM with the following line
meshio convert mesh_12_nastran.bdf venturi_coarse.xdmf
I get from Fluent a .txt file with 4 columns. (vx.txt)
the number of the point, the 3 spatial coordinates and the value of the function in these points.
my code in FEniCSx:
import dolfinx
from mpi4py import MPI
from petsc4py import PETSc
import numpy as np
import math
import ufl
from ufl import (FacetNormal, FiniteElement, Identity, Measure, TestFunction, TrialFunction, VectorElement,
as_vector, div, dot, ds, dx, inner, lhs, grad, nabla_grad, rhs, sym)
from dolfinx.fem.petsc import (apply_lifting, assemble_matrix, assemble_vector,
create_vector, create_matrix, set_bc)
from dolfinx.fem import (Constant, Function, FunctionSpace,
assemble_scalar, dirichletbc, form, locate_dofs_topological, set_bc)
with dolfinx.io.XDMFFile(MPI.COMM_WORLD, "venturi_coarse.xdmf", "r") as xdmf:
domain = xdmf.read_mesh(name="Grid")
s_cg1 = FiniteElement("CG", domain.ufl_cell(), 1)
Q = dolfinx.fem.FunctionSpace(domain, s_cg1)
vx_np = np.loadtxt('vx.txt')
vx_aux = []
vx_aux[:] = vx_np[:,4]
vx = Function(Q)
vx.x.array[:]=vx_aux[:]
with dolfinx.io.XDMFFile(domain.comm, "Plot/vx.xdmf", "w") as file:
file.write_mesh(domain)
file.write_function(vx)
and obtain
but it should be
Does anyone have any ideas? I think the vertices are not ordered in the same way.
Besides solving it, I would like to know how I can, given a point, find the nearest vertex (coordinates and mesh number).
In this folder are all the files