Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jalhyd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
Cassiopée
jalhyd
Commits
299a0d84
Commit
299a0d84
authored
2 years ago
by
François Grand
Browse files
Options
Downloads
Patches
Plain Diff
refactor: pressure loss: move common computations to pressure loss law class
refs
#334
parent
896bbe0b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pipe_flow/pl_lechaptcalmon.ts
+4
-20
4 additions, 20 deletions
src/pipe_flow/pl_lechaptcalmon.ts
src/pipe_flow/pressureloss_law.ts
+33
-1
33 additions, 1 deletion
src/pipe_flow/pressureloss_law.ts
with
37 additions
and
21 deletions
src/pipe_flow/pl_lechaptcalmon.ts
+
4
−
20
View file @
299a0d84
...
...
@@ -91,6 +91,10 @@ export class PL_LechaptCalmon extends PressureLossLaw implements Observer {
this
.
properties
.
setPropValue
(
"
material
"
,
m
);
}
protected
calc_Jlin
():
number
{
return
this
.
prms
.
L
.
v
*
Math
.
pow
(
this
.
prms
.
Q
.
v
,
this
.
prms
.
M
.
v
)
/
Math
.
pow
(
this
.
prms
.
D
.
v
,
this
.
prms
.
N
.
v
)
*
(
this
.
prms
.
Lg
.
v
/
1000
);
}
/**
* paramètres castés au bon type
*/
...
...
@@ -106,26 +110,6 @@ export class PL_LechaptCalmon extends PressureLossLaw implements Observer {
return
r
;
}
public
Equation
(
sVarCalc
:
string
):
Result
{
if
(
sVarCalc
!==
"
J
"
)
{
throw
new
Error
(
"
LechaptCalmon.Equation() : invalid variable name
"
+
sVarCalc
);
}
const
r
:
Result
=
new
Result
(
0
,
this
);
r
.
values
.
V
=
this
.
prms
.
Q
.
v
/
(
Math
.
PI
*
Math
.
pow
(
this
.
prms
.
D
.
v
/
2
,
2
));
if
(
r
.
values
.
V
<
0.4
||
r
.
values
.
V
>
2
)
{
r
.
resultElement
.
log
.
add
(
new
Message
(
MessageCode
.
WARNING_LECHAPT_CALMON_SPEED_OUTSIDE_04_2
));
}
r
.
values
.
Jl
=
this
.
prms
.
L
.
v
*
Math
.
pow
(
this
.
prms
.
Q
.
v
,
this
.
prms
.
M
.
v
)
/
Math
.
pow
(
this
.
prms
.
D
.
v
,
this
.
prms
.
N
.
v
)
*
(
this
.
prms
.
Lg
.
v
/
1000
);
r
.
vCalc
=
r
.
values
.
Jl
+
this
.
prms
.
Kloc
.
v
/
19.62
*
Math
.
pow
(
r
.
values
.
V
,
2
);
return
r
;
}
// interface Observer
public
update
(
sender
:
any
,
data
:
any
)
{
...
...
This diff is collapsed.
Click to expand it.
src/pipe_flow/pressureloss_law.ts
+
33
−
1
View file @
299a0d84
import
{
Nub
}
from
"
../internal_modules
"
;
import
{
Nub
,
PressureLossLawParams
}
from
"
../internal_modules
"
;
import
{
Result
}
from
"
../internal_modules
"
;
import
{
Message
,
MessageCode
}
from
"
../internal_modules
"
;
/**
* Loi de perte de charge
...
...
@@ -17,4 +19,34 @@ export abstract class PressureLossLaw extends Nub {
public
get
pressureLossType
():
PressureLossType
{
return
this
.
_pressureLossType
;
}
/**
* paramètres castés au bon type
*/
get
prms
():
PressureLossLawParams
{
return
this
.
_prms
as
PressureLossLawParams
;
}
/**
* calcul de la perte de charge linéaire spécifique à chaque mdule de perte de charge
*/
protected
abstract
calc_Jlin
():
number
;
public
Equation
(
sVarCalc
:
string
):
Result
{
if
(
sVarCalc
!==
"
J
"
)
{
throw
new
Error
(
"
LechaptCalmon.Equation() : invalid variable name
"
+
sVarCalc
);
}
const
r
:
Result
=
new
Result
(
0
,
this
);
r
.
values
.
V
=
this
.
prms
.
Q
.
v
/
(
Math
.
PI
*
Math
.
pow
(
this
.
prms
.
D
.
v
/
2
,
2
));
if
(
r
.
values
.
V
<
0.4
||
r
.
values
.
V
>
2
)
{
r
.
resultElement
.
log
.
add
(
new
Message
(
MessageCode
.
WARNING_LECHAPT_CALMON_SPEED_OUTSIDE_04_2
));
}
r
.
values
.
Jl
=
this
.
calc_Jlin
();
r
.
vCalc
=
r
.
values
.
Jl
+
this
.
prms
.
Kloc
.
v
/
19.62
*
Math
.
pow
(
r
.
values
.
V
,
2
);
return
r
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment