Hi,
I want to create a new vector field like velocity field.
How can I do that? in which file? Is there an example?
Also, I want to know that if I define a field in a C file, can I call and use that field values in a Fortran file?
Thank you
How to define a new vector field and its values?
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
Re: How to define a new vector field and its values?
Hello,
You can add a new scalar or vector field in the subroutine cs_user_parameter.c by using the function: cs_parameters_add_variable (name, dimension).
you can find here an example of adding a scalar field: https://www.code-saturne.org/cms/sites/ ... eters.html
And you can get the field values by using the functions:
C function: const cs_real_3_t *cvar_vector = (const cs_real_3_t *)cs_field_by_name("vector_name")->val ;
Fortran function: call field_get_val_v_by_name('vector_name', cvar_vector)
Regards,
Jamal
You can add a new scalar or vector field in the subroutine cs_user_parameter.c by using the function: cs_parameters_add_variable (name, dimension).
you can find here an example of adding a scalar field: https://www.code-saturne.org/cms/sites/ ... eters.html
And you can get the field values by using the functions:
C function: const cs_real_3_t *cvar_vector = (const cs_real_3_t *)cs_field_by_name("vector_name")->val ;
Fortran function: call field_get_val_v_by_name('vector_name', cvar_vector)
Regards,
Jamal
Re: How to define a new vector field and its values?
Thanks a lot.
When I use this code:
The compiler ends with the following error:
I appreciate your helps.
When I use this code:
Code: Select all
cs_parameters_add_variable("vector_name", 3);
Where's the problem?Only user variables of dimension 1 are currently handled,
but vector_name is defined with dimension 3.
I appreciate your helps.
Last edited by Mohammad on Sun Oct 27, 2019 2:58 pm, edited 1 time in total.
-
- Posts: 4208
- Joined: Mon Feb 20, 2012 3:25 pm
Re: How to define a new vector field and its values?
Hello,
Could you specify at least the version info as per the forum usage recommendations ?
Regards,
Yvan
Could you specify at least the version info as per the forum usage recommendations ?
Regards,
Yvan
Re: How to define a new vector field and its values?
Sorry,
My version is 5.0.9.
My version is 5.0.9.
-
- Posts: 4208
- Joined: Mon Feb 20, 2012 3:25 pm
Re: How to define a new vector field and its values?
Hello,
Looking at the code, it seems you can add a user vector in version 6.0, not in 5.0.
Regards,
Yvan
Looking at the code, it seems you can add a user vector in version 6.0, not in 5.0.
Regards,
Yvan
Re: How to define a new vector field and its values?
Thank you Yvan.