-
-
January 28, 2021 at 4:19 pm
soloviev
SubscriberHello,I'm trying to write a UDF to implement a temperature based salinity in Fluent, but the temperature in the model is a profile (imported from a .csv). Is this possible? I have a UDF I used previously (see below), but I'm not sure how to implement the salinity based on the variable temperature profile, if even possible.nn#include udf.hnn}nDEFINE_PROPERTY(salinity_dens,c,t)n{ntreal pho_w, sigma_t;ntreal sal = C_UDSI(c,t,salinity); / in promillesntreal temp = C_T(c,t) - 273.15; nn  / complex formula - see www.es.flinders.edu.au/~mattom/IntroOc/lecture03.htmlnn  sigma_t = - 0.157406 + temp*(6.793952E-2 - temp*(9.095290E-3 - temp*(1.001685E-4 - temp*(1.120083E-6 - temp n*6.536332E-9)))) + n    sal*(8.24493E-1 - temp*(4.0899E-3 - temp*(7.6438E-5 - temp*(8.2467E-7 - temp*5.3875E-9))) n    - sqrt(sal)*(5.72466E-3 - temp*(1.0227E-4 - temp*1.6546E-6)) + sal*4.8314E-4);nntpho_w = 1000.0 + sigma_t; ntreturn pho_w;n}Thanks,nAlexnn -
January 28, 2021 at 4:40 pm
Rob
Forum ModeratorIs salinity a straight mass fraction of salt in water, or is it a % of saturation? n -
January 28, 2021 at 5:08 pm
soloviev
SubscriberMass fraction should be sufficient n -
January 28, 2021 at 5:30 pm
DrAmine
Ansys EmployeeTemperature profile is it a boundary profile or transient one?n -
January 28, 2021 at 5:50 pm
soloviev
Subscriberthe temperature profile is a boundary profile. we are updating it every 1 minute with real temperature data we collected at the boundaries of the domain. n -
January 28, 2021 at 5:57 pm
DrAmine
Ansys EmployeeOkay and what about the salinity or where /what do you want to customize?n -
January 28, 2021 at 6:25 pm
soloviev
SubscriberWe'd like to apply a salinity property to the water phase based on the temperature. n -
January 29, 2021 at 10:48 am
Rob
Forum ModeratorYou want to alter the mass fraction going into the domain based on temperature? Or change the whole domain? I'm a little confused on this one: it's been a long week....n -
January 29, 2021 at 12:40 pm
DrAmine
Ansys EmployeeYes Rob I am confused too: How is that salinity property defined in your case? Is is specie? Is it an UDS? Is it just a density? Do you want to do that only at entry or in the whole volume?n -
January 29, 2021 at 1:56 pm
soloviev
SubscriberWe do initialize the temperature in the entire domain, also using a volume profile / fixed value. Then fixed values are turned off after initializing. We did try setting density based on temperature (polynomial) and it gave us stratification, but we'd like to also implement salinity. We previously used salinity as a UDS in other models, but it was set at a specific area in the domain (i.e. a salinity plume that spread due to gravity current). n -
January 29, 2021 at 2:26 pm
Rob
Forum ModeratorYou may want to look at using temperature dependent density and also adding in a second species for the higher salinity liquid plume? Mixture density is then a function of temperature and salinity. nI've seen the mixing of fresh and salt water when diving. It's often accompanied by a temperature change (4C fresh water & 6-8C salt water) and the two streams take a while to fully mix. n -
February 1, 2021 at 9:05 am
DrAmine
Ansys EmployeeThe species approach as mentioned by Rob is better here. You can then make the mixture density as a weighted sum of the density of the components. The density of component can be then set temperature dependent.n
-
Viewing 11 reply threads
- The topic ‘UDF for salinity based on temperature profiles’ is closed to new replies.
Innovation Space
Trending discussions
Top Contributors
-
5834
-
1906
-
1420
-
1305
-
1021
Top Rated Tags
© 2026 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.