Giter Site home page Giter Site logo

Comments (6)

jorgensd avatar jorgensd commented on August 28, 2024 2

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

from turtlefsi.

keiyamamo avatar keiyamamo commented on August 28, 2024 1

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.

from turtlefsi.

keiyamamo avatar keiyamamo commented on August 28, 2024

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.

from turtlefsi.

zhangmuElias avatar zhangmuElias commented on August 28, 2024

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

from turtlefsi.

zhangmuElias avatar zhangmuElias commented on August 28, 2024

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.

from turtlefsi.

zhangmuElias avatar zhangmuElias commented on August 28, 2024

Dear @jorgensd

Thank you! I see!

from turtlefsi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.