|
[Sponsors] |
[Gmsh] solving a matrix 2x2 inside the geo file! |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 16, 2017, 01:34 |
solving a matrix 2x2 inside the geo file!
|
#1 |
Member
OpenFoam
Join Date: Jun 2016
Posts: 82
Rep Power: 9 |
Hello All,
I am working on a small problem in the geo file, which involves solving a matrix 2x2 to fit a polynomial. I was wondering if there is any way to do that. I have created the following code in Matlab and I want to do the same in the geo file Code:
clear all;clc;close all R = 0.509515; % m R1 = 0.559467; % m R2 = 0.579594; % m L = 0; L1 = -0.08568; L2 = 0.13974; hold on plot([L L1 L2],[R R1 R2],'k.') y = [R1-R;R2-R]; x = [L1^2 L1;L2^2 L2]; c = x\y; x1 = linspace(-0.08568,0.13974,20); for ii = 1:length(x1) y(ii) = c(1)*x1(ii)^2+c(2)*x1(ii)+R; end plot(x1,y) |
|
June 17, 2017, 02:04 |
|
#2 |
Member
OpenFoam
Join Date: Jun 2016
Posts: 82
Rep Power: 9 |
Can I for instance call a Matlab script through the .geo file in order to get the coefficients c1 and c2 that will be used in the geo file?
Thanks, |
|
June 17, 2017, 06:44 |
|
#3 |
Senior Member
|
||
June 17, 2017, 17:27 |
|
#4 | |
Member
OpenFoam
Join Date: Jun 2016
Posts: 82
Rep Power: 9 |
Quote:
Why not, your formula works perfect. That's what I need for now. Many thanks for the formula, |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] funkyDoCalc with OF2.3 massflow | NiFl | OpenFOAM Community Contributions | 14 | November 25, 2020 03:30 |
chtMultiRegionSimpleFoam turbulent case | Aditya Patil | OpenFOAM Running, Solving & CFD | 6 | April 24, 2017 22:13 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 06:20 |
[swak4Foam] build problem swak4Foam OF 2.2.0 | mcathela | OpenFOAM Community Contributions | 14 | April 23, 2013 13:59 |
pisoFoam with k-epsilon turb blows up - Some questions | Heroic | OpenFOAM Running, Solving & CFD | 26 | December 17, 2012 03:34 |