Git Product home page Git Product logo

Comments (4)

simulkade avatar simulkade commented on July 16, 2024

Hi @SA8416 , let me investigate it and come back to you. Converting M to a dense matrix is not a memory-efficient fix. I will come back with a better solution.

from jfvm.jl.

simulkade avatar simulkade commented on July 16, 2024

I cannot reproduce this error with the master branch of JFVM and julia 1.8

using JFVM #, JFVMvis
function diff()
    Nx = 10
    Lx = 1.0
    m = createMesh1D(Nx, Lx)
    BC = createBC(m)
    BC.left.a[:].=BC.right.a[:].=0.0
    BC.left.b[:].=BC.right.b[:].=1.0
    BC.left.c[:].=1.0
    BC.right.c[:].=0.0
    c_init = 0.0 # initial value of the variable
    c_old = createCellVariable(m, 0.0, BC)
    D_val = 1.0 # value of the diffusion coefficient
    D_cell = createCellVariable(m, D_val) # assigned to cells
    # Harmonic average
    D_face = harmonicMean(D_cell)
    N_steps = 20 # number of time steps
    dt= sqrt(Lx^2/D_val)/N_steps # time step
    M_diff = diffusionTerm(D_face) # matrix of coefficient for diffusion term
    (M_bc, RHS_bc)=boundaryConditionTerm(BC) # matrix of coefficient and RHS for the BC
    for i =1:5
        (M_t, RHS_t)=transientTerm(c_old, dt, 1.0)
        M=M_t-M_diff+M_bc # add all the [sparse] matrices of coefficient
        RHS=RHS_bc+RHS_t # add all the RHS's together
        c_old = solveLinearPDE(m, M, RHS) # solve the PDE
    end
    return c_old
    #visualizeCells(c_old)
end

diff()

from jfvm.jl.

SA8416 avatar SA8416 commented on July 16, 2024

Strange, even after re-installing julia the error seems to persist- I have found a more memory-efficient workaround by using the LinearSolve.jl package instead of the julia "" solver.

from jfvm.jl.

simulkade avatar simulkade commented on July 16, 2024

a more memory-efficient workaround by using the LinearSolve.jl package

Very good idea. Let me know if it is faster too. I saw a talk about this package and it is nice to use it instead of the default Julia backslash solver.

from jfvm.jl.

Related Issues (11)

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.