Coder Social home page Coder Social logo

aerofuse.jl's Introduction

I'm an unguided missile.

aerofuse.jl's People

Contributors

github-actions[bot] avatar godotmisogi avatar jamesmshihua avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aerofuse.jl's Issues

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Strange floating point precision error

I was trying to calculate the lift coefficient of a NACA4412 airfoil and I encountered the following error:

foil = naca4((4,4,1,2), 70)
uniform = Uniform2D(1.0, 4.0)
system = solve_case(
    foil,
    uniform
)
cl = lift_coefficient(system)
ERROR: BoundsError: attempt to access 69-element extrapolate(interpolate((view(::Matrix{Float64}, :, 1),), ::Vector{Float64}, Gridded(Linear())), Throw()) with element type Float64 at index [-0.000268420185446816]
Stacktrace:
  [1] throw_boundserror(A::Interpolations.Extrapolation{Float64, 1, Interpolations.GriddedInterpolation{Float64, 1, Vector{Float64}, Interpolations.Gridded{Interpolations.Linear{Interpolations.Throw{Interpolations.OnGrid}}}, Tuple{SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}}}, Interpolations.Gridded{Interpolations.Linear{Interpolations.Throw{Interpolations.OnGrid}}}, Interpolations.Throw{Nothing}}, I::Tuple{Float64})
    @ Base ./abstractarray.jl:691
  [2] inbounds_index
    @ ~/.julia/packages/Interpolations/Sxe87/src/extrapolation/extrapolation.jl:111 [inlined]
  [3] inbounds_position
    @ ~/.julia/packages/Interpolations/Sxe87/src/extrapolation/extrapolation.jl:102 [inlined]
  [4] Extrapolation
    @ ~/.julia/packages/Interpolations/Sxe87/src/extrapolation/extrapolation.jl:48 [inlined]
  [5] _broadcast_getindex_evalf
    @ ./broadcast.jl:670 [inlined]
  [6] _broadcast_getindex
    @ ./broadcast.jl:643 [inlined]
  [7] getindex
    @ ./broadcast.jl:597 [inlined]
  [8] macro expansion
    @ ./broadcast.jl:961 [inlined]
  [9] macro expansion
    @ ./simdloop.jl:77 [inlined]
 [10] copyto!
    @ ./broadcast.jl:960 [inlined]
 [11] copyto!
    @ ./broadcast.jl:913 [inlined]
 [12] copy
    @ ./broadcast.jl:885 [inlined]
 [13] materialize
    @ ./broadcast.jl:860 [inlined]
 [14] interpolate(foil::Foil{Float64}, xs::Vector{Float64})
    @ AeroFuse.AircraftGeometry ~/.julia/packages/AeroFuse/dwOGa/src/Geometry/AircraftGeometry/Foils/foil.jl:76
 [15] cosine_interpolation
    @ ~/.julia/packages/AeroFuse/dwOGa/src/Geometry/AircraftGeometry/Foils/foil.jl:125 [inlined]
 [16] make_panels(foil::Foil{Float64}, n::Int64)
    @ AeroFuse.AircraftGeometry ~/.julia/packages/AeroFuse/dwOGa/src/Geometry/AircraftGeometry/Foils/foil.jl:149
 [17] #solve_case#7
    @ ~/.julia/packages/AeroFuse/dwOGa/src/Aerodynamics/Cases/foil_cases.jl:10 [inlined]
 [18] solve_case(foil::Foil{Float64}, freestream::Uniform2D{Float64})
    @ AeroFuse ~/.julia/packages/AeroFuse/dwOGa/src/Aerodynamics/Cases/foil_cases.jl:10
 [19] top-level scope
    @ REPL[4]:1

Strangely, this error only occurs for specific values of n:

foil = naca4((4,4,1,2), n) # fails if n = 69, 70, 72, 73 but works if n = 67, 68, 71, 74

Looking through the code, I suspect that when it is calculating the cosine interpolation,

cosine_spacing(x_center, diameter, n :: Integer = 40) = @. x_center + (diameter / 2) * cos(-π/(n-1):0)

x_circ = cosine_spacing((x_min + x_max) / 2, x_max - x_min, n)
interpolate(foil, x_circ)

the resulting minima of the interpolated values can sometimes be lower than the minima of the input values, causing interpolate to fail due to it being out of bounds.
Maybe change it to the following to avoid the loss of precision?

cosine_spacing(x_start, x_end, n :: Integer = 40) = @. max(x_start + (x_end - x_start) * (cos(-π/(n-1):0)+1)/2, x_end)
# ...
x_circ = cosine_spacing(x_min, x_max, n)

Thanks!

Incorrect results in doublet-source panel method example case.

When I ran the case codes, I got that:
julia> begin airfoil = naca4((2,4,1,2)); foil = Foil(airfoil); V, α = 1.0, 3.0; uniform = Uniform2D(V, α); cl, cls, cms, cps, panels = solve_case(foil, uniform; num_panels = 80); end;cl -0.06478979281472284

as the result of NACA2412 is around 0.608250
# result from XFoil when alpha = 3.0 deg and re = 1e5 and mach = 0.0 is 0.608250 ? where is the error?

Importing Coordinates file and assigning new header name do not work

Describe the bug
The read_foil() function fail to assign new header name to the airfoil

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'read_airfoil()'
  2. Set 'header = true'
  3. Assign a value 'name = airfoil_test'
  4. See error

Expected behavior
I expected airfoil.name to give the newly assigned value.

Screenshots
image

Desktop (please complete the following information):

  • OS: macOs Monterey 12.2.1
  • Browser: Safari
  • Version: 12.2.1

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.