# How to convert equation units if mesh units do not match parameter units

**URL:** <https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213>\
**Category:** General\
**Created:** [April 11, 2024, 12:54pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213 "2024-04-11T12:54:18Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathilda](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mathilda](https://fenicsproject.discourse.group/u/Mathilda)\
**Post date:** [April 11, 2024, 12:54pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/1 "2024-04-11T12:54:18Z")

</div>

I’m solving Navier-Stokes equations on a 3D cylinder geomertry to simulate a vessel in human. However, the unit of the mesh generated from gmsh seems to be millimeter while the unit of parameters are SI( the unit of density is kg/m^3, the unit of viscosity is kg/(m s) ,the velocity inlet is m/s, the pressure outlet is Pa, gravity is m/s^2)  
 ![图片](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/1/1b09d1a615a972cc84604517cb6068c7b8f5210d.png)  
Below is the code contains equations, how can I convert the equations or the boundary conditions, this problem has been bothering me for many days:

```python
dt=0.001
num_steps=100
mu=0.0035
rho=1060
nu=mu/rho
V=VectorFunctionSpace(mesh,"P",3) #velocity space
Q=FunctionSpace(mesh,"P",1) #pressure space
bcu_in=DirichletBC(V,Constant((0.182866,-0.03869,-0.071156)),boundary_markers,in_marker)

bcp_out=DirichletBC(Q,Constant(666.61),boundary_markers,out_marker)
bcu_wall=DirichletBC(V,Constant((0.0,0.0,0.0)),boundary_markers,wall_marker)
bcu=[bcu_in,bcu_wall]
bcp=[bcp_out]
u = TrialFunction(V)
v = TestFunction(V)
p = TrialFunction(Q)
q = TestFunction(Q)

# t=n (u,p) unknown
#u_ = Function(V)
#p_ = Function(Q)

# t=n-1 known
#u_1 = Function(V)
#p_1 = Function(Q)
# Create functions
u0 = Function(V)
u1 = Function(V)
p1 = Function(Q)

# Define coefficients
k = Constant(dt)
g = Constant((0, 0,-9.81))

# Tentative velocity step
F1 = (1/k)*inner(u - u0, v)*dx + inner(grad(u0)*u0, v)*dx + \
     nu*inner(grad(u), grad(v))*dx - inner(g, v)*dx
a1 = lhs(F1)
L1 = rhs(F1)

# Pressure update
a2 = inner(grad(p), grad(q))*dx
L2 = -(rho/k)*div(u1)*q*dx

# Velocity update
a3 = inner(u, v)*dx
L3 = inner(u1, v)*dx - k/rho*inner(grad(p1), v)*dx

```

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [April 11, 2024, 1:08pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/2 "2024-04-11T13:08:44Z")

</div>

You choose the units for your mesh (mm), so you can either: 1. Rescale the mesh to be in meter  
2. rescale density, viscosity etc to be in compatible units with a mesh defined in `mm`

---

<div class="post-metadata">

**Author:** ![Mathilda](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mathilda](https://fenicsproject.discourse.group/u/Mathilda)\
**Post date:** [April 11, 2024, 1:25pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/3 "2024-04-11T13:25:18Z")

</div>

I try to rescale the unit of density, viscosity, velocity and pressure, however an error message still appeared.  
I changed the density to 1060/(10^9) kg/mm^3, viscosity to 0.0035/(10^3)(kg/ m), pressure \*10^-3(outlet boundary condition), velocity \*10^3 (mm/s) (inlet boundary condition)and g to 9810 mm/s^2. I can’t find the error of the units, could you help me?

```python
dt=0.001
num_steps=100
mu=0.0000035
rho=0.000001060
nu=mu/rho
V=VectorFunctionSpace(mesh,"P",3) #velocity space
Q=FunctionSpace(mesh,"P",1) #pressure space
bcu_in=DirichletBC(V,Constant((182.866,-38.69,-71.156)),boundary_markers,in_marker)

bcp_out=DirichletBC(Q,Constant(0.66661),boundary_markers,out_marker)
bcu_wall=DirichletBC(V,Constant((0.0,0.0,0.0)),boundary_markers,wall_marker)
bcu=[bcu_in,bcu_wall]
bcp=[bcp_out]
u = TrialFunction(V)
v = TestFunction(V)
p = TrialFunction(Q)
q = TestFunction(Q)

```

And the error message:

```python
  File "test.py", line 104, in <module>
    solve(A1, u1.vector(), b1, "bicgstab", "default")
  File "/public/lib/python3.8/site-packages/dolfin/fem/solving.py", line 227, in solve
    return dolfin.la.solver.solve(*args)
  File "/public/solver.py", line 72, in solve
    return cpp.la.solve(A, x, b, method, preconditioner)
RuntimeError: 

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
*** fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to solve linear system using PETSc Krylov solver.
*** Reason: Solution failed to converge in 0 iterations (PETSc reason DIVERGED_NANORINF, residual norm ||r|| = inf).
*** Where: This error was encountered inside PETScKrylovSolver.cpp.
*** Process: 0
*** 
*** DOLFIN version: 2019.1.0
*** Git changeset: 2e001bd1aae8e14d758264f77382245e6eed04b0
*** -------------------------------------------------------------------------

```

---

<div class="post-metadata">

**Author:** ![nate](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/nate/32/17_2.png) [@nate](https://fenicsproject.discourse.group/u/nate)\
**Post date:** [April 11, 2024, 2:00pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/4 "2024-04-11T14:00:11Z")

</div>

This error is likely because of poor choice of scaling parameters inducing large floating point error in the linear solver, or your choice of parameters would lead to a Reynolds number which yields a convection dominated flow yielding an unstable numerical scheme.

Consider: [Nondimensionalization - Wikipedia](https://en.wikipedia.org/wiki/Nondimensionalization) and specifically [Non-dimensionalization and scaling of the Navier–Stokes equations - Wikipedia](https://en.wikipedia.org/wiki/Non-dimensionalization_and_scaling_of_the_Navier%E2%80%93Stokes_equations).

As a rule of thumb, the ideal goal would be to get a standard 2-norm measure of the residual to be in the range of 10^{-3} to 10^3. It will take care on your part to ensure your formulation is correct and appropriately scaled.

---

<div class="post-metadata">

**Author:** ![Mathilda](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mathilda](https://fenicsproject.discourse.group/u/Mathilda)\
**Post date:** [April 11, 2024, 2:29pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/5 "2024-04-11T14:29:00Z")

</div>

Thank you for your advice! But I still have some questions.

 ![图片](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/2/28aa2c760845c96cbd2867aa0fadd9e9e53c6927.png)  
L and U in the table refers to?  
The dimensionless varible should be implemented in which form?  
Excuse me I just can’t understand the table. Should I add coefficients to the equation to achieve unit conversion

---

<div class="post-metadata">

**Author:** ![Mathilda](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mathilda](https://fenicsproject.discourse.group/u/Mathilda)\
**Post date:** [April 15, 2024, 12:17pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/6 "2024-04-15T12:17:53Z")

</div>

Hi! I changed the import file to .step and rescale the mesh, and the unit is right now. But it still meet errors. Here is the new code, I think the code of ns equation has no errors, I really don’t know where is the problem…

```python
import meshio
import matplotlib.pyplot as plt
from dolfin import * 
#msh = meshio.read("import_stl.msh")
msh=meshio.read("pipe_cad.msh")
meshio.write("pipe_cad.xdmf", meshio.Mesh(points=msh.points, cells={"tetra": msh.cells["tetra"]}))
#boundary face
meshio.write("mf_pipe_cad.xdmf", meshio.Mesh(points=msh.points, cells={"triangle": msh.cells["triangle"]},cell_data={"triangle": {"name_to_read": msh.cell_data["triangle"]["gmsh:physical"]}}))
#boundary cell
meshio.write("cf_pipe_cad.xdmf", meshio.Mesh(points=msh.points, cells={"tetra": msh.cells["tetra"]},cell_data={"tetra": {"name_to_read":msh.cell_data["tetra"]["gmsh:physical"]}}))
mesh = Mesh()
with XDMFFile("pipe_cad.xdmf") as infile:
    infile.read(mesh)
##
mvc = MeshValueCollection("size_t", mesh, 2) 
with XDMFFile("mf_pipe_cad.xdmf") as infile:
    infile.read(mvc, "name_to_read")
mf = cpp.mesh.MeshFunctionSizet(mesh, mvc)
boundary_markers=MeshFunction("size_t",mesh,mvc)
##
mvc = MeshValueCollection("size_t", mesh, 3)
with XDMFFile("cf_pipe_cad.xdmf") as infile:
    infile.read(mvc, "name_to_read")
cf = cpp.mesh.MeshFunctionSizet(mesh, mvc)
T=1
in_marker=1
out_marker=2
wall_marker=3
domain_marker=4
#deltat=T/num_steps
dt=0.01
num_steps=100
mu=0.0035
rho=1060
nu=mu/rho
V=VectorFunctionSpace(mesh,"P",3) #velocity space
Q=FunctionSpace(mesh,"P",1) #pressure space
bcu_in=DirichletBC(V,Constant((0.037386,-0.002018,0.196464)),boundary_markers,in_marker)

bcp_out=DirichletBC(Q,Constant(666.61),boundary_markers,out_marker)
bcu_wall=DirichletBC(V,Constant((0.0,0.0,0.0)),boundary_markers,wall_marker)
bcu=[bcu_in,bcu_wall]
bcp=[bcp_out]
u = TrialFunction(V)
v = TestFunction(V)
p = TrialFunction(Q)
q = TestFunction(Q)

# t=n (u,p) unknown
#u_ = Function(V)
#p_ = Function(Q)

# t=n-1 known
#u_1 = Function(V)
#p_1 = Function(Q)
# Create functions
u0 = Function(V)
u1 = Function(V)
p1 = Function(Q)

# Define coefficients
k = Constant(dt)
f = Constant((0, 0, 0))

# Tentative velocity step
F1 = (1/k)*inner(u - u0, v)*dx +inner(grad(u0)*u0, v)*dx + \
     nu*inner(grad(u), grad(v))*dx - inner(f, v)*dx
a1 = lhs(F1)
L1 = rhs(F1)

# Pressure update
a2 = inner(grad(p), grad(q))*dx
L2 = -(rho/k)*div(u1)*q*dx

# Velocity update
a3 = inner(u, v)*dx
L3 = inner(u1, v)*dx - (k/rho)*inner(grad(p1), v)*dx

# Assemble matrices
A1 = assemble(a1)
A2 = assemble(a2)
A3 = assemble(a3)

# Use amg preconditioner if available
prec = "amg" if has_krylov_solver_preconditioner("amg") else "default"

# Use nonzero guesses - essential for CG with non-symmetric BC
parameters['krylov_solver']['nonzero_initial_guess'] = True

# Create files for storing solution
ufile = File("results/velocity_cad.pvd")
pfile = File("results/pressure_cad.pvd")

# Time-stepping
t = dt
while t < T + DOLFIN_EPS:
    print(t)
    # Update pressure boundary condition
    #p_in.t = t
    begin("Computing tentative velocity")
    # Compute tentative velocity step
    b1 = assemble(L1)
    [bc.apply(A1, b1) for bc in bcu]
    solve(A1, u1.vector(), b1, "bicgstab", "default")
    end()
    begin("Computing pressure correction")
    # Pressure correction
    b2 = assemble(L2)
    [bc.apply(A2, b2) for bc in bcp]
    [bc.apply(p1.vector()) for bc in bcp]
    solve(A2, p1.vector(), b2, "bicgstab", prec)
    end()
    begin("Computing velocity correction")
    # Velocity correction
    b3 = assemble(L3)
    [bc.apply(A3, b3) for bc in bcu]
    solve(A3, u1.vector(), b3, "bicgstab", "default")
    end()
    # Save to file
    ufile << u1
    pfile << p1

    # Move to next time step
    u0.assign(u1)
    t += dt

```

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [April 15, 2024, 12:28pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/7 "2024-04-15T12:28:26Z")

</div>

As we do not have the meshes, it is quite hard to reproduce any behavior that you are seeing.  
Please either use a simplified mesh (unit square or cube) or post the full error traceback.

---

<div class="post-metadata">

**Author:** ![Mathilda](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mathilda](https://fenicsproject.discourse.group/u/Mathilda)\
**Post date:** [April 15, 2024, 12:58pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/8 "2024-04-15T12:58:11Z")

</div>

> **[GitHub - caoxiran/pipe](https://github.com/caoxiran/pipe)**
>
> Contribute to caoxiran/pipe development by creating an account on GitHub.

The full script is here, the pipe\_ns.py is the solve code. pipe\_CAD.step is the geometry. the pipe\_msh\_cad.py is the mesh feneration script. Thank you very much for helping me exam the script!

---

<div class="post-metadata">

**Author:** ![Mathilda](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mathilda](https://fenicsproject.discourse.group/u/Mathilda)\
**Post date:** [April 15, 2024, 1:31pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/9 "2024-04-15T13:31:53Z")

</div>

The error traceback is the same as the information

```python
Traceback (most recent call last):
  File "tipe_ns.py", line 104, in <module>
    solve(A1, u1.vector(), b1, "bicgstab", "default")
  File "/public/home/cxr1/.conda/envs/fenicss/lib/python3.8/site-packages/dolfin/fem/solving.py", line 227, in solve
    return dolfin.la.solver.solve(*args)
  File "/public/home/cxr1/.conda/envs/fenicss/lib/python3.8/site-packages/dolfin/la/solver.py", line 72, in solve
    return cpp.la.solve(A, x, b, method, preconditioner)
RuntimeError: 

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
*** fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to solve linear system using PETSc Krylov solver.
*** Reason: Solution failed to converge in 0 iterations (PETSc reason DIVERGED_NANORINF, residual norm ||r|| = inf).
*** Where: This error was encountered inside PETScKrylovSolver.cpp.
*** Process: 0
*** 
*** DOLFIN version: 2019.1.0
*** Git changeset: 2e001bd1aae8e14d758264f77382245e6eed04b0
*** -------------------------------------------------------------------------

```

for the simplified mesh, I have tested 2D mesh yesterday, and the code seems no problem. Is the problem related to the solver?

---

<div class="post-metadata">

**Author:** ![Mathilda](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mathilda](https://fenicsproject.discourse.group/u/Mathilda)\
**Post date:** [April 16, 2024, 11:21am UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/10 "2024-04-16T11:21:51Z")

</div>

I think the problem is either in the grid or in the solver, but I can’t be sure where the problem lies. I’m a bit confused now. I have compared the results and found that the calculated result is correct when the density is 1. However, when the density is changed to 1060, non convergence occurs, and another software based on finite volume can still calculate the result

---

<div class="post-metadata">

**Author:** ![francesco-ballarin](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@francesco-ballarin](https://fenicsproject.discourse.group/u/francesco-ballarin)\
**Post date:** [April 16, 2024, 11:34am UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/11 "2024-04-16T11:34:27Z")

</div>

That makes the Reynolds number 1000 times bigger, i.e. you’ll likely be in a laminar case when density is 1 and a turbulent case when density is 1000. It’s no surprise that the latter case is much more difficult.

---

<div class="post-metadata">

**Author:** ![dparsons](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@dparsons](https://fenicsproject.discourse.group/u/dparsons)\
**Post date:** [April 16, 2024, 12:10pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/12 "2024-04-16T12:10:54Z")

</div>

If you can solve successfully at low density, then one approach is to iteratively solve using an effective density. Start with the solvable small value and use its solution as an initial guess for the next (nonlinear) iteration, ramping up the density until you reach your target value.

---

<div class="post-metadata">

**Author:** ![Mathilda](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mathilda](https://fenicsproject.discourse.group/u/Mathilda)\
**Post date:** [April 16, 2024, 1:32pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/13 "2024-04-16T13:32:20Z")

</div>

The parameters contains density(1060kg/m^3), viscosity(0.0035Pa s) are all properties of blood, and it is assumed as laminar in the finite volume software. So I really can’t understand why it can’t be solved by fenics.

---

<div class="post-metadata">

**Author:** ![nate](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/nate/32/17_2.png) [@nate](https://fenicsproject.discourse.group/u/nate)\
**Post date:** [April 16, 2024, 3:12pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/14 "2024-04-16T15:12:22Z")

</div>

The finite volume scheme is an inherently stabilised scheme as a consequence of interior flux approximation choices. Being low order (first order accurate) it may also be highly dissipative which aids in stability.

The scheme you propose using in your code above is not stabilised. I’m not actually sure if the degree 3 velocity and degree 1 pressure approximations even satisfy the inf-sup condition, or if that’s even necessary for your formulation.

It is not fair to compare two radically different discretisation schemes, one of which is not well suited for the problem you’re seeking to solve.

Finite volume schemes may be implemented with FEniCS also; however, this would require deriving the formulation and its implementation which is quite different from what you have above.

---

<div class="post-metadata">

**Author:** ![dparsons](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@dparsons](https://fenicsproject.discourse.group/u/dparsons)\
**Post date:** [April 16, 2024, 5:11pm UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/15 "2024-04-16T17:11:38Z")

</div>

This document gives a helpful review of the fundamental distinction (and similarity) between FEM and FVM methods (and FDM).  
[https://doi.org/10.1002/9781119176817.ecm2010](https://doi.org/10.1002/9781119176817.ecm2010)  
FEM centres around the weak formulation, while FVM centres around a balance equation (a conservation law). In certain specific low order conditions they are identical, but in general (in higher order models) they are using a completely different mathematics.

---

<div class="post-metadata">

**Author:** ![Mathilda](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mathilda](https://fenicsproject.discourse.group/u/Mathilda)\
**Post date:** [April 17, 2024, 2:10am UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/16 "2024-04-17T02:10:26Z")

</div>

The problem I want to solve is a three dimensional blood vessel geometery, so the degree 3 velocity is necessary for me

---

<div class="post-metadata">

**Author:** ![Mathilda](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mathilda](https://fenicsproject.discourse.group/u/Mathilda)\
**Post date:** [April 17, 2024, 2:12am UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/17 "2024-04-17T02:12:23Z")

</div>

Thank you for your suggestion! I will learn the relevant code and make an attempt

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [April 18, 2024, 6:55am UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/18 "2024-04-18T06:55:45Z")

</div>

> [@Mathilda](#):
>
> The problem I want to solve is a three dimensional blood vessel geometery, so the degree 3 velocity is necessary for me

The degree of a Finite element space and the dimensionality of a mesh does not need to be the same.

---

<div class="post-metadata">

**Author:** ![Mathilda](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Mathilda](https://fenicsproject.discourse.group/u/Mathilda)\
**Post date:** [April 19, 2024, 2:40am UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/19 "2024-04-19T02:40:49Z")

</div>

If the degree of the Finite element space is 2, and the degree of the mesh is 3, how to define the velocity boundary condition? 😿

---

<div class="post-metadata">

**Author:** ![francesco-ballarin](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@francesco-ballarin](https://fenicsproject.discourse.group/u/francesco-ballarin)\
**Post date:** [April 19, 2024, 5:31am UTC](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213/20 "2024-04-19T05:31:07Z")

</div>

Exactly in the same way as you already did

```auto
bcu_in=DirichletBC(V,Constant((0.037386,-0.002018,0.196464)),boundary_markers,in_marker)

```

Since your inlet condition is a constant, it is possible to represent it in a polynomial space of any order, including degree 2.

[Next page](https://fenicsproject.discourse.group/t/how-to-convert-equation-units-if-mesh-units-do-not-match-parameter-units/14213.md?page=2)
