-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rigid coupled solver #120
Merged
Merged
Rigid coupled solver #120
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c630242
new rigid body motions solver
ArturoMS13 0fc8ecf
fix bug SaveData mb
ArturoMS13 da49fe8
fix bug
ArturoMS13 4e413f5
fix writevariablestime for when no flow velocity required
ArturoMS13 bcefc19
update xbeam branch
ArturoMS13 99c7213
Remove unused buggy function. Fixes #117
ArturoMS13 59db8ef
fix Jupyter WT (WIP)
ArturoMS13 792f2a5
remove SHWUvlm from jupyter examples
ArturoMS13 e4f829f
Update docs. Fixes #119
ArturoMS13 70ae043
update xbeam uvlm to master
ArturoMS13 d7b77ce
Merge branch 'dev_minor_fixes_v1.2' into dev_rigid_coupled_solver
ArturoMS13 af2f4f1
update docs
ArturoMS13 34d856b
Merge branch 'develop' into dev_rigid_coupled_solver
ngoiz 00d3b69
indentation fix
ArturoMS13 2b8ee35
include default skip_attr
ArturoMS13 6a0e9fc
fix
ArturoMS13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1,372 changes: 692 additions & 680 deletions
1,372
docs/source/content/example_notebooks/wind_turbine.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
docs/source/includes/generators/modifystructure/ChangeLumpedMass.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ChangeLumpedMass | ||
---------------- | ||
|
||
.. autoclass:: sharpy.generators.modifystructure.ChangeLumpedMass | ||
:members: |
5 changes: 5 additions & 0 deletions
5
docs/source/includes/generators/modifystructure/ChangedVariable.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ChangedVariable | ||
--------------- | ||
|
||
.. autoclass:: sharpy.generators.modifystructure.ChangedVariable | ||
:members: |
5 changes: 5 additions & 0 deletions
5
docs/source/includes/generators/modifystructure/LumpedMassControl.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
LumpedMassControl | ||
----------------- | ||
|
||
.. autoclass:: sharpy.generators.modifystructure.LumpedMassControl | ||
:members: |
5 changes: 5 additions & 0 deletions
5
docs/source/includes/generators/modifystructure/ModifyStructure.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ModifyStructure | ||
--------------- | ||
|
||
.. autoclass:: sharpy.generators.modifystructure.ModifyStructure | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.. toctree:: | ||
:glob: | ||
|
||
./ChangeLumpedMass | ||
./ChangedVariable | ||
./LumpedMassControl | ||
./ModifyStructure |
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
docs/source/includes/solvers/structural/RigidDynamicCoupledStep.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
RigidDynamicCoupledStep | ||
----------------------- | ||
|
||
|
||
|
||
.. autoclass:: sharpy.solvers.rigiddynamiccoupledstep.RigidDynamicCoupledStep | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
docs/source/includes/utils/algebra/get_transformation_matrix.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
get_transformation_matrix | ||
------------------------- | ||
|
||
.. automodule:: sharpy.utils.algebra.get_transformation_matrix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule xbeam
updated
3 files
+3 −1 | README.md | |
+141 −0 | src/xbeam_interface.f90 | |
+373 −0 | src/xbeam_solv.f90 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import ctypes as ct | ||
import numpy as np | ||
|
||
import sharpy.structure.utils.xbeamlib as xbeamlib | ||
from sharpy.utils.settings import str2bool | ||
from sharpy.utils.solver_interface import solver, BaseSolver, solver_from_string | ||
import sharpy.utils.settings as settings | ||
import sharpy.utils.algebra as algebra | ||
import sharpy.utils.cout_utils as cout | ||
|
||
|
||
_BaseStructural = solver_from_string('_BaseStructural') | ||
|
||
@solver | ||
class RigidDynamicCoupledStep(_BaseStructural): | ||
""" | ||
Structural solver used for the dynamic simulation of free-flying rigid structures. | ||
|
||
This solver provides an interface to the structural library (``xbeam``) and updates the structural parameters | ||
for every k-th step in the FSI iteration. | ||
|
||
This solver can be called as part of a standalone structural simulation or as the structural solver of a coupled | ||
aeroelastic simulation. | ||
|
||
""" | ||
solver_id = 'RigidDynamicCoupledStep' | ||
solver_classification = 'structural' | ||
|
||
settings_types = _BaseStructural.settings_types.copy() | ||
settings_default = _BaseStructural.settings_default.copy() | ||
settings_description = _BaseStructural.settings_description.copy() | ||
|
||
settings_types['balancing'] = 'bool' | ||
settings_default['balancing'] = False | ||
|
||
settings_types['relaxation_factor'] = 'float' | ||
settings_default['relaxation_factor'] = 0.3 | ||
settings_description['relaxation factor'] = 'Relaxation factor' | ||
|
||
settings_table = settings.SettingsTable() | ||
__doc__ += settings_table.generate(settings_types, settings_default, settings_description) | ||
|
||
def __init__(self): | ||
self.data = None | ||
self.settings = None | ||
|
||
def initialise(self, data, custom_settings=None): | ||
self.data = data | ||
if custom_settings is None: | ||
self.settings = data.settings[self.solver_id] | ||
else: | ||
self.settings = custom_settings | ||
settings.to_custom_types(self.settings, self.settings_types, self.settings_default) | ||
|
||
# load info from dyn dictionary | ||
self.data.structure.add_unsteady_information(self.data.structure.dyn_dict, self.settings['num_steps'].value) | ||
|
||
# generate q, dqdt and dqddt | ||
xbeamlib.xbeam_solv_disp2state(self.data.structure, self.data.structure.timestep_info[-1]) | ||
|
||
def run(self, structural_step, previous_structural_step=None, dt=None): | ||
if dt is None: | ||
dt = self.settings['dt'] | ||
|
||
xbeamlib.xbeam_step_coupledrigid(self.data.structure, | ||
self.settings, | ||
self.data.ts, | ||
structural_step, | ||
dt=dt) | ||
self.extract_resultants(structural_step) | ||
self.data.structure.integrate_position(structural_step, dt) | ||
|
||
return self.data | ||
|
||
def add_step(self): | ||
self.data.structure.next_step() | ||
|
||
def next_step(self): | ||
pass | ||
|
||
def extract_resultants(self, step=None): | ||
if step is None: | ||
step = self.data.structure.timestep_info[-1] | ||
applied_forces = self.data.structure.nodal_b_for_2_a_for(step.steady_applied_forces + step.unsteady_applied_forces, | ||
step) | ||
|
||
applied_forces_copy = applied_forces.copy() | ||
gravity_forces_copy = step.gravity_forces.copy() | ||
for i_node in range(self.data.structure.num_node): | ||
applied_forces_copy[i_node, 3:6] += algebra.cross3(step.pos[i_node, :], | ||
applied_forces_copy[i_node, 0:3]) | ||
gravity_forces_copy[i_node, 3:6] += algebra.cross3(step.pos[i_node, :], | ||
gravity_forces_copy[i_node, 0:3]) | ||
|
||
totals = np.sum(applied_forces_copy + gravity_forces_copy, axis=0) | ||
step.total_forces = np.sum(applied_forces_copy, axis=0) | ||
step.total_gravity_forces = np.sum(gravity_forces_copy, axis=0) | ||
return totals[0:3], totals[3:6] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm, these are no longer necessary because when
ClassesToSave
in thesave_timestep()
method is used these are not included?I assume that is the case given the usual
remove_cpointers
but just to make sureThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remove these lines of code because
settings_default['skip_attr']
is already defined in the class attributes. These lines are just redundant.I created the
save_timestep
method for clarity.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that if you give a list of attributes to skip as a setting, the
settings_default
are not used and all of those "rubbish" attributes are included.So, actually, the original
SaveData
was incorrect, line 117 in the snippet above should beself.**settings**['skip_attr'].append([<all these attributes>])
. That way, you can include your own values tosettings['skip_attr']
and thosect_
attributes are included regardless.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. We should use "extend" instead of "append" to avoid nesting lists.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh indeed it is
extend
rather thanappend
. Thanks for spotting that!