Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
4
Merge Requests
4
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
toolbox
Commits
77a8f886
Commit
77a8f886
authored
Aug 23, 2017
by
Markus Mueller-Trapet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use the amazing itaWaitbar, and other minor changes
parent
32bd1a66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
92 deletions
+63
-92
applications/Numeric/FluidFEM/particularS.m
applications/Numeric/FluidFEM/particularS.m
+11
-13
applications/Numeric/FluidFEM/sys_mat.m
applications/Numeric/FluidFEM/sys_mat.m
+52
-79
No files found.
applications/Numeric/FluidFEM/particularS.m
View file @
77a8f886
...
...
@@ -13,8 +13,8 @@ l_N = length(coord.ID); % number of nodes
dirichlet
=
zeros
(
length
(
groupMaterial
),
2
);
% checks if a pressure boundary condition exists
omega
=
2
*
pi
*
GUI
.
Freq
;
h
=
waitbar
(
0
,
'Particular: Pressure calculation is running...
'
);
tic
h
=
itaWaitbar
(
length
(
GUI
.
Freq
),
'Pressure calculation ...'
,
'Particular Solution
'
);
tic
%% Main
for
i1
=
1
:
length
(
GUI
.
Freq
)
% loop over all frequencies
% init admittancematrix and weightvector
...
...
@@ -43,7 +43,7 @@ for i1 = 1:length(GUI.Freq) % loop over all frequencies
if
nnz
(
dirichlet
)
==
0
&&
nnz
(
f
)
==
0
% neumann boundary condition
warning
(
'ModeSolve:: No excitation'
);
%#ok<*WNTAG>
p
=
zeros
(
length
(
f
),
i1
);
p
=
zeros
(
length
(
f
),
i1
);
elseif
nnz
(
dirichlet
(:,
1
))
~=
0
% dirichlet boundary condition
for
i4
=
1
:
nnz
(
dirichlet
(:,
1
))
if
i4
>
1
...
...
@@ -51,16 +51,16 @@ for i1 = 1:length(GUI.Freq) % loop over all frequencies
end
K
=
(
SysMat
.
S
-
(
omega
(
i1
)
.
/
fluid
.
c
)
^
2.
*
SysMat
.
M
+
1
j
*
omega
(
i1
)
*
fluid
.
rho
.*
A
);
p_unknownElem
=
zeros
(
length
(
coord
.
x
),
1
);
p_knownElem
=
unique
(
elements
{
2
}(
groupMaterial
{
dirichlet
(
i4
,
1
)}
.
ID
,:));
p_unknownElem
(
p_knownElem
)
=
[];
K_temp
=
K
;
l_knownElem
=
length
(
p_knownElem
);
K_temp
(
p_knownElem
,
p_knownElem
)
=
eye
(
l_knownElem
,
l_knownElem
);
K_temp
(
p_knownElem
,
p_unknownElem
)
=
zeros
(
length
(
p_knownElem
),
length
(
p_unknownElem
));
K_temp
(
p_unknownElem
,
p_knownElem
)
=
zeros
(
length
(
p_unknownElem
),
length
(
p_knownElem
));
p_const
=
sparse
(
1
,
length
(
coord
.
x
));
p_const
(
p_knownElem
)
=
dirichlet
(
i4
,
2
);
p_const
(
p_unknownElem
)
=
f
(
p_unknownElem
)
-
K
(
p_unknownElem
,
p_knownElem
)
*
p_const
(
p_knownElem
)
.'
;
...
...
@@ -68,17 +68,15 @@ for i1 = 1:length(GUI.Freq) % loop over all frequencies
p
=
K_temp
\
p_const
.'
;
end
else
% neumann boundary condition
p
(:,
i1
)
=
(
SysMat
.
S
-
(
omega
(
i1
)
.
/
fluid
.
c
)
^
2.
*
SysMat
.
M
+
1
j
.*
omega
(
i1
)
.*
fluid
.
rho
*
A
)\(
omega
(
i1
)
^
2.
*
fluid
.
rho
.*
f
);
end
waitbar
(
i1
/
length
(
GUI
.
Freq
)
);
h
.
inc
(
);
end
close
(
h
);
t
3
=
toc
;
t
=
toc
;
disp
(
'Time particular'
);
disp
(
'-------------------------------------------------------------------'
);
disp
([
'Total : '
num2str
(
t3
)]);
disp
(
' '
);
close
(
h
);
\ No newline at end of file
disp
([
'Total : '
num2str
(
t
)]);
disp
(
' '
);
\ No newline at end of file
applications/Numeric/FluidFEM/sys_mat.m
View file @
77a8f886
...
...
@@ -3,7 +3,7 @@ function [SystemMatrices]=sys_mat(coord, elements, groupMaterial)
% (coord), elements (elements) and groups with boundary conditions
% (groupMaterial) are needed. systemmatrices are stored in struct
% SystemMatrices.
% Currently systemmatrices can only created for
% Currently systemmatrices can only created for
% - surface parabolic triangle elements
% - surface parabolic quadrilateral elements
% - volume parabolic triangle elements
...
...
@@ -27,11 +27,11 @@ f=cell(length(groupMaterial),1);% weightvector
SurfElem
=
elements
{
2
};
VolumeElem
=
elements
{
1
};
h
=
waitbar
(
0
,
'Please wait, I integrate over all elements...'
);
n_nodes
=
size
(
VolumeElem
.
nodes
,
2
);
l_elem
=
size
(
VolumeElem
.
nodes
,
1
);
h
=
itaWaitbar
(
l_elem
,
'I am integrating over all elements ...'
,
'System Matrices'
);
%% tri
% - basisfunctions are adjusted for I*DEAS
if
n_nodes
==
10
||
n_nodes
==
4
...
...
@@ -46,26 +46,21 @@ if n_nodes==10 || n_nodes==4
case
'Acceleration'
,
rb
=
2
;
case
'Point Source'
,
rb
=
3
;
otherwise
,
rb
=
0
;
end
% create admittancematrix
if
rb
==
1
&&
(
length
(
groupMaterial
{
i1
}{
2
}
.
Value
)
>
1
||
groupMaterial
{
i1
}{
2
}
.
Value
(
end
)
~=
0
)
try
A
{
i1
}
=
sparse
(
l_N
,
l_N
);
if
n_nodes
==
10
for
i2
=
1
:
length
(
groupMaterial
{
i1
}{
1
}
.
ID
)
elem
=
groupMaterial
{
i1
}{
1
}
.
ID
(
i2
);
nodes
=
SurfElem
.
nodes
(
elem
,:);
coordT
=
coord
.
cart
(
nodes
,:);
A
{
i1
}
=
sur_tri_gauss_A
(
A
{
i1
},
coordT
,
nodes
);
end
func_handle
=
@
sur_tri_gauss_A
;
else
%linear elements
for
i2
=
1
:
length
(
groupMaterial
{
i1
}{
1
}
.
ID
)
elem
=
groupMaterial
{
i1
}{
1
}
.
ID
(
i2
);
nodes
=
SurfElem
.
nodes
(
elem
,:);
coordT
=
coord
.
cart
(
nodes
,:);
A
{
i1
}
=
sur_tri_gauss_A_lin
(
A
{
i1
},
coordT
,
nodes
);
end
func_handle
=
@
sur_tri_gauss_A_lin
;
end
for
i2
=
1
:
length
(
groupMaterial
{
i1
}{
1
}
.
ID
)
elem
=
groupMaterial
{
i1
}{
1
}
.
ID
(
i2
);
nodes
=
SurfElem
.
nodes
(
elem
,:);
coordT
=
coord
.
cart
(
nodes
,:);
A
{
i1
}
=
func_handle
(
A
{
i1
},
coordT
,
nodes
);
end
catch
close
(
h
);
...
...
@@ -74,22 +69,16 @@ if n_nodes==10 || n_nodes==4
elseif
rb
==
2
% create weightvector of surface elements
f
{
i1
}
=
sparse
(
l_N
,
1
);
if
n_nodes
==
10
for
i2
=
1
:
length
(
groupMaterial
{
i1
}{
1
}
.
ID
)
elem
=
groupMaterial
{
i1
}{
1
}
.
ID
(
i2
);
nodes
=
SurfElem
.
nodes
(
elem
,:);
coordT
=
coord
.
cart
(
nodes
,:);
f
{
i1
}
=
sur_tri_gauss_f
(
f
{
i1
},
coordT
,
nodes
);
end
func_handle
=
@
sur_tri_gauss_f
;
else
%linear elements
for
i2
=
1
:
length
(
groupMaterial
{
i1
}{
1
}
.
ID
)
elem
=
groupMaterial
{
i1
}{
1
}
.
ID
(
i2
);
nodes
=
SurfElem
.
nodes
(
elem
,:);
coordT
=
coord
.
cart
(
nodes
,:);
f
{
i1
}
=
sur_tri_gauss_f_lin
(
f
{
i1
},
coordT
,
nodes
);
end
func_handle
=
@
sur_tri_gauss_f_lin
;
end
for
i2
=
1
:
length
(
groupMaterial
{
i1
}{
1
}
.
ID
)
elem
=
groupMaterial
{
i1
}{
1
}
.
ID
(
i2
);
nodes
=
SurfElem
.
nodes
(
elem
,:);
coordT
=
coord
.
cart
(
nodes
,:);
f
{
i1
}
=
func_handle
(
f
{
i1
},
coordT
,
nodes
);
end
elseif
rb
==
3
% create weightvector of a point source
f
{
i1
}
=
sparse
(
l_N
,
1
);
f
{
i1
}(
groupMaterial
{
i1
}{
1
}
.
ID
)
=
1
;
...
...
@@ -102,19 +91,15 @@ if n_nodes==10 || n_nodes==4
% Volume elements: creates mass- and stiffnessmatrices
%--------------------------------------------------------------------------
if
n_nodes
==
10
for
i1
=
1
:
l_elem
nodes
=
VolumeElem
.
nodes
(
i1
,:);
coordT
=
coord
.
cart
(
nodes
,:);
[
M
S
]
=
vol_tri_gauss
(
M
,
S
,
coordT
,
nodes
);
waitbar
(
i1
/
l_elem
)
end
func_handle
=
@
vol_tri_gauss
;
else
%linear elements
for
i1
=
1
:
l_elem
nodes
=
VolumeElem
.
nodes
(
i1
,:);
coordT
=
coord
.
cart
(
nodes
,:);
[
M
S
]
=
vol_tri_gauss_lin
(
M
,
S
,
coordT
,
nodes
);
waitbar
(
i1
/
l_elem
)
end
func_handle
=
@
vol_tri_gauss_lin
;
end
for
i1
=
1
:
l_elem
nodes
=
VolumeElem
.
nodes
(
i1
,:);
coordT
=
coord
.
cart
(
nodes
,:);
[
M
,
S
]
=
func_handle
(
M
,
S
,
coordT
,
nodes
);
h
.
inc
();
end
%% hex
...
...
@@ -137,19 +122,15 @@ elseif n_nodes==20 || n_nodes==8
try
A
{
i1
}
=
sparse
(
l_N
,
l_N
);
if
n_nodes
==
20
for
i2
=
1
:
length
(
groupMaterial
{
i1
}{
1
}
.
ID
)
elem
=
groupMaterial
{
i1
}{
1
}
.
ID
(
i2
);
nodes
=
SurfElem
.
nodes
(
elem
,:);
coordT
=
coord
.
cart
(
nodes
,:);
A
{
i1
}
=
sur_hex_gauss_A
(
A
{
i1
},
coordT
,
nodes
);
end
func_handle
=
@
sur_hex_gauss_A
;
else
%linear elements
for
i2
=
1
:
length
(
groupMaterial
{
i1
}{
1
}
.
ID
)
elem
=
groupMaterial
{
i1
}{
1
}
.
ID
(
i2
);
nodes
=
SurfElem
.
nodes
(
elem
,:);
coordT
=
coord
.
cart
(
nodes
,:);
A
{
i1
}
=
sur_hex_gauss_A_lin
(
A
{
i1
},
coordT
,
nodes
);
end
func_handle
=
@
sur_hex_gauss_A_lin
;
end
for
i2
=
1
:
length
(
groupMaterial
{
i1
}{
1
}
.
ID
)
elem
=
groupMaterial
{
i1
}{
1
}
.
ID
(
i2
);
nodes
=
SurfElem
.
nodes
(
elem
,:);
coordT
=
coord
.
cart
(
nodes
,:);
A
{
i1
}
=
func_handle
(
A
{
i1
},
coordT
,
nodes
);
end
catch
close
(
h
);
...
...
@@ -159,19 +140,15 @@ elseif n_nodes==20 || n_nodes==8
% create weightvector of surface elements
f
{
i1
}
=
sparse
(
l_N
,
1
);
if
n_nodes
==
20
for
i2
=
1
:
length
(
groupMaterial
{
i1
}{
1
}
.
ID
)
elem
=
groupMaterial
{
i1
}{
1
}
.
ID
(
i2
);
nodes
=
SurfElem
.
nodes
(
elem
,:);
coordT
=
coord
.
cart
(
nodes
,:);
f
{
i1
}
=
sur_hex_gauss_f
(
f
{
i1
},
coordT
,
nodes
);
end
func_handle
=
@
sur_hex_gauss_f
;
else
%linear elements
for
i2
=
1
:
length
(
groupMaterial
{
i1
}{
1
}
.
ID
)
elem
=
groupMaterial
{
i1
}{
1
}
.
ID
(
i2
);
nodes
=
SurfElem
.
nodes
(
elem
,:);
coordT
=
coord
.
cart
(
nodes
,:);
f
{
i1
}
=
sur_hex_gauss_f_lin
(
f
{
i1
},
coordT
,
nodes
);
end
func_handle
=
@
sur_hex_gauss_f_lin
;
end
for
i2
=
1
:
length
(
groupMaterial
{
i1
}{
1
}
.
ID
)
elem
=
groupMaterial
{
i1
}{
1
}
.
ID
(
i2
);
nodes
=
SurfElem
.
nodes
(
elem
,:);
coordT
=
coord
.
cart
(
nodes
,:);
f
{
i1
}
=
func_handle
(
f
{
i1
},
coordT
,
nodes
);
end
elseif
rb
==
3
% create weightvector of point source
...
...
@@ -186,19 +163,15 @@ elseif n_nodes==20 || n_nodes==8
% Volume elements: creates mass- and stiffnessmatrices
%--------------------------------------------------------------------------
if
n_nodes
==
20
for
i1
=
1
:
l_elem
nodes
=
VolumeElem
.
nodes
(
i1
,:);
coordT
=
coord
.
cart
(
nodes
,:);
[
M
S
]
=
vol_hex_gauss
(
M
,
S
,
coordT
,
nodes
);
waitbar
(
i1
/
l_elem
)
end
func_handle
=
@
vol_hex_gauss
;
else
for
i1
=
1
:
l_elem
nodes
=
VolumeElem
.
nodes
(
i1
,:);
coordT
=
coord
.
cart
(
nodes
,:);
[
M
S
]
=
vol_hex_gauss_lin
(
M
,
S
,
coordT
,
nodes
);
waitbar
(
i1
/
l_elem
)
end
func_handle
=
@
vol_hex_gauss_lin
;
end
for
i1
=
1
:
l_elem
nodes
=
VolumeElem
.
nodes
(
i1
,:);
coordT
=
coord
.
cart
(
nodes
,:);
[
M
,
S
]
=
func_handle
(
M
,
S
,
coordT
,
nodes
);
h
.
inc
();
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment