Hello all,
I am using code_saturne 8.2 and trying to perform a simple VOF simulation.
I am trying to write a user expression through the GUI for a source term in the momentum equation:
"""
if (t<1.)
{
Su = 0.;
} else if (t<2.)
{
Su = rho * 9.81 * (t-1.);
} else
{
Su = rho * 9.81;
}
Sv = 0;
Sw = 0;
dSudu = 0;
dSudv = 0;
dSudw = 0;
dSvdu = 0;
dSvdv = 0;
dSvdw = 0;
dSwdu = 0;
dSwdv = 0;
dSwdw = 0;
"""
This should represent a ramp-like gravitational acceleration in x-direction, starting in 1 and reaching the maximum value in 2.
However, I get the error:
"""
In function ‘void cs_meg_source_terms(const char*, cs_lnum_t, const cs_lnum_t*, const cs_real_t (*)[3], const char*, const char*, cs_real_t*)’:
‘rho’ does not name a type
‘rho’ was not declared in this scope
‘rho’ was not declared in this scope
"""
And still, "rho" is found among the predefined symbols for this user expression:
"""
Predefined symbols:
x: cell center coordinate
y: cell center coordinate
z: cell center coordinate
t: current time
volume: Source terms zone volume
fluid_volume: Source terms zone fluid volume
u: x velocity component
v: y velocity component
w: z velocity component
rho: local density (kg/m^3)
"""
Why is it not recognised ???
And "rho" is EVEN USED IN THE EXAMPLE for this user expression in the GUI!!!
"""
#example:
tau = 10.; # relaxation time (s)
vel_x_imp = 1.5; #target velocity (m/s)
Su = rho * (vel_x_imp - u) / tau;
dSudu = - rho / tau; # Jacobian of the source term
"""
If I try to simply copy the example in the user expression editor (and add the rest of the terms with v and w equal to zero), I get the same error "rho not declared in this scope". There is obviously a bug here that has not been detected before ...
Regards,
Théo
Source term in momentum equation - GUI bug - "rho" not declared in this scope
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
-
- Posts: 6
- Joined: Mon Sep 02, 2024 5:17 pm