Skip to content

Adding a new variable to the system memory #351

Answered by sy-cui
mmsor87 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

You are correct that elastica/memory_block/memory_block_rod.py is the place to add this variable internally. Assuming that you want to add a vector variable called fluid_velocity on the nodes of a rod, there are three files you want to change:

  1. elastica/memory_block/memory_block_rod.py. In the _allocate_block_variables_in_nodes method you mentioned, simply add to the map_vector_dofs_in_rod_nods dictionary the line "fluid_velocity": 3. The block initialization will automatically go through each item in the dictionary and allocate the memory as vectors stored in rod nodes. Of course if you decide to put them on rod elements instead, you will need to put this in the _allocate_block_varia…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mmsor87
Comment options

Answer selected by mmsor87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants