基于 MacCormack 有限体积法实现维喷嘴设计

基于 MacCormack 有限体积法实现维喷嘴设计

维喷嘴是一种常见的喷嘴类型,广泛应用于航空航天、化工和燃烧等领域。在维喷嘴的设计过程中,数值模拟是一种有效的工具。本文将介绍如何基于 MacCormack 有限体积法实现维喷嘴设计,并提供相应的 MATLAB 代码。

在开始之前,我们需要了解一些背景知识。MacCormack 有限体积法是一种计算流体力学方法,用于求解一维守恒方程。它通过将空间离散化为有限体积单元,并应用守恒方程的积分形式,进行数值求解。这种方法被广泛用于气体动力学和喷流计算。

以下是基于 MacCormack 有限体积法实现维喷嘴设计的 MATLAB 代码:

% 定义参数
N = 100; % 离散化网格数
L = 1.0; % 维喷嘴长度
A_exit = 
亚声速-超声速等熵喷管拟一维流动的CFD解法(附完整代码) 入门CFD,主要参考书目《计算流体力学基础及其应用》(John D.Anderson著,吴颂平等译) 实现了第 7.3节亚声速-超声速等熵喷管流动的CFD解法的代码,采用的是MacCormack 方法。代码中增加了动态显示无量纲温度和无量纲密度的功能,参考的是python中plot实现即时数据动态显示方法,最终结果如下:图中红点代表喉口所在位置。 ... 阅读详情

相关推荐

激波管的matlab程序,matlab中用MacCormack法求解激波喷管问题

激波管两端封闭 内部充满气体 直管中有一薄膜将激波管隔开 在薄膜两侧充有均匀理想气体薄膜两侧气体的压力密度不同当t<0时 气体处于静止状态当t>=0时薄膜瞬时突然破裂气体从高压端冲向低压端控制方程有一维欧拉方程和理想气体方程:边界条件:初始条件:MacCormack两步差分迭代格式:人工黏性项:----------------------------------------------...

weixin_30222083的博客 2250

matlab 与 python 在科学计算中的区别比较

本文以求解拟一维喷管流动为例,比较两者在科学计算中的区别。 感受:matlab矩阵实验室在求解矩阵方面具有得天独厚的优势,尤其是在矩阵之间的运算方面、求解方程过程中,能够明显感觉到编程给人带来的快感,调试过程中实时显示运算结果是当今任何一款编程软件都无法比拟的。而近年来非常火的python,同样有其优势(可能在大数据处理,人工智能领域吧),在本次实验中表现差强人意(勉强使人满意)。 本次实验采用二...

qq_30285869的博客 1978

MacCormack方法详解:如何用有限差分法求解Navier-Stokes方程(含超声速流动案例)

本文详细解析了MacCormack方法在超声速流动模拟中的应用,通过有限差分法求解Navier-Stokes方程。文章从核心原理出发,结合超声速平板流动案例,展示了预测-校正机制的实现细节和关键技术,包括粘性应力计算、时间步长确定和变量更新策略。最后通过质量守恒检查和流场可视化验证了方法的可靠性,为CFD领域的研究者提供了实用参考。

weixin_29281941的博客 126

一维完全气体的Riemann问题求解

一维完全气体欧拉方程的引入 在这里我们将利用LF格式,MacCormack格式和Roe格式对一维完全气体欧拉方程进行数值求解。 {(ρρuE)t+(ρuρu2+pu(E+p))x=0,p=(γ−1)(E−12ρu2),γ=1.4.\left\{\begin{array}{c} \left(\begin{array}{c} \rho \\ \rho u \\ E \end{array}\right)_{t}+\left(\begin{array}{c} \rho u \\ \rho u^{2}+p \\ u(

forrestguang的博客 3344

基于MacCormack方法的拟一维拉法尔喷管流动数值模拟

为了便于数值处理,我们将上述三个方程合并成一个向量形式的守恒方程:其中:- $\mathbf{U}$ 为守恒变量向量$$\rho \\rho u \E$$$\mathbf{F}(\mathbf{U})$ 为对应的通量向量$$\rho u \u(E + p)$$此向量形式不仅简化了编程实现中的变量管理,也使得通用求解器设计成为可能。

weixin_42284380的博客 1268

计算流体matlab程序

采用laxwendroff格式,laxwendroff格式,lax格式,MacCormack格式等分别计算欧拉方程程序

MacCormack程序——Matlab版.rar_MacCormack matlab_MacCormack程序;_matlab

计算流体力学基础及其应用中的程序,是matlab版本的MacCormack程序

可压缩准一维管道无粘流动-欧拉方程-MacCormack.rar_channel flow _supersonic_亚网格_可压

本题利用一维欧拉方程求解可压缩一维无粘管道流动,并针对出口不同的条件,出口亚音速和出口超音速两种不同条件,将流道进行网格划分,利用MacCormack进行差分求解,得到管道内的总压、马赫数、总焓、内能的分布,并给出计算过程中残差收敛的过程。

拟一维喷管流动MacCormack法_CFD_拟一维喷管流动_

计算流体力学CFD中的拟一维喷管流动,使用MacCormack迭代

ArcMap 10.7/10.8启动加载界面后闪退?可能是这个隐藏的Normal.mxt模板文件在搞鬼

本文深入分析了ArcMap 10.7/10.8启动加载界面后闪退的问题,指出Normal.mxt模板文件损坏是常见原因。提供了从定位、删除模板文件到系统级修复的完整解决方案,帮助GIS工程师快速恢复工作流程。

weixin_28523493的博客 341

从透射谱到能量分布:用Rsoft破解光纤光栅耦合模式的3个关键技巧

本文面向光通信工程师与研究者,分享了利用Rsoft软件深入分析光纤光栅耦合模式的三个关键技巧。通过配置场监视器观察XY截面能量分布、利用传播动画追踪动态过程,并结合模式求解器精准判定相位匹配,帮助用户超越透射谱分析,直观可视化能量从纤芯到包层的耦合与流动,从而优化器件设计。

weixin_29290963的博客 424

ArcGIS小白必看:5分钟搞定面要素转点要素+自动计算经纬度坐标(附常见报错解决方案)

本文为ArcGIS新手详细解析了面要素转点要素并自动计算经纬度坐标的完整流程。核心在于正确理解和使用坐标系,并掌握ArcToolbox中的“要素转点”等工具。文章深入剖析了常见报错(如坐标系未定义、字段计算失败)的根源,提供了从基础操作到Python脚本自动化的实战解决方案,确保数据转换的准确与高效。

weixin_29284885的博客 588

本体(Ontology)概述

认识本体        本体(Ontology)的概念源自于哲学领域,在哲学中的定义为“对世界上客观事物的系统描述,即存在论”。哲学中的本体关心的是客观现实的抽象本质。而在计算机领域,本体可以在语义层次上描述知识,可以看成描述某个学科领域知识的一个通用概念模型。德国学者Studer在1998年给出了本体的相关定义“本体是共享概念模型的形式化规范说明”。这个定义包含了四层含义:即共享(share)...

baijinswpu的博客 7万+

YOLOv9改进策略【损失函数篇】| Slide Loss,解决简单样本和困难样本之间的不平衡问题

本文记录的是改进YOLOv9的损失函数,将其替换成Slide Loss,并详细说明了优化原因,注意事项等。Slide Loss函数可以有效地解决样本不平衡问题,为困难样本赋予更高的权重,使模型在训练过程中更加关注困难样本。若是在自己的数据集中发现容易样本的数量非常大,而困难样本相对稀疏,可尝试使用Slide Loss来提高模型在处理复杂样本时的性能。

Limiiiing的博客 2625

小梅哥Xilinx FPGA学习笔记11——亚稳态

亚稳态就是D触发器输入信号在其数据窗口期内发生变化,导致D触发器的输出进入一段时间的不稳定状态,有可能发生振荡,并最终随机稳定在高电平或者低电平。

m0_51430584的博客 636

GNN-图卷积模型-直推式-2016:GCN【消息传递(前向传播):聚合函数+更新函数】【聚合函数:mean(邻域所有节点取平均值)】【训练更新函数的参数】【空域+频域】【同质图】

图神经网络(GNN):GCN【开山之作】

u013250861的博客 2062

ubuntu20.04屏幕亮度无法调节(亮度条调节无效)的简单靠谱解决方案及踩坑历程

0 前言   网上关于ubuntu系统亮度无法调节的问题的解决方法有很多,但是绝大部分并没有什么用(这也是我自己的亲身体会),或者并不靠谱。在遍尝各路方法过后,我终于解决了这一棘手的问题(毕竟最大亮度真的非常刺眼,无法长时间直视),在此记录一下踩坑历程以及最后的解决方案。 1 Naive方法   由于使用需要,最近在电脑原有的win10基础上安装了ubuntu双系统。我安装的是当前新版的ubuntu20.04.2.0,靠谱的安装教程可以参考这里。   之前师兄说双ssd安装双系统会有系统启动引导的问题出现,

zeeq的博客 4万+

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: 基于共形能量最小化的维人类模型贴图算法MATLAB仿真
下一篇: 基于LK光流算法的视频图像序列抖动程度计算 MATLAB 仿真
普通网友
博客等级 码龄4年 1009粉丝 1545原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址