solving a matrix 2x2 inside the geo file!

 Register Blogs Members List Search Today's Posts Mark Forums Read

 June 16, 2017, 01:34 solving a matrix 2x2 inside the geo file! #1 Member   OpenFoam Join Date: Jun 2016 Posts: 82 Rep Power: 3 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) Many thanks,

 June 17, 2017, 02:04 #2 Member   OpenFoam Join Date: Jun 2016 Posts: 82 Rep Power: 3 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   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,734 Rep Power: 29 Hi, Why you cannot put this simple analytic solution into geo: But it you REALLY want to call Matlab, you can use SystemCall function to call Matlab script, and parse output. CFD-Lover likes this.

June 17, 2017, 17:27
#4
Member

OpenFoam
Join Date: Jun 2016
Posts: 82
Rep Power: 3
Quote:
 Originally Posted by alexeym Hi, Why you cannot put this simple analytic solution into geo: But it you REALLY want to call Matlab, you can use SystemCall function to call Matlab script, and parse output.
Hi Alexeym,

Why not, your formula works perfect. That's what I need for now.

Many thanks for the formula,

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Aditya Patil OpenFOAM Running, Solving & CFD 6 April 24, 2017 22:13 NiFl OpenFOAM 11 November 1, 2016 07:43 Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20 Heroic OpenFOAM Running, Solving & CFD 26 December 17, 2012 04:34 jakaranda OpenFOAM Installation 3 October 27, 2008 12:46

All times are GMT -4. The time now is 23:07.