Skip to content
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

Enhance MeshFunction to handle vector variables #3714

Open
lindsayad opened this issue Nov 16, 2023 · 4 comments · May be fixed by #3835
Open

Enhance MeshFunction to handle vector variables #3714

lindsayad opened this issue Nov 16, 2023 · 4 comments · May be fixed by #3835

Comments

@lindsayad
Copy link
Member

We would resize the output vector to be equal to vec_dim * n_vector_vars + n_scalar_vars

@andcarl1364
Copy link

so we can easily get the vec_dim using this->_system_vars.size() as already implemented, however which specific vector vars are we counting to calculate n_vector_vars and the same for scaler vars with n_scalar_vars?

@roystgnr
Copy link
Member

vec_dim isn't _system_vars.size(); it would be the dimensionality of the vector variables, not the total number of variables.

_system_vars is a vector of variable indices; vector variables with any of those indices would be included in n_vector_vars and scalar variables with any of those indices would be included in n_scalar_vars.

@andcarl1364
Copy link

thank you! I guess what i'm confused about is which specific variables am I checking for having those indices, are they in the mesh_function.C file? and is there some sort of map of vector variables and their dimensionality in order to calculate vec_dim?

@roystgnr
Copy link
Member

Variables are added dynamically to a System; DofMap::n_variables() returns the total count of them for its associated system. Each variable's information is available from DofMap::variable(i); that information includes a FEType, and FEInterface::n_vec_dim(mesh, fe_type) indicates how many dimensions a particular non-SCALAR variable has.

You might want to consider looking through some of the libMesh example programs; e.g. the distinction between variables in the C++ (might be named in a library .C file) context versus variables in the mathematical (added and named by an application) context is shown in introduction_ex2.C; later introduction_ex4.C is the first to use the returned index of a newly-added variable.

andcarl1364 pushed a commit to andcarl1364/libmesh that referenced this issue Apr 21, 2024
enhances MeshFunction to better handle vector variables
which in turn helps general field transfers work with vectors as well

resolves: libMesh#3714
see also: #26084, #26045
andcarl1364 pushed a commit to andcarl1364/libmesh that referenced this issue Apr 22, 2024
enhances MeshFunction to better handle vector variables
which in turn helps general field transfers work with vectors as well

 resolves: libMesh#3714
see also: #26084, #26045
@andcarl1364 andcarl1364 linked a pull request Apr 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants