Skip to content

Commit 447f64c

Browse files
committed
feat: add issue templates
1 parent 2362903 commit 447f64c

15 files changed

+1796
-3
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us improve MCLSimPy
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Describe the Bug
10+
A clear and concise description of what the bug is.
11+
12+
## To Reproduce
13+
Steps to reproduce the behavior:
14+
1. Import module '...'
15+
2. Create object '....'
16+
3. Call function '....'
17+
4. See error
18+
19+
## Expected Behavior
20+
A clear and concise description of what you expected to happen.
21+
22+
## Error Messages
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Documentation Issue
3+
about: Report problems or suggest improvements to MCLSimPy documentation
4+
title: '[DOCS] '
5+
labels: documentation
6+
assignees: ''
7+
---
8+
9+
## Documentation Issue
10+
Describe the issue with the current documentation.
11+
12+
## Location
13+
Link or path to the documentation with issues.
14+
15+
## Suggested Improvement
16+
A clear description of how the documentation could be improved.
17+
18+
## Additional Context
19+
Any other information that might be relevant.
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for MCLSimPy
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Problem Statement
10+
A clear and concise description of the problem you're trying to solve. Ex. I'm always frustrated when [...]
11+
12+
## Proposed Solution
13+
A clear and concise description of what you want to happen.
14+
15+
## Alternative Solutions
16+
A clear and concise description of any alternative solutions or features you've considered.
17+
18+
## Additional Context
19+
Add any other context or screenshots about the feature request here.
20+
21+
## Would you be willing to contribute this feature?
22+
- [ ] Yes, I'm interested in implementing this feature
23+
- [ ] No, I'm hoping someone else can implement it

.github/ISSUE_TEMPLATE/question.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Question
3+
about: Ask a question about using MCLSimPy
4+
title: '[QUESTION] '
5+
labels: question
6+
assignees: ''
7+
---
8+
9+
## Question
10+
A clear and detailed question about MCLSimPy.
11+
12+
## Context
13+
What are you trying to accomplish? Include any relevant code snippets or configurations.
14+
15+
## What I've Tried
16+
Describe what you've tried so far to solve your problem.
17+
18+
## Environment
19+
- Project version:
20+
- Python version:
21+
- Operating system:

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ pip install git+https://github.com/NTNU-MCS/mclsimpy.git@master
2222

2323
Demonstration of how the individual components of the python package can be used is given in `demos`. Some demos of combination of the different components are also given here.
2424

25-
---
25+
## Issues
26+
27+
If you find any issues, please **create an issue on the GitHub repository**. We will try to fix it as soon as possible.
28+
2629
### Disclaimer
2730

2831
This is a cleaned-up version of a previous master's work, called MCSimPython, into a new package called mclsimpy to streamline our development efforts on digital twin and developing high fidelity simulation models for Cybership Vessels. The package can be found here

demos/waves/wave_loads_demo.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/usr/bin/env python3
22

3+
# import os, sys
4+
5+
# sys.path.insert(0, "src")
6+
37
import numpy as np
48
import matplotlib.pyplot as plt
59

src/mclsimpy/simulator/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818

1919
# Import all the models s.t we can access them from e.g.
2020
# from mclsimpy.simulator import CSAD_DP_6DOF
21-
from mclsimpy.simulator.csad import CSAD_DP_6DOF, CSADMan3DOF, CSAD_DP_Seakeeping
22-
from mclsimpy.simulator.gunnerus import GunnerusManeuvering3DoF, RVG_DP_6DOF
21+
# from mclsimpy.simulator.csad import CSAD_DP_6DOF, CSADMan3DOF, CSAD_DP_Seakeeping
22+
# from mclsimpy.simulator.gunnerus import GunnerusManeuvering3DoF, RVG_DP_6DOF

src/mclsimpy/tools/__init__.py

Whitespace-only changes.

src/mclsimpy/tools/abc_transform.py

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import numpy as np
2+
3+
def viscous(vessel):
4+
"""
5+
Placeholder function that computes or returns viscous damping (Bv)
6+
for the vessel. You must implement or replace with your actual code.
7+
"""
8+
# For now, just return an empty structure or placeholder array.
9+
Bv_placeholder = {}
10+
return Bv_placeholder
11+
12+
def plot_speedterms(vessel, Anew, Bnew, Bv):
13+
"""
14+
Placeholder function that plots the raw data in MSS axes.
15+
Implement or replace with your custom plotting routine.
16+
"""
17+
print("[DEBUG] plot_speedterms(...) called")
18+
19+
def ABCtransform(vessel, striptheory='veres', plot_flag=0):
20+
"""
21+
Python version of ABCtransform.m
22+
23+
Parameters
24+
----------
25+
vessel : dict
26+
The MSS vessel structure, which must contain at least:
27+
- vessel['freqs'] (array of wave frequencies)
28+
- vessel['velocities'] (array of forward speeds)
29+
- vessel['A'] and vessel['B'], each shaped [6,6,Nfreqs,Nspeeds]
30+
- vessel['main']['nabla'], vessel['main']['Lpp'], vessel['main']['rho']
31+
striptheory : str, optional
32+
E.g. 'veres'. If 'veres', we do the special transformations for A11/B11.
33+
plot_flag : int, optional
34+
1 to plot the raw data in MSS axes (calls plot_speedterms).
35+
0 (or anything else) => no plotting.
36+
37+
Returns
38+
-------
39+
Anew : ndarray
40+
Transformed added-mass array.
41+
Bnew : ndarray
42+
Transformed damping array.
43+
Bv : dict or ndarray
44+
Viscous damping structure (as returned by `viscous(...)`).
45+
"""
46+
47+
# Extract relevant data
48+
freqs = vessel['freqs'] # shape (Nfreqs,) or similar
49+
speeds = vessel['velocities'] # shape (Nspeeds,) or similar
50+
A = vessel['A'] # shape (6,6,Nfreqs,Nspeeds)
51+
B = vessel['B'] # shape (6,6,Nfreqs,Nspeeds)
52+
53+
Nfreqs = len(freqs)
54+
Nspeeds = len(speeds)
55+
56+
# We will create copies for Anew and Bnew
57+
Anew = np.copy(A)
58+
Bnew = np.copy(B)
59+
60+
# ------------------------------------------------------------------
61+
# 1) Symmetrize zero-speed A( :, :, :, 0 ) and B( :, :, :, 0 )
62+
# to remove numerical noise.
63+
# In MATLAB: for i=1..Nfreqs => A_0(1:6,1:6,i) = 0.5*(A_0 + A_0')
64+
# ------------------------------------------------------------------
65+
speed0_index = 0 # zero-based => 'speed=1' in MATLAB
66+
67+
for i in range(Nfreqs):
68+
# Symmetrize A( :,:, i, speed0_index )
69+
A_slice = Anew[:, :, i, speed0_index]
70+
A_sym = 0.5 * (A_slice + A_slice.T)
71+
Anew[:, :, i, speed0_index] = A_sym
72+
73+
# Symmetrize B( :,:, i, speed0_index )
74+
B_slice = Bnew[:, :, i, speed0_index]
75+
B_sym = 0.5 * (B_slice + B_slice.T)
76+
Bnew[:, :, i, speed0_index] = B_sym
77+
78+
# ------------------------------------------------------------------
79+
# 2) If striptheory == 'veres', scale A11, B11 from A22, B22
80+
# A11_0 = 2.7*(rho / L^2)*nabla^(5/3)
81+
# alpha = A11_0 / A22_0
82+
# Then A11(w) = alpha * A22(w), B11(w) = alpha * B22(w)
83+
# ------------------------------------------------------------------
84+
if striptheory.lower() == 'veres':
85+
nabla = vessel['main']['nabla']
86+
Lpp = vessel['main']['Lpp']
87+
rho = vessel['main']['rho']
88+
89+
# A11_0 => from the formula
90+
A11_0 = 2.7 * (rho / (Lpp**2)) * (nabla ** (5/3))
91+
92+
# A22_0 => from A(2,2,1,1) in MATLAB => zero-based => A[1,1,0,0] in Python
93+
A22_0 = Anew[1, 1, 0, 0] # freq=0, speed=0
94+
95+
alpha = A11_0 / A22_0
96+
97+
# Scale A(1,1,i,speed), B(1,1,i,speed)
98+
for s in range(Nspeeds):
99+
for i in range(Nfreqs):
100+
# A(1,1,i,s), B(1,1,i,s)
101+
Anew[0, 0, i, s] = alpha * Anew[1, 1, i, s]
102+
Bnew[0, 0, i, s] = alpha * Bnew[1, 1, i, s]
103+
104+
# ------------------------------------------------------------------
105+
# 3) Viscous damping
106+
# We create vessel_new with updated A & B and call `viscous(...)`.
107+
# ------------------------------------------------------------------
108+
vessel_new = dict(vessel) # shallow copy
109+
vessel_new['A'] = Anew
110+
vessel_new['B'] = Bnew
111+
112+
Bv = viscous(vessel_new)
113+
114+
# ------------------------------------------------------------------
115+
# 4) Optional plotting
116+
# ------------------------------------------------------------------
117+
if plot_flag == 1:
118+
plot_speedterms(vessel, Anew, Bnew, Bv)
119+
120+
return Anew, Bnew, Bv

src/mclsimpy/tools/veres/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import *

0 commit comments

Comments
 (0)