Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Found no facets matching domain for boundary condition.(TF_csm) #56

Closed
zhangmuElias opened this issue May 6, 2023 · 6 comments
Closed

Comments

@zhangmuElias
Copy link

Dear everyone

When testing TF_csm, I tried to change the fixed boundary conditions for the solid domain by modifying the def get_mesh_domain_and_boundaries

def get_mesh_domain_and_boundaries(c_x, c_y, f_H, f_L, R, **namespace):
    # Read mesh
    mesh = Mesh(path.join(path.dirname(path.abspath(__file__)),  "mesh", "TF_csm.xml.gz"))
    mesh = refine(mesh)

    # Mark boundaries
    Barwall =  AutoSubDomain(lambda x: ((x[0] - c_x)**2 + (x[1] - c_y)**2 < R**2 + DOLFIN_EPS * 1e5))
    #Downwall = AutoSubDomain(lambda x: near(x[1], c_y - f_H / 2))#0.2-0.02/2=0.19
    #Upwall =   AutoSubDomain(lambda x: near(x[1], c_y + f_H / 2))#0.2+0.02/2=0.21
    #Rightwall= AutoSubDomain(lambda x: near(x[0], c_x + R + f_L))#0.2+0.05+0.35=0.60
 
    def Down(x, on_boundary):
        return near(x[1], 0.19) and on_boundary
    def Up(x, on_boundary):
        return near(x[1], 0.21) and on_boundary
    def Right(x, on_boundary):
        return near(x[0], 0.60) and on_boundary

    Downwall = AutoSubDomain(Down)
    Upwall= AutoSubDomain(Up)
    Rightwall= AutoSubDomain(Right)
    
    boundaries = MeshFunction("size_t", mesh, mesh.geometry().dim() - 1)
    boundaries.set_all(0)
    Barwall.mark(boundaries, 1)
    Downwall.mark(boundaries, 2)
    Upwall.mark(boundaries, 3)
    Rightwall.mark(boundaries, 4)

    # Mark domain
    domains = MeshFunction("size_t", mesh, mesh.geometry().dim())
    domains.set_all(1)

    return mesh, domains, boundaries

def create_bcs(DVP, boundaries, **namespace):
    # Clamp on the right hand side
    u_barwall = DirichletBC(DVP.sub(0), ((0.0, 0.0)), boundaries, 4)

    return dict(bcs=[u_barwall])

But it seems it can't be found during calculating.

hwloc/linux: Ignoring PCI device with non-16bit domain.
Pass --enable-32bits-pci-domain to configure to support such devices
(warning: it would break the library ABI, don't enable unless really needed).
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
WARNING: Could not import module "cppimport" - it is required for using
 Probes, but not installed on your system. Install with "pip install cppimport"
This is used for solid using electic tensor C ----ZHANG
1 solid region(s) found, using following parameters
{'dx_s_id': 1, 'material_model': 'C_arbitrary', 'rho_s': 5550, 'c11': 226000000000.0, 'c13': 124000000000.0, 'c33': 216000000000.0, 'c44': 44200000000.0}
1 fluid region(s) found, using following parameters
{'dx_f_id': 0, 'rho_f': 1000.0, 'mu_f': 1.0}
dx_f_id_list: [0] 
dx_s_id_list: [1] 
Using fluid file: no_fluid 
Using solid file: solid_C_arbitraty_reversetest 
Using extrapolation file: no_extrapolation 
Compute Jacobian matrix
Newton iteration 0: r (atol) = 7.506e+00 (tol = 1.000e-07), r (rel) = 8.203e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 1.434e-05 (tol = 1.000e-07), r (rel) = 5.072e-09 (tol = 1.000e-07) 
Distance x: 2.852964e-18
Distance y: -4.900000e-04
Solved for timestep 1, t = 0.0100 in 0.4 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 7.506e+05 (tol = 1.000e-07), r (rel) = 8.204e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 4.308e-05 (tol = 1.000e-07), r (rel) = 1.521e-08 (tol = 1.000e-07) 
Distance x: 1.569242e-17
Distance y: -1.960000e-03
Solved for timestep 2, t = 0.0200 in 0.3 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 1.501e+06 (tol = 1.000e-07), r (rel) = 8.206e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 7.208e-05 (tol = 1.000e-07), r (rel) = 2.536e-08 (tol = 1.000e-07) 
Distance x: 4.674880e-17
Distance y: -4.410000e-03
Solved for timestep 3, t = 0.0300 in 0.3 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 2.252e+06 (tol = 1.000e-07), r (rel) = 8.208e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 1.017e-04 (tol = 1.000e-07), r (rel) = 3.550e-08 (tol = 1.000e-07) 
Distance x: 1.055812e-16
Distance y: -7.840000e-03
Solved for timestep 4, t = 0.0400 in 0.4 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 3.002e+06 (tol = 1.000e-07), r (rel) = 8.212e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 1.302e-04 (tol = 1.000e-07), r (rel) = 4.564e-08 (tol = 1.000e-07) 
Distance x: 1.982616e-16
Distance y: -1.225000e-02
Solved for timestep 5, t = 0.0500 in 0.3 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 3.753e+06 (tol = 1.000e-07), r (rel) = 8.216e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 1.614e-04 (tol = 1.000e-07), r (rel) = 5.579e-08 (tol = 1.000e-07) 
Distance x: 3.371549e-16
Distance y: -1.764000e-02
Solved for timestep 6, t = 0.0600 in 0.3 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 4.504e+06 (tol = 1.000e-07), r (rel) = 8.221e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 1.905e-04 (tol = 1.000e-07), r (rel) = 6.593e-08 (tol = 1.000e-07) 
Distance x: 5.248376e-16
Distance y: -2.401000e-02
Solved for timestep 7, t = 0.0700 in 0.3 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 5.254e+06 (tol = 1.000e-07), r (rel) = 8.226e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 2.260e-04 (tol = 1.000e-07), r (rel) = 7.607e-08 (tol = 1.000e-07) 
Distance x: 7.799181e-16
Distance y: -3.136000e-02
Solved for timestep 8, t = 0.0800 in 0.3 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 6.005e+06 (tol = 1.000e-07), r (rel) = 8.233e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 2.565e-04 (tol = 1.000e-07), r (rel) = 8.622e-08 (tol = 1.000e-07) 
Distance x: 1.094141e-15
Distance y: -3.969000e-02
Solved for timestep 9, t = 0.0900 in 0.3 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 6.756e+06 (tol = 1.000e-07), r (rel) = 8.240e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 2.872e-04 (tol = 1.000e-07), r (rel) = 9.636e-08 (tol = 1.000e-07) 
Distance x: 1.496842e-15
Distance y: -4.900000e-02
Solved for timestep 10, t = 0.1000 in 0.4 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 7.506e+06 (tol = 1.000e-07), r (rel) = 8.248e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 3.184e-04 (tol = 1.000e-07), r (rel) = 1.065e-07 (tol = 1.000e-07) 
Newton iteration 2: r (atol) = 1.042e-04 (tol = 1.000e-07), r (rel) = 9.129e-14 (tol = 1.000e-07) 
Distance x: 1.939238e-15
Distance y: -5.929000e-02
Solved for timestep 11, t = 0.1100 in 0.4 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 8.257e+06 (tol = 1.000e-07), r (rel) = 8.257e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 3.611e-04 (tol = 1.000e-07), r (rel) = 1.166e-07 (tol = 1.000e-07) 
Newton iteration 2: r (atol) = 1.484e-04 (tol = 1.000e-07), r (rel) = 9.999e-14 (tol = 1.000e-07) 
Distance x: 2.379777e-15
Distance y: -7.056000e-02
Solved for timestep 12, t = 0.1200 in 0.5 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 9.007e+06 (tol = 1.000e-07), r (rel) = 8.267e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 3.894e-04 (tol = 1.000e-07), r (rel) = 1.268e-07 (tol = 1.000e-07) 
Newton iteration 2: r (atol) = 1.745e-04 (tol = 1.000e-07), r (rel) = 1.087e-13 (tol = 1.000e-07) 
Distance x: 2.823974e-15
Distance y: -8.281000e-02
Solved for timestep 13, t = 0.1300 in 0.5 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 9.758e+06 (tol = 1.000e-07), r (rel) = 8.278e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 4.276e-04 (tol = 1.000e-07), r (rel) = 1.369e-07 (tol = 1.000e-07) 
Newton iteration 2: r (atol) = 1.915e-04 (tol = 1.000e-07), r (rel) = 1.174e-13 (tol = 1.000e-07) 
Distance x: 3.263889e-15
Distance y: -9.604000e-02
Solved for timestep 14, t = 0.1400 in 0.4 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 1.051e+07 (tol = 1.000e-07), r (rel) = 8.289e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 4.574e-04 (tol = 1.000e-07), r (rel) = 1.471e-07 (tol = 1.000e-07) 
Newton iteration 2: r (atol) = 1.915e-04 (tol = 1.000e-07), r (rel) = 1.261e-13 (tol = 1.000e-07) 
Distance x: 3.721201e-15
Distance y: -1.102500e-01
Solved for timestep 15, t = 0.1500 in 0.3 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 1.126e+07 (tol = 1.000e-07), r (rel) = 8.301e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 5.223e-04 (tol = 1.000e-07), r (rel) = 1.572e-07 (tol = 1.000e-07) 
Newton iteration 2: r (atol) = 2.812e-04 (tol = 1.000e-07), r (rel) = 1.348e-13 (tol = 1.000e-07) 
Distance x: 4.157062e-15
Distance y: -1.254400e-01
Solved for timestep 16, t = 0.1600 in 0.4 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 1.201e+07 (tol = 1.000e-07), r (rel) = 8.314e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 5.593e-04 (tol = 1.000e-07), r (rel) = 1.674e-07 (tol = 1.000e-07) 
Newton iteration 2: r (atol) = 2.982e-04 (tol = 1.000e-07), r (rel) = 1.435e-13 (tol = 1.000e-07) 
Distance x: 4.616574e-15
Distance y: -1.416100e-01
Solved for timestep 17, t = 0.1700 in 0.3 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 1.276e+07 (tol = 1.000e-07), r (rel) = 8.328e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 5.893e-04 (tol = 1.000e-07), r (rel) = 1.775e-07 (tol = 1.000e-07) 
Newton iteration 2: r (atol) = 3.199e-04 (tol = 1.000e-07), r (rel) = 1.522e-13 (tol = 1.000e-07) 
Distance x: 5.059804e-15
Distance y: -1.587600e-01
Solved for timestep 18, t = 0.1800 in 0.3 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 1.351e+07 (tol = 1.000e-07), r (rel) = 8.343e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 6.376e-04 (tol = 1.000e-07), r (rel) = 1.876e-07 (tol = 1.000e-07) 
Newton iteration 2: r (atol) = 3.783e-04 (tol = 1.000e-07), r (rel) = 1.608e-13 (tol = 1.000e-07) 
Distance x: 5.505911e-15
Distance y: -1.768900e-01
Solved for timestep 19, t = 0.1900 in 0.3 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 1.426e+07 (tol = 1.000e-07), r (rel) = 8.358e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 6.766e-04 (tol = 1.000e-07), r (rel) = 1.978e-07 (tol = 1.000e-07) 
Newton iteration 2: r (atol) = 3.762e-04 (tol = 1.000e-07), r (rel) = 1.695e-13 (tol = 1.000e-07) 
Distance x: 5.981709e-15
Distance y: -1.960000e-01
Solved for timestep 20, t = 0.2000 in 0.6 s
Compute Jacobian matrix
Newton iteration 0: r (atol) = 1.501e+07 (tol = 1.000e-07), r (rel) = 8.374e-03 (tol = 1.000e-07) 
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.

And actually, in the four boundaries, both top and right can't be found but left and bottom seem work fine. Is there anything wrong for the boundary conditions I defined?

@keiyamamo
Copy link
Collaborator

keiyamamo commented May 7, 2023

I can see that you're using your own solver. Can you check if the same error happens with the original solver by only changing the way of marking the boundary? If the error happens with the original solver, please post the problem here that can reproduce the error so that I can test it. Without minimum working example, it is hard to debug the code.

@zhangmuElias
Copy link
Author

Yes, sure. The same error happens with the original solver by only changing the way of marking the boundary.

hwloc/linux: Ignoring PCI device with non-16bit domain.
Pass --enable-32bits-pci-domain to configure to support such devices
(warning: it would break the library ABI, don't enable unless really needed).
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
*** Warning: Found no facets matching domain for boundary condition.
Compute Jacobian matrix
Newton iteration 0: r (atol) = 2.760e-01 (tol = 1.000e-07), r (rel) = 1.674e-03 (tol = 1.000e-07) 
Newton iteration 1: r (atol) = 1.712e-11 (tol = 1.000e-07), r (rel) = 2.601e-15 (tol = 1.000e-07) 
Distance x: 1.817850e-18
Distance y: -1.000000e-04

Although it will go on calculating, the contour result is wrong.
The not working case file is here, you can run it with original turtleFSI to see the errors.
TF_csm_topfix.txt

I think the proposed TF_csm.xml.gz file has some problems with identifying the top boundary.
Because I tested using different ways to build the mesh for the original TF_CSM case, like:

    p1 = Point(0.25, 0.19)
    p2 = Point(0.6, 0.21)
    mesh = RectangleMesh(p1, p2, 175, 10)

Then the top boundary can be chosen using:

    Barwall = AutoSubDomain(lambda x: (near(x[0], 0.25)))
    Topwall = AutoSubDomain(lambda x: (near(x[1], 0.21)))
    boundaries = MeshFunction("size_t", mesh, mesh.geometry().dim() - 1)
    boundaries.set_all(0)
    Barwall.mark(boundaries, 1)
    Topwall.mark(boundaries, 2)

Then the displacement contour is:
image

@keiyamamo
Copy link
Collaborator

Hi @zhangmuElias

Thank you for supplying the code!
I can see that the top and right boundary cannot be marked for some reason. As you said, I tested the bottom and it worked fine, so there seems to be something wrong with the top and right boundary. Although it is not immediately clear for me if it comes from the original mesh or the way we try to define the boundary...

In fact, the original csm mesh is not actually rectangular (left boundary is curved), but if you only need rectangular domain, I would suggest to use RectangleMesh. If not, I can further try to identify why top and right are not working, so please let me know.

@zhangmuElias
Copy link
Author

Dear @keiyamamo
Thank you, RectangleMesh will fit my need for now. I am just testing my code. You don't need to change now. (^_^)
I think it is not an important problem since it goes well for the left fixed condition. And users will use their own mesh files when they solve their own projects.

@jorgensd
Copy link
Collaborator

jorgensd commented May 7, 2023

This is down to the numerical accuracy of the mesh.
i.e. this can be reproduced with:

from dolfin import *

mesh = Mesh("TF_cfd.xml.gz")
R = 0.05       # Radius of the circle
c_x = 0.2       # Center of the circle x-direction
c_y = 0.2       # Center of the circle y-direction
mesh = refine(mesh)
Barwall = AutoSubDomain(lambda x: (
    (x[0] - c_x)**2 + (x[1] - c_y)**2 < R**2 + DOLFIN_EPS * 1e8))


def Down(x, on_boundary):
    return near(x[1], 0.19) and on_boundary


def Up(x, on_boundary):
    return near(x[1], 0.21, DOLFIN_EPS) and on_boundary


def Right(x, on_boundary):
    return near(x[0], 0.60) and on_boundary


Downwall = AutoSubDomain(Down)
Upwall = AutoSubDomain(Up)
Rightwall = AutoSubDomain(Right)

boundaries = MeshFunction("size_t", mesh, mesh.geometry().dim() - 1)
boundaries.set_all(0)
#Barwall.mark(boundaries, 1)
#Downwall.mark(boundaries, 2)
Upwall.mark(boundaries, 3)
#Rightwall.mark(boundaries, 4)


File("facet_function.pvd") << boundaries

if you change

def Up(x, on_boundary):
    return near(x[1], 0.21, DOLFIN_EPS) and on_boundary

to

def Up(x, on_boundary):
    return near(x[1], 0.21, 1e8*DOLFIN_EPS) and on_boundary

the boundary will be marked correctly.

Similarly, you should use tolerances for the other near operators

Barwall = AutoSubDomain(lambda x: (
    (x[0] - c_x)**2 + (x[1] - c_y)**2 < R**2 + DOLFIN_EPS * 1e8))


def Down(x, on_boundary):
    return near(x[1], 0.19, DOLFIN_EPS*1e8) and on_boundary


def Up(x, on_boundary):
    return near(x[1], 0.21, DOLFIN_EPS*1e8) and on_boundary


def Right(x, on_boundary):
    return near(x[0], 0.60, DOLFIN_EPS*1e8) and on_boundary

@jorgensd jorgensd closed this as completed May 7, 2023
@zhangmuElias
Copy link
Author

Dear @jorgensd

Thank you! I see!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants