|
[Sponsors] |
Pressure solver in Matlab using the code developed by Benjamin Seibold |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 26, 2015, 03:42 |
Pressure solver in Matlab using the code developed by Benjamin Seibold
|
#1 |
New Member
|
I am trying to check different pressure solvers and have better understanding.
Interestingly, when I replace codes I do not get correct results. Original code for pressure: Code:
Lp = kron(speye(ny),K1(nx,hx,1))+kron(K1(ny,hy,1),speye(nx)); Lp(1,1) = 3/2*Lp(1,1); perp = symamd(Lp); Rp = chol(Lp(perp,perp)); Rpt = Rp'; rhs = reshape(diff([uW;U;uE])/hx+diff([vS' V vN']')'/hy,[],1); p(perp) = -Rp\(Rpt\rhs(perp)); P = reshape(p,nx,ny); Code:
Lp = kron(speye(ny),K1(nx,hx,1))+kron(K1(ny,hy,1),speye(nx)); Lp(1,1) = 3/2*Lp(1,1); perp = symamd(Lp); Rp = chol(Lp(perp,perp)); Rpt = Rp'; rhs = reshape(diff([uW;U;uE])/hx+diff([vS' V vN']')'/hy,[],1); % p(perp) = -Rp\(Rpt\rhs(perp)); p= Lp\rhs; P = reshape(p,nx,ny); Code:
Lp = kron(speye(ny),K1(nx,hx,1))+kron(K1(ny,hy,1),speye(nx)); Lp(1,1) = 3/2*Lp(1,1); perp = symamd(Lp); Rp = chol(Lp(perp,perp)); Rpt = Rp'; rhs = reshape(diff([uW;U;uE])/hx+diff([vS' V vN']')'/hy,[],1); % p(perp) = -Rp\(Rpt\rhs(perp)); [p,flagCG,relresCG,iterCG,rCG] = pcg(Lp,rhs,1e-06,10000); P = reshape(p,nx,ny); What is missing here? Any advise would be appreciated. Cheers, |
|
September 26, 2015, 04:33 |
Answer:
|
#2 |
New Member
|
There was a small mistake:
Code:
Lp = kron(speye(ny),K1(nx,hx,1))+kron(K1(ny,hy,1),speye(nx)); Lp(1,1) = 3/2*Lp(1,1); perp = symamd(Lp); Rp = chol(Lp(perp,perp)); Rpt = Rp'; rhs = reshape(diff([uW;U;uE])/hx+diff([vS' V vN']')'/hy,[],1); % p(perp) = -Rp\(Rpt\rhs(perp)); [p,flagCG,relresCG,iterCG,rCG] = pcg(Lp,rhs,1e-06,10000); P = reshape(p,nx,ny); P=-P; |
|
Tags |
matlab coding, pressure solver |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Issues on the simulation of high-speed compressible flow within turbomachinery | dowlee | OpenFOAM Running, Solving & CFD | 11 | August 6, 2021 07:40 |
static vs. total pressure | auf dem feld | FLUENT | 17 | February 26, 2016 14:04 |
sonicFoam - pressure driven pipe: flow continuity violation and waveTransmissive BC | Endel | OpenFOAM Running, Solving & CFD | 3 | September 11, 2014 17:29 |
The correction on pressure equation of SIMPLE algorithm in MRFSimpleFOAM solver | renyun0511 | OpenFOAM Running, Solving & CFD | 0 | November 10, 2010 02:47 |
Reading forces within solver code | SD@TUB | OpenFOAM Running, Solving & CFD | 0 | February 28, 2010 19:39 |