Category: Python

  • [Python] Unittest

    Introduction unittest is a built-in library in Python that is used for unit testing. It provides a way to test individual units of source code, such as functions or classes, to ensure they work as intended. It is based on the xUnit architecture and features a similar interface to other xUnit frameworks, such as JUnit…

  • [Python] Flask-Boostrap – Python based web development frameworks

    Introduction Flask-Bootstrap is a Flask extension that makes it easy to use Bootstrap with Flask. It provides a simple way to include Bootstrap in your Flask application by adding a few lines of code. Flask-Bootstrap provides a set of base templates and utilities that make it easy to include Bootstrap’s CSS and JavaScript in your…

  • [Linux] Linux commands : update-alternatives

    Introduction update-alternatives is a command-line utility in Linux that is used to manage alternative versions of packages. It is used to configure different versions of a package that can be installed on the system, and to switch between them. How to Use For example, there might be multiple versions of a package like Java or…

  • [Python] glob package : Search for Files with a Specific Name but You Don’t Know the File Extension

    If you want to search for files with a specific name (e.g. “example”), but you don’t know the file extension, you can use the glob module to search for files with a specific pattern. The glob module provides a function called glob() that can be used to search for files with a specific pattern in…

  • [Python] File find by os.path and pathlib

    using os.path There are several ways to check if a file exists in Python, one of the most common ways is using the os.path module, specifically the os.path.exists() function. The os.path.exists() function takes a file path as an argument and returns True if the file exists, and False if it does not. Here’s an example…

  • Pyvista

    Introduction PyVista is a 3D data visualization library for the Python programming language. It is built on top of the popular VTK library and provides a simple and intuitive interface for working with 3D data. PyVista allows users to create, manipulate, and visualize 3D data in a variety of formats, including STL, PLY, OBJ, VTK,…

  • NGSOLVE Tutorial (4) Static Condensation Part B. Inhomogeneous Dirichlet B.C and Automatic utility

    Inhomogeneous Dirichlet Boundary Conditions In case of inhomogeneous Dirichlet boundary conditions, we combine the technique of Dirichlet data extension with the above static condensation principle in the following code. The code you provided is solving a Poisson equation with a manufactured solution and then calculates the error between the manufactured solution and the numerical solution…

  • NGSOLVE Tutorial (4) Static Condensation Part A

    Descriptions Static condensation is a technique used in the solution of partial differential equations (PDEs) to reduce the size of the system to be solved. In the context of the ngsolve example, it likely refers to the use of static condensation to reduce the size of the system of equations being solved by the solver…

  • How to Use Geometry Generation Functions of GMSH by Python (1) Basics

    You can export Gmsh geometry in a Python environment by using the Python bindings that are provided with Gmsh. The process for doing this is as follows: Here is an example of a script that exports a 3D geometry to a .stl file: STL format is typically used for solid models. If you want to…

  • NGSolve Tutorials (3) Dirichlet Boundary Conditions Part C

    Solve for the free dofs¶ We need to assemble the right hand side of $A_{FF}u_{0,F}=f_F-\left[ Au_D \right]_F$, namely This code creates a linear form f, and it represents the left hand side of the weak form of a PDE. In this case, a constant function 1 is used as a forcing term and multiplied by…