自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Clatterrr

谷粒牛奶好好喝

  • 博客(39)
  • 收藏
  • 关注

原创 三维转动惯量

三维转动惯量首先角速度(angular momentum)如下其中r是点到中心的距离,v是它的线速度速度可用下面求得那么代回角动量方程得到第一项是零,为什么?只剩下第二项为了将叉乘化为矩阵乘法,需要有如下变化那么也就是其中转动惯量,也就是inertia tensor或者inertia of momentum为...

2021-10-13 21:45:10 931

原创 cmake 找不到包

if(MSVC) include_directories(D:/FluidSim/cppsystem/freeglut-3.2.1)include_directories(D:/FluidSim/cppsystem/freeglut-3.2.1/FreeGLUT)include_directories(D:/FluidSim/cppsystem/freeglut-3.2.1/include)set (CMAKE_MODULE_PATH "D:/FluidSim/cpps.

2021-07-03 21:45:12 366

原创 图片合成视频python

import osimport cv2import time# 图片合成视频def picvideo(png_path, size, fps, avi_fn): # path: png file path filelist = os.listdir(png_path) # get all files in the path fourcc = cv2.VideoWriter_fourcc('I', '4', '2', '0') # 不同视频编码对应不同视频格式(例:'I

2020-12-20 09:24:10 174 1

原创 unity的ComputeShader

using System.Collections;using System.Collections.Generic;using UnityEngine;public class ComputeManager : MonoBehaviour{ public Texture2D inputTexture; private RenderTexture ART; private RenderTexture huvRT; public ComputeShader Ini.

2020-12-02 17:56:22 163

原创 2020-10-11

现在不能理解的是,貌似CFL越高越好,以及为什么加了二阶反而跌的更快。Numerical diffffusion illustrated in semi-Lagrangian advection of a triangular signal transported at constant velocity. From top to bottom, we see the initial signal, after one time step, after ten tim...

2020-10-14 22:22:53 142

原创 1d wave equation with term

https://www.youtube.com/watch?v=MqlDQzw3x6QLab12_1: Wave Equation 1DLx = 10;dx = 0.1;nx = fix(Lx/dx);x = linespace(0,Lx,nx);T = 20;%Timewn = zeros(nx,1);wnm1 = wn; % at time n - 1wnp1 = wn; % at time n + 1CFL = 1; %CFL = c.dt/dxc = 1;dt =.

2020-10-09 23:33:41 240

原创 2020-10-09

https://nbviewer.jupyter.org/github/barbagroup/CFDPython/blob/master/lessons/01_Step_1.ipynbhttps://nbviewer.jupyter.org/github/barbagroup/CFDPython/blob/master/lessons/02_Step_2.ipynbhttps://www.azimuthproject.org/azimuth/show/Burgers%27+equation

2020-10-09 22:06:14 123

原创 Matlab program with the Crank-Nicholson method

Matlab program with the Crank-Nicholson method for the diffusion equationhttps://www.youtube.com/watch?v=HiCdEG7uw7E%Heat diffusion in one dimension wire within%Parameters to define the heat equationcond = 1/2; % Heat conductivity parameterL = 1

2020-10-04 13:07:19 425 1

原创 Matlab program with the explicit Lax method

https://www.youtube.com/watch?v=ONDp4Rdj0OYMatlab program with the explicit Lax method for the advection equation%Square-wave test for the lax method to solve the advection equationclear;%Parameters needed to Implement the advection Lmax = 1.0; ..

2020-10-04 12:10:57 190

原创 【名词一】Vortex和Vorticity和Circulation和Kelvin‘s circulation theorem

看一个简单的2D平面流,V就是速度,只有X,Y方向的,但是这个流会旋转,所以vorticity在x,y方向为0,绕Z轴旋转,所以W的Z分量不为0。V * W = 0,很容易理解。http://web.mit.edu/fluids-modules/www/potential_flows/LecturesHTML/lec07/kelvintheoproof/kelvintheoproof.htmlKelvin's theorem of ...

2020-10-04 11:31:09 541

原创 ME 702 - Computational Fluid Dynamics学习笔记(二)

Video Lesson 9注意dt = c/dx。后面的展开的泰勒级数就是错误的来源。所以修改后upwindVideo Lesson 12还有个NS cavity flow的东西没看明白Video Lesson 13Leapfrog integration

2020-10-03 23:44:23 382

原创 ME 702 - Computational Fluid Dynamics学习笔记(一)

Video Lesson 4Video Lesson 5Video Lesson 6Video Lesson 7对于如下方程如果使用Central Condition,如下面的代码:就会blow up使用BD,注释掉CD,这稳定

2020-10-03 23:08:30 261

原创 高级C++

https://www.youtube.com/watch?v=dj8zvTTXbnY&list=PL6tEaVUU83w2__ngt9Ier5vAM1b9ZJgQi动态映射如下,静态映射在编译时映射,它不会检查映射合不合理。不过下面这段代码还没什么问题Rabbit rabbit;Animal *bunny = &rabbit;Rabbit *rab = static_cast<Rabbit>*(bunny);下面这段代码就错了,但静态编译检查不出这样的问.

2020-10-03 21:42:43 154

原创 LBM with Computer Codes第五章学习笔记

从第五章才开始有代码,而且代码在书最后,看起来有点麻烦一维扩散方程为如下形式那个可以是任何需要求解的东西,比如温度,压力。a对温度来说就是热传递参数,对动量传输来说就是动力学粘度。可以看到对于时间t只有一阶导,因为待求解的东西只取决于之前的时间。比如墨水在清水中扩散,某个点是否会有墨水,在空间上来说可能和这个点的上方和下方是否有墨水有关,但在时间上只与这个时间之前是否有墨水有关,而不可能取决于未来是否有墨水。比如正宗的热传递方程这时候a就等于 k / pC,于是简化为写成机器

2020-10-03 15:42:07 446

原创 Elementary Computational Fluid Dynamics Using Finite-Difference Methods阅读笔记

作者最简单的一阶方程使用有限差分法得出下一个时间n+1在方格i上的数值泊松方程p是一个标量,比如说压力。b是一个源,或者说是b的初始分布函数然后记住二阶导长这样转换方程,写成机器能看懂的形式最终得到The Navier-Stokes Equations 首先是这鬼东西,这里忽略了重力写成人能看懂的东西上面这坨太复杂不好算,所以第一行对x求导,第二行对y求导相加,然后利用du/dx + dv/dy = 0得到如下结

2020-10-03 11:51:44 137

原创 Solving the Heat Diffusion Equation (1D PDE) in Python

Solving the Heat Diffusion Equation (1D PDE) in Pythonhttps://www.youtube.com/watch?v=6-2Wzs0sXd8import numpy as npimport matplotlib.pyplot as pltL = 0.1 #Grosor de la pared en metrosn = 10 #Numero de nodos utilizados T0 = 20 #Temperat

2020-10-03 10:27:10 347 1

原创 2D热传输方程使用matlab

%2D Heat Transfer using Matlab%https://www.youtube.com/watch?v=x47QZxVF1gYn = 4;w = 3;h = 3;x = linespace(0,w,n);y = linespace(0,h,n);% create an array from 1 to 10 with 5 values %values = linspace(1, 10, 5) %ans = 1.0000 3.2500 5.5...

2020-10-02 23:57:59 645

原创 MATLAB解拉普拉斯方程

#https://www.youtube.com/watch?v=PE7oiOq_xig#MATLAB code for solving Laplace's equation using the Jacobi methodclear clcNx = 5;Ny = 4; % nodes number in y directionntol = 1d - 6; %tolerencek = 0; % iteration c..

2020-09-27 22:51:07 3515

原创 失败的UnityRayMarchShader

此后这个博客专门用于做失败记录了哈哈哈https://www.youtube.com/watch?v=82iBWIycU0o&list=PL3POsQzaCw53iK_EhOYR39h1J9Lvg-m-g&index=2using System.Collections;using System.Collections.Generic;using UnityEngine;[RequireComponent(typeof(Camera))][ExecuteInEditMode

2020-09-23 13:06:37 155

原创 记录一个DX11创建缓存时的pad

D3D11_BUFFER_DESC ccbbd; ZeroMemory(&ccbbd, sizeof(D3D11_BUFFER_DESC)); ccbbd.Usage = D3D11_USAGE_DEFAULT; ccbbd.ByteWidth = sizeof(SecondStruct); ccbbd.BindFlags = D3D11_BIND_CONSTANT_BUFFER; ccbbd.CPUAccessFlags = 0; ccb...

2020-09-15 23:28:23 155

原创 关于directx的报错‘main‘: entrypoint not found如何解决这件事

困扰了我一些天,网上的方法就是说把改入口点的名字,然而毫无用处,因为根本visual studio根本就不需要编译hlsl文件。所以只需要将hlsl文件从项目中移除就行了,以后改hlsl直接用记事本改。其它的有关fxc.exe的错误我猜也是这个原因。附上自己在stackoverflow的回答https://stackoverflow.com/questions/47006402/x3501-main-entrypoint-not-found/63871216#63871216...

2020-09-13 21:18:53 1263

原创 opengl画一个简单窗口

#include <GL/glew.h>#include <GL/wglew.h>#include <GL/freeglut.h>#include <vector>#include <glm/glm.hpp>#include <glm/gtc/matrix_transform.hpp> //for matrices#include <glm/gtc/type_ptr.hpp>#include <cti.

2020-09-12 22:53:06 150

原创 Unity未完成的布料模拟

// qu.cpp : This file contains the 'main' function. Program execution begins and ends there.//#include <stdio.h>#include <stdlib.h>#include <vector>#define STB_IMAGE_IMPLEMENTATION#include "stb_image.h"#define STB_IMAGE_WRITE_IMPL.

2020-09-06 17:13:49 180

原创 重启d3d11篇02_初始化d3d11

参考https://www.braynzarsoft.net/viewtutorial/q16390-3-initializing-direct3d-11背景颜色那里有问题,改了一下表达方式 const float bgColor[] = {red, green, blue, 1.0f}; sp_context->ClearRenderTargetView(sp_rtv, bgColor);效果就是背景颜色一直在变化代码如下:#pragma com...

2020-08-28 08:44:07 289

原创 重启dx11系列01_win32窗口创建

决定重新扎扎实实从头开始学一遍dx。参考https://www.braynzarsoft.net/viewtutorial/q16390-directx-11-an-introduction-to-the-win32-api新建空项目,最后报错说未解析的外部符号,解决方法代码如下#include <Windows.h>LPCTSTR WndClassName = L"firstwindow";HWND hwnd = NULL;const int Width = 8

2020-08-28 08:10:01 139

原创 Unity程序化地形p2

MeshGeneratorpublic static MeshData GenerateTerrainMesh(float[,] heightMap,float heightMultiplier,AnimationCurve heightCurve)...meshData.vertices[vertexIndex] = new Vector3(x + topLeftX,heightCurve.Evaluate(heightMap[x, y]) * heightMultiplier, topL

2020-08-11 12:22:57 375

原创 Unity程序化地形p1

新建一个noise.cs文件,代码如下:using System.Collections;using System.Collections.Generic;using UnityEngine;public static class Noise { public static float[,] GenerateNoiseMap(int mapWidth,int mapHeight,float scale) { float[,] noiseMap = new fl

2020-08-11 10:25:11 405 1

原创 Unity未完成的光滑粒子SPH

尝试写SPH,失败了,一开始就爆炸,推测原因是参数太大或太小,不过还是代码奉上using System.Collections;using System.Collections.Generic;using UnityEngine;public class Manager : MonoBehaviour{ // Start is called before the first frame update public GameObject prefab; pr

2020-08-06 19:18:43 426 2

原创 c++绘制png图片

#include "svpng.inc"//用于绘制png#include "Fucker.h"//万能头文件const int width = 256, height = 256;unsigned char rgba[width * height * 4];void Pixel(int x, int y, int r, int g, int b, int a){ int idx = (y * width + x)*4; rgba[idx++] = r; rgba[i.

2020-08-03 22:10:52 3240 1

原创 虚幻4创建纹理资产

// Fill out your copyright notice in the Description page of Project Settings.#include "Yu.h"#include "Engine\Texture2D.h"#include "UObject\Package.h"#include "AssetRegistryModule.h"// Sets default valuesAYu::AYu(){ // Set this actor to call Ti.

2020-07-11 21:58:30 1267

原创 虚幻4简易RayMarch

float4 Col = 0;float3 pos = WorldPosition;float3 Normal = 0;for(int i = 0;i<MaxSteps;i++){ if(SceneDepth < length(pos - CameraPosition)) break; float distance = length(pos - ObjectPosition) - 50; if(distance < 0.01) { Co.

2020-07-08 10:14:26 201

原创 【DX12龙书】第四五六章笔记

COM我们可以把Component Object Model (COM)当作一个接口,或是当作一个C++类使用。COM是会记录被引用的数量的,当我们不再需要一个COM物体的时候,我们需要释放它,因为所有COM接口都继承自IUnknown COM,而后者提供了释放函数。我们需要释放它而不是删除它,COM物体将会再它们的引用数量到0的时候自动释放。为了帮助管理COM物体的生命周期, the Windows Runtime Library (WRL) provides the Microsoft::WRL

2020-06-27 16:02:58 442

原创 【学习DirectX12(6)】渲染——第三部分

Tutorial2::Tutorial2Tutorial2的构造类需要几个参数。Tutorial2::Tutorial2( const std::wstring& name, int width, int height, bool vSync ): super(name, width, height, vSync), m_ScissorRect(CD3DX12_RECT(0, 0, LONG_MAX, LONG_MAX)), m_Viewport(CD3DX1...

2020-06-27 10:46:17 693

原创 【学习DirectX12(5)】渲染——第二部分

COMMANDQUEUE::GETCOMMANDLISTGetCommandList可以返回一个指令集并直接用于发布GPU绘制or dispatch指令。这个指令集一开始就处在记录状态所有开发者无需重设它就可以直接使用它。但指令集需要一个指令分配器与之相关联。但是指令集又没有直接的方法去查询究竟应该是哪个指令分配器,所以一开始创建的时候就必须指定一个未经使用的指令分配器。但只要这个指令分配器不在当前这个指令队列上工作,那么这个指令分配器就可以立马重用。Microsoft::WRL::Com...

2020-06-26 21:48:38 428

原创 【学习DirectX12】渲染——第一节

Introduction在DirectX 12里面,用于描述资源的唯一接口是ID3D12Resource。ID3D12Heap接口允许不同的内存映射技术,用于优化GPU内存。为了在DX12里更好地状态管理,使用pipeline state object(PSO)来描述不同的渲染和计算管线。也就是PSO结合了渲染管线中的input assembly(IA),vertex shader(VS),hull shader(HS),domain shader(DS),geometry shade...

2020-06-26 20:05:51 1432

原创 【学习DirectX12(3)】初始化——第三部分

【注:我把所有的command list翻译成指令列表,而command queue翻译成指令队列,command allocator翻译成指令分配器】创建 Descriptor Heapdescriptor heap可以被认为是resource views数组。在DX12中,在resource view创建之前 (such asRender Target Views(RTV),Shader Resource Views(SRV),Unordered Access Views(UA...

2020-06-23 15:12:09 1176

原创 今天之

天贪心算法HDU1009,给数组排序并反复用到最大那个值我用的是先找出最大值,获得索引,将其赋为0,然后继续找可别人一下双层嵌套完了,我想复杂了for (i = 0; i &lt; (n-1); i++) { for (j = 0; j &lt; (n-1-i); j++) { if (tr[j].k &lt; tr[j+1].k) {...

2020-06-23 10:06:25 72

原创 【学习DirectX12(2)】初始化——第二部分

解析 Command-line 参数当应用程序执行的时候,ParseCommandLineArguments函数可以使用命令行参数来重载一些全局定义的变量。void ParseCommandLineArguments(){ int argc; wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); for (size_t i = 0; i < argc; ++i) {

2020-06-22 23:13:22 1085

原创 【学习DirectX12(1)】初始化——第一部分

https://www.3dgep.com/learning-directx-12-1DX12是DirectX11 SDK的继任者。DirectX12相比于11作了很多改进,比如在11中的资源管理中,驱动必须持续追踪被渲染管线使用的资源的生命周期,但这在很多时候都是不必要的,于是DX12中将这部分交给了程序开发者来实现他们所需要的资源管理方式。DirectX 12 组件DirectX SDK事实上是一些了API的合集。其中用于硬件加速3D图形渲染的是Direct3D。其余的包括Direct2D,

2020-06-22 21:36:20 839

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除