Setting up a time independent domain order parameter and its gradients

9 views
Skip to first unread message

Andrew Li

unread,
Nov 4, 2024, 12:41:55 PM11/4/24
to PRISMS-PF Users
Hi everyone, 

This is a fairly basic question, but is there a best practice for defining a domain order parameter and its spatial gradient that is not coupled to any other variables? 

For example, I've tried introducing a scalarType or scalargradType explicitly in the equations.cc, in the form of 

scalarvalueType psi;
psi= std::tanh(x);

which gives me qualitatively the results I'm looking for, but becomes kind of cumbersome if I have to write out the spatial derivatives as well. Instead, is it possible to define the domain parameter as a variable such as 

set_variable_name(1, "psi");
 set_variable_type(1, SCALAR);
 set_variable_equation_type(1, TIME_INDEPENDENT);

  set_dependencies_value_term_RHS(1, "");
  set_dependencies_gradient_term_RHS(1, "");

and use variable_list.get_scalar_gradient, or is there a better approach? 


Best,
Andrew

Jason Landini

unread,
Nov 4, 2024, 12:55:25 PM11/4/24
to Andrew Li, PRISMS-PF Users
Hi Andrew,

The best way to do this would be to define an EXPLICIT_TIME_DEPENDENT field like this:


set_variable_name(1, "psi");
 set_variable_type(1, SCALAR);
 set_variable_equation_type(1,  EXPLICIT_TIME_DEPENDENT );

  set_dependencies_value_term_RHS(1, "psi");
  set_dependencies_gradient_term_RHS(1, "");

Make sure you list psi (or the var name) as the dependency so the field initializes correctly. You can then call the value, gradient, or hessian of this field to calculate the values in any of your other fields.

However, in this case, you will have to update the value of psi with itself at every time step. I had some code that introduced constant field types, where you'd only calculate the field in the 0th timestep. I can add this to the master branch in the next day or so.

Let me know if you have any other questions.

-Jason

--
You received this message because you are subscribed to the Google Groups "PRISMS-PF Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prisms-pf-use...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/prisms-pf-users/85b612bd-a1f5-4fb7-aaae-ed228b421e65n%40googlegroups.com.


--
Jason Landini
Ph.D. Pre-Candidate, Thornton Group
Materials Science & Engineering
University of Michigan

Andrew Li

unread,
Nov 4, 2024, 1:02:00 PM11/4/24
to PRISMS-PF Users

Hi Jason, 

Thanks! Yes I would love to see some code template with the constant field type to avoid calculating it at every timestep. Please let me know when you have a chance to add it to the master branch. 

Best,
Andrew
Reply all
Reply to author
Forward
0 new messages