CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Pressure solver in Matlab using the code developed by Benjamin Seibold

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 26, 2015, 02:42
Question Pressure solver in Matlab using the code developed by Benjamin Seibold
  #1
New Member
 
Mehdi
Join Date: Aug 2013
Location: Australia
Posts: 22
Rep Power: 12
mahdi_kh8 is on a distinguished road
Send a message via Yahoo to mahdi_kh8
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);
Edited code:

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);
or

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);
None of the above changes work.

What is missing here?

Any advise would be appreciated.

Cheers,
mahdi_kh8 is offline   Reply With Quote

Old   September 26, 2015, 03:33
Smile Answer:
  #2
New Member
 
Mehdi
Join Date: Aug 2013
Location: Australia
Posts: 22
Rep Power: 12
mahdi_kh8 is on a distinguished road
Send a message via Yahoo to mahdi_kh8
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;
mahdi_kh8 is offline   Reply With Quote

Reply

Tags
matlab coding, pressure solver


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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 06:40
static vs. total pressure auf dem feld FLUENT 17 February 26, 2016 13:04
sonicFoam - pressure driven pipe: flow continuity violation and waveTransmissive BC Endel OpenFOAM Running, Solving & CFD 3 September 11, 2014 16:29
The correction on pressure equation of SIMPLE algorithm in MRFSimpleFOAM solver renyun0511 OpenFOAM Running, Solving & CFD 0 November 10, 2010 01:47
Reading forces within solver code SD@TUB OpenFOAM Running, Solving & CFD 0 February 28, 2010 18:39


All times are GMT -4. The time now is 11:43.